:root {
  --navy: #1f3864; --navy-2: #2b4a82; --bg: #f4f6fa; --card: #fff; --line: #e1e6ef; --text: #1d2433; --muted: #6a7488;
  --ok: #1f8a4c; --warn: #b7791f; --bad: #c0392b; --blue: #2563eb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans Bengali", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--blue); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* layout */
.shell { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--navy); color: #dfe7f7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { padding: 18px 18px 14px; font-weight: 700; font-size: 15px; color: #fff; line-height: 1.25; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand small { display: block; font-weight: 400; color: #aebbd9; margin-top: 2px; }
.side nav { padding: 10px 8px; flex: 1; overflow: auto; }
.side nav a { display: block; padding: 9px 12px; border-radius: 8px; color: #dfe7f7; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side nav a.on { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.side .me { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; color: #aebbd9; }
.side .me b { color: #fff; display: block; font-size: 13px; }
.side .me a { color: #cfe0ff; margin-right: 10px; }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.menu-btn { display: none; }
@media (max-width: 800px) {
  .shell { display: block; }
  .side { position: static; width: auto; height: auto; }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  .side nav a { margin: 0; }
  .main { padding: 16px 12px 60px; }
}

/* cards & tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.alert .n { color: var(--bad); }
.stat a { display: block; color: inherit; }
.stat a:hover { text-decoration: none; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f3f9; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #4a5671; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f7f9fd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.bar-row .lab { width: 150px; font-size: 13px; }
.bar-row .bar { flex: 1; background: #edf1f8; border-radius: 5px; height: 14px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--navy-2); border-radius: 5px; }
.bar-row .val { width: 36px; text-align: right; font-weight: 600; }

/* forms */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  border: 1px solid #cfd6e4; border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--text); width: 100%;
}
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9cdf7; border-color: var(--blue); }
textarea { min-height: 70px; resize: vertical; }
.btn { border: 1px solid #cfd6e4; background: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; color: var(--text); }
.btn:hover { background: #f1f4fa; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--bad); border-color: #efc4be; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .6; cursor: default; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.form-grid label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.form-grid label.check input { width: auto; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #e9eef8; color: #33415f; white-space: nowrap; }
.b-green { background: #dcf3e6; color: #17653a; } .b-red { background: #fbe0dc; color: #8f2a1e; }
.b-amber { background: #fdf0d2; color: #85590f; } .b-blue { background: #dbe8fe; color: #1e4fb5; }
.b-gray { background: #ebedf2; color: #596176; } .b-purple { background: #ece3fb; color: #5a35a3; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: #eef2fa; color: #3d4a68; }
.chip.on { background: #dcf3e6; color: #17653a; }
.due { color: var(--bad); font-weight: 600; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px; overflow: auto; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.modal-head h2 { margin: 0; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.timeline { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.tl { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tl:last-child { border-bottom: 0; }
.tl .when { font-size: 11px; color: var(--muted); }
.tl.portal { background: #f7f9ff; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1d2433; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; max-width: 90vw; }
.toast.err { background: var(--bad); }
.login { max-width: 360px; margin: 12vh auto 0; }
.login .card { padding: 26px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 8px; background: #e9eef8; color: #33415f; }
.tabs a.on { background: var(--navy); color: #fff; text-decoration: none; }
.doc { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.doc input { width: auto; }
.doc span { flex: 1; }
.doc.got span { color: var(--muted); text-decoration: line-through; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; }
