/* ============================================================================
   Factura Indata — design tokens + base styles
   Linear-meets-Stripe: sharp, refined, data-dense but breathable.
   ============================================================================ */

:root {
  /* type */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Inter', ui-sans-serif, system-ui, sans-serif;

  /* accent (tweakable: emerald-700) */
  --accent:        #15803d;
  --accent-hover:  #166534;
  --accent-active: #14532d;
  --accent-soft:   #f0fdf4;
  --accent-soft-2: #dcfce7;
  --accent-text:   #14532d;
  --accent-ring:   rgba(21, 128, 61, .35);
  --on-accent:     #ffffff;

  /* neutrals (light) */
  --bg:            #fafafa;
  --bg-2:          #f4f4f5;
  --surface:       #ffffff;
  --surface-2:     #fafafa;
  --surface-hover: #f4f4f5;
  --border:        #ececef;
  --border-strong: #d4d4d8;
  --border-input:  #e4e4e7;

  --text:          #0a0a0a;
  --text-muted:    #52525b;
  --text-soft:     #71717a;
  --text-faint:    #a1a1aa;
  --text-on-accent:#ffffff;

  /* semantic */
  --danger:        #dc2626;
  --danger-soft:   #fef2f2;
  --danger-text:   #991b1b;
  --warning:       #d97706;
  --warning-soft:  #fffbeb;
  --warning-text:  #92400e;
  --info:          #2563eb;
  --info-soft:     #eff6ff;
  --info-text:     #1e40af;
  --violet:        #7c3aed;
  --violet-soft:   #f5f3ff;
  --violet-text:   #5b21b6;
  --blue:          #0ea5e9;

  /* sizing */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-2xl: 18px;
  --r-pill: 999px;

  /* shadows — very subtle, Linear-style */
  --shadow-xs: 0 1px 0 0 rgba(0,0,0,.04);
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.04), 0 1px 0 0 rgba(0,0,0,.02);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,.06), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px -8px rgba(0,0,0,.10), 0 6px 16px -6px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 48px -12px rgba(0,0,0,.18), 0 12px 24px -10px rgba(0,0,0,.10);
  --shadow-ring-accent: 0 0 0 3px var(--accent-ring);
  --shadow-ring-focus: 0 0 0 3px rgba(21,128,61,.18);

  /* density */
  --row-h:         44px;
  --row-pad-y:     12px;
  --row-pad-x:     16px;
  --input-h:       36px;

  /* layout */
  --sidebar-w:     244px;
  --sidebar-w-collapsed: 64px;
  --topbar-h:      56px;
}

[data-theme="dark"] {
  --bg:            #09090b;
  --bg-2:          #0d0d10;
  --surface:       #131316;
  --surface-2:     #1a1a1f;
  --surface-hover: #1f1f24;
  --border:        #26262b;
  --border-strong: #3a3a40;
  --border-input:  #2c2c32;

  --text:          #fafafa;
  --text-muted:    #a1a1aa;
  --text-soft:     #71717a;
  --text-faint:    #52525b;

  --accent:        #22c55e;
  --accent-hover:  #16a34a;
  --accent-active: #15803d;
  --accent-soft:   #052e16;
  --accent-soft-2: #052e16;
  --accent-text:   #4ade80;
  --accent-ring:   rgba(34, 197, 94, .35);
  --on-accent:     #052e16;

  --danger-soft:   #2a0e0e;
  --danger-text:   #fca5a5;
  --warning-soft:  #2a1d05;
  --warning-text:  #fbbf24;
  --info-soft:     #0f1d3a;
  --info-text:     #93c5fd;
  --violet-soft:   #1f1535;
  --violet-text:   #c4b5fd;

  --shadow-xs: 0 1px 0 0 rgba(0,0,0,.4);
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.4), 0 1px 0 0 rgba(0,0,0,.2);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,.5), 0 2px 4px -1px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 32px -8px rgba(0,0,0,.6), 0 6px 16px -6px rgba(0,0,0,.4);
  --shadow-xl: 0 24px 48px -12px rgba(0,0,0,.8), 0 12px 24px -10px rgba(0,0,0,.5);
}

[data-density="compact"] {
  --row-h: 36px;
  --row-pad-y: 8px;
  --row-pad-x: 12px;
  --input-h: 32px;
}

