:root {
  --ink: #15181C; --ink-2: #3D4540; --muted: #5A635D; --line: #E2E6E1; --line-2: #EEF0ED;
  --ground: #F4F5F2; --card: #FFFFFF; --field: #FAFBF9; --border: #C9CFCA;
  --accent: #0F5D52; --accent-ink: #0A3F38; --accent-soft: #CDE9E2; --mint: #2BB39A;
  --side: #15181C; --side-ink: #E9ECE8; --side-muted: #A9B0AB; --side-on: #263029;
  --urgent-bg: #FDE7E4; --urgent: #9A1B12; --soon-bg: #FDEFD9; --soon: #8A3B05; --mon-bg: #EEF0F3; --mon: #475467;
  --warn-bg: #FFF8EC; --warn-line: #F1D9A8; --warn-ink: #5C4A1E; --ok-bg: #E7F4EF; --err-bg: #FDE7E4;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body { font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.45; }
a { color: var(--accent); } a:hover { color: var(--accent-ink); }
h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 232px; max-width: 100%; background: var(--side); color: var(--side-ink); padding: 26px 16px; display: flex; flex-direction: column; gap: 22px; }
.main { flex: 999 1 560px; min-width: 0; padding: 30px 40px 56px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--mint); color: var(--ink); display: grid; place-items: center; font-weight: 800; }
.brand strong { display: block; font-size: 16px; } .brand span { display: block; font-size: 12px; color: var(--side-muted); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); padding: 0 10px 6px; }
.side a { display: flex; justify-content: space-between; align-items: center; min-height: 42px; padding: 0 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 14px; }
.side a:hover { background: #1f2622; color: #fff; }
.side a.on { background: var(--side-on); color: #fff; font-weight: 600; }
.count { background: var(--mint); color: var(--ink); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.nav-bottom { margin-top: auto; }
.me { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px 0; margin-top: 8px; border-top: 1px solid #2a312d; font-size: 13px; }
.muted-dark { color: var(--side-muted); }
.linkish { background: none; border: 0; padding: 6px 0 0; color: var(--mint); font: inherit; font-size: 13px; cursor: pointer; text-align: left; min-height: 32px; }
.switcher { display: flex; flex-direction: column; gap: 4px; }
.switcher select { font: inherit; font-size: 14px; min-height: 40px; border-radius: 8px; border: 1px solid #39423d; background: #1f2622; color: #fff; padding: 0 10px; }

/* page header */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head .eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* buttons & fields */
.btn { font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); color: #fff; }
.btn.ghost { border-color: var(--accent); color: var(--accent); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn.danger { border-color: var(--urgent); color: var(--urgent); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  font: inherit; font-size: 14px; min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--field); color: var(--ink); width: 100%;
}
textarea { padding: 10px 12px; min-height: 84px; resize: vertical; }
input[type=file] { font: inherit; font-size: 14px; }
:focus-visible { outline: 3px solid #7FC8B9; outline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

/* cards & tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile .value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.tile .note { font-size: 13px; color: var(--muted); }
.tile.hero { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile.hero .label, .tile.hero .note { color: var(--accent-soft); }
.meter { height: 6px; border-radius: 999px; background: var(--line); }
.meter > span { display: block; height: 6px; border-radius: 999px; background: var(--accent); }
.two-col { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.two-col > .wide { flex: 3 1 520px; min-width: 0; }
.two-col > .narrow { flex: 2 1 300px; min-width: 0; }

/* toolbar & chips */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.urgent { color: var(--urgent); } .chip.soon { color: var(--soon); } .chip.monitor { color: var(--mon); }
.chip.on.urgent, .chip.on.soon, .chip.on.monitor { color: #fff; }
.search { display: flex; gap: 8px; align-items: center; }
.search input { width: 260px; max-width: 60vw; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding: 12px; white-space: nowrap; }
table.data td { padding: 13px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data .num { text-align: right; white-space: nowrap; }
table.data .sub { font-size: 12px; color: var(--muted); }
table.data.compact td { padding: 9px 12px; }
.empty { padding: 36px 24px; text-align: center; color: var(--muted); }

/* pills */
.pill { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pill.urgent { background: var(--urgent-bg); color: var(--urgent); }
.pill.soon { background: var(--soon-bg); color: var(--soon); }
.pill.monitor { background: var(--mon-bg); color: var(--mon); }
.pill.ok { background: var(--ok-bg); color: var(--accent-ink); }
.pill.grey { background: var(--mon-bg); color: var(--mon); }
.pill.warn { background: var(--soon-bg); color: var(--soon); }

/* notices */
.flash { border-radius: 10px; padding: 12px 16px; font-size: 14px; background: var(--ok-bg); color: var(--accent-ink); border: 1px solid #BFE3D8; }
.flash.err { background: var(--err-bg); color: var(--urgent); border-color: #F3C2BC; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; color: var(--warn-ink); }
.notice strong { color: var(--ink); }

/* bar chart */
.bars { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 18px; align-items: end; height: 220px; border-bottom: 1px solid var(--border); padding: 0 6px; }
.bar-pair { display: flex; justify-content: center; align-items: flex-end; gap: 6px; height: 100%; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 12px; }
.bar { width: 30px; border-radius: 6px 6px 0 0; background: var(--accent); }
.bar.ctl { background: #B7C0BA; }
.bar-labels { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 18px; padding: 0 6px; font-size: 12px; color: var(--muted); text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); margin-right: 6px; vertical-align: -1px; }
.legend i.ctl { background: #B7C0BA; }
.funnel-row { display: flex; flex-direction: column; gap: 6px; }
.funnel-row .top { display: flex; justify-content: space-between; font-size: 14px; }
.track { height: 10px; border-radius: 999px; background: var(--line-2); }
.track > span { display: block; height: 10px; border-radius: 999px; background: var(--accent); }

/* detail lists */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; font-size: 14px; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 720px) {
  .main { padding: 22px 16px 40px; }
  .side { padding: 14px 12px; gap: 8px; flex-basis: 100%; }
  .side .nav-head { display: none; }
  .nav-group { flex-direction: row; overflow-x: auto; gap: 4px; }
  .side a { flex: 0 0 auto; min-height: 40px; white-space: nowrap; gap: 8px; }
  .nav-bottom { margin-top: 0; }
  .nav-bottom { flex-wrap: wrap; }
  .me { flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px 0; margin-top: 0; }
  .me .linkish { padding: 0; }
  h1 { font-size: 26px; }
  .search input { width: 100%; max-width: none; }
}

@media print {
  .side, .actions, .flash, form { display: none !important; }
  .main { padding: 0; }
  body, .card, .tile { background: #fff; }
  .tile.hero { color: #000; background: #fff; border-color: #000; }
  .tile.hero .label, .tile.hero .note { color: #333; }
}

/* demo */
.demo-band { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; background: #EAF0FF; border: 1px solid #C9D6FF; color: #1B2C6B; font-size: 14px; }
