/* NineGuard dashboard. One accent (burnt orange), stone neutrals, 10px cards / 6px controls. */

/* JetBrains Mono Nerd Font (SIL OFL, see /fonts/OFL.txt): Nerd Font glyphs render too. */
@font-face {
  font-family: "NineGuard Mono";
  src: url("/fonts/JetBrainsMonoNerdFontMono-Regular.woff2") format("woff2");
  font-weight: 100 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "NineGuard Mono";
  src: url("/fonts/JetBrainsMonoNerdFontMono-Bold.woff2") format("woff2");
  font-weight: 600 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #f4f3f1;
  --panel: #ffffff;
  --panel-2: #fafaf9;
  --hover: #f1efec;
  --border: #e7e4e0;
  --border-strong: #d5d1cc;
  --text: #1c1917;
  --text-2: #4a4542;
  --muted: #7c756f;
  --accent: #c2410c;
  --accent-soft: #fcece2;
  --accent-text: #b13a0a;
  --danger: #c42b1c;
  --ok: #15803d;
  --shadow: 0 1px 2px rgb(41 37 36 / .06);
  --shadow-pop: 0 8px 28px rgb(41 37 36 / .14);
  --spark: #b5aea7;
  --grid: #eeebe8;

  /* severity levels: chart/mark colors (validated palette) and readable text variants */
  --lv-debug: #2f9e83; --lvt-debug: #1f7a64;
  --lv-info: #4f7fd9;  --lvt-info: #2f62c0;
  --lv-warn: #c98a0c;  --lvt-warn: #94620a;
  --lv-error: #d63d2b; --lvt-error: #b72f1f;
  --lv-fatal: #a3174f; --lvt-fatal: #a3174f;


  --radius: 10px;
  --radius-sm: 6px;
  --font: "NineGuard Mono", "JetBrainsMono Nerd Font Mono", "JetBrains Mono", "SF Mono", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121110;
  --panel: #1c1a19;
  --panel-2: #211f1d;
  --hover: #292624;
  --border: #302d2a;
  --border-strong: #423e3a;
  --text: #ece9e6;
  --text-2: #c4beb8;
  --muted: #948d86;
  --accent: #ea6a2a;
  --accent-soft: rgb(234 106 42 / .15);
  --accent-text: #f28b52;
  --danger: #e5584e;
  --ok: #4ade80;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-pop: 0 10px 30px rgb(0 0 0 / .45);
  --spark: #5e5853;
  --grid: #2a2826;

  --lv-debug: #319a80; --lvt-debug: #4fc0a2;
  --lv-info: #5282d8;  --lvt-info: #82a8ee;
  --lv-warn: #b88c14;  --lvt-warn: #e0b240;
  --lv-error: #d9475a; --lvt-error: #f07a86;
  --lv-fatal: #c0487e; --lvt-fatal: #e57fae;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 12.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
kbd {
  font: 10.5px var(--font);
  color: var(--muted);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  background: var(--panel);
}
mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; }
.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.muted { color: var(--muted); }
.spacer { flex: 1; }
.only-dark { display: none; }
[data-theme="dark"] .only-dark { display: block; }
[data-theme="dark"] .only-light { display: none; }

/* ── Shell ── */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100dvh; }
.sidebar-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar-collapsed .sidebar { visibility: hidden; }

.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 10px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 14px; }
.brand img { border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--accent-text); letter-spacing: -.01em; }
.brand-ver { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


.type-tag { font-size: 9.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; line-height: 15px; }


.main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  margin: 8px 8px 8px 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.sidebar-collapsed .main { margin-left: 8px; }
.topbar { display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 12px; border-bottom: 1px solid var(--border); flex: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--border); color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumbs b { color: var(--text); font-weight: 600; }
.crumbs .icon { width: 12px; height: 12px; }
.crumbs span { overflow: hidden; text-overflow: ellipsis; }

.search {
  display: flex; align-items: center; gap: 8px; width: min(280px, 30vw); height: 32px; padding: 0 8px 0 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--muted); text-align: left;
}
.search:hover { border-color: var(--border-strong); color: var(--text-2); }
.search:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn:disabled { opacity: .4; cursor: default; background: none; }
.icon-btn.sm { width: 26px; height: 26px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-strong); cursor: pointer;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; margin-left: 4px;
}

.view { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }

/* ── Controls ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 28px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
  color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn .icon { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11.5px; }

.input, .select {
  height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); outline: 0; min-width: 0;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { padding-right: 24px; appearance: none; cursor: pointer; max-width: 170px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
/* A set filter stays white (the native option list takes the select's colors); only weight and border mark it. */
.select.has-value { border-color: var(--border-strong); color: var(--text); font-weight: 600; }
.select option { background: var(--panel); color: var(--text); font-weight: 400; }

