/* One design system — navy #06305C, teal #00A9C7, the logo's gradient as the accent.
   Same bones as Quickly and Wiseo: one token layer, slate neutrals, 4px grid,
   dense tables, calm surfaces. Everything below is built from the tokens. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Geist+Mono:wght@500&display=swap');

:root {
  /* type */
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-body: 13.5px; --fs-cell: 13px; --fs-small: 12.5px; --fs-meta: 11.5px;
  --fs-th: 11px; --fs-title: 19px; --fs-section: 14.5px; --fs-kpi: 25px;

  /* neutrals */
  --bg: #F5F7FA; --surface: #FFFFFF; --subtle: #F1F4F8; --hover: #F7F9FC;
  --line: #E4E8EE; --line-strong: #D3D9E2;
  --text: #0A1F3B; --text-2: #3C4B60; --muted: #67748A; --placeholder: #9AA5B5;

  /* brand — taken from the logo */
  --navy: #06305C; --navy-600: #0A3F78; --navy-700: #042444; --navy-50: #E9F0F8;
  --teal: #00A9C7; --teal-600: #027E96; --teal-50: #E2F6FB;
  --green: #16C77C; --green-600: #0B7A4B; --green-50: #E6F8F0;
  --brand: var(--navy);
  --ring: rgba(0, 169, 199, .30);
  /* the logo's ring, used sparingly: the sign-in mark, the active nav bar */
  --sweep: linear-gradient(135deg, #06305C 0%, #0A7FA8 45%, #00B6CC 72%, #57F4A3 100%);

  /* status: soft tint, dark text of the same hue */
  --ok-bg: #E6F8F0; --ok: #0B7A4B;
  --warn-bg: #FEF3C7; --warn: #92400E;
  --bad-bg: #FEE4E2; --bad: #B42318;
  --info-bg: #E2F6FB; --info: #027E96;
  --idle-bg: #EEF1F5; --idle: #4A5769;

  /* shape and space */
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --shadow: 0 1px 2px rgba(10, 31, 59, .04), 0 12px 28px rgba(10, 31, 59, .08);
  --shadow-sm: 0 1px 2px rgba(10, 31, 59, .06);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --side: 224px; --top: 54px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 var(--fs-body)/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: var(--fs-title); font-weight: 650; }
h2 { font-size: var(--fs-section); font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }
a { color: var(--teal-600); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.muted { color: var(--muted); }
.mono { font: 500 var(--fs-meta)/1.4 var(--mono); }
.spacer { flex: 1 1 auto; }

.boot { display: grid; place-items: center; height: 100vh; gap: 14px; color: var(--muted); }
.boot img { width: 120px; }

/* ---------------------------------------------------------------- sign in */
.login { display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background: radial-gradient(1200px 500px at 50% -10%, #EAF4F8 0%, var(--bg) 60%); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 32px 28px; width: 100%; max-width: 380px; }
.login-card img { width: 190px; display: block; margin: 0 auto 4px; }
.login-card .sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: var(--fs-small); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.side-top { height: var(--top); flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  padding: 0 14px; border-bottom: 1px solid var(--line); }
.side-top img { width: 26px; height: 26px; }
.side-top b { font-size: 15px; font-weight: 650; letter-spacing: -.02em; color: var(--navy); }
.side nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.side .group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--placeholder); padding: 14px 8px 6px; font-weight: 600; }
.side .group:first-child { padding-top: 2px; }
.side a { position: relative; display: flex; align-items: center; gap: 10px; height: 34px;
  padding: 0 9px; border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-body);
  font-weight: 500; white-space: nowrap; }
.side a:hover { background: var(--subtle); color: var(--text); text-decoration: none; }
.side a.on { background: var(--navy-50); color: var(--navy); font-weight: 600; }
.side a.on::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--sweep); }
.side a > span:first-child { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; color: var(--placeholder); }
.side a:hover > span:first-child { color: var(--text-2); }
.side a.on > span:first-child { color: var(--teal-600); }
.side a .pill { margin-left: auto; background: var(--bad); color: #fff; border-radius: 20px;
  min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px;
  font-size: 10.5px; font-weight: 700; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; font-size: var(--fs-small); color: var(--muted); }
