:root {
  --ink: #12263a;
  --ink-2: #4a5d70;
  --ink-3: #7d8c9b;
  --line: #e2e8ef;
  --line-2: #eef2f6;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --navy: #143a5a;
  --navy-2: #1d4f78;
  --teal: #1f9d8f;
  --teal-soft: #e3f4f1;
  --amber: #b7791f;
  --amber-soft: #fdf3e1;
  --red: #c0392b;
  --red-soft: #fbe9e7;
  --blue-soft: #e8f0f8;
  --budget: #b9c9d9;
  --actual: #143a5a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(18, 38, 58, 0.06), 0 2px 8px rgba(18, 38, 58, 0.04);
  font-family: 'Segoe UI', 'Nirmala UI', 'Noto Sans Bengali', 'Vrinda', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #cfe0ee; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 22px 20px 18px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.08); display: grid; place-items: center; }
.brand b { display: block; color: #fff; font-size: 15px; }
.brand span { display: block; font-size: 10.5px; color: #8fb0c9; line-height: 1.3; margin-top: 1px; }
.brand small { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; color: #37c4b4; }
.brand b { letter-spacing: 0.02em; font-size: 17px; }
.login .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; color: #1f9d8f; }
.login .tagline { font-size: 13px; color: #4a5d70; margin: 2px 0 14px; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { color: #cfe0ee; padding: 9px 12px; border-radius: 7px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.nav a.active { background: rgba(55,196,180,0.16); color: #fff; box-shadow: inset 3px 0 0 #37c4b4; }
.nav svg { width: 17px; height: 17px; opacity: 0.85; }
.nav .sep { height: 1px; background: rgba(255,255,255,0.08); margin: 10px 4px; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; }
.side-foot b { color: #fff; display: block; }
.side-foot button { margin-top: 8px; background: none; border: 1px solid rgba(255,255,255,0.2); color: #cfe0ee; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-main { grid-template-columns: 2fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1100px) { .g2, .g3, .g-main { grid-template-columns: 1fr; } }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 22px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .hint { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.kpi .bar { height: 5px; border-radius: 3px; background: var(--line-2); margin-top: 10px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--teal); }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-2); background: #f8fafc; font-weight: 650; position: sticky; top: 0; z-index: 2; }
tr:hover td { background: #fafcfe; }
tfoot td { font-weight: 650; background: #f5f8fb; border-top: 1px solid var(--line); }
.tbl-compact td, .tbl-compact th { padding: 6px 8px; font-size: 13px; }
.util { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.util .track { flex: 1; height: 7px; background: var(--line-2); border-radius: 4px; position: relative; overflow: hidden; }
.util .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teal); border-radius: 4px; }
.util .track i.over { background: var(--red); }
.util .track i.warn { background: var(--amber); }
.util span { width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* Pills & alerts */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--teal-soft); color: #136b61; }
.pill.warn { background: var(--amber-soft); color: #8a5a10; }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.info { background: var(--blue-soft); color: var(--navy-2); }
.pill.draft { background: #eef0f3; color: var(--ink-2); }
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { padding: 9px 12px; border-radius: 8px; font-size: 13px; border-left: 3px solid; line-height: 1.4; }
.alert.danger { background: var(--red-soft); border-color: var(--red); }
.alert.warn { background: var(--amber-soft); border-color: var(--amber); }
.alert.info { background: var(--blue-soft); border-color: var(--navy-2); }
.empty { padding: 30px; text-align: center; color: var(--ink-3); }

/* Forms */
label { font-size: 12px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 4px; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #cdd6df; border-radius: 7px; padding: 7px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,157,143,0.35); border-color: var(--teal); }
input[type='checkbox'] { width: 15px; height: 15px; vertical-align: middle; }
.field { display: flex; flex-direction: column; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.btn { font: inherit; font-weight: 600; border-radius: 7px; padding: 8px 14px; border: 1px solid #cdd6df; background: #fff; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f5f8fb; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.danger { color: var(--red); border-color: #efc7c2; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.linkbtn { background: none; border: none; color: var(--navy-2); cursor: pointer; padding: 0; font: inherit; }
.dropzone { border: 2px dashed #c4d0dc; border-radius: 10px; padding: 26px; text-align: center; color: var(--ink-2); background: #fafcfe; cursor: pointer; }
.dropzone.drag { border-color: var(--teal); background: var(--teal-soft); }
.dropzone b { color: var(--navy); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: none; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--navy); border-color: var(--teal); }

/* Plan grid */
.plan-grid { max-height: calc(100vh - 330px); min-height: 300px; }
.plan-grid table { width: max-content; min-width: 100%; }
.plan-grid td, .plan-grid th { padding: 4px 5px; font-size: 12.5px; }
.plan-grid input, .plan-grid select { padding: 4px 6px; font-size: 12.5px; border-radius: 5px; border-color: #dbe2e9; }
.plan-grid input.q { width: 46px; text-align: right; }
.plan-grid input.money { width: 102px; text-align: right; }
.plan-grid input.comp { width: 215px; }
.plan-grid select.head { width: 140px; }
.plan-grid select.cat { width: 140px; }
.plan-grid .sticky { position: sticky; left: 0; background: #fff; z-index: 1; }
.plan-grid th.sticky { z-index: 3; background: #f8fafc; }
.plan-grid tr.review td { background: #fffaf0; }
.plan-grid tr.review td.sticky { background: #fffaf0; }
.basis { max-width: 360px; font-size: 12px; color: var(--ink-2); white-space: normal; line-height: 1.35; }
.basis.review { color: #8a5a10; }
.readonly-val { display: inline-block; min-width: 30px; text-align: right; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #143a5a 0%, #0f2c45 60%, #0c2438 100%); }
.login { width: 360px; background: #fff; border-radius: 14px; padding: 30px 30px 26px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.login h1 { margin-bottom: 4px; }
.login .field { margin-top: 14px; }
.login input { width: 100%; }
.login .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 10px; }
.err { color: var(--red); font-size: 13px; margin-top: 10px; white-space: pre-line; }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(12,36,56,0.45); display: grid; place-items: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: min(640px, 94vw); max-height: 90vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .form-grid .full { grid-column: 1 / -1; }
.modal input, .modal select, .modal textarea { width: 100%; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 60; max-width: 420px; white-space: pre-line; }
.toast.error { background: var(--red); }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 340px; }
.insights { margin: 0; padding-left: 18px; line-height: 1.55; }
.insights li { margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.steps { display: flex; gap: 8px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; margin-bottom: 14px; }
.steps span.on { color: var(--navy); }

/* ---------------- v2.0 ---------------- */
.nav { overflow-y: auto; }
.nav a { padding: 7px 12px; }
.side-foot #lang { margin-left: 4px; }
.alert-link { display: block; color: inherit; }
.alert-link:hover { text-decoration: none; filter: brightness(0.97); }
.panel textarea, .field textarea { width: 100%; resize: vertical; }
details > summary { cursor: pointer; }

/* Renewal calendar */
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cal-m { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbfcfd; min-height: 70px; }
.cal-h { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.cal-h span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal-i { font-size: 12.5px; padding: 2px 0; border-top: 1px dashed var(--line-2); }
.cal-i span { display: inline-block; min-width: 20px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal-i.over { color: var(--red); }

/* What-if */
.wi-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.wi-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fbfcfd; }
.wi-name { width: 100%; font-weight: 650; margin-bottom: 10px; }
.form-grid2 { display: grid; grid-template-columns: 1fr 110px; gap: 6px 10px; align-items: center; }
.form-grid2 label { margin: 0; font-weight: 500; }
.form-grid2 input { width: 110px; text-align: right; padding: 5px 8px; }
.wi-add { border: 2px dashed #c4d0dc; border-radius: 10px; background: #fafcfe; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; min-height: 120px; }
.wi-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; }
.wi-list label { font-weight: 400; color: var(--ink); margin: 3px 0; }
.wi-tbl td, .wi-tbl th { min-width: 130px; }
.wi-tbl td:first-child { min-width: 180px; }
.wi-total td { background: #f5f8fb; }

/* Bangla text needs a little more line height */
html[lang='bn'] body { line-height: 1.45; }
html[lang='bn'] .kpi .label, html[lang='bn'] th { text-transform: none; letter-spacing: 0; }

/* Users */
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.role-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fbfcfd; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.role-card b { display: block; color: var(--ink); font-size: 13px; margin-bottom: 2px; }
.role-pick { display: flex; flex-direction: column; gap: 6px; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 0; cursor: pointer; font-weight: 400; }
.role-opt:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.role-opt input { width: auto; margin-top: 3px; }
.role-opt b { display: block; color: var(--ink); }
.role-opt small { color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.pw-box { border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; padding: 12px 14px; display: grid; gap: 8px; }
.pw-box div { display: flex; justify-content: space-between; gap: 16px; }
.pw-box b { font-family: Consolas, 'Courier New', monospace; font-size: 14px; }

/* Assets & inventory */
.kv2 { grid-template-columns: 150px 1fr; }
.holder b { font-size: 16px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-top: 16px; }
.person { padding: 14px 16px; }
.person table td { border-bottom-color: var(--line-2); }

/* Monthly budget vs actual (dashboard) */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.panel-head h2 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--navy); color: #fff; }
.mb-sum { margin: 6px 0 12px; line-height: 1.6; }
.mb-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; }
.mb-leg span { display: inline-flex; align-items: center; gap: 6px; }
.mb-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.mb-leg i.dash { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed; }
.mb-tbl { margin-top: 12px; }
.mb-tbl summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--navy); }
.mb-tbl .table-wrap { margin-top: 8px; max-height: 360px; }

/* Department picker (sidebar) */
.dept-pick { margin: 4px 14px 10px; }
.dept-pick label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #8fb0c9; margin-bottom: 4px; }
.dept-pick select { width: 100%; background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 7px; padding: 7px 8px; font: inherit; font-size: 13px; }
.dept-pick select option { color: #143a5a; }
.dept-pick .dept-name { color: #fff; font-weight: 600; font-size: 13px; padding: 6px 0; }
