:root {
  --bg: #080a09;
  --sidebar: #0b0e0c;
  --surface: #0e1210;
  --surface-2: #121714;
  --surface-3: #182019;
  --line: rgba(225, 242, 229, .09);
  --line-strong: rgba(225, 242, 229, .16);
  --text: #eef4ef;
  --muted: #a1ada4;
  --quiet: #7e8980;
  --accent: #9bef6c;
  --accent-ink: #0b1608;
  --success: #73dfa2;
  --warning: #e9bb63;
  --danger: #f07d73;
  --info: #73b8ee;
  --radius: 12px;
  --shadow: 0 30px 80px rgba(0, 0, 0, .45);
  --sidebar-width: 216px;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Segoe UI Variable Display", "Segoe UI Variable Text", "Aptos", "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  --bg: #f3f5f1;
  --sidebar: #f8f9f6;
  --surface: #ffffff;
  --surface-2: #f2f5f0;
  --surface-3: #e8eee6;
  --line: rgba(23, 32, 23, .10);
  --line-strong: rgba(23, 32, 23, .18);
  --text: #172017;
  --muted: #566258;
  --quiet: #657166;
  --accent: #39791d;
  --accent-ink: #ffffff;
  --success: #18784a;
  --warning: #8d5c00;
  --danger: #b43a31;
  --info: #1f669e;
  --shadow: 0 30px 80px rgba(25, 35, 25, .14);
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; scroll-behavior: smooth; }
html[data-theme="light"] { color-scheme: light; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 300; left: 12px; top: -64px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; font-weight: 700; transition: top .18s ease; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.ambient-orb { position: fixed; z-index: -1; width: 680px; height: 680px; top: -420px; left: 42%; border-radius: 50%; background: color-mix(in srgb, var(--accent) 6%, transparent); filter: blur(80px); pointer-events: none; animation: ambient-drift 20s ease-in-out infinite alternate; }
.demo-banner { position: fixed; z-index: 80; inset: 0 0 auto 0; height: 28px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; background: #dcb45f; color: #211a09; font-size: 11px; }
.demo-banner strong { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; }
.demo-pulse { width: 6px; height: 6px; border-radius: 50%; background: #211a09; animation: demo-pulse 2.8s ease-in-out infinite; }
.app-shell { min-height: 100vh; padding-top: 28px; }

.sidebar { position: fixed; z-index: 50; top: 28px; bottom: 0; left: 0; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 22px 12px 16px; background: color-mix(in srgb, var(--sidebar) 96%, transparent); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 28px; }
.brand-mark { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-2); }
.brand-mark i { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 48%, transparent); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: var(--quiet); font-size: 11px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 20px 10px 7px; color: var(--quiet); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .10em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.nav-item { position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 8px; padding: 0 11px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav-item > span { width: 20px; color: var(--quiet); font-family: var(--mono); font-size: 11px; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-item.active { background: var(--surface-3); color: var(--text); font-weight: 620; }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 2px; height: 18px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent); }
.nav-item.active > span { color: var(--accent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; }
.system-mini { display: flex; align-items: center; gap: 10px; }
.system-mini strong, .system-mini small { display: block; }
.system-mini strong { font-size: 12px; font-weight: 600; }
.system-mini small { color: var(--quiet); font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--quiet); }
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 12%, transparent); animation: status-breathe 3.6s ease-in-out infinite; }
.tracker-link { min-height: 44px; display: flex; align-items: center; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; text-decoration: none; }
.tracker-link:hover { color: var(--text); }

.workspace { margin-left: var(--sidebar-width); min-height: calc(100vh - 28px); }
.topbar { position: sticky; z-index: 30; top: 28px; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(22px, 3vw, 44px); background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px) saturate(120%); }
.page-title p, .overline { margin: 0 0 4px; color: var(--quiet); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .09em; }
.page-title h1 { margin: 0; font-size: clamp(21px, 2vw, 27px); font-weight: 620; letter-spacing: -.045em; line-height: 1.1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.search-control { width: min(250px, 23vw); min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; box-shadow: inset 0 0 0 1px var(--line); border-radius: 8px; background: var(--surface); color: var(--quiet); transition: box-shadow .16s ease, background .16s ease; }
.search-control:focus-within { box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); background: var(--surface-2); }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
kbd { border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; color: var(--quiet); font-family: var(--mono); font-size: 11px; }
.range-button, .icon-button, .avatar { min-height: 44px; border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.range-button { padding: 0 14px; color: var(--muted); font-size: 12px; }
.icon-button { width: 44px; padding: 0; display: inline-grid; place-items: center; }
.avatar { width: 44px; background: var(--surface-3); font-size: 11px; font-weight: 700; }
.mobile-menu { display: none; }
.range-button:hover, .icon-button:hover, .avatar:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); transform: translateY(-1px); }

