:root {
  --text-xs: clamp(0.8125rem, 0.75rem + 0.25vw, 0.9375rem);
  --text-sm: clamp(0.9375rem, 0.875rem + 0.3vw, 1.0625rem);
  --text-base: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  --text-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-xl: clamp(1.625rem, 1.3rem + 1.2vw, 2.125rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem; --space-5: 1.25rem;
  --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --radius-sm: 10px; --radius-md: 16px; --radius-lg: 22px; --radius-xl: 28px; --radius-pill: 999px;

  --bg: oklch(0.975 0.012 80);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.955 0.015 80);
  --ink: oklch(0.24 0.03 260);
  --ink-2: oklch(0.45 0.025 260);
  --ink-3: oklch(0.6 0.02 260);
  --line: oklch(0.3 0.03 260 / 0.1);
  --accent: oklch(0.66 0.19 42);
  --accent-ink: oklch(0.42 0.14 42);
  --accent-soft: oklch(0.94 0.05 50);
  --good: oklch(0.6 0.16 150); --good-soft: oklch(0.94 0.06 150);
  --ok: oklch(0.6 0.14 230); --ok-soft: oklch(0.94 0.04 230);
  --warn: oklch(0.72 0.16 75); --warn-soft: oklch(0.96 0.07 85);
  --bad: oklch(0.58 0.2 25); --bad-soft: oklch(0.95 0.05 25);
  --shadow: 0 10px 30px -14px oklch(0.3 0.04 60 / 0.25), 0 2px 6px -2px oklch(0.3 0.04 60 / 0.12);

  --font: 'Plus Jakarta Sans', 'Nunito', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: var(--text-base); line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); font-weight: 800; }
h3 { font-size: var(--text-base); font-weight: 700; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--ink-2); }
.small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); }
.skip:focus { left: var(--space-4); z-index: 100; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100dvh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-4); }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 0.72rem; letter-spacing: 0; flex: none; }
.brand-name { font-weight: 800; font-size: var(--text-base); line-height: 1.1; }
.brand-sub { font-size: var(--text-xs); color: var(--ink-2); }
.nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); text-decoration: none; font-weight: 600; font-size: var(--text-sm); color: var(--ink-2); min-height: 48px; }
.nav a svg { width: 22px; height: 22px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: var(--radius-pill); padding: 0 var(--space-2); font-size: var(--text-xs); font-weight: 700; min-width: 24px; text-align: center; }
.nav-label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--space-4) var(--space-4) var(--space-1); }
.role-box { margin-top: auto; background: var(--surface-2); border-radius: var(--radius-lg); padding: var(--space-4); }
.role-box label { display: block; font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); margin-bottom: var(--space-2); }
.role-box select { width: 100%; }

.main { min-width: 0; padding: var(--space-6) var(--space-8) var(--space-12); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.topbar .sub { color: var(--ink-2); margin-top: var(--space-1); }
.topbar-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.btn.menu-btn { display: none; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 48px; padding: 0 var(--space-5); border-radius: var(--radius-pill); border: 2px solid transparent; background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: var(--text-sm); cursor: pointer; transition: transform 0.12s ease, background 0.15s ease; white-space: nowrap; }
.btn:hover { background: oklch(0.93 0.02 80); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.good { background: var(--good); color: #fff; }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.sm { min-height: 40px; padding: 0 var(--space-4); font-size: var(--text-xs); }
.btn.icon { width: 48px; padding: 0; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea { width: 100%; min-height: 48px; padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); border: 2px solid var(--line); background: var(--surface); font-size: var(--text-sm); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { min-height: 96px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field > span { font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }

.chip { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 700; line-height: 1.6; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: oklch(0.5 0.13 70); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.plain::before { display: none; }

.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.tab { min-height: 48px; padding: 0 var(--space-5); border-radius: var(--radius-pill); border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: var(--text-sm); cursor: pointer; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-pill); padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: var(--radius-pill); padding: var(--space-2) var(--space-4); font-weight: 700; font-size: var(--text-xs); min-height: 40px; cursor: pointer; color: var(--ink-2); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Cards and grids */
.card { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-5) var(--space-6); box-shadow: var(--shadow); }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.tight { padding: var(--space-4) var(--space-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-4); }
.grid > * { min-width: 0; }
.grid.sold { grid-template-columns: minmax(0, 1fr) 320px; }
td.nowrap, th.nowrap { white-space: nowrap; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.two { grid-template-columns: 1.4fr 1fr; }
.grid.even { grid-template-columns: 1fr 1fr; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.kpi { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-5) var(--space-6); box-shadow: var(--shadow); }
.kpi .label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi .value { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.02em; margin-top: var(--space-1); }
.kpi .delta { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); margin-top: var(--space-1); }
.kpi.accent { background: var(--accent); color: #fff; }
.kpi.accent .label, .kpi.accent .delta { color: oklch(1 0 0 / 0.85); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); padding: var(--space-3) var(--space-4); font-weight: 700; }
thead th:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
thead th:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
tbody td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--accent-soft); }
td.right, th.right { text-align: right; }
.pos { color: var(--good); font-weight: 700; }
.neg { color: var(--bad); font-weight: 700; }

/* Pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-3); }
.col { background: var(--surface-2); border-radius: var(--radius-lg); padding: var(--space-3); min-height: 200px; }
.col h3 { display: flex; justify-content: space-between; align-items: center; padding: var(--space-1) var(--space-2) var(--space-3); font-size: var(--text-sm); }
.col h3 span { background: var(--surface); border-radius: var(--radius-pill); padding: 0 var(--space-2); font-size: var(--text-xs); }
.vcard { background: var(--surface); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-2); box-shadow: var(--shadow); cursor: pointer; border: 2px solid transparent; }
.vcard:hover { border-color: var(--accent); }
.vcard .t { font-weight: 800; font-size: var(--text-sm); }
.vcard .s { font-size: var(--text-xs); color: var(--ink-2); display: flex; justify-content: space-between; margin-top: var(--space-1); }

/* Avatars */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: var(--text-xs); font-weight: 800; flex: none; }
.avatar.bot { background: var(--accent); }
.avatar.sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 240px 1fr 300px; gap: var(--space-4); }
.space-list button { display: flex; width: 100%; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 0; background: transparent; font-weight: 700; font-size: var(--text-sm); cursor: pointer; text-align: left; }
.space-list button.active { background: var(--accent-soft); color: var(--accent-ink); }
.msg { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg .who { font-weight: 800; font-size: var(--text-sm); }
.msg .when { color: var(--ink-3); font-size: var(--text-xs); margin-left: var(--space-2); }
.msg .body { margin-top: 2px; }
.msg.system .body { background: var(--surface-2); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.msg.command .body { font-family: var(--mono); font-size: var(--text-sm); background: var(--ink); color: #fff; border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); display: inline-block; }
.stk-tag { display: inline-block; background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-pill); padding: 0 var(--space-2); font-size: var(--text-xs); font-weight: 800; margin-left: var(--space-2); text-decoration: none; }
.composer { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.composer input { flex: 1; }

/* Checklist + action items */
.check { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); cursor: pointer; }
.check:hover { background: var(--surface-2); }
.check input { width: 26px; height: 26px; accent-color: var(--good); flex: none; }
.check.done span.t { text-decoration: line-through; color: var(--ink-3); }

/* Readiness dots */
.dots { display: flex; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--good); }
.dot.half { background: var(--warn); }

/* Drawer / modal */
.overlay { position: fixed; inset: 0; background: oklch(0.2 0.03 260 / 0.45); display: none; z-index: 40; }
.overlay.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 50; transform: translateX(100%); transition: transform 0.25s ease; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-6); border-radius: var(--radius-xl) 0 0 var(--radius-xl); box-shadow: var(--shadow); }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-5); }
.toast { position: fixed; left: 50%; bottom: var(--space-6); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill); font-weight: 700; font-size: var(--text-sm); opacity: 0; transition: all 0.2s ease; z-index: 60; pointer-events: none; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ROI */
.roi { background: var(--ink); color: #fff; border-radius: var(--radius-xl); padding: var(--space-5) var(--space-6); }
.roi .big { font-size: var(--text-xl); font-weight: 800; letter-spacing: -0.02em; }
.roi .line { display: flex; justify-content: space-between; padding: var(--space-1) 0; font-size: var(--text-sm); color: oklch(1 0 0 / 0.8); }
.roi .line strong { color: #fff; }
.roi hr { border: 0; border-top: 1px solid oklch(1 0 0 / 0.2); margin: var(--space-3) 0; }
.bar { height: 14px; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--good); border-radius: var(--radius-pill); }

.tier-pill { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 800; font-size: var(--text-xs); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); }
.tier-pill.good { background: var(--good-soft); color: var(--good); }
.tier-pill.ok { background: var(--ok-soft); color: var(--ok); }
.tier-pill.warn { background: var(--warn-soft); color: oklch(0.5 0.13 70); }
.tier-pill.bad { background: var(--bad-soft); color: var(--bad); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-2); }
.day { background: var(--surface-2); border-radius: var(--radius-md); padding: var(--space-3); min-height: 110px; }
.day .d { font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; color: var(--ink-2); }
.day .e { font-size: var(--text-xs); font-weight: 600; margin-top: var(--space-2); background: var(--surface); border-radius: var(--radius-sm); padding: var(--space-1) var(--space-2); }
.day.today { background: var(--accent-soft); }
.day .e.hot { background: var(--accent); color: #fff; }

.empty { text-align: center; color: var(--ink-2); padding: var(--space-8); font-weight: 600; }
.list { display: flex; flex-direction: column; gap: var(--space-2); }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); min-height: 56px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--accent-soft); }

