/* ═══════════════════════════════════════════════════════
   Telescope Command Center — Brand Styles

   Brand Palette:
     Deep Space   #002B49  (primary dark)
     Arrival      #000C2B  (deepest dark)
     Dune         #FFF5EB  (replaces white)
     Starlight    #FDD086  (gold accent on dark)
     Brass        #CEA24A  (interactive accent)
     Mars         #A33A21  (warm accent)
     2049         #611A02  (deep warm accent)

   Typography:
     Headers: 'Prata', serif
     Body:    'Proxima Nova', -apple-system, sans-serif

   Principles:
     - Dark mode first (Deep Space backgrounds)
     - Dune replaces white everywhere
     - Rounded shapes only
     - Generous spacing
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Prata&display=swap');

/* Hide number input spin buttons globally — fields are always typeable */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ═══════════════════════════════════════════════════════
   Theme tokens — dark (default) + light, flipped via <html data-theme>

   The brand palette vars below (--dune, --arrival, --brass …) are
   DERIVED from channel-RGB tokens so they flip automatically between
   themes. Channel-RGB lets opacity carry across themes unchanged:
   a translucent cream ink over Deep Space inverts cleanly to a
   translucent navy ink over Dune at the same alpha.

   Rules baked into the token model:
     • --on-accent is the dark ink that sits ON gold buttons/chips.
       It NEVER flips (gold stays gold in both themes).
     • Status colors (green/red/blue/amber) stay literal — they read
       on both backgrounds.
   ═══════════════════════════════════════════════════════ */
:root, :root[data-theme="dark"] {
  /* channel-RGB primitives (flip per theme) */
  --ink-rgb: 255,245,235;            /* Dune — foreground ink ramp */
  --accent-rgb: 206,162,74;          /* Brass — interactive accent */
  --accent-bright-rgb: 253,208,134;  /* Starlight — bright glow accent */
  --page-rgb: 0,43,73;               /* Deep Space — page background */
  --paper-rgb: 0,12,43;              /* Arrival — card/surface */
  --paper-2-rgb: 0,8,22;             /* deeper surface / 2nd gradient stop */
  --shadow-rgb: 0,0,0;               /* box-shadow color */

  /* fixed (do NOT flip) */
  --on-accent: #000C2B;              /* dark ink ON gold — never flips */
  --on-dark: #FFF5EB;                /* light ink ON fixed-dark fills (e.g. error toast) */
  --mars: #A33A21;                   /* warm brand accent (reads both) */
  --t2049: #611A02;

  /* frosted glass — alpha tuned per theme (NOT carried over) */
  --glass: rgba(0,20,40,.72);

  /* image-backed surfaces (nebula → rover/rocket in light) */
  --bg-image: url('/images/nebula-bg.jpg');
  --bg-image-client: url('/images/client-bg.jpg');
  --bg-image-order: url('/images/order-bg.jpg');
  --bg-overlay: linear-gradient(180deg, rgba(0,12,43,.5) 0%, rgba(0,12,43,.82) 100%);

  /* derived brand palette (flip via the channels above) */
  --deep-space: rgb(var(--page-rgb));
  --arrival: rgb(var(--paper-rgb));
  --dune: rgb(var(--ink-rgb));
  --dune-muted: rgb(var(--paper-2-rgb));
  --starlight: rgb(var(--accent-bright-rgb));
  --brass: rgb(var(--accent-rgb));

  /* derived semantic tokens */
  --text-primary: rgb(var(--ink-rgb));
  --text-secondary: rgba(var(--ink-rgb),.55);
  --text-muted: rgba(var(--ink-rgb),.35);
  --border-subtle: rgba(var(--ink-rgb),.08);
  --border-light: rgba(var(--ink-rgb),.12);
  --surface: rgba(var(--ink-rgb),.04);
  --surface-hover: rgba(var(--ink-rgb),.07);

  /* layout (theme-agnostic) */
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --sidebar-width: 250px;
  --sidebar-collapsed: 68px;
  --topbar-height: 46px;
}