/* ─────────────────────────────────────────────────────────────────── reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.005em;
}
#root { min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
input:focus, textarea:focus, select:focus { outline: none; }
a { color: inherit; text-decoration: none; }
mark.hl { background: rgba(21,128,61,.18); color: inherit; padding: 0 1px; border-radius: 2px; }
[data-theme="dark"] mark.hl { background: rgba(34,197,94,.22); color: inherit; }

/* numerics tabular */
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-faint); background-clip: content-box; border: 2px solid transparent; }

/* ─────────────────────────────────────────────────────── primitives */

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--input-h);
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .12s ease, box-shadow .12s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible { box-shadow: var(--shadow-ring-focus); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-active); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-icon { width: var(--input-h); padding: 0; }
.btn-sm   { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-sm.btn-icon { width: 30px; }
.btn-lg   { height: 44px; padding: 0 18px; font-size: 14.5px; border-radius: var(--r-md); }
.btn-xl   { height: 48px; padding: 0 22px; font-size: 15px; border-radius: var(--r-lg); font-weight: 600; }
.btn-block { width: 100%; }

/* Input */
.input {
  display: flex; align-items: center;
  height: var(--input-h);
  width: 100%;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: var(--shadow-ring-focus); }
.input:disabled { background: var(--surface-2); color: var(--text-soft); cursor: not-allowed; }
.input-error { border-color: var(--danger); }
.input-error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.18); }

textarea.input { padding: 9px 11px; height: auto; min-height: 76px; line-height: 1.5; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

.input-with-icon { position: relative; }
.input-with-icon .input { padding-left: 34px; }
.input-with-icon .input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-soft); pointer-events: none; }
.input-with-icon .input-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }

.label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text); margin-bottom: 5px; letter-spacing: -0.005em; }
.label-help { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

/* Kbd */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-soft);
  font-family: var(--font-sans);
}

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); }
.card-pad { padding: 20px; }
.card-pad-sm { padding: 14px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-subtitle { font-size: 12.5px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.card-body { padding: 16px 20px; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex-shrink: 0; }
.badge-neutral  { background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.badge-success  { background: var(--accent-soft); color: var(--accent-text); }
.badge-danger   { background: var(--danger-soft); color: var(--danger-text); }
.badge-warning  { background: var(--warning-soft); color: var(--warning-text); }
.badge-info     { background: var(--info-soft); color: var(--info-text); }
.badge-violet   { background: var(--violet-soft); color: var(--violet-text); }
.badge-outline  { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 4px; }
.tab {
  position: relative;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: color .12s;
}
.tab:hover { color: var(--text); }
.tab-active { color: var(--text); }
.tab-active::after { content:''; position:absolute; left:0; right:0; bottom:-1px; height:2px; background: var(--accent); border-radius: 2px; }

/* Table */
.table-wrap { width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: var(--row-pad-y) var(--row-pad-x); text-align: left; }
.table thead th {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky; top: 0;
  height: 38px;
  padding-top: 0; padding-bottom: 0;
}
.table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child { border-bottom: 0; }
.table td { vertical-align: middle; color: var(--text); }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-actions { width: 1%; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }

/* Empty state */
.empty {
  display:flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-illustration { margin-bottom: 16px; opacity: .9; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; max-width: 320px; }

/* Skeleton */
.skel {
  display: block;
  background: linear-gradient(90deg, var(--surface-hover) 0%, var(--surface-2) 50%, var(--surface-hover) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-sm);
  height: 12px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Tooltips */
.tooltip-host { position: relative; display: inline-flex; }
.tooltip-host:hover .tooltip, .tooltip-host:focus-within .tooltip { opacity: 1; transform: translate(-50%, -4px); pointer-events: auto; }
.tooltip {
  position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, 0);
  background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .12s, transform .12s;
  z-index: 100;
}

/* Drawer */
.drawer-backdrop { position: fixed; inset:0; background: rgba(0,0,0,.32); z-index: 80; animation: fadeIn .15s ease-out; }
[data-theme="dark"] .drawer-backdrop { background: rgba(0,0,0,.55); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 560px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 81;
  display: flex; flex-direction: column;
  animation: slideInRight .25s cubic-bezier(.16,.84,.44,1);
}
.drawer-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { flex: 1; overflow: auto; padding: 20px 22px; }
.drawer-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; display:flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .15s ease-out; }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.6); }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-xl); max-width: 480px; width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: modalIn .2s cubic-bezier(.16,.84,.44,1); border: 1px solid var(--border); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body   { padding: 20px 22px; overflow: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Toast */
.toast-stack { position: fixed; bottom: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 280px; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; animation: toastIn .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.toast-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* Chips / pills filter */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-input);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pill-count { font-size: 11px; color: inherit; opacity: .65; font-variant-numeric: tabular-nums; }

/* Switch */
.switch { position: relative; display: inline-flex; width: 32px; height: 18px; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch::after { content:''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: white; border-radius: 50%; transition: transform .15s, background .15s; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.switch-on { background: var(--accent); }
.switch-on::after { transform: translateX(14px); }
[data-theme="dark"] .switch::after { background: #fafafa; }

/* Radio cards */
.radio-card {
  flex: 1;
  border: 1px solid var(--border-input);
  border-radius: var(--r-lg);
  padding: 14px;
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
  background: var(--surface);
  position: relative;
}
.radio-card:hover { border-color: var(--border-strong); }
.radio-card-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-ring-focus); }
.radio-card-active::after { content:''; position: absolute; top: 8px; right: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); }

/* Sidebar nav */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item-active { background: var(--surface-hover); color: var(--text); }
.nav-item-active .nav-icon { color: var(--accent); }
.nav-icon { color: var(--text-soft); flex-shrink: 0; transition: color .12s; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; transition: width .2s ease; }
.sidebar-collapsed { width: var(--sidebar-w-collapsed); }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
.page { flex: 1; padding: 24px 28px; }
.page-narrow { max-width: 1320px; margin: 0 auto; }

/* Avatar */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft-2); color: var(--accent-text); font-weight: 600; font-size: 12px; letter-spacing: -.02em; flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-md { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* Misc utility */
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.col { display: flex; flex-direction: column; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Type */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.012em; color: var(--text); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; }

/* Page header */
.page-header { display:flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -.012em; }
.page-subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; }
.kpi-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }
.delta-pos { color: var(--accent-text); }
.delta-neg { color: var(--danger); }

