/* =====================================================================
   WTECH DATA — DATA / MADE CLEAR
   Design system: emerald/teal on deep graphite, technical grid, quiet glow.
   ===================================================================== */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050a0a;
  --bg-2: #081111;
  --surface: #0b1514;
  --surface-2: #0f1c1b;
  --surface-3: #142523;
  --overlay: rgba(3, 8, 8, 0.72);
  --border: rgba(150, 232, 212, 0.085);
  --border-strong: rgba(150, 232, 212, 0.16);
  --text: #e6f2ef;
  --text-muted: #94aca6;
  --text-faint: #5f7571;
  --accent: #2dd4bf;
  --accent-2: #10b981;
  --accent-strong: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.1);
  --accent-softer: rgba(45, 212, 191, 0.05);
  --accent-ink: #032420;
  --positive: #34d399;
  --positive-soft: rgba(52, 211, 153, 0.12);
  --negative: #f87171;
  --negative-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --chart-grid: rgba(150, 232, 212, 0.08);
  --grid-line: rgba(150, 232, 212, 0.035);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.85);
  --glow: 0 0 0 1px rgba(45, 212, 191, 0.22), 0 0 28px -10px rgba(45, 212, 191, 0.45);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6f5;
  --bg-2: #edf2f1;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --surface-3: #eef4f2;
  --overlay: rgba(12, 31, 28, 0.35);
  --border: #e0e8e6;
  --border-strong: #cad8d4;
  --text: #0b1f1c;
  --text-muted: #4f645e;
  --text-faint: #8a9d98;
  --accent: #0d9488;
  --accent-2: #059669;
  --accent-strong: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.09);
  --accent-softer: rgba(13, 148, 136, 0.05);
  --accent-ink: #ffffff;
  --positive: #047857;
  --positive-soft: rgba(5, 150, 105, 0.1);
  --negative: #dc2626;
  --negative-soft: rgba(220, 38, 38, 0.08);
  --warning: #b45309;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.08);
  --chart-grid: rgba(11, 31, 28, 0.08);
  --grid-line: rgba(11, 31, 28, 0.035);
  --shadow: 0 1px 2px rgba(11, 31, 28, 0.04), 0 12px 32px -18px rgba(11, 31, 28, 0.18);
  --shadow-lg: 0 24px 64px -24px rgba(11, 31, 28, 0.28);
  --glow: 0 0 0 1px rgba(13, 148, 136, 0.25), 0 0 24px -10px rgba(13, 148, 136, 0.35);
}

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 12% -10%, var(--accent-softer), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; font-weight: 650; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ------------------------------------------------------------------ brand */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: 0.08em; }
.logo:hover { color: var(--text); }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-word { font-size: 14px; line-height: 1; }
.logo-word b { color: var(--accent); font-weight: 700; }
.logo-tag { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; color: var(--text-faint); font-weight: 500; margin-top: 4px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: 500 13px/1 var(--font-sans); cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s, box-shadow 0.2s, transform 0.08s;
  white-space: nowrap; user-select: none; text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); box-shadow: var(--glow); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-outline { background: transparent; }