.side-foot b { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.side-foot button { margin-top: 9px; width: 100%; height: 30px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); flex: 0 0 auto;
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 var(--s6); }
.content { padding: var(--s5) var(--s6) 40px; flex: 1; }
.burger { display: none; }

/* ---------------------------------------------------------------- pieces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card > header { padding: 12px var(--s4); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.card > header .spacer { flex: 1; }
.card > .body { padding: var(--s4); }
.grid { display: grid; gap: var(--s4); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: var(--fs-small); color: var(--muted); font-weight: 500; }
.stat .v { font-size: var(--fs-kpi); font-weight: 650; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .s { font-size: var(--fs-meta); color: var(--muted); }
.stat.tap { cursor: pointer; }
.stat.tap:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--fs-cell); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: var(--s4); }
th:last-child, td:last-child { padding-right: var(--s4); }
thead th { position: sticky; top: 0; z-index: 2; background: #FAFBFD; font-size: var(--fs-th);
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
tr.tap { cursor: pointer; }
tfoot th { background: #FAFBFD; font-size: var(--fs-meta); color: var(--text-2); font-weight: 600; border-top: 1px solid var(--line); }
.num { text-align: right; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: var(--fs-small); }

/* ---------------------------------------------------------------- chips */
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 20px;
  font-size: var(--fs-meta); font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-mute { background: var(--idle-bg); color: var(--idle); }

/* ---------------------------------------------------------------- buttons */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: 500 var(--fs-body)/1 var(--font);
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
button:hover, .btn:hover { background: var(--hover); border-color: #C3CAD6; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-p { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-p:hover { background: var(--navy-600); border-color: var(--navy-600); color: #fff; }
.btn-d { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-d:hover { filter: brightness(.94); color: #fff; }
.btn-s { height: 28px; padding: 0 10px; font-size: var(--fs-small); }
.btn-link { border: 0; background: none; color: var(--teal-600); height: auto; padding: 2px 4px; }
.btn-link:hover { background: none; text-decoration: underline; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: var(--fs-small); font-weight: 500; color: var(--text-2); margin-bottom: 5px; }
input, select, textarea { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: 400 var(--fs-body)/1 var(--font); }
textarea { height: auto; padding: 9px 10px; line-height: 1.5; resize: vertical; }
select { padding-right: 6px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--ring); }
input[type=checkbox] { width: auto; height: auto; }
.field { margin-bottom: var(--s3); }
.fields { display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.hint { font-size: var(--fs-meta); color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 31, 59, .40); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 620px;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(10, 31, 59, .28); }
.modal.wide { max-width: 980px; }
.modal > header { padding: 14px var(--s5); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--s3); }
.modal > .body { padding: var(--s5); overflow: auto; }
.modal > footer { padding: 12px var(--s5); border-top: 1px solid var(--line); display: flex; gap: var(--s2); justify-content: flex-end; }

/* ---------------------------------------------------------------- misc */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: var(--r);
  z-index: 200; box-shadow: var(--shadow); font-size: var(--fs-body); max-width: 88vw; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tabs button { border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0;
  height: 38px; padding: 0 13px; color: var(--muted); font-weight: 500; }
.tabs button:hover { background: none; color: var(--text); }
.tabs button.on { color: var(--navy); border-bottom-color: var(--teal); font-weight: 600; }
.err { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: var(--r-sm);
  font-size: var(--fs-small); margin-bottom: var(--s3); }
.note { background: var(--teal-50); color: #08556A; padding: 10px 12px; border-radius: var(--r-sm); font-size: var(--fs-small); }
.bar { height: 6px; background: var(--subtle); border-radius: 4px; overflow: hidden; min-width: 72px; }
.bar i { display: block; height: 100%; background: var(--sweep); border-radius: 4px; }
.bar i.over { background: var(--green); }
.map { width: 100%; height: 420px; border-radius: var(--r); border: 1px solid var(--line); background: #EAF0F6; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side); z-index: 60;
    transform: translateX(-100%); transition: transform .18s ease; }
  .side.open { transform: none; }
  .burger { display: inline-flex; border: 0; background: none; width: 34px; padding: 0; font-size: 18px; }
  .content { padding: var(--s4); }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; }
  .scrim { position: fixed; inset: 0; background: rgba(10, 31, 59, .35); z-index: 50; }
}