main { padding: 0 clamp(22px, 3vw, 44px) 72px; }
.context-strip { display: flex; flex-wrap: wrap; gap: 9px 24px; margin: 0 calc(clamp(22px, 3vw, 44px) * -1); padding: 10px clamp(22px, 3vw, 44px); border-bottom: 1px solid var(--line); color: var(--quiet); font-size: 11px; }
.context-strip span { display: flex; gap: 5px; }
.context-strip strong { color: var(--muted); font-weight: 600; }
#view-root { max-width: 1500px; margin: 0 auto; }
.section-gap { height: 16px; }
.view-enter { animation: view-enter .42s cubic-bezier(.2,.8,.2,1) both; }
.view-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 34px 0 20px; }
.view-intro h2 { margin: 0; font-size: 20px; font-weight: 620; letter-spacing: -.035em; }
.view-intro p { max-width: 720px; margin: 6px 0 0; color: var(--muted); font-size: 13px; text-wrap: pretty; }
.freshness { color: var(--quiet); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); border-block: 1px solid var(--line); }
.kpi { position: relative; min-height: 120px; padding: 20px 20px 18px; border-right: 1px solid var(--line); animation: rise-in .48s cubic-bezier(.2,.8,.2,1) both; }
.kpi:first-child { padding-left: 0; }
.kpi:last-child { border-right: 0; }
.kpi:nth-child(2) { animation-delay: 40ms; }
.kpi:nth-child(3) { animation-delay: 80ms; }
.kpi:nth-child(4) { animation-delay: 120ms; }
.kpi:nth-child(5) { animation-delay: 160ms; }
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.kpi-value { margin-top: 12px; font-size: clamp(27px, 2.4vw, 36px); font-weight: 590; letter-spacing: -.055em; line-height: 1; }
.kpi-foot { margin-top: 9px; color: var(--quiet); font-size: 11px; }
.delta { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.delta.up { color: var(--success); }
.delta.down { color: var(--warning); }

.dashboard-grid, .section-row { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .8fr); align-items: stretch; gap: 16px; margin-top: 16px; }
.overview-lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; overflow: hidden; background: color-mix(in srgb, var(--surface) 72%, transparent); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--radius); animation: rise-in .5s cubic-bezier(.2,.8,.2,1) both; }
.panel-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 620; letter-spacing: -.015em; }
.panel-head p { margin: 3px 0 0; color: var(--quiet); font-size: 11px; }
.panel-action { min-height: 36px; border: 0; padding: 0 2px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.panel-action:hover { color: var(--text); }
.panel-body { padding: 17px 18px; }
.chart-legend { display: flex; gap: 18px; color: var(--quiet); font-size: 11px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.legend-dot.contribution { background: var(--info); box-shadow: none; }
.chart-wrap { height: 260px; padding: 10px 0 0; }
.line-chart { width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--quiet); font: 11px var(--mono); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-line 1.1s .2s cubic-bezier(.3,.7,.2,1) forwards; }
.chart-line.secondary { stroke: var(--info); stroke-width: 1.6; animation-delay: .34s; }
.chart-area { fill: color-mix(in srgb, var(--accent) 7%, transparent); opacity: 0; animation: fade-area .8s .65s ease forwards; }
.chart-point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; opacity: 0; animation: fade-area .4s .9s ease forwards; }