@media (max-width: 1100px) {
  .grid.two, .grid.even, .grid.sold { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform 0.25s ease; z-index: 45; height: 100dvh; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: var(--space-4) var(--space-4) var(--space-12); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { align-items: center; }
  .drawer { border-radius: var(--radius-xl) var(--radius-xl) 0 0; top: 8vh; width: 100%; }
  .board { grid-auto-columns: 82vw; }
  .list-item { flex-wrap: wrap; }
  .list-item .grow { flex: 1 1 100%; }
  .kpi .value { font-size: var(--text-lg); }
  .grid.kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: var(--space-4); }
  .card { padding: var(--space-4); }
  .msg .who { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Entry screen (workspace gate) ---------- */
.gate { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-rows: auto 1fr auto; background: radial-gradient(1200px 700px at 85% -10%, oklch(0.4 0.14 42 / 0.55), transparent 60%), radial-gradient(900px 600px at -10% 110%, oklch(0.35 0.08 250 / 0.6), transparent 60%), oklch(0.19 0.02 260); color: #fff; overflow-y: auto; transition: opacity 0.5s cubic-bezier(0.4, 0, 1, 1), transform 0.5s cubic-bezier(0.4, 0, 1, 1); }
.gate.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }
.gate-glow { position: absolute; inset: 0; background-image: linear-gradient(oklch(1 0 0 / 0.04) 1px, transparent 1px), linear-gradient(90deg, oklch(1 0 0 / 0.04) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%); pointer-events: none; }
.gate-top, .gate-foot { position: relative; display: flex; justify-content: space-between; align-items: center; padding: var(--space-6) var(--space-10); font-weight: 600; color: oklch(1 0 0 / 0.75); font-size: var(--text-sm); }
.gate-foot { justify-content: center; font-size: var(--text-xs); color: oklch(1 0 0 / 0.45); }
.gate-brand { display: flex; align-items: center; gap: var(--space-3); color: #fff; font-weight: 800; font-size: var(--text-base); }
.gate-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; font-size: 0.68rem; font-weight: 800; box-shadow: 0 10px 30px -8px var(--accent); }
.gate-body { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-6) var(--space-8) var(--space-10); width: 100%; max-width: 1240px; margin: 0 auto; }
.gate-step { width: 100%; animation: gate-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.gate-step.out { animation: gate-out 0.22s cubic-bezier(0.4, 0, 1, 1) both; }
@keyframes gate-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes gate-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-16px) scale(0.98); } }
.gate-kicker { text-align: center; font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: oklch(0.85 0.1 50); margin-bottom: var(--space-3); }
.gate-title { text-align: center; font-size: clamp(2rem, 1.4rem + 2.6vw, 3.6rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; margin: 0 auto var(--space-10); max-width: 16ch; }
.gate-title em { font-style: normal; color: oklch(0.82 0.16 50); }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--space-4); width: 100%; }
.ws-tile { position: relative; display: flex; flex-direction: column; gap: var(--space-3); min-height: 230px; padding: var(--space-6); border-radius: var(--radius-xl); border: 1.5px solid oklch(1 0 0 / 0.1); background: linear-gradient(180deg, oklch(1 0 0 / 0.08), oklch(1 0 0 / 0.03)); color: #fff; text-align: left; cursor: pointer; overflow: hidden; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease; animation: gate-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i) * 60ms + 120ms); backdrop-filter: blur(6px); }
.ws-tile::after { content: ''; position: absolute; inset: auto -40% -60% auto; width: 240px; height: 240px; border-radius: 50%; background: var(--tone); filter: blur(60px); opacity: 0.25; transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.ws-tile:hover, .ws-tile:focus-visible { transform: translateY(-6px); border-color: oklch(1 0 0 / 0.35); background: linear-gradient(180deg, oklch(1 0 0 / 0.13), oklch(1 0 0 / 0.05)); box-shadow: 0 30px 60px -30px oklch(0 0 0 / 0.8); }
.ws-tile:hover::after { opacity: 0.55; transform: scale(1.3); }
.ws-tile:active { transform: translateY(-2px) scale(0.99); }
.ws-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--tone); color: #fff; box-shadow: 0 16px 30px -14px var(--tone); transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.ws-icon svg { width: 34px; height: 34px; }
.ws-tile:hover .ws-icon { transform: rotate(-6deg) scale(1.06); }
.ws-name { font-size: var(--text-lg); font-weight: 800; letter-spacing: -0.01em; margin-top: auto; }
.ws-blurb { color: oklch(1 0 0 / 0.65); font-size: var(--text-sm); font-weight: 600; }
.ws-people { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: oklch(1 0 0 / 0.6); font-weight: 700; }
.ws-people .avatars { gap: 6px; }
.ws-people .avatars .avatar { width: 30px; height: 30px; font-size: 0.68rem; margin-left: 0; border: 1.5px solid oklch(1 0 0 / 0.25); background: oklch(1 0 0 / 0.14); }
.gate-back { display: inline-flex; align-items: center; gap: var(--space-2); background: transparent; border: 0; color: oklch(1 0 0 / 0.7); font-weight: 700; font-size: var(--text-sm); cursor: pointer; padding: var(--space-2) 0; margin-bottom: var(--space-6); min-height: 44px; }
.gate-back:hover { color: #fff; }
.gate-two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: start; width: 100%; max-width: 980px; margin: 0 auto; }
.ws-hero { padding: var(--space-8); border-radius: var(--radius-xl); border: 1.5px solid oklch(1 0 0 / 0.14); background: linear-gradient(160deg, oklch(1 0 0 / 0.12), oklch(1 0 0 / 0.04)); position: relative; overflow: hidden; min-height: 320px; display: flex; flex-direction: column; gap: var(--space-4); }
.ws-hero::after { content: ''; position: absolute; right: -30%; bottom: -40%; width: 360px; height: 360px; border-radius: 50%; background: var(--tone); filter: blur(70px); opacity: 0.5; }
.ws-hero .ws-icon { width: 84px; height: 84px; border-radius: 26px; }
.ws-hero .ws-icon svg { width: 44px; height: 44px; }
.ws-hero h2 { font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; margin-top: auto; position: relative; }
.ws-hero p { color: oklch(1 0 0 / 0.7); font-weight: 600; position: relative; }
.ws-hero ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); position: relative; }
.ws-hero li { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: oklch(1 0 0 / 0.8); font-weight: 600; }
.ws-hero li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: oklch(0.82 0.16 50); flex: none; }
.who-panel { display: flex; flex-direction: column; gap: var(--space-3); }
.who-panel h3 { font-size: var(--text-lg); font-weight: 800; margin-bottom: var(--space-2); }
.person-tile { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); border: 1.5px solid oklch(1 0 0 / 0.12); background: oklch(1 0 0 / 0.05); color: #fff; cursor: pointer; text-align: left; min-height: 84px; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background 0.2s ease; animation: gate-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i) * 70ms + 80ms); }
.person-tile:hover, .person-tile:focus-visible { transform: translateX(6px); border-color: oklch(1 0 0 / 0.4); background: oklch(1 0 0 / 0.1); }
.person-tile.selected { border-color: oklch(0.82 0.16 50); background: oklch(0.82 0.16 50 / 0.15); }
.person-tile .avatar { width: 52px; height: 52px; font-size: var(--text-sm); background: var(--tone); }
.person-tile .n { font-weight: 800; font-size: var(--text-base); }
.person-tile .r { color: oklch(1 0 0 / 0.65); font-size: var(--text-sm); font-weight: 600; }
.person-tile .go { margin-left: auto; opacity: 0; transform: translateX(-6px); transition: all 0.2s ease; font-weight: 800; color: oklch(0.82 0.16 50); }
.person-tile:hover .go, .person-tile.selected .go { opacity: 1; transform: none; }
.pin { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg); background: oklch(1 0 0 / 0.06); border: 1.5px solid oklch(1 0 0 / 0.12); animation: gate-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.pin label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: oklch(1 0 0 / 0.6); }
.pin-dots { display: flex; gap: var(--space-3); }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid oklch(1 0 0 / 0.4); transition: all 0.15s ease; }
.pin-dots span.on { background: oklch(0.82 0.16 50); border-color: oklch(0.82 0.16 50); transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.pin-pad button { min-height: 56px; border-radius: var(--radius-md); border: 1.5px solid oklch(1 0 0 / 0.12); background: oklch(1 0 0 / 0.05); color: #fff; font-size: var(--text-lg); font-weight: 700; cursor: pointer; transition: background 0.15s ease, transform 0.1s ease; }
.pin-pad button:hover { background: oklch(1 0 0 / 0.12); }
.pin-pad button:active { transform: scale(0.95); }
.pin-pad button.soft { font-size: var(--text-sm); color: oklch(1 0 0 / 0.7); }
.btn.enter { background: oklch(0.82 0.16 50); color: oklch(0.2 0.03 260); min-height: 60px; font-size: var(--text-base); border-radius: var(--radius-pill); width: 100%; box-shadow: 0 20px 40px -18px oklch(0.82 0.16 50); }
.btn.enter:hover { background: oklch(0.88 0.14 60); }
.btn.enter[disabled] { opacity: 0.4; box-shadow: none; }
.shell.entering { animation: shell-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes shell-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .gate-top, .gate-foot { padding: var(--space-4) var(--space-5); }
  .gate-body { padding: var(--space-4) var(--space-4) var(--space-8); }
  .gate-two { grid-template-columns: 1fr; gap: var(--space-5); }
  .ws-hero { min-height: 0; }
  .ws-hero ul { display: none; }
  .ws-tile { min-height: 170px; padding: var(--space-5); }
  .ws-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .ws-name { font-size: var(--text-base); }
  .ws-blurb { display: none; }
}
@media (max-width: 480px) { .ws-grid { grid-template-columns: 1fr 1fr; } .ws-icon { width: 52px; height: 52px; } .ws-icon svg { width: 28px; height: 28px; } }
@media (prefers-reduced-motion: reduce) { .ws-tile, .person-tile, .gate-step, .pin, .shell.entering { animation: none !important; } }

@media (max-width: 600px) { .gate-date { display: none; } }

/* =====================================================================
   v2 — premium refinements + thumb-first mobile shell
   ===================================================================== */
:root {
  --ink-deep: oklch(0.2 0.02 260);
  --hairline: oklch(0.3 0.03 260 / 0.08);
  --shadow: 0 1px 2px oklch(0.3 0.04 60 / 0.06), 0 14px 36px -22px oklch(0.3 0.04 60 / 0.35);
  --shadow-lift: 0 2px 4px oklch(0.3 0.04 60 / 0.06), 0 24px 48px -24px oklch(0.3 0.04 60 / 0.45);
  --grad-accent: linear-gradient(135deg, oklch(0.7 0.19 45), oklch(0.6 0.2 30));
  --tab-h: 72px;
}
body { background: radial-gradient(900px 500px at 100% -10%, oklch(0.95 0.04 60 / 0.8), transparent 60%), var(--bg); }
.card, .kpi { border: 1px solid var(--hairline); box-shadow: var(--shadow); transition: box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.card.soft { border-color: transparent; }
.kpi.accent { background: var(--grad-accent); border-color: transparent; box-shadow: 0 20px 40px -20px oklch(0.6 0.2 35 / 0.7); }
.kpi .value { letter-spacing: -0.03em; }
.btn.primary { background: var(--grad-accent); box-shadow: 0 10px 24px -12px oklch(0.6 0.2 35 / 0.8); transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, filter 0.18s ease; }
.btn.primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 14px 28px -12px oklch(0.6 0.2 35 / 0.9); }
.btn.ghost { background: var(--surface); border-color: var(--hairline); box-shadow: 0 1px 2px oklch(0.3 0.04 60 / 0.05); }
.tab { border-color: var(--hairline); box-shadow: 0 1px 2px oklch(0.3 0.04 60 / 0.05); }
.tab.active { background: var(--ink-deep); border-color: var(--ink-deep); }
.seg { background: oklch(0.3 0.03 260 / 0.07); }
.vcard, .list-item { border: 1px solid transparent; }
.list-item { background: oklch(0.3 0.03 260 / 0.045); }
.list-item.clickable:hover { background: var(--accent-soft); border-color: oklch(0.66 0.19 42 / 0.3); }
thead th { background: oklch(0.3 0.03 260 / 0.06); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea { border-color: var(--hairline); background: oklch(0.3 0.03 260 / 0.03); }
input:focus, select:focus, textarea:focus { background: var(--surface); box-shadow: 0 0 0 4px oklch(0.66 0.19 42 / 0.15); }
h1 { letter-spacing: -0.025em; }

/* Desktop sidebar — graphite, matches the entry screen */
.sidebar { background: linear-gradient(180deg, oklch(0.22 0.02 260), oklch(0.18 0.02 260)); border-right: 0; color: #fff; }
.brand-name { color: #fff; }
.brand-sub { color: oklch(1 0 0 / 0.55); }
.brand-mark { box-shadow: 0 10px 24px -8px var(--accent); }
.sidebar .nav-label { color: oklch(1 0 0 / 0.4); }
.nav a { color: oklch(1 0 0 / 0.72); }
.nav a:hover { background: oklch(1 0 0 / 0.08); color: #fff; }
.nav a.active { background: var(--grad-accent); color: #fff; box-shadow: 0 10px 24px -12px oklch(0.6 0.2 35 / 0.9); }
.nav a .count { background: oklch(1 0 0 / 0.18); color: #fff; }
.nav a.active .count { background: oklch(1 0 0 / 0.3); }
.role-box { background: oklch(1 0 0 / 0.07); border: 1px solid oklch(1 0 0 / 0.1); }
.role-box label { color: oklch(1 0 0 / 0.6); }
.role-box select { background: oklch(1 0 0 / 0.08); color: #fff; border-color: oklch(1 0 0 / 0.15); }
.role-box select option { color: var(--ink); }
.role-box .btn.ghost { background: oklch(1 0 0 / 0.1); color: #fff; border-color: transparent; }
.role-box .chip.accent { background: oklch(0.82 0.16 50 / 0.2); color: oklch(0.9 0.12 60); }

/* User chip in the top bar (desktop) */
.user-chip { display: inline-flex; align-items: center; gap: var(--space-3); padding: 6px 14px 6px 6px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow); font-size: var(--text-xs); font-weight: 700; min-height: 48px; }
.user-chip .avatar { width: 36px; height: 36px; background: var(--grad-accent); }
.user-chip .muted { font-weight: 600; }

/* Mobile shell: app bar, bottom tab bar, quick-action button, action dock, bottom sheets */
.appbar, .tabbar, .dock { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none !important; }
  .btn.menu-btn { display: none; }
  .main { padding: var(--space-3) var(--space-4) calc(var(--tab-h) + 96px + env(safe-area-inset-bottom)); }
  .appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-4)) var(--space-3); padding: calc(env(safe-area-inset-top) + 10px) var(--space-4) 10px; background: oklch(0.975 0.012 80 / 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--hairline); }
  .appbar .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 0.62rem; }
  .appbar .t { font-weight: 800; font-size: var(--text-sm); line-height: 1.1; }
  .appbar .s { font-size: var(--text-xs); color: var(--ink-2); font-weight: 600; }
  .appbar .avatar { width: 38px; height: 38px; background: var(--grad-accent); }
  .topbar { margin-bottom: var(--space-4); }
  .topbar h1 { font-size: var(--text-lg); }
  .topbar .sub { font-size: var(--text-xs); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .topbar-actions { display: none; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 var(--space-2) env(safe-area-inset-bottom); background: oklch(0.2 0.02 260 / 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid oklch(1 0 0 / 0.08); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: var(--tab-h); border: 0; background: transparent; color: oklch(1 0 0 / 0.6); font-size: 0.7rem; font-weight: 700; text-decoration: none; cursor: pointer; position: relative; }
  .tabbar svg { width: 24px; height: 24px; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
  .tabbar .active { color: #fff; }
  .tabbar .active svg { transform: translateY(-2px); }
  .tabbar .active::after { content: ''; position: absolute; top: 8px; width: 28px; height: 3px; border-radius: 3px; background: var(--accent); }
  .tabbar .badge { position: absolute; top: 10px; right: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 0.65rem; display: grid; place-items: center; padding: 0 5px; }
  .tabbar .fab { align-self: center; height: auto; }
  .tabbar .fab span.circle { width: 60px; height: 60px; border-radius: 50%; background: var(--grad-accent); display: grid; place-items: center; color: #fff; box-shadow: 0 14px 30px -10px oklch(0.6 0.2 35), 0 0 0 6px oklch(0.2 0.02 260); transform: translateY(-18px); transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
  .tabbar .fab:active span.circle { transform: translateY(-18px) scale(0.94); }
  .tabbar .fab svg { width: 28px; height: 28px; }
  .dock { position: fixed; left: var(--space-3); right: var(--space-3); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px); z-index: 34; display: flex; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-pill); background: oklch(1 0 0 / 0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--hairline); box-shadow: var(--shadow-lift); overflow-x: auto; scrollbar-width: none; }
  .dock::-webkit-scrollbar { display: none; }
  .dock:empty { display: none; }
  .dock .btn { flex: 1 0 auto; min-height: 50px; }
  .dock .seg { flex: 1 0 auto; }
  .dock .seg button { min-height: 42px; }
  .drawer { top: auto; bottom: 0; max-height: 92dvh; width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(100%); padding: var(--space-3) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom)); transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1); }
  .drawer.open { transform: translateY(0); }
  .drawer::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: oklch(0.3 0.03 260 / 0.2); margin: 0 auto var(--space-4); }
  .drawer .drawer-head { position: sticky; top: 0; background: var(--surface); padding-top: var(--space-1); z-index: 1; }
  .toast { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 76px); }
  /* one-screen helpers: horizontal snap rows */
  .grid.kpis { display: flex; gap: var(--space-3); overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; grid-template-columns: none; }
  .grid.kpis::-webkit-scrollbar { display: none; }
  .grid.kpis > .kpi { flex: 0 0 72%; scroll-snap-align: start; }
  .week { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--space-2); padding-bottom: 6px; scrollbar-width: none; }
  .week::-webkit-scrollbar { display: none; }
  .week .day { flex: 0 0 46%; scroll-snap-align: start; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-right: calc(-1 * var(--space-4)); padding-right: var(--space-4); }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; min-height: 44px; }
  .board { grid-auto-columns: 86vw; scroll-snap-type: x mandatory; }
  .table-wrap table { min-width: 620px; }
  .card.tight .table-wrap table { min-width: 720px; }
  .col { scroll-snap-align: start; }
  .chat-layout { grid-template-columns: 1fr; }
  .space-list { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-2) !important; scrollbar-width: none; }
  .space-list .nav-label { display: none; }
  .space-list button { width: auto; flex: 0 0 auto; min-height: 42px; border-radius: var(--radius-pill); background: var(--surface-2); font-size: var(--text-xs); gap: var(--space-2); }
  .chat-layout > .stack { display: none; }
  .composer { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 72px); background: var(--surface); padding-top: var(--space-2); }
  .gate-body { justify-content: flex-start; padding-top: var(--space-2); }
  .gate-title { font-size: clamp(1.7rem, 7vw, 2.4rem); margin-bottom: var(--space-5); }
  .ws-tile { min-height: 150px; }
}
/* Quick-action sheet */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.qa { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--hairline); background: oklch(0.3 0.03 260 / 0.04); color: var(--ink); cursor: pointer; min-height: 104px; text-align: left; transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background 0.15s ease; }
.qa:hover, .qa:active { background: var(--accent-soft); transform: translateY(-2px); }
.qa .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ink-deep); color: #fff; }
.qa .ic svg { width: 22px; height: 22px; }
.qa strong { font-size: var(--text-sm); }
.qa span { font-size: var(--text-xs); color: var(--ink-2); font-weight: 600; }
.sheet-nav a { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: 0 var(--space-4); border-radius: var(--radius-md); text-decoration: none; font-weight: 700; background: oklch(0.3 0.03 260 / 0.04); margin-bottom: var(--space-2); }
.sheet-nav a svg { width: 22px; height: 22px; }
.sheet-nav a .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: var(--radius-pill); padding: 0 8px; font-size: var(--text-xs); }