:root[data-theme="light"] {
  --ink-rgb: 0,43,73;                /* Deep Space ink on light */
  --accent-rgb: 178,134,42;          /* darker brass for contrast on cream */
  --accent-bright-rgb: 206,162,74;   /* brass replaces the starlight glow */
  --page-rgb: 255,245,235;           /* Dune — warm page background */
  --paper-rgb: 255,255,255;          /* white cards lift above the page */
  --paper-2-rgb: 245,232,216;        /* dune-muted deeper surface */
  --shadow-rgb: 0,43,73;             /* navy-tinted shadow, softer than black */

  --glass: rgba(255,255,255,.95);    /* near-solid in light so panels stay legible over the image */

  --bg-image: url('/images/light-bg.jpg');
  --bg-image-client: url('/images/light-client-bg.jpg');
  --bg-image-order: url('/images/light-order-bg.jpg');
  /* Heavier scrim in light mode: the warm image stays a faint backdrop, but
     near-flat cream behind cards keeps translucent surfaces reading solid. */
  --bg-overlay: linear-gradient(180deg, rgba(255,245,235,.82) 0%, rgba(255,245,235,.95) 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--deep-space);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, rgba(var(--paper-rgb),.97) 0%, rgba(var(--paper-2-rgb),.99) 100%);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  color: var(--dune);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  border-right: 1px solid rgba(var(--accent-rgb),.06);
  transition: width 0.3s cubic-bezier(.4,0,.2,1);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 16px 22px;
  border-bottom: 1px solid rgba(var(--accent-rgb),.06);
  min-height: 64px;
}

.sidebar-brand {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.25s ease;
}

.sidebar-logo {
  font-family: 'Prata', serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--starlight);
  letter-spacing: 0.3px;
  line-height: 1.2;
  text-shadow: 0 0 20px rgba(var(--accent-bright-rgb),.12);
}

.sidebar-sub {
  font-size: 8.5px;
  color: rgba(var(--accent-rgb),.45);
  margin-top: 3px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Sidebar toggle button */
.sidebar-toggle {
  background: rgba(var(--ink-rgb),.02);
  border: 1px solid rgba(var(--ink-rgb),.06);
  border-radius: 8px;
  color: rgba(var(--ink-rgb),.3);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(.4,0,.2,1);
  width: 28px;
  height: 28px;
}
.sidebar-toggle:hover {
  color: var(--starlight);
  border-color: rgba(var(--accent-rgb),.25);
  background: rgba(var(--accent-rgb),.08);
  transform: scale(1.05);
}

.sidebar-toggle-mobile {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.2s;
}
.sidebar-toggle-mobile:hover { color: var(--starlight); }

.sidebar-nav {
  flex: 1; padding: 10px 0; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb),.15) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb),.15); border-radius: 4px; }

.nav-section {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(var(--accent-rgb),.35);
  padding: 20px 22px 7px;
  overflow: hidden;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 22px;
  margin: 1px 8px;
  font-size: 13px;
  color: rgba(var(--ink-rgb),.45);
  text-decoration: none;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  transition: color 0.2s ease, background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0;
  background: var(--brass);
  border-radius: 0 3px 3px 0;
  transition: height 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s ease;
  opacity: 0;
}

.nav-item:hover {
  color: rgba(var(--ink-rgb),.8);
  background: rgba(var(--ink-rgb),.04);
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item.active {
  color: rgb(var(--accent-bright-rgb));
  background: rgba(var(--accent-rgb),.08);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),.1), 0 0 16px rgba(var(--accent-rgb),.04);
}

.nav-item.active::before {
  height: 20px;
  opacity: 1;
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px rgba(var(--accent-bright-rgb),.3));
}

.nav-icon {
  font-size: 16px; width: 22px; text-align: center; flex-shrink: 0;
  transition: filter 0.25s ease, transform 0.2s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.08);
}

.nav-label {
  font-weight: 500;
  transition: opacity 0.25s ease;
  letter-spacing: 0.1px;
}

/* Light mode: dark ink on cream needs more contrast + weight than cream-on-dark
   to read as "solid." Deepen nav text and section labels for legibility. */
:root[data-theme="light"] .nav-item { color: rgba(var(--ink-rgb),.74); }
:root[data-theme="light"] .nav-item:hover { color: rgb(var(--ink-rgb)); }
:root[data-theme="light"] .nav-label { font-weight: 600; }
:root[data-theme="light"] .nav-section { color: rgba(var(--accent-rgb),.72); }
:root[data-theme="light"] .sidebar-sub { color: rgba(var(--accent-rgb),.7); }

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(var(--accent-rgb),.06);
  background: rgba(var(--paper-2-rgb),.4);
}

.sidebar-user { display: flex; align-items: center; gap: 12px; overflow: hidden; }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(var(--accent-rgb)) 0%, #8B6914 100%);
  color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(var(--accent-rgb),.15);
  transition: box-shadow 0.2s ease;
}
.user-avatar:hover { box-shadow: 0 0 18px rgba(var(--accent-rgb),.25); }