.decision-list, .alert-list, .activity-list, .agent-mini-list { display: flex; flex-direction: column; }
.decision-row, .alert-row, .activity-row, .agent-mini { display: grid; gap: 11px; border-bottom: 1px solid var(--line); }
.decision-row:last-child, .alert-row:last-child, .activity-row:last-child, .agent-mini:last-child { border-bottom: 0; }
.decision-row { grid-template-columns: 8px minmax(0,1fr) auto; align-items: start; min-height: 72px; padding: 13px 0; cursor: pointer; transition: transform .15s ease; }
.decision-row:first-child { padding-top: 0; }
.decision-row:hover { transform: translateX(3px); }
.priority-mark { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--warning); }
.priority-mark.medium { background: var(--info); }
.row-title { font-size: 12px; font-weight: 620; }
.row-meta, .row-detail { color: var(--quiet); font-size: 11px; }
.row-detail { margin-top: 3px; color: var(--muted); }
.age { color: var(--quiet); font-family: var(--mono); font-size: 11px; }

.table-wrap { max-width: 100%; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
table { width: 100%; border-collapse: collapse; }
th { height: 44px; padding: 0 13px; border-bottom: 1px solid var(--line); color: var(--quiet); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { height: 56px; padding: 9px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-detail] { cursor: pointer; transition: background .15s ease; }
tbody tr[data-detail]:hover { background: var(--surface-2); }
.cell-main { color: var(--text); font-size: 12px; font-weight: 620; }
.cell-sub { margin-top: 2px; color: var(--quiet); font-size: 11px; }
.num { text-align: right; font-family: var(--mono); }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; padding: 0 9px; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 550; text-transform: uppercase; letter-spacing: .03em; }
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--quiet); }
.pill.healthy::before, .pill.active::before, .pill.complete::before, .pill.winner::before, .pill.strong::before { background: var(--success); }
.pill.watch::before, .pill.waiting::before, .pill.attention::before, .pill.medium::before, .pill.aging::before { background: var(--warning); }
.pill.blocked::before, .pill.loser::before, .pill.rejected::before { background: var(--danger); }
.pill.running::before, .pill.learning::before, .pill.moderate::before { background: var(--info); }
.progress { width: 100%; height: 4px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; animation: grow-bar .7s .2s cubic-bezier(.2,.8,.2,1) both; }

