/* (c) 2026 Timothy Klint. All rights reserved. Part of North Star Kit; licensed, not sold. See LICENSE.
   Base styles on North Star's token names. A licensee overrides tokens in its own tokens.css,
   which loads AFTER this file. Nothing here names a licensee color. */
:root {
  --bg: #f3f4f6; --panel: #ffffff; --panel2: #f7f8fa; --panel3: #eceff3; --line: #e2e6ea;
  --ink: #18212b; --muted: #5b6573; --faint: #6f7987;
  --brand: #1f2937; --brand-ink: #ffffff; --brand2: #2b3a4e; --brandred: #b91c1c;
  --accent: #1f2937; --accent-ink: #ffffff;
  --good: #1e6b3a; --good-bg: #e7f4ec; --warn: #8a5300; --warn-bg: #fdf1dc; --bad: #9b1c1c; --bad-bg: #fde8e8; --info: #1d4e89; --info-bg: #e6effb;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font-head: system-ui, sans-serif; --font-body: system-ui, sans-serif;
  --nav-w: 232px; --tap: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-body); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
a { color: var(--info); }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* shell: side nav on desktop, bottom tab bar on phones */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.side { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side .logo { background: #fff; border-radius: 8px; padding: 8px; margin: 0 4px 12px; display: block; }
.side .logo img { width: 100%; display: block; }
.side a { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 12px; border-radius: 8px; color: var(--brand-ink); text-decoration: none; opacity: .92; }
.side a:hover { background: var(--brand2); opacity: 1; }
.side a[aria-current="page"] { background: var(--brand2); opacity: 1; font-weight: 600; box-shadow: inset 3px 0 0 var(--brandred); }
.side a .ic { width: 22px; text-align: center; }
.side .sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin: 12px 12px 4px; }
.side .soon { margin-left: auto; font-size: .68rem; opacity: .75; border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .sp { flex: 1; }
.content { padding: 20px 24px 40px; max-width: 1280px; }
.tabbar { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 16px; background: var(--brand); color: var(--brand-ink); border: 0; }
  .topbar a, .topbar button.ghost { color: var(--brand-ink); }
  .content { padding: 14px 16px 96px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; color: var(--muted); text-decoration: none; }
  .tabbar a .ic { font-size: 1.25rem; }
  .tabbar a[aria-current="page"] { color: var(--brand); font-weight: 700; }
  .hide-sm { display: none !important; }
}
@media (min-width: 821px) { .show-sm { display: none !important; } }

/* building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card > h2:first-child, .card > h3:first-child { display: flex; align-items: center; gap: 8px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-h h2, .card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; padding: 14px 16px; }
.stat-l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-v { font: 700 1.3rem/1.2 var(--font-head); }
.stat-s { font-size: .85rem; color: var(--muted); }
a.stat:hover { border-color: var(--brand); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 8px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 600 .95rem var(--font-body); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.good { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn.icon { padding: 0; width: var(--tap); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--panel3); color: var(--ink); white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--info); }

label.f { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
label.f > input, label.f > select, label.f > textarea { margin-top: 4px; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
textarea { min-height: 96px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; min-height: 20px; }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-left: 5px solid; }
.banner.warning { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.banner.advisory { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.banner.info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.banner b { color: inherit; }
.banner a { color: inherit; font-weight: 700; }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-top: 0; }

#nk-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.nk-toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 90vw; }
.nk-toast.bad { background: var(--bad); } .nk-toast.good { background: var(--good); }
.nk-modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.nk-dialog { background: var(--panel); border-radius: 12px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.nk-dialog-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 0 18px; }
.nk-dialog-h h2 { margin: 0; }
.nk-dialog-b { padding: 12px 18px 18px; }