/* ── Searchable Select (Combobox) ── */
.search-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  min-width: 140px;
  max-width: 190px;
  padding: 0 6px 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  vertical-align: middle;
}
.search-select:hover {
  border-color: var(--border-strong);
}
.search-select:focus-visible,
.search-select.is-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: 0;
}
.search-select.has-value {
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
}
.search-select.wide {
  width: 100%;
  max-width: none;
  min-width: 0;
}
.search-select.lg {
  height: 32px;
  font-size: 12px;
  padding: 0 8px 0 10px;
}
.search-select.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.search-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.search-select-label.placeholder {
  color: var(--muted);
  font-weight: 400;
}

.search-select-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  flex-shrink: 0;
}
.search-select-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.search-select-clear:hover {
  color: var(--text);
  background: var(--hover);
}
.search-select-clear .icon {
  width: 12px;
  height: 12px;
}

.search-select-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform .18s ease;
  pointer-events: none;
}
.search-select-arrow .icon {
  width: 12px;
  height: 12px;
}
.search-select.is-open .search-select-arrow {
  transform: rotate(180deg);
}

/* ── Searchable Select Popover ── */
.search-select-popover {
  position: fixed;
  z-index: 1050;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: searchSelectPop .12s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes searchSelectPop {
  from { opacity: 0; transform: scale(0.97) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.search-select-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-shrink: 0;
}
.search-select-header .icon {
  width: 13px;
  height: 13px;
  color: var(--muted);
  flex-shrink: 0;
}
.search-select-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 11.5px;
  outline: 0;
}
.search-select-input::placeholder {
  color: var(--muted);
}
.search-select-count {
  font-size: 10px;
  color: var(--muted);
  background: var(--hover);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.search-select-list {
  flex: 1;
  min-height: 0;
  max-height: 250px;
  overflow-y: auto;
  padding: 4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.search-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  background: none;
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: background .1s ease, color .1s ease;
}
.search-select-option:hover,
.search-select-option.focused {
  background: var(--hover);
}
.search-select-option.selected {
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-soft);
}
.search-select-option.is-all {
  border-bottom: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  margin-bottom: 2px;
  font-style: italic;
  color: var(--text-2);
}
.search-select-option-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-select-option-text mark.hl {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}
.search-select-option-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--hover);
  color: var(--muted);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.search-select-option.selected .search-select-option-badge {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent-text);
}
.search-select-option-check {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: auto;
}

.search-select-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}
.search-select-empty span {
  display: block;
  font-size: 10.5px;
  margin-top: 4px;
  color: var(--muted);
  opacity: 0.8;
}
.search-select-empty .btn {
  margin-top: 8px;
}

.input-group { display: inline-flex; align-items: center; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 11.5px; color: var(--text-2); }
.field .input { height: 34px; }

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-wrap .input {
  width: 100%;
  padding-right: 36px;
  height: 34px;
}
.password-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color .15s ease, background .15s ease;
}
.password-toggle:hover {
  color: var(--text);
  background: var(--hover);
}
.password-toggle .icon {
  width: 15px;
  height: 15px;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
  color: var(--muted); font-size: 11px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text-2); }
