/* SHABAB NEXUS 1.0 — SHABAB Blue / navy / silver / gold hairline. Phone first (360 / 390 / 430), dark mode. */
:root {
  --blue: #1A5BE6; --navy: #06276F; --gold: #D4A63A; --silver: #C9D1DC;
  --bg: #EEF2F8; --card: #FFFFFF; --ink: #0B1B44; --muted: #5B6B8C; --line: #DCE3EE; --soft: #F5F7FB;
  --red: #C62828; --red-bg: #FDECEC; --amber: #B26A00; --amber-bg: #FFF4E0; --green: #1B7F3B; --green-bg: #E6F5EA;
  --chip: #E8EEFC; --shadow: 0 1px 2px rgba(6,39,111,.06), 0 4px 14px rgba(6,39,111,.07);
  --radius: 14px; --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070F24; --card: #0F1A36; --ink: #E7ECF7; --muted: #9AA8C7; --line: #22305A; --soft: #13204A;
    --red: #FF6B6B; --red-bg: #3A1418; --amber: #FFB547; --amber-bg: #3A2A10; --green: #5ED38A; --green-bg: #0F2E1C;
    --chip: #1B2A57; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070F24; --card: #0F1A36; --ink: #E7ECF7; --muted: #9AA8C7; --line: #22305A; --soft: #13204A;
  --red: #FF6B6B; --red-bg: #3A1418; --amber: #FFB547; --amber-bg: #3A2A10; --green: #5ED38A; --green-bg: #0F2E1C;
  --chip: #1B2A57; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; min-height: 80vh; color: var(--muted); letter-spacing: .2em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- login / setup */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, #1A5BE6 0%, transparent 60%), linear-gradient(160deg, #06276F, #031542 70%); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; border-top: 3px solid var(--gold); }
.auth-card .logo { display: block; width: 100%; height: auto; background: #fff; }
.auth-body { padding: 18px 20px 22px; }
.auth h1 { margin: 0 0 2px; font-size: 18px; letter-spacing: .08em; color: var(--navy); }
:root[data-theme="dark"] .auth h1 { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth h1 { color: var(--ink); } }
.auth .sub { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.field { display: block; margin: 10px 0; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); outline: none; min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,91,230,.18); }
.msg { margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; font-size: 13.5px; }
.msg.err { background: var(--red-bg); color: var(--red); }
.msg.ok { background: var(--green-bg); color: var(--green); }
.msg.warn { background: var(--amber-bg); color: var(--amber); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 42px; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn.gold { background: linear-gradient(180deg, #E2B955, #C8962A); color: #2A1C00; }
.btn.red { background: var(--red); }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

/* ---------- shell */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); color: #fff; background: linear-gradient(90deg, #06276F, #0B3A9C 60%, #1A5BE6); border-bottom: 1px solid var(--gold); }
.top .brand { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.top .brand img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.top .brand b { letter-spacing: .12em; font-size: 15px; white-space: nowrap; }
.top .brand small { display: block; font-size: 10.5px; letter-spacing: .14em; color: #C9D6F5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .brand > div { min-width: 0; }
.top .tbtn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: #fff; border-radius: 9px; min-width: 38px; height: 36px; padding: 0 10px; cursor: pointer; font-size: 14px; }
.layout { display: flex; min-height: calc(100vh - 57px); }
.side { width: 240px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 12px 10px 90px; position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto; }
.side h4 { margin: 14px 10px 6px; font-size: 11px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--soft); }
.side a.on { background: var(--chip); color: var(--blue); font-weight: 700; box-shadow: inset 3px 0 0 var(--gold); }
.side .badge { background: var(--red); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 11.5px; font-weight: 700; }
.side .tag { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
main { flex: 1; min-width: 0; padding: 16px; padding-bottom: 96px; }
.bottom { display: none; }
.scrim { display: none; }
@media (max-width: 899px) {
  .side { position: fixed; z-index: 40; top: 0; left: 0; height: 100vh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); padding-top: max(16px, env(safe-area-inset-top)); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(3,12,35,.45); z-index: 39; }
  .bottom { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom)); gap: 6px; }
  .bottom button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; background: none; border: 0; padding: 6px 2px; border-radius: 10px; color: var(--muted); font-size: 11.5px; cursor: pointer; }
  .bottom button b { font-size: 18px; line-height: 1; color: var(--blue); }
  .bottom button:active { background: var(--soft); }
  .top .hide-phone { display: none; }
}
@media (min-width: 900px) { .top .menu-btn { display: none; } }

/* ---------- content */
h2.page { margin: 2px 0 12px; font-size: 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h3 { margin: 18px 0 8px; font-size: 15px; letter-spacing: .02em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; min-width: 0; }
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.kpi.red::before { background: var(--red); } .kpi.green::before { background: var(--green); } .kpi.gold::before { background: var(--gold); }
.kpi .l { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 18px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v.red { color: var(--red); } .kpi .v.green { color: var(--green); }
.kpi .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; background: var(--chip); color: var(--blue); white-space: nowrap; }
.chip.cc { background: var(--navy); color: #fff; border: 1px solid var(--gold); letter-spacing: .1em; }
.chip.on { background: var(--green-bg); color: var(--green); }
.chip.off { background: var(--red-bg); color: var(--red); }
.chip.ns { background: var(--soft); color: var(--muted); border: 1px dashed var(--line); }
.chip.soon { background: var(--amber-bg); color: var(--amber); }
.country { display: flex; flex-direction: column; gap: 8px; }
.country .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.country .head b { font-size: 16px; }
.country .kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; font-size: 13.5px; }
.country .kv span:nth-child(odd) { color: var(--muted); }
.country .kv span:nth-child(even) { text-align: right; font-weight: 600; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #4F86FF); border-radius: 99px; }
.bar.done i { background: linear-gradient(90deg, #1B7F3B, #36B368); }
.alertbox { background: var(--red-bg); border: 1px solid var(--red); border-left-width: 5px; color: var(--ink); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.alertbox b { color: var(--red); }
.alertbox ul { margin: 6px 0 4px; padding-left: 18px; }
.alertbox li { margin: 2px 0; word-break: break-word; }
.okbox { background: var(--green-bg); border: 1px solid var(--green); color: var(--green); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 2px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; min-width: 0; }
.list li > div { min-width: 0; word-break: break-word; }
.list li:last-child { border-bottom: 0; }
.lvl { width: 9px; height: 9px; border-radius: 99px; flex: none; margin-top: 6px; background: var(--amber); }
.lvl.red { background: var(--red); }
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; white-space: nowrap; }
table.t td.r, table.t th.r { text-align: right; }
table.t tr.bad td { color: var(--red); }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .lbl { fill: var(--ink); font-weight: 600; }
.soon-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.soon-tile { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; background: var(--card); text-align: center; }
.soon-tile b { display: block; margin: 6px 0 2px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.tabs button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.form2 { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.help { font-size: 13px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.help ol { margin: 6px 0 0; padding-left: 18px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 86px; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); border-bottom: 2px solid var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* ---------- locker */
.banner { background: var(--amber-bg); color: var(--amber); border: 1px solid currentColor; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; }
.litem { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--line); min-width: 0; }
.litem .info { min-width: 0; flex: 1; }
.litem .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.litem .info span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; }
.modal { position: fixed; inset: 0; background: rgba(3,12,35,.55); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal .box { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border-radius: 16px; padding: 16px; border-top: 3px solid var(--gold); }

/* ---------- month report (print) */
.report { background: #fff; color: #0B1B44; border-radius: 12px; padding: 18px; border: 1px solid var(--line); }
.report .lh { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid #06276F; padding-bottom: 8px; position: relative; flex-wrap: wrap; }
.report .lh::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 1px; background: #D4A63A; }
.report .lh img { height: 54px; width: auto; }
.report .lh .ttl { text-align: right; }
.report .lh .ttl b { display: block; font-size: 16px; letter-spacing: .06em; color: #06276F; }
.report table.t th { color: #5B6B8C; } .report table.t td, .report table.t th { border-color: #DCE3EE; }
.report .chart text { fill: #5B6B8C; } .report .chart .lbl { fill: #0B1B44; }
.report .foot { margin-top: 12px; font-size: 11px; color: #5B6B8C; border-top: 1px solid #DCE3EE; padding-top: 6px; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .top, .side, .bottom, .scrim, .noprint, .toast { display: none !important; }
  main { padding: 0; }
  .report { border: 0; padding: 0; }
}
.red { color: var(--red); } .green { color: var(--green); }
.hidden-x { position: fixed; left: -9999px; top: 0; opacity: 0; }
.row > input.field, .row > select.field { flex: 1 1 160px; min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.row > select.field { flex: 0 1 160px; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.side p.muted { padding: 0 10px; }
.grid > .card + .card, .grid .card + .card { margin-top: 0; }
.chart { max-width: 640px; }
a.soon-tile { text-decoration: none; color: var(--ink); }
.soon-grid { margin-top: 10px; }
.kpi .s { white-space: normal; overflow: visible; }
.list li b.num, .list li .num { white-space: nowrap; flex: none; }