.btn-danger { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 35%, transparent); background: transparent; }
.btn-danger:hover { background: var(--negative-soft); border-color: var(--negative); color: var(--negative); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: var(--r); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.kbd { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong); color: var(--text-faint); background: var(--surface); }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.hint { font-size: 12px; color: var(--text-faint); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 400 13.5px var(--font-sans); transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-sm, .select-sm { height: 30px; font-size: 12.5px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .icon { position: absolute; left: 11px; color: var(--text-faint); pointer-events: none; }
.input-group .input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font: 500 12.5px var(--font-sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: 0.2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-muted); transition: 0.2s var(--ease); }
.switch input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent); }
.form-error { color: var(--negative); font-size: 12.5px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--text-faint); }
.card-body { padding: 16px 20px 20px; }
.card-link { display: block; color: inherit; transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s; }
.card-link:hover { color: inherit; border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat-label { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.stat-label .icon { color: var(--accent); width: 15px; height: 15px; }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-foot { margin-top: 8px; font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 8px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--border-strong); color: var(--text-muted); background: var(--surface-2); white-space: nowrap; }
.badge-accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge-positive { color: var(--positive); background: var(--positive-soft); border-color: transparent; }
.badge-negative { color: var(--negative); background: var(--negative-soft); border-color: transparent; }
.badge-warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.badge-info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge-mono { font-family: var(--font-mono); letter-spacing: 0.06em; font-size: 10.5px; text-transform: uppercase; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.change { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.change.up { color: var(--positive); }
.change.down { color: var(--negative); }
.change.flat { color: var(--text-muted); }

/* ------------------------------------------------------------------ app shell */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px 14px;
  border-right: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); z-index: 30;
}
.sidebar .logo { padding: 4px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; color: var(--text-faint); text-transform: uppercase; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--text-muted); font-weight: 500; font-size: 13.5px; position: relative; transition: background 0.15s, color 0.15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--accent-soft); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.nav a.active .icon { color: var(--accent); }
.nav-count { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--negative); background: var(--negative-soft); padding: 1px 6px; border-radius: 999px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user .who b { display: block; font-size: 13px; font-weight: 600; }
.sidebar-user .who span { display: block; font-size: 11.5px; color: var(--text-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px);
}
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 36px; width: min(420px, 100%); padding: 0 10px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-faint); cursor: pointer; font: 400 13px var(--font-sans);
}
.search-trigger:hover { border-color: var(--accent); color: var(--text-muted); }
.search-trigger .kbd { margin-left: auto; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell { position: relative; }
.bell .count { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--negative); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.menu-toggle { display: none; }

.page { padding: 28px 32px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header .titles { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.page-header p { color: var(--text-muted); max-width: 720px; }
.page-header .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { font-size: 15px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow: auto; border-radius: var(--r); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }
.row-link { cursor: pointer; }

/* dataset viewer (spreadsheet-like) */
.sheet { overflow: auto; max-height: 64vh; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.sheet table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.sheet th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--border-strong); border-right: 1px solid var(--border); padding: 0; text-align: left; }
.sheet th .col-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; white-space: nowrap; cursor: pointer; min-width: 120px; }
.sheet th .col-head:hover { background: var(--surface-3); }
.sheet th .col-name { font-weight: 600; font-size: 12.5px; color: var(--text); }
.sheet th .col-type { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.sheet td { padding: 7px 10px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.sheet td.num { text-align: right; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.sheet td.null { color: var(--text-faint); font-style: italic; }
.sheet .rownum { position: sticky; left: 0; background: var(--surface-2); color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; text-align: right; min-width: 52px; z-index: 1; }
.sheet th.rownum { z-index: 3; }
.pager { display: flex; align-items: center; gap: 8px; padding-top: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { position: relative; height: 40px; padding: 0 14px; background: none; border: 0; color: var(--text-muted); font: 500 13.5px var(--font-sans); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); }
.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; box-shadow: 0 0 10px var(--accent); }

/* ------------------------------------------------------------------ overlays */
.modal-backdrop { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade 0.15s var(--ease); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: pop 0.2s var(--ease); }
.modal-lg { width: min(820px, 100%); }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 0; }
.modal-header h2 { font-size: 17px; }
.modal-body { padding: 18px 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; flex-wrap: wrap; }
.drawer-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 90; animation: fade 0.15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--surface); border-left: 1px solid var(--border-strong); z-index: 91; overflow: auto; box-shadow: var(--shadow-lg); animation: slide 0.22s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: pop 0.2s var(--ease); }
.toast b { display: block; font-size: 13px; }
.toast p { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.toast.success .icon { color: var(--positive); }
.toast.error .icon { color: var(--negative); }
.toast.warning .icon { color: var(--warning); }
.toast.info .icon { color: var(--info); }

/* command palette */
.palette-backdrop { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(6px); z-index: 150; display: flex; justify-content: center; padding: 12vh 16px 16px; animation: fade 0.12s; }
.palette { width: min(640px, 100%); max-height: 64vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg), var(--glow); overflow: hidden; animation: pop 0.18s var(--ease); }
.palette-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-head .eyebrow { font-size: 10px; }
.palette-input { flex: 1; border: 0; background: transparent; color: var(--text); font: 400 16px var(--font-sans); outline: none; }
.palette-list { overflow: auto; padding: 8px; }
.palette-group { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); padding: 10px 10px 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-sm); border: 0; background: none; color: var(--text); font: 500 13.5px var(--font-sans); cursor: pointer; text-align: left; }
.palette-item .icon { color: var(--text-muted); }
.palette-item small { color: var(--text-faint); font-weight: 400; margin-left: auto; font-size: 12px; }
.palette-item.selected, .palette-item:hover { background: var(--accent-soft); }
.palette-item.selected .icon { color: var(--accent); }