.chip .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--border-strong); }
.chip.active { color: var(--text); border-color: var(--border-strong); }
.chip.active .dot { background: var(--lvc); }
.chip .icon { width: 13px; height: 13px; }
.chip.live.active { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.chips { display: inline-flex; gap: 4px; }

.lv-DEBUG { --lvc: var(--lv-debug); --lvt: var(--lvt-debug); }
.lv-INFO  { --lvc: var(--lv-info);  --lvt: var(--lvt-info); }
.lv-WARN  { --lvc: var(--lv-warn);  --lvt: var(--lvt-warn); }
.lv-ERROR { --lvc: var(--lv-error); --lvt: var(--lvt-error); }
.lv-FATAL { --lvc: var(--lv-fatal); --lvt: var(--lvt-fatal); }
.status-chip-2xx { --lvc: var(--ok); }
.status-chip-403 { --lvc: #c42b1c; }
.status-chip-4xx { --lvc: var(--lv-warn); }
.status-chip-5xx { --lvc: var(--danger); }
.lv {
  display: inline-block; min-width: 44px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  padding: 0 5px; border-radius: 4px; line-height: 17px; color: var(--lvt);
  background: color-mix(in srgb, var(--lvc) 14%, transparent);
}

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex: none; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.range { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.range .icon { width: 14px; height: 14px; }

.menu {
  position: fixed; z-index: 30; min-width: 170px; padding: 4px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop);
}
.menu button, .menu .menu-label {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 10px;
  border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer;
}
.menu button:hover { background: var(--hover); }
.menu .menu-label { color: var(--muted); cursor: default; font-size: 11.5px; }

/* ── Pages ── */
.page { padding: 22px 26px 30px; }
.page-fill { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── Log viewer / Traffic Explorer ── */
.histogram { padding: 8px 14px 4px; border-bottom: 1px solid var(--border); flex: none; min-height: 106px; }
.vchart { position: relative; }
.vchart svg { display: block; overflow: visible; }
.vchart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 4px; font-size: 11px; color: var(--muted); }
.vchart-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.vchart-legend b { color: var(--text); font-weight: 600; }
.vchart-legend .partial { margin-left: auto; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.vchart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.vchart .hl { fill: var(--hover); }
.vchart .grid { stroke: var(--grid); stroke-width: 1; }
.vchart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.vchart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.vchart .end-label { fill: var(--text); font-size: 11px; font-weight: 700; font-family: var(--font); }
.chart-toggle {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--panel); color: var(--muted); font-size: 10.5px; cursor: pointer;
}
.chart-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.chart-toggle .icon { width: 12px; height: 12px; }
.vchart-table { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.vchart-table .table th { position: sticky; top: 0; background: var(--panel-2); }
.vchart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 170px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 11px;
}
.vchart-tip .tip-row { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.vchart-tip .tip-row b { min-width: 44px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.vchart-tip .tip-key { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.vchart-tip .tip-key.none { background: none; }
.vchart-tip .tip-name { color: var(--text-2); }
.vchart-tip .tip-sub { margin-left: auto; padding-left: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vchart-tip .tip-title { color: var(--muted); margin-bottom: 4px; }
.vchart-tip .tip-sep { height: 1px; margin: 4px 0; background: var(--border); }
.vchart-tip .tip-hint { margin-top: 5px; color: var(--muted); font-size: 10.5px; }
.vchart-empty { display: grid; place-items: center; height: 70px; color: var(--muted); }

.log-table { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log-head, .row {
  display: grid; grid-template-columns: 94px 52px minmax(130px, 230px) minmax(0, 1fr);
  gap: 12px; align-items: center; padding: 0 14px;
}
.log-head { height: 28px; flex: none; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--panel-2); }
.log-body { flex: 1; min-height: 0; overflow: auto; font-size: 12px; }
.row { height: 24px; cursor: pointer; border-left: 2px solid transparent; }
.row:hover { background: var(--hover); }
.row.lv-ERROR, .row.lv-FATAL { background: color-mix(in srgb, var(--lvc) 6%, transparent); border-left-color: var(--lvc); }
.row.lv-ERROR:hover, .row.lv-FATAL:hover { background: color-mix(in srgb, var(--lvc) 11%, transparent); }
.row.open { background: var(--hover); }
.row.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: var(--accent-soft); } }
.c-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-src { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); }
.c-src .src-wl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.c-src .src-pod { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 20px; }
.pod-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.c-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font); font-size: 11.5px; }
.c-msg .more { color: var(--muted); margin-left: 8px; font-size: 10.5px; }

/* ── Traffic Explorer Custom Table Columns ── */
.traffic-table {
  overflow-x: auto;
}
.traffic-table .log-head,
.traffic-table .row {
  display: grid;
  grid-template-columns: 100px 120px minmax(130px, 190px) minmax(200px, 1fr) 75px 95px 125px;
  gap: 12px;
  align-items: center;
  padding: 0 14px;
  min-width: 880px;
}
.traffic-table .log-head {
  height: 28px;
}
.traffic-table .row {
  height: 30px;
  font-size: 11.5px;
}
.traffic-table .c-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 11px;
}
.traffic-table .c-key {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.traffic-table .c-key b {
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}
.traffic-table .c-key span {
  font-size: 10.5px;
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.traffic-table .c-model {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.traffic-table .c-model .source-ns {
  flex: none;
  font-size: 10px;
  margin-right: 5px;
}
.traffic-table .c-model .strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.traffic-table .c-model .traffic-err-msg {
  color: #c42b1c;
  font-size: 10.5px;
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: none;
}
.traffic-table .c-tokens {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.traffic-table .c-lat {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.traffic-table .c-ip {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.traffic-table .log-head span.num {
  text-align: right;
}
.traffic-table .detail {
  min-width: 880px;
}
.row.s-row-403 {
  background: color-mix(in srgb, #c42b1c 6%, transparent);
  border-left-color: #c42b1c;
}
.row.s-row-403:hover {
  background: color-mix(in srgb, #c42b1c 12%, transparent);
}

.detail { padding: 10px 14px 14px 30px; background: var(--panel-2); border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); cursor: auto; }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 20px; margin-bottom: 10px; font-size: 11.5px; }
.detail-meta div { display: flex; gap: 8px; min-width: 0; }
.detail-meta .k { color: var(--muted); flex: none; width: 76px; }
.detail-meta .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-msg {
  margin: 0; padding: 10px 12px; max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); font: 12px/1.55 var(--font);
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.statusbar { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 14px; flex: none; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); background: var(--panel-2); }
.statusbar .warn { display: inline-flex; align-items: center; gap: 5px; color: var(--lvt-warn); }
.statusbar .warn .icon { width: 13px; height: 13px; }

.skel { border-radius: 4px; background: linear-gradient(90deg, var(--hover) 25%, var(--panel-2) 50%, var(--hover) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel-row { height: 12px; margin: 6px 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.chip .live-dot, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.live-dot.wait { background: var(--lv-warn); }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0; font-size: 14px; }
.card .card-sub { color: var(--muted); margin: 2px 0 12px; font-size: 11.5px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.stat-icon .icon { width: 20px; height: 20px; }
.stat-label { color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.stat-sub { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 11.5px; color: var(--text-2); }
.stat-sub .icon { width: 13px; height: 13px; color: var(--ok); }
.stat-sub.bad .icon { color: var(--danger); }

.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 8px; margin: 0 -8px; border-radius: 6px; cursor: pointer;
}
.list-row:hover { background: var(--hover); }
.list-row .sub { color: var(--muted); font-size: 11px; }
.list-row .bar { height: 4px; border-radius: 2px; background: var(--lv-error); margin-top: 5px; }
.list-row.err-row { grid-template-columns: 76px 50px minmax(0, 1fr); font-size: 11.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.meter { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; margin: 10px 0 6px; }
.meter > div { height: 100%; border-radius: 4px; background: var(--accent); }
.meter.warn > div { background: var(--lv-warn); }
.meter.bad > div { background: var(--danger); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

table.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .inline-bar { display: block; height: 4px; border-radius: 2px; background: var(--accent); opacity: .7; min-width: 2px; }
.table-wrap { overflow-x: auto; }

.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0; }
.danger-row + .danger-row { border-top: 1px solid var(--border); }
.danger-row p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 60px 20px; text-align: center; color: var(--muted); width: 100%; }
.empty > .icon { width: 36px; height: 36px; stroke-width: 1.5; margin-bottom: 6px; }
.empty h3 { margin: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.empty p { margin: 0 0 4px; max-width: 480px; font-size: 12px; color: var(--muted); }
.empty .btn { margin-top: 8px; }
.error-text { color: var(--danger); }

.skel { border-radius: 4px; background: linear-gradient(90deg, var(--hover) 25%, var(--panel-2) 50%, var(--hover) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel-row { height: 12px; margin: 6px 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Overlays ── */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgb(12 10 9 / .45); overflow-y: auto; }
.dialog { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); box-sizing: border-box; }
.dialog h3 { margin: 0 0 6px; font-size: 15px; }
.dialog-body { margin: 0 0 16px; color: var(--text-2); }
.dialog .field { margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }


.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px; max-width: 380px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop);
  animation: toast-in .2s ease-out; transition: opacity .2s, transform .2s;
}
.toast.has-action { max-width: 440px; }
.toast-text { flex: 1; min-width: 0; line-height: 1.35; }
.toast-action { margin-left: auto; flex-shrink: 0; font-size: 11.5px; padding: 3px 10px; border-radius: 6px; }
.toast .icon { color: var(--ok); flex-shrink: 0; }
.toast.error .icon { color: var(--danger); flex-shrink: 0; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Narrow screens ── */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2e { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app, .sidebar-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 35; width: 250px; background: var(--bg);
    border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform .2s; visibility: visible !important;
  }
  .sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .main, .sidebar-collapsed .main { margin: 0; border-radius: 0; border: 0; }
  .search kbd, .crumbs { display: none; }
  .search { width: auto; flex: 1; }
  .page { padding: 16px; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ── Sidebar: grouped links (Kite-style) ── */
.side-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 0 8px; scrollbar-width: thin; }
.side-group + .side-group { margin-top: 12px; }
.side-group-title {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 4px 10px 5px;
  border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.side-group-title:hover { color: var(--text-2); }
.side-group-title .icon { width: 13px; height: 13px; transition: transform .15s; }
.side-group.collapsed .side-group-title .icon { transform: rotate(-90deg); }
.side-group.collapsed .side-links { display: none; }
.side-links { display: flex; flex-direction: column; gap: 1px; }
.side-link {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px;
  border-radius: 8px; color: var(--text-2); transition: background .15s, color .15s;
}
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link .icon { color: var(--accent); }
.side-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: var(--shadow); }
.side-link .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link .count { font-size: 11px; color: var(--muted); font-weight: 400; }
.side-link .state { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.side-link .state.bad { background: var(--danger); }
.side-link .unpin { display: none; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.side-link .unpin .icon { color: inherit; width: 12px; height: 12px; }
.side-link:hover .unpin { display: inline-grid; }
.side-link .unpin:hover { background: var(--border); color: var(--text); }
.scope-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px 0 8px; margin-left: 4px; flex: none;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11px; cursor: pointer; white-space: nowrap;
}
.scope-chip .icon { width: 12px; height: 12px; }
.scope-chip:hover { border-color: var(--accent); }
.menu { max-height: 60vh; overflow-y: auto; }
.menu button.checked { color: var(--accent-text); font-weight: 600; background: var(--accent-soft); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

/* ── Pages, detail, tables ── */
.mt { margin-top: 14px; }
.grid.stack { grid-template-columns: minmax(0, 1fr); align-content: start; }
.page-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.page-sub { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.page-detail .page-head { align-items: flex-start; margin-bottom: 14px; }
.page-detail h1 { font-size: 24px; }
.page.fill { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 14px; }
.page.fill .tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; margin-bottom: 14px; background: var(--hover); border-radius: 9px; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--text-2); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 19px; padding: 0 7px; border-radius: 5px; font-size: 11px; background: var(--hover); color: var(--text-2); white-space: nowrap; }
.tab .badge { height: 17px; padding: 0 5px; background: var(--border); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.badge.err { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.err-text, .num.err { color: var(--lvt-error); font-weight: 600; }
.kv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 22px; }
.kv-grid .k { color: var(--muted); font-size: 11.5px; }
.kv-grid .v { margin-top: 3px; font-weight: 600; overflow-wrap: anywhere; }
.table-card { padding: 4px 8px 6px; }
.table-foot { padding: 8px; color: var(--muted); font-size: 11.5px; }
.table.clickable tbody tr { cursor: pointer; }
.table.clickable tbody tr:hover td { background: var(--hover); }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover, .table th.sorted { color: var(--text); }
.table .strong { font-weight: 600; color: var(--text); }
.table .sub { color: var(--muted); font-size: 11px; }
.table td { vertical-align: middle; }
.pin .icon { width: 14px; height: 14px; color: var(--muted); }
.pin.on .icon { color: var(--accent); }

/* ── Sign-in and setup pages ── */
.auth-body { background: var(--bg); }
.auth-page { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; }
.auth-theme { position: fixed; top: 16px; right: 16px; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 56px 16px; }
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: -4px 0 20px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border); font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--accent-text);
}
.auth-brand img { border-radius: 9px; }
.auth-card { width: min(440px, 100%); padding: 28px 30px 30px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); }
.auth-card.wide { width: min(560px, 100%); }
.auth-title { text-align: center; margin-bottom: 22px; }
.auth-title h1 { margin: 0; font-size: 20px; }
.auth-title p { margin: 6px 0 0; color: var(--text-2); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .field .input { height: 36px; }
.btn-block { width: 100%; height: 38px; }
.steps { display: flex; flex-direction: column; gap: 20px; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 12px; }
.step-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); }
.step-icon .icon { width: 18px; height: 18px; }
.step.done .step-icon { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .step-head h2 { color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.step.pending { opacity: .45; }
.step-head h2 { margin: 0; font-size: 14px; }
.step-head p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.step-body { grid-column: 2; margin-top: 14px; }
.qr { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.qr img { width: 140px; height: 140px; flex: none; padding: 6px; border-radius: 6px; background: #fff; }
.qr code { display: block; margin: 4px 0 8px; font-size: 11px; word-break: break-all; color: var(--text); }
.otp-row { display: flex; justify-content: center; gap: 8px; }
.otp-box {
  width: 44px; height: 50px; text-align: center; font-size: 20px; font-weight: 600; outline: 0;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); color: var(--text);
}
.otp-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { min-height: 16px; margin: 0; color: var(--danger); font-size: 12px; text-align: center; }
.account-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.account-chip .icon { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-text); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.auth-hint { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 11.5px; }
.auth-hint .icon { width: 13px; height: 13px; vertical-align: -2px; }
.auth-footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px max(16px, 8vw); border-top: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .otp-box { width: 38px; height: 46px; }
  .qr { flex-direction: column; }
}

/* ── Chart tokens and stat tiles ── */
:root { --spark: #b5aea7; --grid: #eeebe8; }
[data-theme="dark"] { --spark: #5e5853; --grid: #2a2826; }
.stat-tile { display: flex; flex-direction: column; gap: 4px; }
.stat-tile .stat-label { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; }
.stat-tile .stat-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-tile .stat-label .icon { width: 14px; height: 14px; color: var(--accent); }
.stat-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.stat-tile .stat-value { font-size: 24px; }
.stat-tile .stat-sub { margin-top: 0; }
.spark { display: inline-block; line-height: 0; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--text-2); }
.delta .icon { width: 13px; height: 13px; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--danger); }
.stat-sub .delta .icon { color: inherit; }
.share-bar { display: flex; gap: 2px; height: 12px; margin: 6px 0 12px; border-radius: 4px; overflow: hidden; }
.share-bar span { min-width: 3px; }
.share-table td, .share-table th { padding: 5px 6px; }
.share-table .swatch { vertical-align: -1px; }
.period { display: inline-flex; gap: 2px; padding: 3px; background: var(--hover); border-radius: 8px; }
.period button { height: 24px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text-2); cursor: pointer; font-size: 11.5px; }
.period button.active { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.trend-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.refetching .card { opacity: .55; transition: opacity .15s; }
.list-row.top-err { grid-template-columns: minmax(0, 1fr) auto auto; }
.num-pair { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.num-pair small { color: var(--muted); font-size: 10.5px; font-weight: 400; }

/* ── Search box in a page toolbar ── */
.tool-search {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; width: min(300px, 100%); padding: 0 8px; cursor: text;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--muted);
}
.tool-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool-search .icon { width: 14px; height: 14px; }
.tool-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); }

/* ── Command palette (Ctrl+K) ── */
.palette-overlay { place-items: start center; padding-top: 12vh; }
.palette {
  display: flex; flex-direction: column; width: min(600px, 100%); max-height: 70vh; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop);
}
.palette-search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); flex: none; }
.palette-input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 14px; }
.palette-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px;
  border: 0; border-radius: 6px; background: none; color: var(--text-2); text-align: left; cursor: pointer;
}
.palette-item .icon { color: var(--muted); }
.palette-item.sel { background: var(--accent-soft); color: var(--accent-text); }
.palette-item.sel .icon { color: var(--accent); }
.palette-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .hint { color: var(--muted); font-size: 11px; white-space: nowrap; }
.palette-empty { padding: 26px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 14px; padding: 7px 14px; border-top: 1px solid var(--border); background: var(--panel-2); color: var(--muted); font-size: 11px; flex: none; }

/* ── Forms: profile, users, dialogs ── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field .input, .form-grid .field .select { height: 32px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.static { display: flex; align-items: center; height: 32px; color: var(--text-2); }
.select.wide { max-width: none; width: 100%; }
.dialog.wide { width: min(600px, 100%); }
.dialog.extra-wide, .dialog.lg { width: min(680px, 100%); }
.dialog .form-error { text-align: left; margin: -6px 0 10px; }
.dialog .field small { font-size: 11px; }
.note, .auth-note {
  display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 9px 12px;
  border-radius: var(--radius-sm); background: var(--hover); color: var(--text-2); font-size: 12px;
}
.note .icon, .auth-note .icon { width: 14px; height: 14px; margin-top: 2px; flex: none; }
.note.warn, .auth-note.warn { background: color-mix(in srgb, var(--lv-warn) 14%, transparent); color: var(--lvt-warn); }
.mt-sm { margin-top: 12px; }
.tf-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cred { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.cred code { font-size: 13px; font-weight: 700; color: var(--text); user-select: all; }
.badge.role-admin { background: var(--accent-soft); color: var(--accent-text); }
.page-foot { display: flex; gap: 8px; align-items: flex-start; margin: 12px 2px 0; color: var(--muted); font-size: 11.5px; }
.page-foot .icon { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* Dashboard recovery question warning banner */
.dashboard-recovery-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: color-mix(in srgb, #f59e0b 8%, var(--panel));
  border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border));
  border-radius: 8px;
}
.dashboard-recovery-banner .banner-icon-wrap {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  color: #f59e0b;
  flex-shrink: 0;
}
.dashboard-recovery-banner .banner-icon-wrap .icon {
  width: 18px;
  height: 18px;
}
.dashboard-recovery-banner .banner-body {
  flex: 1;
  min-width: 0;
}
.dashboard-recovery-banner .banner-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 2px;
}
.dashboard-recovery-banner .banner-desc {
  font-size: 12px;
  color: var(--text-2);
}
.dashboard-recovery-banner .banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dashboard-recovery-banner .banner-dismiss-btn {
  padding: 4px 6px;
  opacity: 0.7;
}
.dashboard-recovery-banner .banner-dismiss-btn:hover {
  opacity: 1;
}