/* =====================================================================
   v3 — "Range Rover & fine watch" theme: charcoal, ivory, champagne gold,
   deep green. Serif display, flatter surfaces, tighter corners.
   ===================================================================== */
:root {
  --font: 'Switzer', 'Inter', system-ui, sans-serif;
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --bg: oklch(0.962 0.008 85);
  --surface: oklch(0.99 0.004 85);
  --surface-2: oklch(0.945 0.009 85);
  --ink: oklch(0.21 0.01 60);
  --ink-2: oklch(0.42 0.012 60);
  --ink-3: oklch(0.58 0.012 60);
  --ink-deep: oklch(0.17 0.008 60);
  --line: oklch(0.2 0.01 60 / 0.1);
  --hairline: oklch(0.2 0.01 60 / 0.1);
  --gold: oklch(0.72 0.1 80);
  --gold-deep: oklch(0.56 0.1 75);
  --accent: var(--gold-deep);
  --accent-ink: oklch(0.42 0.09 70);
  --accent-soft: oklch(0.93 0.03 85);
  --green: oklch(0.36 0.07 160);
  --good: oklch(0.42 0.09 160); --good-soft: oklch(0.93 0.03 160);
  --ok: oklch(0.45 0.05 240); --ok-soft: oklch(0.93 0.015 240);
  --warn: oklch(0.6 0.1 70); --warn-soft: oklch(0.94 0.035 85);
  --bad: oklch(0.46 0.14 25); --bad-soft: oklch(0.94 0.025 25);
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px;
  --shadow: 0 1px 1px oklch(0.2 0.01 60 / 0.04), 0 10px 30px -24px oklch(0.2 0.01 60 / 0.35);
  --shadow-lift: 0 1px 2px oklch(0.2 0.01 60 / 0.05), 0 24px 48px -28px oklch(0.2 0.01 60 / 0.45);
  --grad-accent: linear-gradient(180deg, oklch(0.26 0.01 60), oklch(0.19 0.01 60));
}
body { background: var(--bg); font-weight: 450; }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.005em; }
h1 { font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.6rem); line-height: 1.05; }
h2 { font-size: clamp(1.35rem, 1.2rem + 0.5vw, 1.65rem); }
h3 { font-weight: 600; }
.gate-title, .ws-hero h2, .drawer-head h2 { font-family: var(--font-display); font-weight: 400; }
.gate-title { letter-spacing: -0.01em; max-width: 18ch; }
.gate-title em { font-style: italic; color: var(--gold); }
.gate-kicker { color: var(--gold); font-weight: 600; font-size: var(--text-xs); }
.kpi .label, thead th, .nav-label, .field > span, .pin label, .role-box label { font-weight: 600; letter-spacing: 0.1em; }
.kpi .value { font-weight: 600; letter-spacing: -0.02em; }
.kpi.accent { background: var(--green); color: oklch(0.97 0.01 85); box-shadow: var(--shadow); }
.kpi.accent .label { color: oklch(0.85 0.06 90); }
.kpi.accent .delta { color: oklch(1 0 0 / 0.75); }
.card, .kpi { border-radius: var(--radius-xl); }
.btn { border-radius: var(--radius-md); font-weight: 600; }
.btn.primary { background: var(--ink-deep); color: oklch(0.97 0.01 85); box-shadow: none; }
.btn.primary:hover { background: oklch(0.3 0.015 60); transform: none; filter: none; box-shadow: none; }
.btn.good { background: var(--green); }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.ghost { box-shadow: none; }
.btn.enter { background: var(--gold); color: var(--ink-deep); box-shadow: none; border-radius: var(--radius-md); }
.btn.enter:hover { background: oklch(0.78 0.1 82); }
.tab { border-radius: var(--radius-md); box-shadow: none; font-weight: 600; }
.tab.active { background: var(--ink-deep); border-color: var(--ink-deep); }
.seg { border-radius: var(--radius-md); background: oklch(0.2 0.01 60 / 0.06); }
.seg button { border-radius: 7px; font-weight: 600; }
.seg button.active { box-shadow: 0 1px 2px oklch(0.2 0.01 60 / 0.12); }
.chip { font-weight: 600; letter-spacing: 0.01em; border-radius: 6px; background: oklch(0.2 0.01 60 / 0.06); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.warn { color: oklch(0.48 0.09 70); }
.tier-pill { border-radius: 6px; font-weight: 600; }
.tier-pill.warn { color: oklch(0.48 0.09 70); }
.stk-tag { border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.avatar { background: var(--ink-deep); color: var(--gold); font-weight: 600; }
.avatar.bot { background: var(--green); color: oklch(0.95 0.02 85); }
.user-chip .avatar, .appbar .avatar { background: var(--ink-deep); }
.list-item { background: oklch(0.2 0.01 60 / 0.035); border-radius: var(--radius-md); }
.list-item.clickable:hover { background: var(--accent-soft); border-color: oklch(0.56 0.1 75 / 0.3); }
.vcard { border-radius: var(--radius-md); }
.vcard:hover { border-color: var(--gold-deep); }
.col { border-radius: var(--radius-lg); }
thead th { background: oklch(0.2 0.01 60 / 0.05); }
thead th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
thead th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
tbody tr.clickable:hover td { background: var(--accent-soft); }
input[type=text], input[type=number], input[type=date], select, textarea { border-radius: var(--radius-md); border-width: 1px; background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--gold-deep); box-shadow: 0 0 0 3px oklch(0.56 0.1 75 / 0.18); }
.check input { accent-color: var(--green); }
.dot.on { background: var(--green); }
.bar > span { background: var(--green); }
.roi { background: var(--ink-deep); border-radius: var(--radius-xl); }
.roi .big { font-family: var(--font-display); font-weight: 400; font-size: 2.2rem; letter-spacing: 0; }
.day { border-radius: var(--radius-md); }
.day.today { background: var(--accent-soft); }
.day .e.hot { background: var(--ink-deep); color: var(--gold); }
.day .e { border-radius: var(--radius-sm); }
.toast { background: var(--ink-deep); color: oklch(0.97 0.01 85); border-radius: var(--radius-md); border: 1px solid oklch(0.72 0.1 80 / 0.35); }
.drawer { border-radius: var(--radius-xl) 0 0 var(--radius-xl); }
.msg.command .body { background: var(--ink-deep); color: var(--gold); border-radius: var(--radius-sm); }
.msg.system .body { border-radius: var(--radius-sm); }
.qa { border-radius: var(--radius-lg); }
.qa .ic { background: var(--ink-deep); color: var(--gold); border-radius: var(--radius-sm); }
.sheet-nav a { border-radius: var(--radius-md); }
.sheet-nav a .count { background: var(--ink-deep); color: var(--gold); }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* Brand mark: black square, gold monogram */
.brand-mark, .gate-mark, .appbar .brand-mark { background: var(--ink-deep); color: var(--gold); font-family: var(--font-display); font-size: 0.95rem; letter-spacing: 0.04em; border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px oklch(0.72 0.1 80 / 0.5); }
.appbar .brand-mark { border-radius: 9px; font-size: 0.85rem; }

/* Sidebar: charcoal with gold hairlines */
.sidebar { background: var(--ink-deep); border-right: 1px solid oklch(0.72 0.1 80 / 0.12); }
.brand-name { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; letter-spacing: 0.01em; }
.brand-sub { color: oklch(0.72 0.1 80 / 0.7); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.66rem; font-weight: 600; }
.nav a { border-radius: var(--radius-md); font-weight: 500; color: oklch(1 0 0 / 0.68); }
.nav a:hover { background: oklch(1 0 0 / 0.06); }
.nav a.active { background: oklch(1 0 0 / 0.08); color: var(--gold); box-shadow: inset 0 0 0 1px oklch(0.72 0.1 80 / 0.35); }
.nav a .count { background: oklch(1 0 0 / 0.12); color: oklch(1 0 0 / 0.85); border-radius: 6px; }
.nav a.active .count { background: var(--gold); color: var(--ink-deep); }
.role-box { background: oklch(1 0 0 / 0.04); border-color: oklch(1 0 0 / 0.08); border-radius: var(--radius-lg); }
.role-box .chip.accent { background: oklch(0.72 0.1 80 / 0.15); color: var(--gold); }
.role-box select { border-radius: var(--radius-md); }

/* Entry screen: black lacquer, gold hairlines, muted tones */
.gate { background: radial-gradient(1000px 600px at 80% -20%, oklch(0.4 0.06 80 / 0.35), transparent 60%), radial-gradient(800px 500px at -10% 110%, oklch(0.3 0.05 160 / 0.45), transparent 60%), oklch(0.15 0.008 60); }
.gate-glow { background-image: linear-gradient(oklch(1 0 0 / 0.03) 1px, transparent 1px), linear-gradient(90deg, oklch(1 0 0 / 0.03) 1px, transparent 1px); }
.gate-top { border-bottom: 1px solid oklch(0.72 0.1 80 / 0.15); color: oklch(1 0 0 / 0.65); }
.gate-brand { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; letter-spacing: 0.01em; }
.gate-mark { box-shadow: inset 0 0 0 1px oklch(0.72 0.1 80 / 0.6); }
.gate-date { letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.72rem; font-weight: 600; color: oklch(0.72 0.1 80 / 0.8); }
.gate-foot { color: oklch(1 0 0 / 0.4); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.68rem; }
.ws-tile { border-radius: var(--radius-xl); border: 1px solid oklch(1 0 0 / 0.1); background: linear-gradient(180deg, oklch(1 0 0 / 0.05), oklch(1 0 0 / 0.02)); backdrop-filter: none; }
.ws-tile::after { opacity: 0.18; }
.ws-tile:hover, .ws-tile:focus-visible { transform: translateY(-4px); border-color: oklch(0.72 0.1 80 / 0.55); background: linear-gradient(180deg, oklch(1 0 0 / 0.08), oklch(1 0 0 / 0.03)); box-shadow: 0 30px 60px -36px oklch(0 0 0 / 0.9); }
.ws-tile:hover::after { opacity: 0.32; transform: scale(1.2); }
.ws-icon { background: oklch(1 0 0 / 0.06); color: var(--tone); border: 1px solid oklch(1 0 0 / 0.14); border-radius: var(--radius-lg); box-shadow: none; }
.ws-tile:hover .ws-icon { transform: none; border-color: var(--tone); }
.ws-name { font-family: var(--font-display); font-weight: 400; font-size: 1.55rem; letter-spacing: 0.005em; }
.ws-blurb { color: oklch(1 0 0 / 0.55); font-weight: 500; }
.ws-people { color: oklch(1 0 0 / 0.55); font-weight: 500; letter-spacing: 0.02em; }
.ws-people .avatars .avatar { background: oklch(1 0 0 / 0.08); color: var(--gold); border-color: oklch(1 0 0 / 0.18); }
.ws-hero { border-radius: var(--radius-xl); border-color: oklch(0.72 0.1 80 / 0.25); background: linear-gradient(160deg, oklch(1 0 0 / 0.07), oklch(1 0 0 / 0.02)); }
.ws-hero::after { opacity: 0.3; }
.ws-hero .ws-icon { border-radius: var(--radius-lg); }
.ws-hero h2 { font-size: clamp(2rem, 1.5rem + 1.6vw, 3rem); }
.ws-hero li::before { background: var(--gold); }
.gate-back { letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.72rem; }
.person-tile { border-radius: var(--radius-lg); border-color: oklch(1 0 0 / 0.1); }
.person-tile:hover, .person-tile:focus-visible { border-color: oklch(0.72 0.1 80 / 0.5); transform: translateX(4px); }
.person-tile.selected { border-color: var(--gold); background: oklch(0.72 0.1 80 / 0.1); }
.person-tile .avatar { background: oklch(1 0 0 / 0.08); color: var(--gold); border: 1px solid oklch(1 0 0 / 0.14); }
.person-tile .go { color: var(--gold); }
.pin { border-radius: var(--radius-lg); border-color: oklch(1 0 0 / 0.1); }
.pin-dots span.on { background: var(--gold); border-color: var(--gold); }
.pin-pad button { border-radius: var(--radius-md); font-weight: 500; }
.pin-pad button:hover { border-color: oklch(0.72 0.1 80 / 0.5); }
.who-panel h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; }