.user-avatar-img {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 1.5px solid rgba(var(--accent-rgb),.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.user-avatar-img:hover {
  border-color: rgba(var(--accent-rgb),.4);
  box-shadow: 0 0 12px rgba(var(--accent-rgb),.15);
}

.user-info { flex: 1; overflow: hidden; white-space: nowrap; transition: opacity 0.25s ease; }
.user-name { font-size: 13px; font-weight: 500; color: rgba(var(--ink-rgb),.85); }
.user-logout { font-size: 11px; color: rgba(var(--ink-rgb),.3); text-decoration: none; transition: color 0.2s ease; }
.user-logout:hover { color: var(--brass); }

/* ─── Sidebar collapsed state ────────────────────── */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}
.sidebar-collapsed .sidebar-brand { opacity: 0; width: 0; overflow: hidden; }
.sidebar-collapsed .sidebar-top { justify-content: center; padding: 18px 0 16px; }
.sidebar-collapsed .nav-section { text-align: center; padding: 18px 0 6px; }
.sidebar-collapsed .nav-section-text { font-size: 0; }
.sidebar-collapsed .nav-section::before {
  content: '';
  display: block;
  width: 16px; height: 1px;
  background: rgba(var(--accent-rgb),.15);
  margin: 0 auto;
}
.sidebar-collapsed .nav-item {
  padding: 10px 0;
  margin: 1px 6px;
  justify-content: center;
  border-radius: 10px;
}
.sidebar-collapsed .nav-item::before {
  display: none;
}
.sidebar-collapsed .nav-item.active {
  background: rgba(var(--accent-rgb),.1);
  box-shadow: 0 0 12px rgba(var(--accent-rgb),.06);
}
.sidebar-collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; position: absolute; }
.sidebar-collapsed .nav-icon { width: auto; }
.sidebar-collapsed .sidebar-footer { padding: 14px 0; display: flex; justify-content: center; }
.sidebar-collapsed .user-info { opacity: 0; width: 0; overflow: hidden; position: absolute; }
.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }
.sidebar-collapsed .topbar { left: var(--sidebar-collapsed); }

/* Tooltip on hover for collapsed icons */
.sidebar-collapsed .nav-item { position: relative; }
.sidebar-collapsed .nav-item:hover::after {
  content: attr(data-app-name);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--arrival);
  color: var(--dune);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 100;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 16px rgba(var(--shadow-rgb),.4);
  pointer-events: none;
}

/* ─── Top bar ─────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--arrival);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  z-index: 40;
  transition: left 0.25s cubic-bezier(.4,0,.2,1);
}

.topbar-left {
  display: flex;
  align-items: center;
  padding-left: 20px;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand-name {
  font-family: 'Prata', serif;
  font-size: 13px;
  color: var(--starlight);
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.2s, width 0.25s;
}

.topbar-brand-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Show brand name in topbar only when sidebar is collapsed */
.sidebar-collapsed .topbar-brand-name { opacity: 1; width: auto; }
.sidebar-collapsed .topbar-brand-divider { opacity: 1; }

.topbar-right {
  padding-right: 20px;
  flex-shrink: 0;
}

/* ─── Tab bar ─────────────────────────────────────── */
/* ─── Topbar navigation (back/forward/history) ────── */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--border-subtle);
  margin-right: 12px;
}

.topbar-nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.topbar-nav-btn:hover:not(:disabled) {
  color: var(--text-secondary);
  background: rgba(var(--ink-rgb),.06);
}
.topbar-nav-btn:active:not(:disabled) {
  background: rgba(var(--ink-rgb),.1);
}
.topbar-nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
}
.topbar-nav-btn.active {
  color: var(--brass);
  background: rgba(var(--accent-rgb),.08);
}

.topbar-page-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.topbar-page-icon { font-size: 14px; }
.topbar-page-name { font-weight: 600; color: var(--dune); }

.topbar-spacer { flex: 1; }

/* ─── History dropdown ───────────────────────────────── */
.nav-history-dropdown {
  display: none;
  position: fixed;
  top: var(--topbar-height);
  left: var(--sidebar-width);
  width: 320px;
  max-height: 480px;
  background: var(--arrival);
  border: 1px solid rgba(var(--accent-rgb),.1);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 12px 40px rgba(var(--shadow-rgb),.45);
  z-index: 100;
  overflow: hidden;
  transition: left 0.25s cubic-bezier(.4,0,.2,1);
}
.nav-history-dropdown.open { display: block; }
.sidebar-collapsed .nav-history-dropdown { left: var(--sidebar-collapsed); }

.nav-history-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  padding: 12px 16px 6px;
}

.nav-history-list {
  overflow-y: auto;
  max-height: 420px;
  padding: 2px 6px 8px;
}