/* Recovery question card in profile */
.recovery-status-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.recovery-status-box.configured {
  background: color-mix(in srgb, var(--ok) 8%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--border));
}
.recovery-status-box.configured .icon {
  color: var(--ok);
  margin-top: 2px;
  flex-shrink: 0;
}
.recovery-status-box.not-configured {
  background: color-mix(in srgb, #f59e0b 8%, var(--panel-2));
  border: 1px solid color-mix(in srgb, #f59e0b 30%, var(--border));
}
.recovery-status-box.not-configured .icon {
  color: #f59e0b;
  margin-top: 2px;
  flex-shrink: 0;
}
.recovery-question-label {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
  font-family: inherit;
}

/* Password rule checklist (ticks turn green while typing) */
.pw-rules { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: -6px 0 0; padding: 0; list-style: none; font-size: 11px; color: var(--muted); }
.pw-rules li { display: inline-flex; align-items: center; gap: 4px; }
.pw-rules .icon { width: 12px; height: 12px; opacity: .3; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok .icon { opacity: 1; }
.form-grid .pw-rules { margin: -4px 0 0; }
.status-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.badge-btn { border: 0; cursor: pointer; font: inherit; font-size: 11px; }
.badge-btn .icon { width: 11px; height: 11px; }
.badge-btn:hover { filter: brightness(.95); text-decoration: underline; }

/* ── About page ── */
.icon .filled { fill: currentColor; stroke: none; }
.about-hero { display: flex; align-items: flex-start; gap: 18px; }
.about-hero img { border-radius: 14px; flex: none; }
.about-hero h2 { margin: 0 0 6px; font-size: 18px; }
.about-hero p { margin: 0; color: var(--text-2); max-width: 70ch; }
.about-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.about-badges .badge { gap: 5px; }
.about-badges .icon { width: 12px; height: 12px; }
.about-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; }
.about-list dt { font-weight: 600; color: var(--text); }
.about-list dd { margin: 2px 0 0; color: var(--text-2); }
.about-text { margin: 0 0 12px; color: var(--text-2); }
.about-author { display: flex; align-items: center; gap: 12px; }
.about-avatar {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 15px;
}
.about-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ── Sign-in extras ── */
.field.center > span { text-align: center; }
.auth-links { text-align: center; font-size: 12px; }
.auth-card .select.wide { height: 36px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-item { display: flex; gap: 8px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.choice-item input { margin: 2px 0 0; accent-color: var(--accent); }
.choice-item small { display: block; color: var(--muted); font-size: 11px; }
.choice-item.on { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 860px) {
  .scope-chip span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .search-text { display: none; }
  .search { width: auto; flex: none; }
}
@media (max-width: 560px) {
  .form-grid, .choice { grid-template-columns: minmax(0, 1fr); }
}

/* ── Usage Report & Filter Components ── */
.filter-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  vertical-align: middle;
}
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s ease;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button.active {
  background: var(--panel);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.segmented button .icon {
  width: 13px;
  height: 13px;
}
.custom-date-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--hover);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  flex-wrap: wrap;
}
.date-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.date-input-wrap input[type="date"],
.custom-date-box input[type="date"] {
  height: 28px;
  padding: 0 28px 0 8px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.date-input-wrap input[type="date"]:hover,
.custom-date-box input[type="date"]:hover {
  border-color: var(--border-strong);
}
.date-input-wrap input[type="date"]:focus,
.custom-date-box input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.date-input-wrap .icon {
  position: absolute;
  right: 7px;
  width: 14px;
  height: 14px;
  color: var(--accent);
  pointer-events: none;
  opacity: 0.95;
}
.date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  right: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  filter: invert(0.8) sepia(1) saturate(5) hue-rotate(345deg);
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.2) sepia(1) saturate(5) hue-rotate(345deg);
}
.breakdown-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: border-color .15s ease;
}
.breakdown-card:hover {
  border-color: var(--border-strong);
}
.breakdown-header {
  user-select: none;
}