/* CFE preview */
.cfe-preview { background: white; color: #111; border: 1px solid #e4e4e7; border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow-sm); }
[data-theme="dark"] .cfe-preview { background: #fafafa; color: #111; }

/* Spinner */
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Code/cae */
.cae { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

/* Hide on mobile etc */
@media (max-width: 880px) {
  .sidebar { display: none; }
  .page { padding: 16px; }
  .hide-sm { display: none !important; }
}

/* Mobile dashboard adaptations */
@media (max-width: 720px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .grid-kpi-4 { grid-template-columns: 1fr 1fr !important; }
  .grid-charts { grid-template-columns: 1fr !important; }
  .grid-cli-rail { grid-template-columns: 1fr !important; }
  .grid-cli-rail .summary-rail { position: static !important; }
  .table thead th, .table td { padding: 10px 12px !important; }
  .hide-mobile { display: none !important; }
}

/* Print hide chrome */
@media print {
  .sidebar, .topbar, .page-header, .no-print { display: none !important; }
  .page { padding: 0; }
}

/* Login bg */
.login-bg {
  min-height: 100vh;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  opacity: .5;
}

/* Combobox dropdown */
.combobox { position: relative; }
.combobox-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px; overflow: auto;
  z-index: 30;
  padding: 4px;
}
.combobox-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
}
.combobox-item:hover, .combobox-item.active { background: var(--surface-hover); }
.combobox-item .item-main { flex: 1; min-width: 0; overflow: hidden; }
.combobox-item .item-main > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combobox-item .item-meta { color: var(--text-soft); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combobox-item > *:not(.item-main) { flex-shrink: 0; }
.combobox-item .mono { white-space: nowrap; }

/* Sticky right card */
.summary-rail { position: sticky; top: calc(var(--topbar-h) + 16px); align-self: flex-start; }

/* Subtle gradient accent */
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-active));
  color: white;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.02em;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.18);
  flex-shrink: 0;
}