/* Mobile shell in the new palette */
@media (max-width: 820px) {
  .appbar { background: oklch(0.962 0.008 85 / 0.88); }
  .appbar .t { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; }
  .appbar .s { letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.64rem; }
  .tabbar { background: oklch(0.15 0.008 60 / 0.94); border-top: 1px solid oklch(0.72 0.1 80 / 0.18); }
  .tabbar .active { color: var(--gold); }
  .tabbar .active::after { background: var(--gold); }
  .tabbar .badge { background: var(--gold); color: var(--ink-deep); }
  .tabbar .fab span.circle { background: var(--gold); color: var(--ink-deep); box-shadow: 0 12px 28px -12px oklch(0.72 0.1 80 / 0.8), 0 0 0 6px oklch(0.15 0.008 60); border-radius: 18px; width: 58px; height: 58px; }
  .dock { border-radius: var(--radius-lg); background: oklch(0.99 0.004 85 / 0.94); }
  .drawer { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .ws-name { font-size: 1.25rem; }
}

a.btn, .sheet-nav a, .nav a, .tabbar a { text-decoration: none; }

/* ---------- Sign-in card (v4) ---------- */
.login-card { width: 100%; max-width: 440px; margin: 0 auto; padding: var(--space-8); border-radius: var(--radius-xl); border: 1px solid oklch(1 0 0 / 0.12); background: linear-gradient(180deg, oklch(1 0 0 / 0.09), oklch(1 0 0 / 0.04)); backdrop-filter: blur(10px); box-shadow: 0 40px 80px -40px oklch(0 0 0 / 0.9); color: #fff; }
.lc-head { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-6); }
.lc-head .gate-mark { width: 48px; height: 48px; border-radius: 14px; font-size: 0.78rem; }
.lc-title { font-family: var(--font-display, inherit); font-size: 1.7rem; line-height: 1.1; letter-spacing: -0.01em; }
.lc-sub { color: oklch(1 0 0 / 0.6); font-size: var(--text-sm); margin-top: 2px; }
.login-card .field > span { color: oklch(1 0 0 / 0.65); }
.login-card input[type=text], .login-card input[type=email], .login-card input[type=password] { padding: var(--space-2) var(--space-4); background: oklch(1 0 0 / 0.07); border: 1px solid oklch(1 0 0 / 0.16); color: #fff; min-height: 52px; font-size: var(--text-base); border-radius: var(--radius-md); }
.login-card input::placeholder { color: oklch(1 0 0 / 0.35); }
.login-card input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.login-card input[disabled] { opacity: 0.55; }
.login-card .check .t { color: oklch(1 0 0 / 0.75); }
.login-card .check:hover { background: transparent; }
.lc-link { background: none; border: 0; padding: 0; color: var(--gold); font-weight: 600; font-size: var(--text-sm); cursor: pointer; min-height: 32px; }
.lc-link:hover { text-decoration: underline; }
.lc-error { background: oklch(0.45 0.14 25 / 0.35); border: 1px solid oklch(0.7 0.14 25 / 0.5); color: #fff; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); }
.login-card .btn.enter { width: 100%; min-height: 56px; font-size: var(--text-base); margin-top: var(--space-2); }
.lc-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-6) 0 var(--space-3); color: oklch(1 0 0 / 0.5); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; }
.lc-divider::before, .lc-divider::after { content: ''; flex: 1; height: 1px; background: oklch(1 0 0 / 0.14); }
.lc-divider code { text-transform: none; letter-spacing: 0; color: var(--gold); background: oklch(1 0 0 / 0.08); padding: 1px 6px; border-radius: 4px; }
.lc-demo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.lc-acct { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); min-height: 56px; border-radius: var(--radius-md); border: 1px solid oklch(1 0 0 / 0.1); background: oklch(1 0 0 / 0.04); color: #fff; text-align: left; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.lc-acct:hover { background: oklch(1 0 0 / 0.1); border-color: oklch(1 0 0 / 0.3); transform: translateY(-1px); }
.lc-acct .avatar { background: oklch(1 0 0 / 0.14); border: 1px solid oklch(1 0 0 / 0.2); flex: none; }
.lc-acct .xs { color: oklch(1 0 0 / 0.55); white-space: nowrap; }
.lc-acct strong { font-size: var(--text-sm); }
.lc-acct:nth-child(odd):last-child { grid-column: 1 / -1; }
.lc-foot { text-align: center; margin-top: var(--space-5); color: oklch(1 0 0 / 0.6); font-size: var(--text-sm); }
.lc-profiles { display: flex; flex-wrap: wrap; gap: 6px; margin: calc(-1 * var(--space-3)) 0 var(--space-5); }
.lc-profiles .chip.accent { background: oklch(0.72 0.1 80 / 0.18); color: var(--gold); }
@media (max-width: 520px) { .login-card { padding: var(--space-6) var(--space-5); border-radius: var(--radius-lg); } .lc-demo { grid-template-columns: 1fr; } .lc-acct:nth-child(odd):last-child { grid-column: auto; } }

/* ---------- Team & access ---------- */
.person-row { align-items: flex-start; padding: var(--space-4); gap: var(--space-4); }
.person-row .avatar { margin-top: 2px; }
.person-row.off { opacity: 0.6; }
.person-actions { flex: none; flex-wrap: nowrap; justify-content: flex-end; }
.person-actions .btn.sm { padding-inline: 10px; }
.chip.xs { font-size: 0.68rem; padding: 2px 8px; min-height: 0; }
.btn.sm.bad { background: transparent; color: var(--bad); border: 1px solid oklch(0.6 0.15 25 / 0.35); }
.btn.sm.bad:hover { background: oklch(0.6 0.15 25 / 0.1); }
@media (max-width: 640px) { .person-row { flex-wrap: wrap; } .person-actions { width: 100%; justify-content: flex-start; max-width: none; padding-left: calc(var(--avatar, 40px) + var(--space-4)); } }

/* ---------- Real wordmark + dealership details ---------- */
.wordmark { display: block; height: auto; object-fit: contain; }
.brand { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.brand .wordmark { width: 150px; }
.brand-sub { letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.66rem; }
.gate-brand .wordmark { width: 138px; }
.lc-head-logo { flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); margin-bottom: var(--space-6); }
.lc-head-logo .wordmark { width: 190px; }
.gate-foot { flex-direction: column; gap: 4px; text-align: center; }
.gate-foot-sub { color: oklch(1 0 0 / 0.3); }
.appbar .wordmark { width: 96px; }
@media (max-width: 520px) { .gate-brand .wordmark { width: 116px; } .lc-head-logo .wordmark { width: 160px; } }

/* =====================================================================
   v5 — shadcn-style admin: near-black surfaces, 1px hairlines, 8px radii,
   sans headings, segmented tabs, command search, monochrome charts.
   Dark by default; html[data-theme=light] keeps the ivory palette.
   ===================================================================== */
:root {
  --bg: oklch(0.145 0.004 60);
  --surface: oklch(0.172 0.004 60);
  --surface-2: oklch(0.215 0.005 60);
  --ink: oklch(0.965 0.004 85);
  --ink-2: oklch(0.7 0.008 75);
  --ink-3: oklch(0.55 0.008 75);
  --ink-deep: oklch(0.12 0.004 60);
  --line: oklch(1 0 0 / 0.1); --hairline: oklch(1 0 0 / 0.1);
  --accent: var(--gold); --accent-ink: var(--gold); --accent-soft: oklch(0.72 0.1 80 / 0.14);
  --green: oklch(0.42 0.08 160);
  --good: oklch(0.78 0.15 150); --good-soft: oklch(0.78 0.15 150 / 0.14);
  --ok: oklch(0.78 0.08 230); --ok-soft: oklch(0.78 0.08 230 / 0.14);
  --warn: oklch(0.82 0.12 80); --warn-soft: oklch(0.82 0.12 80 / 0.14);
  --bad: oklch(0.72 0.17 25); --bad-soft: oklch(0.72 0.17 25 / 0.14);
  --shadow: none; --shadow-lift: 0 20px 50px -20px oklch(0 0 0 / 0.8);
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px; --radius-xl: 12px;
  --side-bg: var(--bg); --side-fg: var(--ink); --primary: var(--ink); --primary-fg: var(--bg);
  color-scheme: dark;
}
html[data-theme=light] {
  --bg: oklch(0.975 0.004 85); --surface: oklch(1 0 0); --surface-2: oklch(0.955 0.006 85);
  --ink: oklch(0.21 0.01 60); --ink-2: oklch(0.45 0.012 60); --ink-3: oklch(0.6 0.012 60); --ink-deep: oklch(0.17 0.008 60);
  --line: oklch(0.2 0.01 60 / 0.1); --hairline: oklch(0.2 0.01 60 / 0.1);
  --accent: var(--gold-deep); --accent-ink: oklch(0.42 0.09 70); --accent-soft: oklch(0.93 0.03 85);
  --green: oklch(0.36 0.07 160);
  --good: oklch(0.42 0.09 160); --good-soft: oklch(0.93 0.03 160);
  --ok: oklch(0.45 0.05 240); --ok-soft: oklch(0.93 0.015 240);
  --warn: oklch(0.55 0.1 70); --warn-soft: oklch(0.94 0.035 85);
  --bad: oklch(0.5 0.15 25); --bad-soft: oklch(0.94 0.025 25);
  --shadow: 0 1px 2px oklch(0.2 0.01 60 / 0.05);
  --side-bg: oklch(0.17 0.008 60); --side-fg: #fff; --primary: var(--ink-deep); --primary-fg: oklch(0.97 0.01 85);
  color-scheme: light;
}
body { font-weight: 400; }
h1, h2, h3 { font-family: var(--font); letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
h2 { font-size: 1rem; font-weight: 600; }
h3 { font-size: 0.9rem; font-weight: 600; }
.topbar .sub { font-size: var(--text-sm); color: var(--ink-2); }
.topbar { margin-bottom: var(--space-5); align-items: center; }
.main { padding: var(--space-5) var(--space-6) var(--space-12); }
:focus-visible { outline: 2px solid oklch(1 0 0 / 0.5); outline-offset: 2px; }
html[data-theme=light] :focus-visible { outline-color: var(--ink); }

/* toolbar (desktop) */
.toolbar { display: flex; align-items: center; gap: var(--space-3); margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-6)) var(--space-5); padding: var(--space-3) var(--space-6); border-bottom: 1px solid var(--hairline); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.cmd { position: relative; flex: 1; max-width: 380px; }
.cmd input { width: 100%; min-height: 36px; padding: 0 64px 0 36px; border-radius: var(--radius-md); border: 1px solid var(--hairline); background: var(--surface); font-size: var(--text-xs); color: var(--ink); }
.cmd input::placeholder { color: var(--ink-3); }
.cmd input:focus { outline: none; border-color: oklch(1 0 0 / 0.3); }
html[data-theme=light] .cmd input:focus { border-color: var(--ink-2); }
.cmd .lens { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); }
.cmd kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 500 0.68rem var(--mono); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 4px; padding: 1px 6px; }
.cmd-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); box-shadow: var(--shadow-lift); padding: 6px; display: none; max-height: 360px; overflow-y: auto; }
.cmd-menu.open { display: block; }
.cmd-menu .grp { font-size: 0.68rem; color: var(--ink-3); padding: 8px 10px 4px; }
.cmd-menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-size: var(--text-xs); color: var(--ink); }
.cmd-menu a:hover, .cmd-menu a.sel { background: var(--surface-2); }
.cmd-menu a svg { width: 15px; height: 15px; color: var(--ink-2); flex: none; }
.cmd-menu a .m { margin-left: auto; color: var(--ink-3); }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ibtn { width: 36px; height: 36px; border-radius: var(--radius-md); border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; position: relative; }
.ibtn svg { width: 17px; height: 17px; }
.ibtn:hover { background: var(--surface-2); color: var(--ink); }
.ibtn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.toolbar .avatar { width: 32px; height: 32px; font-size: 0.68rem; margin-left: 6px; }
.date-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--surface); font-size: var(--text-xs); color: var(--ink); white-space: nowrap; }
.date-chip svg { width: 14px; height: 14px; color: var(--ink-2); }
@media (max-width: 820px) { .toolbar { display: none; } }