/* ── Usage Reports Enhanced Layout ── */
.report-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}
.report-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tok-dot-in {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  flex: none;
}
.tok-dot-out {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex: none;
}

.tok-in {
  color: #2563eb;
  font-weight: 600;
}
[data-theme="dark"] .tok-in {
  color: #60a5fa;
}

.tok-out {
  color: #16a34a;
  font-weight: 600;
}
[data-theme="dark"] .tok-out {
  color: #34d399;
}

.token-ratio-bar {
  display: flex;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.token-ratio-prompt {
  background: #3b82f6;
  height: 100%;
  transition: width .2s ease;
}
[data-theme="dark"] .token-ratio-prompt {
  background: #60a5fa;
}
.token-ratio-comp {
  background: #10b981;
  height: 100%;
  transition: width .2s ease;
}
[data-theme="dark"] .token-ratio-comp {
  background: #34d399;
}

.report-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  gap: 12px;
}
.report-list-header .col-entity {
  flex: 1;
  min-width: 200px;
}
.report-list-header .col-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
}
.report-list-header .metric-col {
  display: flex;
  flex-direction: column;
}
.report-list-header .col-tokens {
  width: 145px;
  text-align: right;
}
.report-list-header .col-requests {
  width: 110px;
  text-align: right;
}
.report-list-header .col-latency {
  width: 70px;
  text-align: right;
}
.report-list-header .col-share {
  width: 100px;
  text-align: left;
}
.report-list-header .col-action {
  width: 85px;
  text-align: right;
}
.report-list-header .sub-hdr {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.breakdown-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
}
.breakdown-metrics .metric-col-tokens {
  width: 145px;
  text-align: right;
}
.breakdown-metrics .metric-col-requests {
  width: 110px;
  text-align: right;
}
.breakdown-metrics .metric-col-latency {
  width: 70px;
  text-align: right;
}
.breakdown-metrics .metric-col-share {
  width: 100px;
}

