/* ═══════════════════════════════════════════════════════════════
   NEO-BRUTALISM — trouter console design system
   Raw structure: thick borders, hard offset shadows, flat saturated
   color. No radius (except 999px pills), no blur, no gradients, no glow.
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset (replaces Tailwind preflight) ──────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
ul, ol, menu { list-style: none; margin: 0; padding: 0; }
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: inherit; }
table { border-collapse: collapse; text-indent: 0; }
button, input, select, textarea, optgroup {
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}
button, select { text-transform: none; }
[role="button"], button { cursor: pointer; }
:disabled { cursor: not-allowed; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
[hidden] { display: none !important; }
.hidden { display: none !important; }

/* ── Color tokens — LIGHT (default) ───────────────────────────── */

:root {
  color-scheme: light;

  --bg-void:        #EFECE3;
  --bg-primary:     #F7F5EE;
  --bg-secondary:   #EFECE3;
  --bg-card:        #FFFFFF;
  --bg-elevated:    #EEF3FF;
  --bg-hover:       #DCE7FF;
  --bg-surface:       var(--bg-card);
  --bg-surface-hover: var(--bg-hover);
  --bg-tertiary:      var(--bg-elevated);

  --border:         #0A0A0A;
  --border-subtle:  #0A0A0A;
  --border-hover:   #0A0A0A;
  --border-color:   var(--border);

  --text-primary:   #0A0A0A;
  --text-secondary: #3F3F3A;
  --text-muted:     #6E6E66;

  --accent:            #2962FF;
  --accent-dim:        #1E4FD6;
  --accent-hover:      #4478FF;
  --accent-foreground: #FFFFFF;
  --accent-contrast:   var(--accent-foreground);
  --accent-glow:        rgba(41,98,255,0.22);  /* legacy alias — flat tint only, never used as a glow */
  --accent-glow-strong: rgba(41,98,255,0.40);

  --success:      #00A651; --success-dim: #007A3C;
  --warning:      #FF8A00; --warning-dim: #D96F00;
  --error:        #FF3B30; --error-dim: #D42A20; --error-border: #0A0A0A;
  --danger:       var(--error);
  --green:        var(--success);
  --red:          var(--error);
  --purple:       #7C4DFF; --purple-dim: #5E35B1;
  --blue:         #2962FF; --blue-dim: #0D47A1;

  --shadow-color: #0A0A0A;
  --shadow-sm: 3px 3px 0 var(--shadow-color);
  --shadow-md: 5px 5px 0 var(--shadow-color);
  --shadow-lg: 8px 8px 0 var(--shadow-color);
  --surface-shadow: var(--shadow-md);
  --shadow-glow: none; /* legacy alias — NB never glows */

  --radius:    0;
  --radius-lg: 0;
  --radius-xl: 0;

  --font-display: 'Archivo Black', 'Arial Black', sans-serif;
  --font-body:    'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --transition:   80ms linear;

  --latency-route:    #2962FF; --latency-route-foreground: #FFFFFF;
  --latency-upstream: #00B8D9; --latency-upstream-foreground: #0A0A0A;
  --latency-overhead: #7C4DFF; --latency-overhead-foreground: #FFFFFF;

  --chart-text: var(--text-secondary);
  --chart-grid: rgba(10,10,10,0.12);
  --modal-overlay: rgba(10,10,10,0.55);
  --overlay-bg: rgba(10,10,10,0.85);
  --overlay-foreground: #FFFFFF;
}

/* ── Color tokens — DARK ───────────────────────────────────────── */

html[data-theme="dark"] {
  color-scheme: dark;

  --bg-void: #0C0C0E; --bg-primary: #121214; --bg-secondary: #18181B;
  --bg-card: #1C1C20; --bg-elevated: #26262B; --bg-hover: #2E2E34;
  --bg-surface: var(--bg-card); --bg-surface-hover: var(--bg-hover);
  --bg-tertiary: var(--bg-elevated);

  --border: #F4F4F0; --border-subtle: #F4F4F0; --border-hover: #F4F4F0;
  --border-color: var(--border);

  --text-primary: #F4F4F0; --text-secondary: #C6C6CC; --text-muted: #8A8A92;

  --accent: #5C8CFF; --accent-dim: #4478FF; --accent-hover: #7AA2FF;
  --accent-foreground: #0A0A0A;
  --accent-glow: rgba(92,140,255,0.18);
  --accent-glow-strong: rgba(92,140,255,0.3);

  --success: #2EE68A; --success-dim: #00C853;
  --warning: #FFB300; --warning-dim: #FF8F00;
  --error: #FF5252; --error-dim: #FF1744; --error-border: #F4F4F0;
  --danger: var(--error); --green: var(--success); --red: var(--error);
  --purple: #B388FF; --purple-dim: #7C4DFF;
  --blue: #82B1FF; --blue-dim: #2962FF;

  --shadow-color: #F4F4F0; /* white hard shadows on dark */
  --surface-shadow: var(--shadow-md);

  --chart-grid: rgba(244,244,240,0.15);
  --modal-overlay: rgba(0,0,0,0.65);
  --overlay-bg: rgba(0,0,0,0.85);
}