/* sidebar */
.shell { grid-template-columns: 240px 1fr; }
.sidebar { background: var(--side-bg); color: var(--side-fg); border-right: 1px solid var(--hairline); padding: var(--space-4); gap: var(--space-2); }
.brand { padding: var(--space-2) var(--space-2) var(--space-3); border-bottom: 1px solid var(--hairline); margin-bottom: var(--space-2); }
.brand .wordmark { width: 124px; }
.brand-sub { color: var(--ink-3); }
html[data-theme=light] .brand-sub { color: oklch(1 0 0 / 0.5); }
.nav { gap: 1px; }
.nav-label, .sidebar .nav-label { font-size: 0.7rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); padding: var(--space-4) var(--space-2) var(--space-1); }
html[data-theme=light] .sidebar .nav-label { color: oklch(1 0 0 / 0.45); }
.nav a { padding: 7px 10px; min-height: 34px; border-radius: 6px; font-size: var(--text-xs); font-weight: 450; color: var(--ink-2); box-shadow: none; }
html[data-theme=light] .nav a { color: oklch(1 0 0 / 0.68); }
.nav a svg { width: 16px; height: 16px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--surface-2); color: var(--ink); box-shadow: none; }
html[data-theme=light] .nav a:hover, html[data-theme=light] .nav a.active { background: oklch(1 0 0 / 0.08); color: #fff; }
.nav a .count { background: transparent; color: var(--ink-3); border-radius: 0; padding: 0; font-weight: 500; min-width: 0; }
.nav a.active .count { background: transparent; color: var(--ink-2); }
html[data-theme=light] .nav a .count, html[data-theme=light] .nav a.active .count { color: oklch(1 0 0 / 0.6); }
.role-box, .sidebar .role-box { background: transparent; border: 0; border-top: 1px solid var(--hairline); border-radius: 0; padding: var(--space-4) var(--space-2) 0; }
.role-box .chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.role-box .btn.ghost { background: var(--surface-2); color: var(--ink); }
html[data-theme=light] .role-box .btn.ghost { background: oklch(1 0 0 / 0.1); color: #fff; }

/* surfaces */
.card, .kpi { border: 1px solid var(--hairline); border-radius: var(--radius-xl); box-shadow: none; background: var(--surface); }
.card { padding: var(--space-5) var(--space-5); }
.card.soft { background: var(--surface-2); border-color: transparent; }
.card-head { margin-bottom: var(--space-4); }
.card-head h2 { font-size: 0.95rem; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--space-5); position: relative; }
.kpi .label { order: 1; font-size: var(--text-sm); font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink); }
.kpi .delta { order: 2; margin: 0; font-size: 0.78rem; font-weight: 400; color: var(--ink-2); }
.kpi .value { order: 3; margin-top: var(--space-4); font-size: clamp(1.5rem, 1.2rem + 0.9vw, 1.9rem); font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.kpi .value.pos { color: var(--ink); } .kpi .value.neg { color: var(--bad); }
.kpi.accent { background: var(--surface); color: inherit; border-color: var(--hairline); box-shadow: none; }
.kpi.accent .label { color: var(--ink); } .kpi.accent .delta { color: var(--good); }
.kpi::after { content: ''; position: absolute; top: 18px; right: 18px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--hairline); opacity: 0.9; }
.kpi.accent::after { border-color: var(--gold); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 9px var(--gold); }
.list-item { background: transparent; border: 1px solid var(--hairline); border-radius: var(--radius-md); }
html[data-theme=light] .list-item { background: transparent; }
.list-item.clickable:hover { background: var(--surface-2); border-color: var(--hairline); }
.col { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-lg); }
.col h3 span { background: var(--surface); border: 1px solid var(--hairline); border-radius: 6px; }
.vcard { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-md); box-shadow: none; }
.vcard:hover { border-color: var(--ink-3); }
.vcard .t { font-weight: 600; }
.day { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-md); }
.day .d { font-weight: 600; letter-spacing: 0.04em; }
.day .e { background: var(--surface); border: 1px solid var(--hairline); font-weight: 450; }
.day.today { background: var(--accent-soft); border-color: oklch(0.72 0.1 80 / 0.35); }
.day .e.hot { background: var(--gold); color: var(--ink-deep); border-color: transparent; font-weight: 600; }
.table-wrap { border-radius: var(--radius-lg); border: 1px solid var(--hairline); }
thead th { background: var(--surface); border-bottom: 1px solid var(--hairline); text-transform: none; letter-spacing: 0; font-size: 0.78rem; font-weight: 500; color: var(--ink-2); border-radius: 0 !important; }
tbody td { border-bottom-color: var(--hairline); font-size: var(--text-xs); }
tbody tr.clickable:hover td { background: var(--surface-2); }

