/* ==========================================================================
   Arizona Training panel in the nebo look.
   panel.css keeps the layout of every page; this file maps its variables onto the nebo tokens
   (monochrome ink on off-white / off-black, Comfortaa + Manrope, radii 28 / 20 / 16 / pill)
   and restyles the shared components. The shell (sidebar, topbar) and the dashboard use the
   nebo classes from static/nebo/css (colliding nebo class names are prefixed with nb-).
   ========================================================================== */

:root {
  --bg: var(--surface);
  --card: var(--panel);
  --card-2: var(--panel-2);
  --card-3: color-mix(in srgb, var(--panel-2) 70%, var(--line));
  --line-2: var(--line-strong);
  --text: var(--ink);
  --muted: var(--ink-3);
  --accent: var(--ink);
  --accent-2: var(--ink-2);
  --accent-soft: color-mix(in srgb, var(--ink) 9%, transparent);
  --accent-ink: var(--on-ink);
  --input: var(--panel);
  --grid: var(--line);
  --shadow: var(--shadow-sm);
  --shadow-pop: var(--shadow-lg);
  --r-card: var(--r-panel);
  --r: 14px;
  --green: #3f8f62;
  --green-soft: color-mix(in srgb, #3f8f62 14%, transparent);
  --red: var(--danger);
  --red-soft: color-mix(in srgb, var(--danger) 13%, transparent);
  --orange: #b7791f;
  --orange-soft: color-mix(in srgb, #b7791f 14%, transparent);
  --amber: #a8841f;
  --violet: var(--ink-2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #7cc59b;
    --orange: #e0a65a;
    --amber: #d9b45a;
  }
}
:root[data-theme="dark"] {
  --green: #7cc59b;
  --orange: #e0a65a;
  --amber: #d9b45a;
}

body.app, body.anon {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
}
h1, h2, h3, .display, .hero-num, .tile b, .meter-top b, .num-big {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.6rem, 1.2rem + 1vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.02rem; font-weight: 700; }
a:hover { color: var(--ink); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace; }

/* ---------------------------------------------------------------- shell */
.page-app .shell { align-items: start; }
.sidebar { gap: 28px; }
.sidebar__nav { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; margin-inline: -4px; padding-inline: 4px; }
.sidebar__nav::-webkit-scrollbar { display: none; }
.sidenav-group { margin: 14px 16px 6px; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.sidenav-group:first-child { margin-top: 0; }
.sidenav-item { height: 46px; text-decoration: none; }
.sidenav-item .ico { width: 21px; height: 21px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sidenav-item.is-active { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); }
.sidebar__profile { position: relative; }
.sidebar__profile .nb-avatar { flex: none; }
.sidebar__logo .nb-logo { color: var(--ink); text-decoration: none; }
.logo-word small { display: block; font: 600 0.62rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }

.main > .wrap { max-width: none; padding: 0; }
.nb-topbar { position: sticky; top: 16px; z-index: var(--z-chrome); flex-wrap: wrap; }
.nb-topbar .segmented { flex: none; }
.segmented__opt { text-decoration: none; white-space: nowrap; }
.segmented__opt small { opacity: 0.6; font-weight: 500; margin-left: 4px; }
.nb-search.as-button { cursor: pointer; text-align: left; color: var(--ink-3); padding-left: 48px; padding-right: 64px; font-size: 0.92rem; }
.nb-search.as-button .ico { position: absolute; left: 18px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; }
.topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar__actions .ico, .nb-icon-btn .ico { width: 20px; height: 20px; }
.topbar__actions .nb-btn .ico { width: 18px; height: 18px; }
.srv-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); margin-right: 6px; vertical-align: middle; }
.srv-dot.ok { background: var(--green); }
.srv-dot.bad { background: var(--red); }

.ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* profile popover (details) */
.me { position: relative; }
.me > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.me > summary::-webkit-details-marker { display: none; }
.me .popover { position: absolute; bottom: calc(100% + 10px); left: 0; z-index: var(--z-popover); width: 280px; padding: 16px; border-radius: var(--r-tile); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-lg); }