.nav-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.1s;
  cursor: pointer;
}
.nav-history-item:hover {
  background: rgba(var(--ink-rgb),.05);
  color: var(--dune);
}
.nav-history-item.current {
  color: var(--starlight);
  background: rgba(var(--accent-rgb),.06);
}
.nav-history-item.current::after {
  content: '';
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brass);
  flex-shrink: 0;
}
.nav-history-icon { font-size: 15px; flex-shrink: 0; }
.nav-history-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-history-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ─── Main content area ────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  flex: 1;
  min-height: calc(100vh - var(--topbar-height));
  background: var(--deep-space);
  transition: margin-left 0.25s cubic-bezier(.4,0,.2,1);
}

/* ─── App header ───────────────────────────────────── */
.app-header {
  background: var(--arrival);
  padding: 16px 36px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: var(--topbar-height);
  z-index: 20;
}

.app-title {
  font-family: 'Prata', serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--dune);
}

.app-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.data-badge {
  display: inline-block;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

/* ─── App body ─────────────────────────────────────── */
.app-body {
  padding: 28px 36px 56px;
  max-width: 1340px;
}

/* ─── Shared component styles ──────────────────────── */
.card {
  background: rgba(var(--ink-rgb),.03);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Prata', serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--dune);
}

.card-body { padding: 20px 24px; }

/* ─── KPIs ─────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.kpi {
  background: rgba(var(--ink-rgb),.03);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 1px solid var(--border-subtle);
  border-top: 3px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.kpi:hover {
  background: var(--surface-hover);
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kpi-value {
  font-family: 'Prata', serif;
  font-size: 26px;
  font-weight: 400;
  color: var(--dune);
  letter-spacing: -0.5px;
  line-height: 1;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ─── Charts ───────────────────────────────────────── */
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.chart-card {
  background: rgba(var(--ink-rgb),.03);
  border-radius: var(--radius);
  padding: 26px;
  border: 1px solid var(--border-subtle);
}

.chart-title {
  font-family: 'Prata', serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--dune);
  margin-bottom: 18px;
}

.chart-title span {
  font-family: 'Proxima Nova', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 8px;
}

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

/* ─── Tables ───────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

thead th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  background: rgba(var(--ink-rgb),.02);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  white-space: nowrap;
}

thead th:hover { color: var(--text-secondary); }

tbody tr {
  border-bottom: 1px solid rgba(var(--ink-rgb),.04);
  transition: background 0.15s;
}

tbody tr:hover { background: var(--surface-hover); }

td {
  font-size: 13px;
  color: var(--text-primary);
  padding: 12px 16px;
}

/* ─── Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--dune);
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-accent);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--starlight);
  border-color: var(--starlight);
}

.btn-primary:disabled {
  background: rgba(var(--ink-rgb),.1);
  border-color: rgba(var(--ink-rgb),.1);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-danger { color: var(--mars); border-color: rgba(163,58,33,.3); }
.btn-danger:hover { background: rgba(163,58,33,.1); border-color: rgba(163,58,33,.5); }

/* ─── Forms ────────────────────────────────────────── */
.search-box {
  font-size: 13px;
  padding: 7px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--dune);
  outline: none;
}

.search-box::placeholder { color: var(--text-muted); }
.search-box:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.15); }

/* ─── Filter pills ─────────────────────────────────── */
.filter-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}

.filter-btn:hover {
  border-color: var(--brass);
  color: var(--starlight);
}

.filter-btn.active {
  background: rgba(var(--accent-rgb),.1);
  border-color: var(--brass);
  color: var(--starlight);
}

/* ─── Toast ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--arrival);
  color: var(--dune);
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 300;
  box-shadow: 0 4px 20px rgba(var(--shadow-rgb),.4);
  border: 1px solid var(--border-light);
  max-width: 400px;
  transition: all 0.3s;
  transform: translateY(80px);
  opacity: 0;
  pointer-events: none;
}

.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast.error { background: var(--mars); border-color: var(--mars); color: var(--on-dark); }
.toast.success { background: rgba(var(--accent-rgb),.15); border-color: var(--brass); color: var(--starlight); }

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3,1fr); }
  .charts { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-brand { opacity: 0; width: 0; }
  .sidebar-top { justify-content: center; padding: 16px 0 14px; }
  .sidebar-toggle { display: none; }
  .sidebar-toggle-mobile { display: flex; }
  .nav-section-text { font-size: 0; }
  .nav-item { padding: 10px 0; justify-content: center; border-left-width: 0; }
  .nav-label { opacity: 0; width: 0; position: absolute; }
  .sidebar-footer { padding: 14px 0; justify-content: center; }
  .user-info { opacity: 0; width: 0; position: absolute; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .topbar { left: var(--sidebar-collapsed); }
  .topbar-brand-name { opacity: 1; width: auto; }
  .topbar-brand-divider { opacity: 1; }
  .kpis { grid-template-columns: repeat(2,1fr); }
  .app-body { padding: 20px 16px 40px; }
}