/* ── Base ─────────────────────────────────────────────────── */

html { background: var(--bg-primary); }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-primary);
  color: var(--text-primary);
}

::selection {
  background: var(--accent);
  color: var(--accent-foreground);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.8; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Card ─────────────────────────────────────────────────── */

.nb-card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* ── Buttons ──────────────────────────────────────────────── */

.nb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.nb-btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nb-btn-primary:hover {
  background: var(--accent-hover);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-md);
}
.nb-btn-primary:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}
.nb-btn-primary:disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-style: dashed;
  box-shadow: none;
  cursor: not-allowed;
}

.nb-btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nb-btn-danger:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-md);
}
.nb-btn-danger:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* Neutral bordered button — the app's default/secondary action.
   .nb-btn-secondary and .nb-btn-outline are the same recipe: they're
   used interchangeably across pages for the same bordered-neutral role. */
.nb-btn-secondary,
.nb-btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nb-btn-secondary:hover,
.nb-btn-outline:hover {
  background: var(--bg-hover);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-md);
}
.nb-btn-secondary:active,
.nb-btn-outline:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.nb-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.nb-btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nb-btn-success {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.nb-btn-success:hover {
  color: var(--success);
  background: var(--success-dim);
}

.nb-btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
}
.nb-btn-icon svg { width: 15px; height: 15px; }

.nb-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: transform var(--transition), background-color var(--transition), box-shadow var(--transition);
}
.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-sm);
}
.theme-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}
.theme-toggle-icon {
  font-size: 17px;
  line-height: 1;
}
.theme-toggle-floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
}

/* ── Inputs ───────────────────────────────────────────────── */

.nb-input {
  height: 42px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-primary);
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.nb-input:focus {
  box-shadow: var(--shadow-sm);
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.nb-input::placeholder {
  color: var(--text-muted);
}

/* ── Labels ───────────────────────────────────────────────── */

.nb-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ── Navigation ───────────────────────────────────────────── */

.nb-nav {
  height: 56px;
  background: var(--bg-card);
  border-bottom: 3px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nb-nav-tab {
  height: calc(100% - 12px);
  margin: 6px 2px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: color var(--transition), background-color var(--transition), border-color var(--transition);
  text-decoration: none;
  position: relative;
}
.nb-nav-tab:hover {
  color: var(--text-primary);
}
.nb-nav-tab.active {
  color: var(--accent-foreground);
  background: var(--accent);
  border-color: var(--border);
}

/* ── Sub-tabs ─────────────────────────────────────────────── */

.nb-subtab {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: color var(--transition), background-color var(--transition), border-color var(--transition);
  text-decoration: none;
}
.nb-subtab:hover {
  color: var(--text-primary);
}
.nb-subtab.active {
  color: var(--accent-foreground);
  background: var(--accent);
  border-color: var(--border);
}

/* ── Tables ───────────────────────────────────────────────── */

.nb-table {
  width: 100%;
  font-size: 13px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
}
.nb-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-foreground);
  border-bottom: 3px solid var(--border);
  background: var(--accent);
}
html[data-theme="dark"] .nb-table thead th {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}
.nb-table thead th:last-child { text-align: right; }
.nb-table tbody td {
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  font-family: var(--font-mono);
  transition: background var(--transition);
}
.nb-table tbody tr:hover td {
  background: var(--bg-elevated);
}
.nb-table tbody tr:last-child td {
  border-bottom: none;
}
.nb-table .text-right { text-align: right; }
.nb-table .text-center { text-align: center; }

/* ── Badges / Tags ────────────────────────────────────────── */