.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pipeline-card { min-height: 178px; padding: 17px; border-right: 1px solid var(--line); background: transparent; cursor: pointer; transition: background .16s ease; }
.pipeline-card:last-child { border-right: 0; }
.pipeline-card:hover { background: var(--surface-2); }
.pipeline-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pipeline-card h4 { margin: 0; font-size: 13px; }
.pipeline-card .stage { margin: 4px 0 17px; color: var(--quiet); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.metric-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.metric-pair small, .micro-stat small { display: block; color: var(--quiet); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.metric-pair strong, .micro-stat strong { display: block; margin-top: 3px; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.gate-copy { margin-top: 12px; color: var(--muted); font-size: 11px; }
.alert-row { grid-template-columns: auto minmax(0,1fr); padding: 13px 0; }
.alert-row:first-child { padding-top: 0; }
.severity-icon { width: 24px; height: 24px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); border-radius: 7px; color: var(--warning); font-size: 11px; }
.alert-row.low .severity-icon { color: var(--info); }
.agent-mini { grid-template-columns: 8px minmax(0,1fr) auto; align-items: center; min-height: 51px; padding: 9px 0; }
.agent-mini:first-child { padding-top: 0; }
.agent-status { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.agent-status.waiting { background: var(--warning); }
.agent-status.blocked { background: var(--danger); }
.agent-status.idle { background: var(--quiet); }

.funnel-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.funnel-step { padding: 16px; border-right: 1px solid var(--line); }
.funnel-step:last-child { border-right: 0; }
.funnel-step strong { display: block; font-size: 25px; font-weight: 590; letter-spacing: -.045em; }
.funnel-step span { color: var(--muted); font-size: 11px; }
.funnel-step small { display: block; margin-top: 8px; color: var(--quiet); font-size: 11px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 14px; }
.filter-chip { min-height: 36px; border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; padding: 0 12px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; transition: color .15s ease, background .15s ease; }
.filter-chip.active { background: var(--surface-3); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, var(--line)); }
.score { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.store-card, .channel-card, .source-card { padding: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--radius); cursor: pointer; transition: transform .17s ease, box-shadow .17s ease, background .17s ease; }
.store-card:hover, .channel-card:hover, .source-card:hover { transform: translateY(-2px); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong), 0 14px 30px rgba(0,0,0,.10); }
.card-top { display: flex; justify-content: space-between; gap: 12px; }
.card-top h3 { margin: 0; font-size: 15px; }
.card-top p { margin: 4px 0 0; color: var(--quiet); font-size: 11px; }
.card-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 18px; }
.card-foot { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 11px; }
.card-foot strong { color: var(--text); }
.channel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.channel-card { cursor: default; }
.channel-card h3 { margin: 0; font-size: 13px; }
.channel-card .big { margin: 20px 0 4px; font-size: 27px; font-weight: 590; letter-spacing: -.045em; }
.channel-card .note { min-height: 34px; margin-top: 15px; color: var(--quiet); font-size: 11px; }
.customer-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.compact-stat { padding: 18px; border-right: 1px solid var(--line); }
.compact-stat:last-child { border-right: 0; }
.compact-stat span { color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.compact-stat strong { display: block; margin-top: 8px; font-size: 25px; font-weight: 590; letter-spacing: -.04em; }
.fulfillment-bar { display: flex; height: 10px; margin: 8px 0 20px; overflow: hidden; border-radius: 5px; background: var(--surface-3); }
.fulfillment-bar span:nth-child(1) { background: var(--success); }
.fulfillment-bar span:nth-child(2) { background: var(--warning); }
.fulfillment-bar span:nth-child(3) { background: var(--danger); }
.activity-row { grid-template-columns: 50px 82px minmax(0,1fr) auto; align-items: start; padding: 12px 0; }
.activity-row:first-child { padding-top: 0; }
.activity-time, .actor { color: var(--quiet); font-family: var(--mono); font-size: 11px; }
.actor { color: var(--accent); }
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.agent-card { min-height: 150px; padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; transition: background .15s ease; }
.agent-card:nth-child(3n) { border-right: 0; }
.agent-card:hover { background: var(--surface-2); }
.agent-card h4 { margin: 0; font-size: 12px; }
.agent-card .id { color: var(--accent); font-family: var(--mono); font-size: 11px; }
.agent-card .current { min-height: 34px; margin: 14px 0; color: var(--muted); font-size: 11px; }
.agent-card footer { display: flex; align-items: center; justify-content: space-between; color: var(--quiet); font-size: 11px; }

.detail-drawer { position: fixed; z-index: 100; top: 28px; right: 0; bottom: 0; width: min(520px, 94vw); display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(102%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.detail-drawer[hidden] { display: none; }
.detail-drawer.open { transform: translateX(0); }
.detail-drawer > header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.detail-drawer h2 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.drawer-body { padding: 22px 22px 56px; overflow-y: auto; }
.drawer-scrim, .mobile-scrim { position: fixed; z-index: 90; inset: 28px 0 0; background: rgba(0,0,0,.62); opacity: 0; pointer-events: none; transition: opacity .22s ease; backdrop-filter: blur(4px); }
.drawer-scrim.open, .mobile-scrim.open { opacity: 1; pointer-events: auto; }
.detail-section { margin-bottom: 26px; }
.detail-section h3 { margin: 0 0 11px; color: var(--quiet); font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.detail-section p { color: var(--muted); }
.detail-list { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 11px 14px; }
.detail-list dt { color: var(--quiet); font-size: 11px; }
.detail-list dd { margin: 0; color: var(--text); font-size: 12px; }
.guardrail { padding: 14px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 34%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--warning) 6%, var(--surface)); color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { min-height: 44px; border-radius: 8px; padding: 0 15px; cursor: pointer; font-size: 12px; font-weight: 650; }
.primary-button { border: 0; background: var(--accent); color: var(--accent-ink); }
.secondary-button { border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); color: var(--text); }
.button-row { display: flex; gap: 9px; margin-top: 18px; }

.search-panel { position: fixed; z-index: 130; inset: 0; padding: 12vh 16px 16px; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
.search-panel[hidden] { display: none; }
.search-dialog { width: min(660px, 100%); max-height: 72vh; margin: 0 auto; overflow: hidden; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); border-radius: 14px; animation: search-in .2s cubic-bezier(.2,.8,.2,1) both; }
.search-dialog > label { min-height: 62px; display: flex; align-items: center; gap: 11px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.search-dialog input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; }
#search-close { min-height: 30px; border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 6px; background: transparent; color: var(--quiet); font-size: 11px; }
#search-results { max-height: 58vh; overflow-y: auto; padding: 8px; }
.search-result { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-radius: 8px; padding: 10px 12px; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover, .search-result:focus { background: var(--surface-2); }
.search-result strong, .search-result small { display: block; }
.search-result strong { font-size: 12px; }
.search-result small { color: var(--quiet); font-size: 11px; }
.search-result > span:last-child { color: var(--quiet); font-family: var(--mono); font-size: 11px; text-transform: uppercase; }
.empty-state { padding: 28px; color: var(--quiet); font-size: 12px; text-align: center; }
.toast { position: fixed; z-index: 160; right: 20px; bottom: 20px; max-width: 380px; padding: 13px 16px; box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow); border-radius: 9px; background: var(--surface-3); color: var(--text); font-size: 12px; opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }

@keyframes view-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes fade-area { to { opacity: 1; } }
@keyframes grow-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes demo-pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes status-breathe { 0%,100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 10%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--success) 3%, transparent); } }
@keyframes ambient-drift { to { transform: translate3d(120px, 60px, 0) scale(1.08); } }
@keyframes search-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi { border-bottom: 1px solid var(--line); }
  .kpi:nth-child(3) { border-right: 0; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .pipeline-card:nth-child(2) { border-right: 0; }
  .pipeline-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .channel-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-card:nth-child(3n) { border-right: 1px solid var(--line); }
  .agent-card:nth-child(2n) { border-right: 0; }
}
@media (max-width: 920px) {
  .sidebar { transform: translateX(-102%); transition: transform .22s cubic-bezier(.2,.8,.2,1); box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .topbar { gap: 12px; }
  .search-control { display: inline-flex; position: relative; width: 44px; min-width: 44px; padding: 0; justify-content: center; }
  .search-control input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
  .search-control kbd, .avatar { display: none; }
  .dashboard-grid, .section-row, .overview-lower { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .mobile-scrim { z-index: 40; }
}
@media (max-width: 680px) {
  .demo-banner { justify-content: center; overflow: hidden; white-space: nowrap; }
  .demo-banner span:last-child { display: none; }
  .topbar { min-height: 70px; padding: 11px 14px; }
  .page-title p { display: none; }
  .page-title h1 { font-size: 19px; }
  .range-button { display: none; }
  main { padding-inline: 14px; padding-bottom: 48px; }
  .context-strip { margin-inline: -14px; padding: 10px 14px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .context-strip span { min-width: max-content; }
  .view-intro { align-items: flex-start; flex-direction: column; padding-top: 26px; }
  .freshness { white-space: normal; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi, .kpi:nth-child(3) { min-height: 112px; padding: 17px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .kpi:first-child { padding-left: 15px; }
  .kpi:nth-child(even) { border-right: 0; }
  .kpi:nth-child(4) { border-bottom: 1px solid var(--line); }
  .kpi:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .kpi-value { font-size: 27px; }
  .panel-head { align-items: flex-start; min-height: 66px; padding: 13px 15px; }
  .panel-body { padding: 15px; }
  .chart-wrap { height: 210px; }
  .pipeline, .channel-grid, .customer-grid, .agent-grid, .funnel-grid { grid-template-columns: 1fr; }
  .pipeline-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .pipeline-card:last-child { border-bottom: 0; }
  .funnel-step, .compact-stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .funnel-step:last-child, .compact-stat:last-child { border-bottom: 0; }
  .agent-card, .agent-card:nth-child(3n) { border-right: 0; }
  .card-metrics { grid-template-columns: repeat(2, 1fr); }
  .card-foot { flex-direction: column; gap: 7px; }
  .activity-row { grid-template-columns: 44px minmax(0,1fr) auto; }
  .activity-row .actor { display: none; }
  .button-row { flex-direction: column; }
  .primary-button, .secondary-button { width: 100%; }
  .toast { left: 14px; right: 14px; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