@media (max-width: 960px) {
  .report-list-header {
    display: none;
  }
  .breakdown-metrics {
    flex-wrap: wrap;
    gap: 12px;
  }
}

/* ── Tab Navigation (IDE / Agent Snippets) ── */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-x: auto;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s ease;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--panel-2);
}
.tab-btn.active {
  background: var(--panel);
  color: var(--accent-text);
  border-color: var(--border);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.tab-btn .icon {
  width: 13px;
  height: 13px;
}
.chart-point {
  cursor: pointer;
  transition: r .15s ease, stroke-width .15s ease;
}
.chart-point:hover {
  r: 6px;
  stroke-width: 3.5px;
}
.chart-hit {
  cursor: pointer;
  pointer-events: all;
}

/* ── Reference Dashboard Elements (Refactored Clean Layout) ── */
.btn-table-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text-2);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s ease;
}
.btn-table-toggle:hover {
  background: var(--hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-table-toggle.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent);
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.kpi-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.kpi-head .icon {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.kpi-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.kpi-val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--text);
}
.kpi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-sub.delta-good {
  color: var(--ok);
}
.kpi-sub.delta-warn {
  color: var(--danger);
}
.kpi-spark {
  display: inline-block;
  line-height: 0;
  flex-shrink: 0;
}