.nb-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  line-height: 1.3;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-family: var(--font-mono);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
/* "-teal" carries over the old accent-badge meaning: colored with the app's accent (yellow). */
.nb-badge-teal   { background: var(--accent);  color: var(--accent-foreground); }
.nb-badge-green  { background: var(--success); color: #fff; }
.nb-badge-red    { background: var(--error);   color: #fff; }
.nb-badge-yellow { background: var(--warning); color: #fff; }
.nb-badge-purple { background: var(--purple);  color: #fff; }
.nb-badge-blue   { background: var(--blue);    color: #fff; }

.nb-badge-xs {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  line-height: 1;
  flex-shrink: 0;
}
.nb-badge-xs-teal   { background: var(--accent);      color: var(--accent-foreground); }
.nb-badge-xs-amber  { background: var(--warning);     color: #fff; }
.nb-badge-xs-purple { background: var(--purple);      color: #fff; }
.nb-badge-xs-blue   { background: var(--blue);        color: #fff; }
.nb-badge-xs-muted  { background: var(--bg-elevated); color: var(--text-muted); }

/* ── Select (flat dropdown, replaces native <select> popups) ──
   Markup: .nb-select > .nb-select-trigger + .nb-select-menu[role=listbox]
   with .nb-select-item rows. Behavior wired by obSelectInit(). */

.nb-select {
  position: relative;
  width: 100%;
}
.nb-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
  text-align: left;
  transition: box-shadow var(--transition);
}
.nb-select-trigger:focus-visible,
.nb-select-trigger[aria-expanded="true"] {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-sm);
}
.nb-select-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.nb-select-trigger[aria-expanded="true"] .nb-select-chevron {
  transform: rotate(180deg);
}
.nb-select-value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.nb-select-value > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-select-value.nb-select-placeholder {
  color: var(--text-muted);
}
.nb-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  padding: 4px;
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
}
.nb-select-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.nb-select-item.active {
  background: var(--bg-hover);
}
.nb-select-check {
  grid-column: 1;
  color: var(--accent-foreground);
  visibility: hidden;
}
.nb-select-item.selected .nb-select-check {
  visibility: visible;
}
.nb-select-item.selected {
  background: var(--accent);
  color: var(--accent-foreground);
}
.nb-select-item-label {
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-select-badges {
  grid-column: 3;
  display: inline-flex;
  gap: 4px;
}
.nb-select-item-desc {
  grid-column: 2 / 4;
  font-size: 11px;
  font-family: var(--font-body);
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-select-item.selected .nb-select-item-desc {
  color: var(--accent-foreground);
  opacity: 0.75;
}
.nb-select-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Progress bars ────────────────────────────────────────── */

.nb-progress {
  height: 8px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.nb-progress-bar {
  height: 100%;
  transition: width var(--transition);
}
.nb-progress-bar.teal { background: var(--accent); }
.nb-progress-bar.green { background: var(--success); }
.nb-progress-bar.yellow { background: var(--warning); }
.nb-progress-bar.red { background: var(--error); }
.nb-progress-bar.blue { background: var(--blue); }

/* ── Codex quota subrow ──────────────────────────────────── */
.nb-quota-mini-bar {
  display: inline-block;
  width: 42px;
  height: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
  vertical-align: middle;
}
.nb-quota-mini-fill {
  display: block;
  height: 100%;
  transition: width var(--transition);
}
.nb-quota-refresh-link:hover { text-decoration: underline; }

/* Fixed-width slot for the optional "套餐 PLUS" badge so the first
   window label (5h / 周) always starts at the same x position even
   when the provider has no plan_type (claude_code). */
.nb-quota-plan-slot {
  display: inline-flex;
  align-items: center;
  min-width: 96px;
  flex-shrink: 0;
}

/* Visually fuse the quota subrow with its parent row:
   - Parent row drops its bottom border so the two look like one block.
   - Subrow has zero top padding and no top border.
   - A vertical accent line on the inner div signals "belongs to row above". */
.nb-table tbody tr.nb-row-has-quota td { border-bottom: none; padding-bottom: 4px; }
.nb-quota-row td {
  border-top: none;
  padding: 0 14px 12px 14px;
  background: transparent;
}
.nb-quota-inner {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 10px;
  margin-left: 6px;
}
.nb-table tbody tr.nb-quota-row:hover td { background: transparent; }

/* ── Modal ────────────────────────────────────────────────── */

.nb-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nb-modal-overlay.hidden { display: none; }

.nb-modal {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  margin: 0 16px;
  box-shadow: var(--shadow-lg);
}

.nb-modal h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 4px;
}

/* ── Providers workbench component layer ─────────────────── */

.nb-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: var(--modal-overlay);
  transition: opacity var(--transition), visibility 0s linear var(--transition);
}
.nb-sheet-overlay.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

.nb-sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  visibility: hidden;
  background: var(--bg-card);
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 160ms linear, visibility 0s linear 160ms;
}
.nb-sheet.open {
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.nb-sheet-header {
  position: relative;
  flex: 0 0 auto;
  padding: 24px 64px 20px 24px;
  border-bottom: 3px solid var(--border);
}
.nb-sheet-title {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.3;
  color: var(--text-primary);
}
.nb-sheet-desc {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.nb-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
}
.nb-sheet-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 3px solid var(--border);
}
.nb-sheet-close {
  position: absolute;
  top: 18px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}
.nb-sheet-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Switch — square brutalist toggle, no pill shape. */
.nb-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.nb-switch input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.nb-switch-track {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: background-color var(--transition);
}
.nb-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-secondary);
  border-radius: var(--radius);
  transition: transform var(--transition), background-color var(--transition);
}
.nb-switch input[type="checkbox"]:checked + .nb-switch-track {
  background: var(--accent);
}
.nb-switch input[type="checkbox"]:checked + .nb-switch-track .nb-switch-thumb {
  background: var(--accent-foreground);
  transform: translateX(16px);
}
.nb-switch input[type="checkbox"]:focus-visible + .nb-switch-track {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.nb-switch:has(input[type="checkbox"]:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.nb-switch-sm .nb-switch-track {
  width: 30px;
  height: 18px;
}
.nb-switch-sm .nb-switch-thumb {
  width: 12px;
  height: 12px;
}
.nb-switch-sm input[type="checkbox"]:checked + .nb-switch-track .nb-switch-thumb {
  transform: translateX(12px);
}

/* Segmented tabs */
.nb-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.nb-seg-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 14px;
  color: var(--text-secondary);
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}
.nb-seg-item:hover {
  color: var(--text-primary);
}
.nb-seg-item.active {
  color: var(--accent-foreground);
  background: var(--accent);
  border-color: var(--border);
}

/* Empty and loading states */
.nb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 120px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.nb-empty-icon {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
}
.nb-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.nb-panel-loading {
  transition: opacity var(--transition);
}
.htmx-request .nb-panel-loading,
.nb-panel-loading.htmx-request {
  opacity: 0.5;
  pointer-events: none;
}

/* Providers workbench layout */
.pv-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  overflow: hidden;
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
}
.pv-summary-action {
  display: flex;
  align-items: center;
}
.pv-summary > * {
  min-width: 0;
  padding: 18px 20px;
}
.pv-summary > * + * {
  border-left: 2px solid var(--border);
}
.pv-summary-value,
.pv-summary > * > :first-child {
  display: block;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.15;
}
.pv-summary-label,
.pv-summary > * > :last-child {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pv-workbench {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.pv-sidebar {
  padding: 8px;
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
}
.pv-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition), box-shadow var(--transition);
}
.pv-sidebar-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.pv-sidebar-item.active {
  color: var(--text-primary);
  background: var(--accent);
  box-shadow: inset 3px 0 0 var(--border);
}
.pv-sidebar-item.inactive {
  opacity: 0.55;
}
.pv-sidebar-item.inactive .pv-sidebar-icon {
  color: var(--text-muted);
}
.pv-sidebar-item.inactive:hover,
.pv-sidebar-item.inactive.active {
  opacity: 0.8;
}
.pv-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pv-dot.on {
  background: var(--success);
}
.pv-dot.off {
  background: var(--text-muted);
  opacity: 0.6;
}
.pv-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.pv-cred-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 30px;
  height: 20px;
  margin-left: auto;
  padding: 0 7px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
}
.pv-panel {
  min-width: 0;
}
.pv-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (max-width: 900px) {
  .pv-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .pv-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pv-summary > :nth-child(3) {
    border-left: none;
  }
  .pv-summary > :nth-child(n + 3) {
    border-top: 2px solid var(--border);
  }
  .pv-summary-action {
    grid-column: 1 / -1;
    border-left: none;
  }
  .pv-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nb-sheet-overlay,
  .nb-sheet,
  .nb-switch-track,
  .nb-switch-thumb,
  .nb-spinner {
    transition: none;
  }
  .nb-spinner {
    animation-duration: 1.4s;
  }
}

/* ── Stat cards ───────────────────────────────────────────── */

.nb-stat {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 3px solid var(--border);
  min-width: 160px;
}
.nb-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.nb-stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--text-primary);
  line-height: 1.1;
}
.nb-stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Code blocks ──────────────────────────────────────────── */