/* ------------------------------------------------------------------ states */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 56px 24px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--accent-softer), transparent 70%); }
.empty-state .empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); box-shadow: var(--glow); margin-bottom: 4px; }
.empty-state h3 { font-size: 17px; }
.empty-state p { color: var(--text-muted); max-width: 420px; }

.error-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 48px 24px; }
.error-state .code { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em; color: var(--negative); text-transform: uppercase; }
.error-state .glyph { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: var(--negative); background: var(--negative-soft); }
.error-state.warning .glyph, .error-state.warning .code { color: var(--warning); }
.error-state.warning .glyph { background: var(--warning-soft); }
.error-state h2 { font-size: 20px; }
.error-state p { color: var(--text-muted); max-width: 460px; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.error-page .big { font-size: clamp(64px, 12vw, 120px); font-weight: 700; letter-spacing: -0.05em; line-height: 1; background: linear-gradient(180deg, var(--text), var(--text-faint)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.processing { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 40px 24px; text-align: center; }
.processing .brand { font-family: var(--font-mono); letter-spacing: 0.3em; font-size: 12px; color: var(--text-muted); }
.processing .title { font-family: var(--font-mono); letter-spacing: 0.22em; font-size: 15px; font-weight: 600; color: var(--accent); }
.processing .title::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.progress { width: min(440px, 100%); height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); box-shadow: 0 0 16px var(--accent); transition: width 0.35s var(--ease); }
.progress.indeterminate > div { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.stages { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100%); text-align: left; }
.stage { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-faint); }
.stage .mark { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.stage.done { color: var(--text-muted); }
.stage.done .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stage.active { color: var(--text); font-weight: 500; }
.stage.active .mark { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stage.active .mark::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.boot-splash { position: fixed; inset: 0; display: grid; place-items: center; z-index: 1; }
body:has(.app-ready) .boot-splash { display: none; }

/* ------------------------------------------------------------------ upload */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 56px 24px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-xl); background: linear-gradient(180deg, var(--accent-softer), transparent); transition: border-color 0.2s, background 0.2s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .up-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); box-shadow: var(--glow); }
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12px; font-family: var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); font-size: 11px; }
.step.active { color: var(--text); }
.step.active .n, .step.done .n { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.step-sep { width: 28px; height: 1px; background: var(--border-strong); }
.file-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.file-summary .item { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.file-summary .item small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.file-summary .item b { display: block; font-size: 16px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.type-pill { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------------ quality */
.score-ring { --v: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none; background: conic-gradient(var(--ring, var(--accent)) calc(var(--v) * 1%), var(--surface-3) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.score-ring span { position: relative; font-size: 30px; font-weight: 700; letter-spacing: -0.04em; }
.score-ring small { position: relative; display: block; text-align: center; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.16em; color: var(--text-faint); margin-top: -4px; }
.issue { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.issue:last-child { border-bottom: 0; }
.issue .icon { margin-top: 2px; }
.issue.Critical .icon { color: var(--negative); }
.issue.Warning .icon { color: var(--warning); }
.issue.Info .icon { color: var(--info); }

/* ------------------------------------------------------------------ dashboards */
.filter-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.filter-bar .field { min-width: 160px; }
.filter-bar .field.wide { min-width: 280px; }
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range .input { min-width: 0; }
.ms { position: relative; }
.ms-button { justify-content: space-between; width: 100%; font-weight: 400; background: var(--surface); height: 36px; }
.ms-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: max(100%, 240px); max-height: 300px; overflow: auto; padding: 8px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.ms-panel label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.ms-panel label:hover { background: var(--surface-2); }
.ms-panel label small { margin-left: auto; color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; }

.dash-grid { --row-h: 76px; --gap: 16px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: var(--row-h); gap: var(--gap); position: relative; }
.widget { container-type: inline-size; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s; }
.widget:hover { border-color: var(--border-strong); }
.widget-header { display: flex; align-items: center; gap: 8px; padding: 14px 16px 0; min-height: 36px; }
.widget-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.widget-sub { font-size: 11.5px; color: var(--text-faint); }
.widget-body { position: relative; flex: 1; min-height: 0; padding: 8px 12px 12px; }
.widget-body .chart { position: absolute; inset: 6px 10px 10px; }
.widget-error { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; color: var(--warning); font-size: 12.5px; text-align: center; padding: 12px; }
.widget.selected { border-color: var(--accent); box-shadow: var(--glow); }
.widget .drag-handle { cursor: grab; color: var(--text-faint); display: inline-flex; padding: 2px; border-radius: 5px; touch-action: none; }
.widget .drag-handle:hover { color: var(--accent); background: var(--accent-soft); }
.widget .resize-handle { position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; color: var(--text-faint); display: grid; place-items: center; z-index: 3; }
.widget .resize-handle:hover { color: var(--accent); }
.widget .widget-tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.widget:hover .widget-tools, .widget.selected .widget-tools { opacity: 1; }
.widget.is-dragging { z-index: 10; box-shadow: var(--shadow-lg), var(--glow); opacity: 0.92; cursor: grabbing; }
.widget.is-resizing { z-index: 10; box-shadow: var(--glow); }
.grid-placeholder { border: 1.5px dashed var(--accent); border-radius: var(--r-lg); background: var(--accent-soft); pointer-events: none; z-index: 0; }

.kpi { display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 4px 6px; gap: 6px; }
.kpi-value { font-size: clamp(17px, 11.5cqi, 32px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-compact { display: none; }
@container (max-width: 230px) { .kpi-full { display: none; } .kpi-compact { display: inline; } }
.kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); flex-wrap: wrap; }
.progress-widget { display: flex; flex-direction: column; justify-content: center; gap: 10px; height: 100%; padding: 0 6px; }
.progress-widget .bar { height: 10px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.progress-widget .bar > div { height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.6s var(--ease); }
.widget-table { position: absolute; inset: 4px 0 0; overflow: auto; }
.widget-table .table th { background: var(--surface); }
.widget-table .table td, .widget-table .table th { padding: 8px 14px; }

/* editor */
.editor { display: grid; grid-template-columns: 216px minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.editor-panel { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow: auto; }
.widget-library { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.lib-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); color: var(--text-muted); font: 500 11.5px var(--font-sans); cursor: pointer; transition: 0.15s; text-align: center; }
.lib-item:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.lib-item .icon { color: var(--accent); }
.config-section { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.config-section:last-child { border-bottom: 0; }
.config-section h4 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); font-weight: 500; }
.canvas-empty { grid-column: 1 / -1; grid-row: 1 / span 4; }

/* insights & ask */
.insight { display: flex; gap: 16px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; }
.insight::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--text-faint); }
.insight.Positive::before { background: var(--positive); }
.insight.Negative::before { background: var(--negative); }
.insight.Neutral::before { background: var(--info); }
.insight .ins-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-muted); }
.insight.Positive .ins-icon { background: var(--positive-soft); color: var(--positive); }
.insight.Negative .ins-icon { background: var(--negative-soft); color: var(--negative); }
.insight.Neutral .ins-icon { background: var(--info-soft); color: var(--info); }
.insight .ins-text { font-size: 14px; line-height: 1.55; }
.insight .spark { width: 160px; height: 52px; flex: none; position: relative; }
.ask-box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow); transition: border-color 0.2s, box-shadow 0.2s; }
.ask-box:focus-within { border-color: var(--accent); box-shadow: var(--glow); }
.ask-box input { flex: 1; border: 0; background: transparent; color: var(--text); font: 400 15.5px var(--font-sans); outline: none; min-width: 0; height: 40px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font: 400 12.5px var(--font-sans); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.answer { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; padding: 22px; }
.answer .big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.answer .q { font-size: 13px; color: var(--text-faint); display: flex; gap: 8px; align-items: center; }
.answer .chart-box { position: relative; min-height: 260px; }
.query-code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; white-space: pre-wrap; }

.chart-box { position: relative; height: 280px; }
.chart-box .chart { position: absolute; inset: 0; }
.connector { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.connector .logo-box { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-muted); font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.timeline { position: relative; display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 14px; padding: 12px 0; position: relative; }
.timeline-item .t-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent); flex: none; }
.timeline-item .t-time { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }

/* onboarding */
.onboarding { text-align: center; padding: 32px 28px 26px; }
.onboarding .steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 26px 0; text-align: left; }
.onboarding .ob-step { padding: 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); }
.onboarding .ob-step .n { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.onboarding .ob-step b { display: block; font-size: 13px; margin-top: 6px; }

/* ------------------------------------------------------------------ public / landing */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.landing-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: 68px; padding: 0 max(24px, calc((100vw - 1200px) / 2)); background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.landing-nav nav { display: flex; gap: 22px; margin-left: 24px; }
.landing-nav nav a { color: var(--text-muted); font-size: 13.5px; font-weight: 500; }
.landing-nav nav a:hover { color: var(--text); }
.landing-nav .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.hero { padding: 88px 0 56px; position: relative; }
.hero::before { content: ""; position: absolute; inset: -80px 0 auto; height: 620px; background: radial-gradient(640px 320px at 50% 0%, var(--accent-soft), transparent 70%); pointer-events: none; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; position: relative; }
.hero .brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.hero .brandline .line { width: 36px; height: 1px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.hero h1 { font-size: clamp(40px, 5.6vw, 68px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 700; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--accent-strong), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 17.5px; color: var(--text-muted); margin-top: 22px; max-width: 520px; line-height: 1.6; }
.hero .cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.hero .trust { display: flex; gap: 22px; margin-top: 36px; flex-wrap: wrap; color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.hero .trust span { display: inline-flex; align-items: center; gap: 8px; }
.hero .trust .dot { color: var(--accent); }
.demo-frame { position: relative; border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-lg), 0 0 80px -30px var(--accent); overflow: hidden; }
.demo-frame .bar { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; color: var(--text-faint); }
.demo-frame .bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); display: inline-block; }
.demo-body { padding: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.demo-kpi { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.demo-kpi small { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--text-faint); }
.demo-kpi b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(14px, 1.4vw, 18px); font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.demo-kpi .change { font-size: 11px; margin-top: 2px; }
.demo-chart { grid-column: span 4; height: 190px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.demo-chart.half { grid-column: span 2; height: 170px; }
.demo-chart > div { position: absolute; inset: 8px; }
.section { padding: 72px 0; }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(26px, 3vw, 36px); letter-spacing: -0.03em; margin-top: 12px; }
.section-head p { color: var(--text-muted); margin-top: 12px; font-size: 15.5px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature { padding: 26px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; transition: border-color 0.2s, transform 0.25s var(--ease); }
.feature:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.feature::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(var(--accent-soft), transparent 70%); }
.feature .f-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 18px; }
.feature .f-name { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--text-faint); }
.feature h3 { font-size: 22px; margin-top: 6px; letter-spacing: -0.03em; }
.feature p { color: var(--text-muted); margin-top: 10px; font-size: 13.5px; }
.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.flow .f-step { padding: 18px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); }
.flow .f-step .n { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.flow .f-step b { display: block; margin-top: 8px; font-size: 14px; }
.flow .f-step p { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }
.cta-band { margin: 24px 0 80px; padding: 48px; border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: radial-gradient(600px 200px at 20% 0%, var(--accent-soft), transparent 70%), var(--surface); display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.cta-band h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.03em; }
.footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--text-faint); font-size: 12.5px; }
.footer .container { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.eco { display: inline-flex; gap: 10px; align-items: center; }
.eco i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--border); background: radial-gradient(700px 400px at 0% 0%, var(--accent-soft), transparent 70%), var(--bg-2); overflow: hidden; }
.auth-side h2 { font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -0.04em; line-height: 1.08; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 24px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-btn svg { width: 17px; height: 17px; }
.dev-note { font-size: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warning-soft); color: var(--warning); }