/* Horizontal Segmented Progress Bar */
.level-segment-bar {
  display: flex;
  width: 100%;
  height: 9px;
  background: var(--hover);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 14px;
}
.level-segment-fill {
  height: 100%;
  transition: width .3s ease;
}

/* Top Error Sources List */
.source-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 48px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.source-item:last-child {
  border-bottom: none;
}
.source-details {
  min-width: 0;
}
.source-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.source-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-ns {
  font-size: 10.5px;
  color: var(--muted);
  background: var(--hover);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.source-bar-wrap {
  width: 100%;
  height: 3px;
  background: var(--hover);
  border-radius: 2px;
  overflow: hidden;
}
.source-bar-fill {
  height: 100%;
  background: #c42b1c;
  border-radius: 2px;
  transition: width .3s ease;
}
.source-spark-col {
  display: flex;
  align-items: center;
  justify-content: center;
}
.source-count-col {
  text-align: right;
  line-height: 1.15;
}
.source-count-val {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.source-count-lbl {
  display: block;
  font-size: 10px;
  color: var(--muted);
}

.source-item.wide-count {
  grid-template-columns: minmax(0, 1fr) 90px 80px;
}
.source-bar-fill.blue {
  background: var(--lv-info);
}
.source-bar-fill.accent {
  background: var(--accent);
}
.source-bar-fill.ok {
  background: var(--ok);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font);
}
.badge-status .icon {
  width: 12px;
  height: 12px;
}
.badge-status.s-2xx {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}
.badge-status.s-403 {
  background: color-mix(in srgb, #c42b1c 14%, transparent);
  color: #c42b1c;
}
.badge-status.s-warn {
  background: color-mix(in srgb, var(--lv-warn) 15%, transparent);
  color: var(--lvt-warn);
}
.badge-status.s-err {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}