.nb-code {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text-primary);
}

/* ── Tool selector pills ──────────────────────────────────── */

.nb-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  border: 2px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}
.nb-pill:hover {
  color: var(--text-primary);
}
.nb-pill.active {
  background: var(--accent);
  color: var(--accent-foreground);
}
.mdl-chip-count {
  opacity: 0.7;
  font-size: 11px;
  margin-left: 4px;
}

/* ── Callout / Note box ───────────────────────────────────── */

.nb-callout {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 13px;
}
.nb-callout b, .nb-callout strong {
  color: var(--text-primary);
}
.nb-callout ul {
  margin-top: 8px;
  margin-left: 16px;
  list-style: disc;
  color: var(--text-secondary);
}
.nb-callout li {
  margin-bottom: 4px;
}

/* ── Health dot ───────────────────────────────────────────── */

.nb-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.nb-dot-green  { background: var(--success); }
.nb-dot-yellow { background: var(--warning); }
.nb-dot-red    { background: var(--error); }

/* ── Scrollbar styling — square ───────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Page headings ────────────────────────────────────────── */

.nb-page-title {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.01em;
}

.nb-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Alert ────────────────────────────────────────────────── */

.nb-alert-error {
  background: var(--error-dim);
  border: 2px solid var(--error-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Hover utilities ──────────────────────────────────────── */

.hover-accent:hover { color: var(--accent); }
.hover-error:hover { color: var(--error); }
.hover-underline:hover { text-decoration: underline; }

/* ── Utility ──────────────────────────────────────────────── */

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent-foreground); background: var(--accent); padding: 0 4px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.text-purple { color: var(--purple); }
.bg-primary { background: var(--bg-primary); }
.bg-card { background: var(--bg-card); }
.bg-elevated { background: var(--bg-elevated); }

/* ── Dashboard ───────────────────────────────────────────── */

.dashboard-page {
  --dashboard-accent: var(--blue, #2962FF);
  font-family: var(--font-mono);
}

.dashboard-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--text-primary);
  background: var(--warning);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

.dashboard-alert-icon {
  flex: 0 0 auto;
}

.dashboard-alert-content {
  font-size: 13px;
}

.dashboard-alert-item {
  margin-left: 8px;
}

.dashboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard-title {
  margin: 0;
  font-family: var(--font-mono);
}

.usage-period-selector {
  display: inline-flex;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

.usage-period-btn {
  min-width: 76px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--text-secondary);
  background: transparent;
  border-right: 2px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
}

.usage-period-btn:last-child {
  border-right: none;
}

.usage-period-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.usage-period-btn.active {
  color: var(--accent-foreground);
  background: var(--dashboard-accent);
  font-weight: 700;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.usage-card {
  min-height: 136px;
  padding: 24px;
  border-radius: var(--radius);
}

.usage-card-title {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.usage-card-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.usage-kpi-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.usage-kpi-status.is-error {
  color: var(--error);
}

.usage-breakdown-card {
  padding: 20px;
  margin-bottom: 20px;
  border-radius: var(--radius);
}

.usage-breakdown-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.usage-breakdown-title {
  margin-bottom: 0;
}

.usage-breakdown-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.usage-control-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.usage-control-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.usage-group-select {
  width: auto;
  min-width: 148px;
  height: 44px;
  padding: 0 30px 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.usage-export-btn,
.usage-retry-btn {
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.usage-export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.usage-breakdown-bar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.usage-breakdown-bar {
  display: flex;
  width: 100%;
  height: 24px;
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
}

.usage-breakdown-segment {
  flex-grow: 0;
  flex-shrink: 0;
  min-width: 1px;
}

.usage-breakdown-table {
  width: 100%;
}

.usage-breakdown-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(96px, 0.38fr));
  align-items: center;
  gap: 16px;
  min-height: 42px;
  padding: 8px 12px;
  border-top: 2px solid var(--border);
  font-size: 12px;
}

.usage-breakdown-header-row {
  min-height: 34px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-top: none;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.usage-breakdown-row > :not(:first-child) {
  text-align: right;
}

.usage-breakdown-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: var(--text-primary);
}

.usage-breakdown-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-legend-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
}

.usage-breakdown-value {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.usage-panel-state {
  display: flex;
  min-height: 152px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.usage-panel-state[data-state="error"],
.usage-chart-state[data-state="error"] {
  color: var(--error);
}

.dash-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.nb-chart-card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.nb-chart-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.nb-chart-wrap {
  position: relative;
  height: 220px;
}

.usage-chart-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ── Claude Code Desktop guide ────────────────────────────── */

.ccd-guide {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ccd-step {
  display: flex;
  gap: 20px;
  padding: 20px;
  align-items: flex-start;
}

.ccd-step-body {
  flex: 1;
  min-width: 0;
}

.ccd-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ccd-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.ccd-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.ccd-step-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
}

.ccd-step-desc code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 1px 6px;
  color: var(--text-primary);
}

.ccd-step-img-wrap {
  position: relative;
  border: 2px solid var(--border);
  overflow: hidden;
  background: var(--bg-secondary);
  flex-shrink: 0;
  width: 280px;
}

.ccd-step-img {
  width: 100%;
  display: block;
  cursor: zoom-in;
}

.ccd-img-hint {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 11px;
  color: var(--overlay-foreground);
  background: var(--overlay-bg);
  padding: 2px 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

.ccd-step-img-wrap:hover .ccd-img-hint {
  opacity: 1;
}

.ccd-step-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  border-style: dashed;
}

.ccd-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  vertical-align: middle;
  transition: color var(--transition), background-color var(--transition);
}

.ccd-copy-btn:hover {
  color: var(--accent-foreground);
  background: var(--accent);
}

@media (max-width: 768px) {
  .ccd-step {
    flex-direction: column;
  }
  .ccd-step-img-wrap {
    width: 100%;
  }
}

.ccd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.ccd-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border: 3px solid #fff;
  cursor: default;
}

/* ── Responsive (keep Tailwind's old breakpoints) ─────────── */

@media (max-width: 1024px) {
  .dash-chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nb-nav-inner {
    padding: 0 64px 0 8px !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .nb-nav-inner::-webkit-scrollbar { display: none; }
  .nb-nav-brand {
    flex: 0 0 auto;
    margin-right: 8px !important;
  }
  .nb-nav-brand-label { display: none; }
  #nav-tabs,
  .nb-nav-actions { flex: 0 0 auto; }
  .nb-nav .theme-toggle {
    position: fixed;
    top: 4px;
    right: 8px;
    z-index: 110;
    background: var(--bg-card);
  }
  .nb-stat-value { font-size: 22px; }
  .nb-nav-tab { padding: 0 12px; font-size: 11px; }
  .dash-kpi-grid { grid-template-columns: 1fr; }

  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-period-selector {
    width: 100%;
  }

  .usage-period-btn {
    min-width: 0;
    flex: 1 1 0;
    padding: 0 8px;
  }

  .usage-card {
    min-height: 116px;
    padding: 20px;
  }

  .usage-card-value {
    font-size: 36px;
  }

  .usage-breakdown-card,
  .nb-chart-card {
    padding: 16px;
  }

  .usage-breakdown-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-breakdown-controls {
    width: 100%;
  }

  .usage-control-field {
    min-width: 0;
    flex: 1 1 auto;
  }

  .usage-group-select {
    width: 100%;
  }

  .usage-breakdown-header-row {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .usage-breakdown-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 0;
  }

  .usage-breakdown-row > :not(:first-child) {
    text-align: left;
  }

  .usage-breakdown-name {
    grid-column: 1 / -1;
  }

  .usage-breakdown-value::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
}

@media (max-width: 420px) {
  .usage-breakdown-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-export-btn {
    width: 100%;
  }

  .dashboard-alert {
    align-items: flex-start;
  }

  .dashboard-alert-item {
    display: block;
    margin: 4px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-page .usage-period-btn,
  .dashboard-page .usage-card,
  .dashboard-page .nb-chart-card {
    transition: none;
  }
}

/* ── Notification bell (nav) ──────────────────────────────── */

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.notif-bell-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.notif-badge-dot {
  display: none;
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  border: 1.5px solid var(--bg-card);
}
.notif-badge-dot.show {
  display: block;
  animation: dotPulse 1.8s ease-in-out infinite;
}
.notif-panel {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 20;
}
.notif-panel.show { display: block; }
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}
.notif-panel-header button {
  background: none;
  border: none;
  color: var(--accent-foreground);
  background-color: var(--accent);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}
.notif-item {
  display: block;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.notif-item.unread .notif-item-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-foreground);
  background-color: var(--accent);
  flex-shrink: 0;
}
.notif-item-body {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}
.notif-item-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}
.notif-panel-empty {
  padding: 32px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