/* ---------------------------------------------------------------- shared panel components */
.card {
  background: var(--panel);
  border: 0;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card.flush { padding: 0; }
.card-head h2 { font-size: 1.05rem; }
.card-head.pad { padding: 18px 24px; }
.head h1 { margin-bottom: 6px; }
.btn { border-radius: var(--r-control); padding: 9px 16px; font-weight: 600; border-color: var(--line-strong); background: var(--panel); }
.btn:hover { background: var(--panel-2); border-color: var(--ink-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { filter: none; opacity: 0.88; }
.btn.pill { border-radius: var(--r-pill); }
.btn.sm { padding: 6px 12px; border-radius: 12px; }
.icon-btn { border-radius: 12px; width: 36px; height: 36px; }
input, select, textarea { border-radius: var(--r-control); padding: 10px 14px; border-color: var(--line-strong); background: var(--panel); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.field > span { font-weight: 600; color: var(--ink-2); }
.chip { border-radius: var(--r-pill); border-color: var(--line-strong); background: var(--panel); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.seg { border-radius: var(--r-pill); background: var(--panel-2); border-color: var(--line); padding: 4px; }
.seg-item { border-radius: var(--r-pill); font-weight: 600; }
.seg-item.on { background: var(--ink); color: var(--on-ink); }
table.grid th { font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.7rem; }
table.grid td, table.grid th { border-color: var(--line); }
table.grid tbody tr:hover { background: var(--panel-2); }
.badge { border-radius: var(--r-pill); }
.flash { border-radius: var(--r-control); border: 0; box-shadow: inset 0 0 0 1px var(--line); border-left: 3px solid var(--ink-3); }
.flash.error { border-left-color: var(--red); }
.flash.ok { border-left-color: var(--green); }
.avatar { background: var(--ink); color: var(--on-ink); }
.tile { border-radius: var(--r-tile); background: var(--panel-2); }
.modal-box, .palette-box { border-radius: var(--r-panel); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-lg); }
.toasts .toast { border-radius: var(--r-control); background: var(--ink); color: var(--on-ink); }
.popover { border-radius: var(--r-tile); }
.meter-dots { border-radius: var(--r-pill); }
.meter-dots span { background: var(--ink); }
.delta.up, .delta-inline.up { color: var(--green); }
.delta.down, .delta-inline.down { color: var(--red); }

/* ---------------------------------------------------------------- dashboard (index) */
.hero-band__card .srv-card { color: var(--on-ink); }
.srv-card__name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.srv-card__addr { font: 600 0.9rem/1.2 ui-monospace, Consolas, monospace; opacity: 0.85; }
.srv-card__status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
.dash-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 18px; }
.dash-grid > .card { margin: 0; }
.dash-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.brief-step { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-tile); background: var(--panel-2); }
.brief-step b { display: block; margin-bottom: 4px; }
.brief-step.bad { box-shadow: inset 3px 0 0 var(--red); }
.brief-step.warn { box-shadow: inset 3px 0 0 var(--orange); }
.brief-step.ok { box-shadow: inset 3px 0 0 var(--green); }
.kv { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kv li { display: flex; justify-content: space-between; gap: 12px; }
.kv li b { font-family: var(--font-display); }
.kv li b.up { color: var(--green); }
.kv li b.down { color: var(--red); }

/* ---------------------------------------------------------------- login */
.login-shell { position: relative; min-height: 100dvh; display: grid; place-items: center; padding: 24px; overflow: hidden; background: var(--page); }
.login-shell__clouds { position: absolute; inset: 0; }
.login-shell__clouds canvas { width: 100%; height: 100%; }
.login-card { position: relative; width: min(420px, 100%); padding: 34px 32px 30px; border-radius: var(--r-panel); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-lg); }
.login-card .nb-logo { margin-bottom: 22px; }
.login-card h1 { font-size: 1.7rem; margin: 0 0 6px; }
.login-card p.sub { margin: 0 0 22px; color: var(--ink-3); }
.login-card .field { display: grid; gap: 6px; margin-bottom: 14px; }
.login-card .nb-btn { width: 100%; height: 52px; margin-top: 6px; }
.login-card .flash { margin-bottom: 16px; }

.meter-block { display: grid; gap: 8px; margin-bottom: 16px; }
.balance__head { gap: 8px; flex-wrap: wrap; }
.balance__value small { font-size: 0.45em; font-weight: 600; }
.mini-pill { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 10px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-2); font-size: 0.8rem; text-decoration: none; }
.tx__row a { text-decoration: none; }
.insights__text .ico { width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; }
.action .ico { width: 22px; height: 22px; }
.action { text-decoration: none; }

/* icon rail (nebo folds the sidebar below 1440px): group titles become thin separators */
@media (max-width: 1439px) {
  .sidenav-group { font-size: 0; height: 1px; margin: 10px 18px; background: var(--line); }
  .sidenav-group:first-child { display: none; }
  .me .popover { left: 0; bottom: 0; transform: translateX(72px); }
}
@media (max-width: 760px) {
  .nb-search.as-button { order: 5; flex: 1 1 100%; max-width: none; }
  .topbar__actions .nb-btn span { display: none; }
  .segmented__opt small { display: none; }
  .tabbar__item .ico { width: 22px; height: 22px; }
}