/* controls */
.btn { border-radius: var(--radius-md); font-weight: 500; font-size: var(--text-xs); min-height: 36px; padding: 0 var(--space-4); box-shadow: none; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 0.78rem; }
.btn.primary { background: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary); opacity: 0.88; }
.btn.ghost { background: var(--surface); border: 1px solid var(--hairline); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.good { background: var(--good-soft); color: var(--good); border: 1px solid oklch(0.78 0.15 150 / 0.3); }
.btn.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid oklch(0.72 0.17 25 / 0.3); }
.btn.icon { min-height: 32px; width: 32px; padding: 0; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-md); flex-wrap: wrap; }
.tab { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: var(--text-xs); box-shadow: none; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); border: 0; box-shadow: 0 1px 2px oklch(0 0 0 / 0.3); }
html[data-theme=light] .tab.active { box-shadow: 0 1px 2px oklch(0 0 0 / 0.08); }
.seg { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 3px; }
.seg button { min-height: 30px; padding: 0 12px; border-radius: 6px; font-weight: 500; color: var(--ink-2); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0 0 0 / 0.3); }
.chip { border-radius: 6px; font-weight: 500; font-size: 0.75rem; padding: 2px 8px; background: transparent; border: 1px solid var(--hairline); color: var(--ink-2); }
.chip::before { width: 6px; height: 6px; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tier-pill { border-radius: 6px; font-weight: 600; }
.tier-pill.warn { color: var(--warn); }
.stk-tag { border-radius: 5px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--hairline); font-weight: 500; font-family: var(--mono); font-size: 0.75rem; }
.avatar { background: var(--surface-2); color: var(--ink); border: 1px solid var(--hairline); font-weight: 600; }
html[data-theme=light] .avatar { background: var(--ink-deep); color: var(--gold); border-color: transparent; }
.avatar.bot { background: var(--accent-soft); color: var(--gold); }
.avatars .avatar { border: 2px solid var(--surface); }
.user-chip { display: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea { border: 1px solid var(--hairline); background: var(--surface); border-radius: var(--radius-md); min-height: 38px; font-size: var(--text-xs); color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--ink-3); }
.field > span { text-transform: none; letter-spacing: 0; font-size: 0.78rem; font-weight: 500; color: var(--ink-2); }
.check { min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); border-radius: 4px; }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); border-radius: var(--radius-md); box-shadow: var(--shadow-lift); font-size: var(--text-xs); }
.drawer { background: var(--bg); border-left: 1px solid var(--hairline); }
.drawer-head h2 { font-family: var(--font); font-weight: 600; font-size: 1.05rem; }
.empty { color: var(--ink-3); }