.share-top { display: flex; align-items: center; gap: 16px; padding: 16px max(16px, calc((100vw - 1480px) / 2 + 32px)); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }

#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show, #components-reconnect-modal.components-reconnect-failed, #components-reconnect-modal.components-reconnect-rejected { display: grid; position: fixed; inset: 0; z-index: 300; place-items: center; background: var(--overlay); backdrop-filter: blur(4px); }
#components-reconnect-modal .rc-box { padding: 22px 26px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
#components-reconnect-modal .rc-failed { display: none; }
#components-reconnect-modal.components-reconnect-failed .rc-failed, #components-reconnect-modal.components-reconnect-rejected .rc-failed { display: block; }
#components-reconnect-modal.components-reconnect-failed .rc-show, #components-reconnect-modal.components-reconnect-rejected .rc-show { display: none; }
#blazor-error-ui { display: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 400; padding: 12px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--negative); box-shadow: var(--shadow-lg); font-size: 13px; }
#blazor-error-ui a { margin-left: 10px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .editor { grid-template-columns: 180px minmax(0, 1fr) 290px; }
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-panel { position: static; max-height: none; }
  .widget-library { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { --row-h: 66px; --gap: 12px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform 0.25s var(--ease); box-shadow: var(--shadow-lg); background: var(--bg); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page { padding: 20px 16px 48px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .landing-nav nav { display: none; }
  .file-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .onboarding .steps-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  h1 { font-size: 22px; }
  .grid-2, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .search-trigger .kbd, .search-trigger span { display: none; }
  .search-trigger { width: 36px; padding: 0; justify-content: center; }
  /* Mobile = view mode: widgets stack in reading order */
  .dash-grid { display: flex; flex-direction: column; }
  .dash-grid .widget { min-height: calc(var(--h, 4) * 58px); }
  .dash-grid .widget.kpi-w { min-height: 118px; }
  .filter-bar .field, .filter-bar .field.wide { min-width: 100%; }
  .feature-grid, .flow { grid-template-columns: minmax(0, 1fr); }
  .demo-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-chart, .demo-chart.half { grid-column: span 2; }
  .hero { padding: 48px 0 32px; }
  .cta-band { padding: 28px; }
  .insight { flex-direction: column; }
  .insight .spark { width: 100%; }
  .landing-nav .actions .btn-ghost { display: none; }
  .modal-footer .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