/* charts */
.chart-card .card-head { align-items: flex-start; }
.chart-card .card-head p { font-size: 0.78rem; color: var(--ink-2); margin-top: 2px; }
.area { width: 100%; height: 220px; display: block; }
.area .grid-line { stroke: var(--hairline); stroke-width: 1; }
.area .line { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.area .fill { fill: url(#areaFill); }
.area .dot { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.area .lbl { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.hl { display: flex; flex-direction: column; }
.hl .r { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 12px 0; border-top: 1px solid var(--hairline); font-size: var(--text-xs); }
.hl .r:first-child { border-top: 0; }
.hl .v { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.hl .v.up { color: var(--good); } .hl .v.down { color: var(--bad); }
.hl .v svg { width: 13px; height: 13px; }
.big { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.bars .b { display: grid; grid-template-columns: 60px 1fr 40px; align-items: center; gap: 10px; font-size: var(--text-xs); padding: 7px 0; }
.bars .b .bar { height: 26px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--hairline); display: flex; align-items: center; padding-left: 8px; font-size: 0.75rem; color: var(--ink); }
.bars .b.first .bar { background: var(--ink); color: var(--bg); border-color: transparent; }

/* mobile */
@media (max-width: 820px) {
  .main { padding: var(--space-4) var(--space-4) calc(var(--space-12) + 72px); }
  .btn { min-height: 44px; } .btn.sm { min-height: 36px; }
  .appbar { background: var(--bg); border-bottom: 1px solid var(--hairline); }
  .appbar .brand-mark { background: var(--surface-2); color: var(--gold); }
  .tabbar { background: oklch(0.15 0.008 60 / 0.97); border-top: 1px solid oklch(1 0 0 / 0.1); }
  .tabbar .fab span.circle { box-shadow: 0 12px 28px -12px oklch(0.72 0.1 80 / 0.8), 0 0 0 6px oklch(0.15 0.008 60); }
  .dock { background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow-lift); }
  .sidebar { border-right: 1px solid var(--hairline); }
}

/* v5 polish */
.kpi .label { padding-right: 28px; }
.seg button { white-space: nowrap; }
.hl .v { white-space: nowrap; }
.hl .r .muted { min-width: 0; }
.role-box .row { flex-wrap: nowrap; }
.chart-card .card-head { flex-wrap: wrap; }
input[type=search] { width: 100%; }
@media (max-width: 820px) { .area { height: 180px; } .big { font-size: 1.6rem; } }

/* centered sign-in */
.gate-body { justify-content: center; min-height: 0; }
.login-card { max-width: 420px; }
.lc-foot code { color: var(--gold); background: oklch(1 0 0 / 0.08); padding: 1px 6px; border-radius: 4px; font-family: var(--mono); font-size: 0.78rem; }

/* =====================================================================
   v6 — desktop-first admin layout (reference: shadcn project dashboard)
   ===================================================================== */
:root { --side-w: 248px; }
.shell { grid-template-columns: var(--side-w) 1fr; transition: grid-template-columns 0.22s ease; }
.shell.collapsed { --side-w: 64px; }
.sidebar { padding: 10px; gap: 0; background: oklch(0.13 0.004 60); }
html[data-theme=light] .sidebar { background: oklch(0.17 0.008 60); }
.ws-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--side-fg); cursor: pointer; text-align: left; min-height: 48px; }
.ws-switch:hover { background: oklch(1 0 0 / 0.06); }
.ws-logo { width: 32px; height: 32px; flex: none; border-radius: 7px; background: #f4f1ec; color: #161412; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.15rem; line-height: 1; }
.ws-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.ws-txt strong { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-txt span { font-size: 0.74rem; color: oklch(1 0 0 / 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-chev svg { width: 15px; height: 15px; color: oklch(1 0 0 / 0.5); }
.pop { position: absolute; z-index: 60; background: var(--surface); color: var(--ink); border: 1px solid var(--hairline); border-radius: 10px; box-shadow: var(--shadow-lift); padding: 5px; min-width: 220px; }
.pop[hidden] { display: none; }
#ws-pop { left: 10px; right: 10px; top: 62px; }
.pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; min-height: 36px; border: 0; background: transparent; border-radius: 6px; font-size: 0.84rem; color: var(--ink); cursor: pointer; text-align: left; }
.pop button:hover, .pop button.sel { background: var(--surface-2); }
.pop button svg { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.pop .ws-ic svg { width: 16px; height: 16px; color: inherit; }
.pop .m { margin-left: auto; }
.pop-head { padding: 8px 10px 10px; font-size: 0.84rem; font-weight: 600; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; display: flex; flex-direction: column; }
.pop-head span { font-weight: 400; font-size: 0.75rem; color: var(--ink-2); }
.sidebar { position: sticky; }
.nav { flex: 1; overflow-y: auto; padding-top: 6px; display: flex; flex-direction: column; gap: 1px; }
.nav-label, .sidebar .nav-label { padding: 14px 10px 6px; font-size: 0.72rem; color: oklch(1 0 0 / 0.42); }
.nav a, .nav-parent { display: flex; align-items: center; gap: 10px; padding: 7px 10px; min-height: 34px; border-radius: 6px; font-size: 0.86rem; font-weight: 400; color: oklch(1 0 0 / 0.78); text-decoration: none; background: transparent; border: 0; width: 100%; cursor: pointer; text-align: left; }
.nav a svg, .nav-parent svg { width: 16px; height: 16px; flex: none; }
.nav a:hover, .nav-parent:hover { background: oklch(1 0 0 / 0.06); color: #fff; }
.nav a.active { background: oklch(1 0 0 / 0.09); color: #fff; }
.nav-parent.on { color: #fff; }
.nav .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a .count { color: oklch(1 0 0 / 0.55); font-size: 0.78rem; }
.nav .new { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; border: 1px solid oklch(0.78 0.15 150 / 0.5); color: oklch(0.8 0.15 150); }
.caret svg { width: 14px; height: 14px; transition: transform 0.2s ease; color: oklch(1 0 0 / 0.5); }
.caret.open svg { transform: rotate(90deg); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 18px; padding-left: 10px; border-left: 1px solid oklch(1 0 0 / 0.1); }
.nav-sub a { padding: 6px 10px; min-height: 30px; font-size: 0.84rem; }
.side-user { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px; border-top: 1px solid oklch(1 0 0 / 0.08); margin-top: 8px; }
.side-user .avatar { width: 34px; height: 34px; flex: none; }
.su-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; color: #fff; }
.su-txt strong { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-txt span { font-size: 0.74rem; color: oklch(1 0 0 / 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .ibtn { color: oklch(1 0 0 / 0.6); width: 30px; height: 30px; }
.side-user .ibtn:hover { background: oklch(1 0 0 / 0.08); color: #fff; }
#user-pop { left: 0; right: 0; bottom: calc(100% + 6px); }
.shell.collapsed .ws-txt, .shell.collapsed .ws-chev, .shell.collapsed .lbl, .shell.collapsed .count, .shell.collapsed .new, .shell.collapsed .caret, .shell.collapsed .nav-sub, .shell.collapsed .su-txt, .shell.collapsed .side-user .ibtn, .shell.collapsed .nav-label { display: none; }
.shell.collapsed .nav a, .shell.collapsed .nav-parent { justify-content: center; padding: 9px; }
.shell.collapsed .ws-switch, .shell.collapsed .side-user { justify-content: center; }
.shell.collapsed .nav { padding-top: 14px; }

/* toolbar & header */
.main { padding: 0 24px 40px; }
.toolbar { margin: 0 -24px 22px; padding: 10px 24px; min-height: 56px; }
.tb-sep { width: 1px; height: 20px; background: var(--hairline); margin: 0 4px; }
.topbar { margin-bottom: 14px; }
.topbar h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.015em; }
.topbar-actions { align-items: center; gap: 8px; }
.topbar-actions .btn svg { width: 15px; height: 15px; }
.btn { gap: 8px; }
.btn.ghost svg, .btn.sm svg { width: 15px; height: 15px; }
.dash-tabs { margin-bottom: 18px; }
.tabs { margin-bottom: 0; }

/* kpis */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi2 { background: linear-gradient(180deg, oklch(1 0 0 / 0.035), transparent 70%), var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
html[data-theme=light] .kpi2 { background: var(--surface); }
.k-top { display: flex; justify-content: space-between; gap: 10px; }
.k-l { font-size: 0.95rem; font-weight: 500; color: var(--ink); }
.k-d { font-size: 0.78rem; color: var(--ink-2); margin-top: 3px; }
.k-d .up { color: var(--good); } .k-d .dn { color: var(--bad); }
.k-ic svg { width: 20px; height: 20px; color: var(--ink-2); }
.k-v { font-size: clamp(1.6rem, 1.2rem + 1vw, 2rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.k-v.neg { color: var(--bad); }

/* middle row */
.dash-mid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(260px, 1fr); gap: 16px; margin-bottom: 16px; }
.chart2 { padding: 20px 20px 16px; position: relative; }
.area2 { width: 100%; height: 270px; display: block; margin-top: 4px; }
.area2 .grid-line { stroke: var(--hairline); }
.xlbls { position: relative; height: 18px; margin-top: 4px; }
.xlbls span { position: absolute; transform: translateX(-50%); font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; }
.xlbls span:first-child { transform: none; }
.xlbls span:last-child { transform: translateX(-100%); }
.legend { display: flex; gap: 18px; margin-top: 12px; font-size: 0.76rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.team2 { padding: 20px; }
.team2 .big { font-size: 1.9rem; margin-top: 4px; }
.t2-h { font-size: 0.84rem; font-weight: 600; margin: 20px 0 10px; }
.faces { display: flex; }
.faces .avatar { width: 38px; height: 38px; margin-left: -6px; border: 2px solid var(--surface); font-size: 0.72rem; }
.faces .avatar:first-child { margin-left: 0; }
.faces .avatar:nth-child(2n) { background: oklch(0.32 0.03 80); color: #f6e9cc; }
.faces .avatar:nth-child(3n) { background: oklch(0.3 0.03 160); color: #d6f0e2; }

/* bottom row */
.dash-bot { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.8fr) minmax(240px, 0.8fr); gap: 16px; }
.rem-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rem { border: 1px solid var(--hairline); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 170px; background: var(--surface); }
.rem.done .rem-t { color: var(--ink-3); text-decoration: line-through; }
.rem-h { display: flex; align-items: center; justify-content: space-between; }
.lvl { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600; }
.lvl i { width: 7px; height: 7px; border-radius: 50%; }
.lv-low { background: var(--ink-3); } .lv-medium { background: oklch(0.78 0.15 65); } .lv-high { background: oklch(0.62 0.2 25); }
.rem-ck { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 2px; border-radius: 50%; }
.rem-ck svg { width: 18px; height: 18px; }
.rem-ck.on { color: var(--good); }
.rem-w { font-size: 0.8rem; color: var(--ink-2); }
.rem-t { font-size: 0.84rem; line-height: 1.4; flex: 1; }
.rem .chip { align-self: flex-start; }
.more-link { display: inline-flex; align-items: center; gap: 6px; float: right; margin-top: 14px; font-size: 0.8rem; color: var(--ink-2); text-decoration: none; }
.more-link svg { width: 14px; height: 14px; }
.more-link:hover { color: var(--ink); }
.mbars { display: flex; flex-direction: column; gap: 14px; }
.mb-n { font-size: 0.78rem; color: var(--ink-2); margin-bottom: 6px; }
.mb-n strong { font-size: 1.35rem; color: var(--ink); font-weight: 600; margin-right: 4px; }
.mb-bar { height: 26px; border-radius: 4px; padding: 0 10px; display: flex; align-items: center; font-size: 0.75rem; }
.mb-bar.hi { background: var(--ink); color: var(--bg); }
.mb-bar.mid { background: var(--ink-3); color: var(--bg); }
.mb-bar.lo { background: var(--surface-2); color: var(--ink); border: 1px solid var(--hairline); }
.donut { display: grid; place-items: center; margin: 4px 0 8px; }
.donut svg { width: min(220px, 100%); height: auto; }
.donut .d0 { fill: oklch(0.96 0.004 85); } .donut .d1 { fill: oklch(0.72 0.006 75); } .donut .d2 { fill: oklch(0.52 0.006 75); } .donut .d3 { fill: oklch(0.38 0.006 75); } .donut .d4 { fill: oklch(0.28 0.005 75); }
html[data-theme=light] .donut .d0 { fill: oklch(0.2 0.01 60); } html[data-theme=light] .donut .d1 { fill: oklch(0.4 0.01 60); } html[data-theme=light] .donut .d2 { fill: oklch(0.58 0.01 60); } html[data-theme=light] .donut .d3 { fill: oklch(0.74 0.01 60); } html[data-theme=light] .donut .d4 { fill: oklch(0.86 0.008 60); }
.donut .gauge { fill: var(--ink); }
.donut .hole { fill: var(--surface); }
.dn-n { fill: var(--ink); font-size: 26px; font-weight: 600; text-anchor: middle; font-family: var(--font); }
.dn-u { fill: var(--ink-2); font-size: 10px; text-anchor: middle; font-family: var(--font); }
.dlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.76rem; color: var(--ink-2); }
.dlegend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.dlegend b { color: var(--ink); font-weight: 500; }
.dlegend .d0 { background: oklch(0.96 0.004 85); } .dlegend .d1 { background: oklch(0.72 0.006 75); } .dlegend .d2 { background: oklch(0.52 0.006 75); } .dlegend .d3 { background: oklch(0.38 0.006 75); } .dlegend .d4 { background: oklch(0.28 0.005 75); border: 1px solid var(--hairline); }
html[data-theme=light] .dlegend .d0 { background: oklch(0.2 0.01 60); } html[data-theme=light] .dlegend .d1 { background: oklch(0.4 0.01 60); } html[data-theme=light] .dlegend .d2 { background: oklch(0.58 0.01 60); } html[data-theme=light] .dlegend .d3 { background: oklch(0.74 0.01 60); } html[data-theme=light] .dlegend .d4 { background: oklch(0.86 0.008 60); }

@media (max-width: 1280px) { .dash-bot { grid-template-columns: 1fr 1fr; } .dash-bot > :first-child { grid-column: 1 / -1; } }
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-mid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .main { padding: 0 16px 120px; }
  .sidebar { width: 272px; }
  .dash-bot, .rem-grid { grid-template-columns: 1fr; }
  .topbar-actions { display: none; }
  .area2 { height: 200px; }
  .chart2 .seg button { padding: 0 8px; font-size: 0.72rem; }
}
@media (max-width: 820px) {
  .kpi-row { gap: 10px; }
  .kpi2 { padding: 14px; gap: 12px; }
  .k-ic { display: none; }
  .k-l { font-size: 0.84rem; }
  .k-v { font-size: 1.4rem; }
  .xlbls span { display: none; }
  .xlbls span:first-child, .xlbls span:last-child, .xlbls span:nth-child(6) { display: block; }
  .dash-tabs { overflow-x: auto; }
  .topbar h1 { font-size: 1.25rem; }
}

/* v7 — business sidebar, no workspace step */
.biz { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; text-decoration: none; color: var(--side-fg); min-height: 48px; }
.biz:hover { background: oklch(1 0 0 / 0.06); }
.nav .ext { font-size: 0.78rem; color: oklch(1 0 0 / 0.45); }
.pop a.pop-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; min-height: 36px; border-radius: 6px; font-size: 0.84rem; color: var(--ink); text-decoration: none; }
.pop a.pop-link:hover { background: var(--surface-2); }
.pop a.pop-link svg { width: 16px; height: 16px; color: var(--ink-2); }
.shell.collapsed .biz { justify-content: center; }
.nav-label { padding-top: 12px; }
.sheet-nav { max-height: 60vh; overflow-y: auto; }
.nav a, .nav-parent { min-height: 31px; padding: 5px 10px; font-size: 0.84rem; }
.nav-label, .sidebar .nav-label { padding: 10px 10px 3px; font-size: 0.7rem; }
.nav { padding-top: 2px; }
.side-user { padding-top: 8px; margin-top: 6px; }
.stk-tag { white-space: nowrap; }
td.nowrap .row { flex-wrap: nowrap; }
@media (max-width: 1000px) { .grid[style*="300px"] { grid-template-columns: 1fr !important; } }


/* =====================================================================
   v9 — cinematic sign-in (reference: full-bleed atmosphere, one statement, minimal UI)
   ===================================================================== */
.gate { background: #070706; grid-template-rows: auto 1fr auto; }
.gate-glow { display: none; }
.gate-sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sky-zoom { position: absolute; inset: -6%; animation: sky-zoom 26s cubic-bezier(0.16, 1, 0.3, 1) both; transform-origin: 50% 62%; }
@keyframes sky-zoom { from { transform: scale(1.12); } to { transform: scale(1); } }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.8; will-change: transform; }
.blob.b1 { width: 70vw; height: 70vw; left: -15vw; top: -25vw; background: radial-gradient(circle, oklch(0.42 0.07 80 / 0.55), transparent 65%); animation: drift-a 38s ease-in-out infinite alternate; }
.blob.b2 { width: 60vw; height: 60vw; right: -20vw; top: -10vw; background: radial-gradient(circle, oklch(0.36 0.06 165 / 0.6), transparent 65%); animation: drift-b 46s ease-in-out infinite alternate; }
.blob.b3 { width: 50vw; height: 50vw; left: 30vw; top: 20vh; background: radial-gradient(circle, oklch(0.55 0.11 70 / 0.35), transparent 65%); animation: drift-c 52s ease-in-out infinite alternate; }
.blob.b4 { width: 80vw; height: 40vw; left: 10vw; bottom: -25vw; background: radial-gradient(ellipse, oklch(0.28 0.03 60 / 0.9), transparent 65%); animation: drift-a 60s ease-in-out infinite alternate-reverse; }
@keyframes drift-a { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(8vw, 6vh, 0); } }
@keyframes drift-b { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-10vw, 8vh, 0) scale(1.1); } }
@keyframes drift-c { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-6vw, -8vh, 0) scale(1.15); } }
.horizon { position: absolute; left: 0; right: 0; top: 64%; height: 1px; background: linear-gradient(90deg, transparent 5%, oklch(0.85 0.12 85 / 0.9) 50%, transparent 95%); }
.horizon-glow { position: absolute; left: 10%; right: 10%; top: 64%; height: 1px; box-shadow: 0 0 60px 18px oklch(0.8 0.12 85 / 0.35), 0 0 180px 60px oklch(0.7 0.1 80 / 0.18); }
.floor { position: absolute; left: -10%; right: -10%; top: 64%; bottom: -10%; background: linear-gradient(180deg, oklch(0.2 0.02 70 / 0.9), #050504 60%); }
.floor::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(90deg, oklch(1 0 0 / 0.045) 1px, transparent 1px), linear-gradient(oklch(1 0 0 / 0.045) 1px, transparent 1px); background-size: 72px 72px; transform: perspective(600px) rotateX(62deg); transform-origin: 50% 0; mask-image: linear-gradient(180deg, oklch(0 0 0 / 0.9), transparent 85%); }
.grain { position: absolute; inset: 0; opacity: 0.09; mix-blend-mode: overlay; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.7'/></svg>"); }
.vignette { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 45%, transparent 40%, oklch(0 0 0 / 0.65) 100%); }
.gate-top { border-bottom: 0; }
.gate-top, .gate-foot, .gate-body { position: relative; z-index: 1; }
.gate-cine { display: flex; flex-direction: column; align-items: center; gap: var(--space-8); }
.gate-statement { text-align: center; }
.gate-statement .gate-kicker { margin-bottom: var(--space-4); letter-spacing: 0.26em; }
.gate-title-cine { font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5.6rem); line-height: 1; letter-spacing: -0.02em; max-width: 16ch; margin: 0 auto; color: oklch(0.97 0.01 85); text-shadow: 0 20px 60px oklch(0 0 0 / 0.6); }
.gate-title-cine .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.gate-title-cine .w > span { display: inline-block; transform: translateY(110%); animation: word-up 1.1s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--d) + 0.15s); }
@keyframes word-up { to { transform: translateY(0); } }
.gate-cine .login-card { max-width: 400px; border-radius: var(--radius-lg); border-color: oklch(1 0 0 / 0.14); background: linear-gradient(180deg, oklch(1 0 0 / 0.07), oklch(1 0 0 / 0.03)); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: 0 50px 100px -40px oklch(0 0 0 / 0.95), inset 0 1px 0 oklch(1 0 0 / 0.08); animation: gate-in 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both; }
.gate-cine .lc-head-logo { flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.gate-cine .lc-head-logo .wordmark { width: 150px; }
.gate-cine .lc-sub { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: oklch(1 0 0 / 0.5); }
.gate-cine .login-card input[type=text], .gate-cine .login-card input[type=password] { background: oklch(1 0 0 / 0.05); border-color: oklch(1 0 0 / 0.12); }
.gate-cine .login-card .btn.enter { background: var(--gold); color: #141210; border: 0; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.8rem; font-weight: 600; min-height: 52px; }
.gate-cine .login-card .btn.enter:hover { background: oklch(0.86 0.12 85); }
.gate-foot { color: oklch(1 0 0 / 0.42); }
@media (max-width: 820px) { .gate-cine { gap: var(--space-6); } .gate-title-cine { font-size: clamp(2.2rem, 1.4rem + 5vw, 3.2rem); } .horizon, .horizon-glow, .floor { top: 58%; } .blob { filter: blur(60px); } }
@media (prefers-reduced-motion: reduce) { .sky-zoom, .blob, .gate-title-cine .w > span, .gate-cine .login-card { animation: none; } .gate-title-cine .w > span { transform: none; } }


/* =====================================================================
   v10 — photographic backdrop (Higgsfield render) + glass dashboard
   ===================================================================== */
.sky-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.sky-fog { position: absolute; inset: 0; background: linear-gradient(180deg, oklch(0 0 0 / 0.35) 0%, transparent 35%, transparent 60%, oklch(0 0 0 / 0.45) 100%); }
.sky-zoom { animation-duration: 32s; }
.vignette { background: radial-gradient(120% 90% at 50% 45%, transparent 45%, oklch(0 0 0 / 0.55) 100%); }
.grain { opacity: 0.12; }
.gate-cine .login-card { background: linear-gradient(180deg, oklch(0.2 0.01 60 / 0.55), oklch(0.12 0.01 60 / 0.5)); border-color: oklch(1 0 0 / 0.16); }
.gate-cine .login-card input[type=text], .gate-cine .login-card input[type=password] { background: oklch(0 0 0 / 0.25); }

/* glass dashboard (dark theme only) */
html:not([data-theme=light]) body.glass { background: #0a0a09; }
html:not([data-theme=light]) body.glass::before { content: ''; position: fixed; inset: -4%; z-index: 0; background: url("backdrop.jpg") center 40% / cover no-repeat; filter: blur(16px) saturate(1.25) brightness(0.85); transform: scale(1.06); pointer-events: none; }
html:not([data-theme=light]) body.glass::after { content: ''; position: fixed; inset: 0; z-index: 0; background: radial-gradient(120% 100% at 50% 0%, oklch(0 0 0 / 0.1), oklch(0 0 0 / 0.5)); pointer-events: none; }
html:not([data-theme=light]) body.glass .shell { position: relative; z-index: 1; }
html:not([data-theme=light]) body.glass .sidebar { background: oklch(0.1 0.004 60 / 0.5); backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2); border-right: 1px solid oklch(1 0 0 / 0.08); }
html:not([data-theme=light]) body.glass .toolbar { background: oklch(0.1 0.004 60 / 0.45); backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2); border-bottom-color: oklch(1 0 0 / 0.08); }
html:not([data-theme=light]) body.glass .card, html:not([data-theme=light]) body.glass .kpi2, html:not([data-theme=light]) body.glass .kpi { background: linear-gradient(180deg, oklch(1 0 0 / 0.06), oklch(1 0 0 / 0.02)), oklch(0.12 0.004 60 / 0.38); border: 1px solid oklch(1 0 0 / 0.12); backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2); box-shadow: 0 30px 60px -40px oklch(0 0 0 / 0.9), inset 0 1px 0 oklch(1 0 0 / 0.06); }
html:not([data-theme=light]) body.glass .card.soft, html:not([data-theme=light]) body.glass .list-item, html:not([data-theme=light]) body.glass .col, html:not([data-theme=light]) body.glass .day { background: oklch(1 0 0 / 0.04); }
html:not([data-theme=light]) body.glass .vcard, html:not([data-theme=light]) body.glass .day .e { background: oklch(1 0 0 / 0.07); }
html:not([data-theme=light]) body.glass .seg { background: oklch(1 0 0 / 0.06); }
html:not([data-theme=light]) body.glass .seg button.active { background: oklch(1 0 0 / 0.12); }
html:not([data-theme=light]) body.glass .drawer, html:not([data-theme=light]) body.glass .pop { background: oklch(0.13 0.004 60 / 0.85); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid oklch(1 0 0 / 0.1); }
html:not([data-theme=light]) body.glass input[type=text], html:not([data-theme=light]) body.glass input[type=search], html:not([data-theme=light]) body.glass select, html:not([data-theme=light]) body.glass .cmd input { background: oklch(0 0 0 / 0.25); }
html:not([data-theme=light]) body.glass thead th { background: oklch(0.14 0.004 60 / 0.9); }
@media (max-width: 820px) { html:not([data-theme=light]) body.glass::before { filter: blur(16px) brightness(0.5); } html:not([data-theme=light]) body.glass .card, html:not([data-theme=light]) body.glass .kpi2 { backdrop-filter: none; -webkit-backdrop-filter: none; background: oklch(0.14 0.004 60 / 0.8); } }


/* =====================================================================
   v11 — cinematic sign-in → dashboard transition
   ===================================================================== */
.gate.launch .gate-statement { transition: transform 0.9s cubic-bezier(0.7, 0, 0.84, 0), opacity 0.6s ease, filter 0.7s ease; transform: translateY(-40px); opacity: 0; filter: blur(8px); }
.gate.launch .login-card { transition: transform 0.8s cubic-bezier(0.7, 0, 0.84, 0), opacity 0.55s ease 0.1s, filter 0.6s ease; transform: translateY(30px) scale(0.94); opacity: 0; filter: blur(10px); }
.gate.launch .gate-top, .gate.launch .gate-foot { transition: opacity 0.5s ease; opacity: 0; }
.gate.launch .sky-zoom { animation: none; transition: transform 3.2s cubic-bezier(0.55, 0, 0.2, 1), filter 3.2s ease; transform: scale(1.75) translateY(-6%); transform-origin: 50% 74%; filter: brightness(1.15) saturate(1.2); }
.gate.launch .vignette { transition: background 2s ease; background: radial-gradient(80% 60% at 50% 70%, transparent 20%, oklch(0 0 0 / 0.85) 100%); }
.intro { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; color: #fff; }
.intro::before { content: ''; position: absolute; inset: 0; background: radial-gradient(70% 50% at 50% 60%, oklch(0.12 0.01 60 / 0.15), oklch(0.06 0.004 60 / 0.75)); opacity: 0; transition: opacity 1.2s ease; }
.intro.greet::before { opacity: 1; }
.intro-flare { position: absolute; left: 0; right: 0; top: 64%; height: 2px; transform: scaleX(0); background: linear-gradient(90deg, transparent, oklch(0.9 0.12 85), #fff 50%, oklch(0.9 0.12 85), transparent); box-shadow: 0 0 40px 10px oklch(0.85 0.13 85 / 0.55), 0 0 160px 50px oklch(0.8 0.12 80 / 0.3); opacity: 0; }
.intro.on .intro-flare { animation: flare 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes flare { 0% { transform: scaleX(0); opacity: 0; } 25% { opacity: 1; } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1.2) scaleY(0.4); opacity: 0; } }
.intro-copy { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro-mark { width: 150px; opacity: 0; transform: translateY(14px); filter: blur(6px); transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.16, 1, 0.3, 1), filter 0.9s ease; }
.intro.greet .intro-mark { opacity: 1; transform: none; filter: none; }
.intro-rule { width: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s; }
.intro.greet .intro-rule { width: 220px; }
.intro-hello { font-family: var(--font-display); font-size: clamp(2.6rem, 1.6rem + 4vw, 5.4rem); line-height: 1; letter-spacing: -0.02em; text-shadow: 0 20px 60px oklch(0 0 0 / 0.7); }
.intro-hello em { font-style: italic; color: var(--gold); }
.intro-hello .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.intro-hello .w > span { display: inline-block; transform: translateY(110%); }
.intro.greet .intro-hello .w > span { animation: word-up 1.1s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--d) + 0.25s); }
.intro-line { font-size: 0.74rem; letter-spacing: 0.26em; text-transform: uppercase; color: oklch(1 0 0 / 0.62); opacity: 0; transition: opacity 0.9s ease 0.9s; }
.intro.greet .intro-line { opacity: 1; }
.intro-skip { position: absolute; right: 28px; bottom: 24px; pointer-events: auto; background: transparent; border: 1px solid oklch(1 0 0 / 0.2); color: oklch(1 0 0 / 0.7); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; padding: 10px 16px; min-height: 40px; border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity 0.5s ease 0.8s; }
.intro.on .intro-skip { opacity: 1; }
.intro-skip:hover { color: #fff; border-color: oklch(1 0 0 / 0.5); }
.intro.out { transition: opacity 1.1s ease, filter 1.1s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1); opacity: 0; filter: blur(10px); transform: scale(1.06); }
.intro.out .intro-skip { display: none; }
.shell.reveal-in { animation: shell-reveal 1.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes shell-reveal { from { opacity: 0; filter: blur(14px) brightness(1.4); transform: scale(1.035); } to { opacity: 1; filter: none; transform: none; } }
.shell.reveal-in .sidebar { animation: side-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both; }
@keyframes side-in { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.shell.reveal-in .kpi2, .shell.reveal-in .card { animation: rise-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }
.shell.reveal-in .kpi2:nth-child(1) { animation-delay: 0.25s; } .shell.reveal-in .kpi2:nth-child(2) { animation-delay: 0.32s; } .shell.reveal-in .kpi2:nth-child(3) { animation-delay: 0.39s; } .shell.reveal-in .kpi2:nth-child(4) { animation-delay: 0.46s; }
.shell.reveal-in .card { animation-delay: 0.5s; }
@keyframes rise-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
