:root {
  --canvas: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --ink: #16212b;
  --muted: #68736e;
  --muted-2: #929b96;
  --line: #dce3de;
  --line-strong: #c9d2cc;
  --primary: #0d615b;
  --primary-soft: #dceee9;
  --good: #1f8a5b;
  --good-soft: #e2f2e9;
  --warning: #b8740c;
  --warning-soft: #fff0d4;
  --risk: #bd3d3d;
  --risk-soft: #f9e3e1;
  --shadow-1: 0 1px 2px rgba(21, 34, 28, 0.05);
  --shadow-2: 0 12px 36px rgba(26, 49, 39, 0.12);
  --radius-panel: 10px;
  --radius-control: 8px;
  --sidebar-width: 224px;
  --content-gap: 16px;
  --panel-pad: 20px;
  color-scheme: light;
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1160px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  text-rendering: optimizeLegibility;
}

button, select, input { font: inherit; }
button { color: inherit; }

.app-shell {
  min-height: 100vh;
  background: var(--canvas);
  transition: background-color 180ms ease, color 180ms ease;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  background: #112d2a;
  color: #eaf2ef;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 24px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 9px;
  color: #c4e9df;
  font: 700 12px/1 "DIN Alternate", "SFMono-Regular", monospace;
  letter-spacing: .08em;
}

.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .04em; }
.brand span { margin-top: 4px; color: #91aaa4; font-size: 11px; }

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 20px;
}

.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: #b9cac5;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.nav-item:hover, .nav-item:focus-visible { background: rgba(255,255,255,.07); color: #fff; outline: none; }
.nav-item.is-active { background: #d7eee7; color: #103c38; font-weight: 650; }
.nav-index { font: 600 10px/1 "SFMono-Regular", monospace; opacity: .58; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-foot strong, .sidebar-foot span { display: block; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot span { margin-top: 3px; color: #819b95; font-size: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #64c894; box-shadow: 0 0 0 4px rgba(100,200,148,.12); }

.workspace { margin-left: var(--sidebar-width); min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 82px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  backdrop-filter: blur(16px);
}

.eyebrow, .section-kicker {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 23px; line-height: 1.15; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 16px; line-height: 1.25; letter-spacing: -.01em; }

.topbar-actions, .date-switch { display: flex; align-items: center; gap: 8px; }
.date-switch { padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.date-switch button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.date-switch button:hover, .date-switch button:focus-visible { color: var(--ink); outline: none; }
.date-switch button.is-selected { background: var(--surface-2); color: var(--ink); font-weight: 650; }

.button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, background-color 160ms ease;
}
.button:active { transform: translateY(1px); }
.button:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 25%, transparent); outline-offset: 2px; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: #0a514c; }
.button-secondary { border-color: var(--line-strong); background: var(--surface); }
.button-secondary:hover { background: var(--surface-2); }

.content-view { padding: 18px 28px 38px; }
.content-view.is-hidden { display: none; }

.context-strip {
  display: grid;
  grid-template-columns: 1fr 1.35fr auto;
  align-items: center;
  min-height: 52px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.context-strip > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.context-label { display: block; margin-bottom: 3px; color: var(--muted-2); font-size: 10px; }
.context-strip strong { font-size: 12px; }
.context-health { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.health-badge, .count-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.health-warning { background: var(--warning-soft); color: var(--warning); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: var(--content-gap);
}

.kpi-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.kpi-card.is-warning { border-color: #e7c992; background: linear-gradient(180deg, var(--surface), #fffaf1); }
.kpi-card.is-muted { background: var(--surface-2); }
.kpi-label, .kpi-note { display: block; color: var(--muted); }
.kpi-label { font-size: 11px; }
.kpi-card strong { display: block; margin: 8px 0 7px; font: 700 25px/1 "DIN Alternate", "SFMono-Regular", monospace; letter-spacing: -.035em; }
.kpi-note { min-height: 14px; font-size: 10px; }
.kpi-note.positive { color: var(--good); }
.kpi-note.warning { color: var(--warning); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr);
  gap: var(--content-gap);
  margin-top: var(--content-gap);
}

.panel {
  min-width: 0;
  padding: var(--panel-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--primary); font-size: 11px; font-weight: 650; cursor: pointer; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend-line { width: 18px; height: 2px; background: var(--primary); }
.legend-line.amber { background: var(--warning); }

.trend-chart { position: relative; height: 250px; margin-top: 16px; overflow: hidden; }
.trend-chart svg { position: absolute; inset: 0 0 24px; width: 100%; height: calc(100% - 24px); overflow: visible; }
.chart-area { fill: color-mix(in srgb, var(--primary) 10%, transparent); }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 3; vector-effect: non-scaling-stroke; }
.chart-line-secondary { fill: none; stroke: var(--warning); stroke-width: 2; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.chart-axis { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; color: var(--muted-2); font-size: 9px; }
.target-line { position: absolute; z-index: 2; inset: 102px 0 auto; border-top: 1px dashed var(--line-strong); }
.target-line span { position: absolute; right: 0; top: -18px; color: var(--muted-2); font-size: 9px; }

.funnel-list { display: grid; gap: 12px; margin-top: 19px; }
.funnel-row { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; height: 31px; padding: 0 10px; overflow: hidden; border-radius: 6px; background: var(--surface-2); }
.funnel-row i { position: absolute; z-index: 0; inset: 0 auto 0 0; width: var(--w); background: color-mix(in srgb, var(--primary) 13%, transparent); }
.funnel-row span, .funnel-row strong { position: relative; z-index: 1; }
.funnel-row span { font-size: 11px; }
.funnel-row strong { font: 700 12px/1 "SFMono-Regular", monospace; }
.funnel-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.funnel-foot span, .funnel-foot strong, .funnel-foot small { display: block; }
.funnel-foot span { color: var(--muted-2); font-size: 9px; }
.funnel-foot strong { margin-top: 4px; font-size: 12px; }
.funnel-foot small { margin-top: 3px; color: var(--warning); font-size: 10px; }

.alert-list { display: grid; margin: 14px -10px -8px; }
.alert-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; min-height: 57px; padding: 8px 10px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.alert-row:hover, .alert-row:focus-visible { background: var(--surface-2); outline: none; }
.alert-row:first-child { border-top: 0; }
.alert-row .priority { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-size: 10px; font-weight: 750; }
.priority-high .priority { background: var(--risk-soft); color: var(--risk); }
.priority-medium .priority { background: var(--warning-soft); color: var(--warning); }
.priority-low .priority { background: var(--surface-2); color: var(--muted); }
.alert-row strong, .alert-row small { display: block; }
.alert-row strong { font-size: 11px; }
.alert-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.alert-row b { color: var(--muted); font-size: 9px; font-weight: 600; }
.count-chip { background: var(--risk-soft); color: var(--risk); }

.teacher-table { margin-top: 14px; }
.teacher-row { display: grid; grid-template-columns: 1.25fr .8fr .75fr .9fr .7fr; align-items: center; min-height: 48px; border-top: 1px solid var(--line); font-size: 11px; }
.teacher-row.table-head { min-height: 32px; border-top: 0; color: var(--muted-2); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.teacher-row > span:first-child { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-style: normal; font-size: 10px; }
.tag { justify-self: start; min-width: 44px; padding: 4px 7px; border-radius: 999px; text-align: center; font-size: 9px; font-weight: 700; }
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-risk { background: var(--risk-soft); color: var(--risk); }
.tag-watch { background: var(--warning-soft); color: var(--warning); }
.tag-muted { background: var(--surface-2); color: var(--muted); }

.placeholder-panel { min-height: 560px; padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.placeholder-panel h2 { margin-top: 8px; font-size: 28px; }
.placeholder-panel p { max-width: 580px; margin-top: 12px; color: var(--muted); line-height: 1.7; text-wrap: pretty; }
.placeholder-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-top: 32px; }
.placeholder-grid div { min-height: 210px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-panel); color: var(--muted-2); }

.tweaks-trigger { position: fixed; z-index: 20; right: 18px; bottom: 18px; min-height: 34px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-2); cursor: pointer; }
.tweaks-panel { position: fixed; z-index: 22; right: 18px; bottom: 18px; width: 264px; padding: 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-2); transform: translateY(12px); opacity: 0; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.tweaks-panel.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.tweaks-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tweaks-head button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tweaks-panel label { display: grid; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.tweaks-panel select { min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--ink); }
.tweaks-panel .toggle-row { display: flex; align-items: center; justify-content: space-between; }

.toast { position: fixed; z-index: 30; left: calc(var(--sidebar-width) + 50%); bottom: 24px; min-width: 260px; padding: 12px 14px; border-radius: 8px; background: #142723; color: #fff; box-shadow: var(--shadow-2); opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

[data-density="compact"] { --content-gap: 10px; --panel-pad: 14px; }
[data-density="compact"] .topbar { min-height: 68px; }
[data-density="compact"] .content-view { padding-top: 12px; }
[data-density="compact"] .kpi-card { padding: 12px; }
[data-density="compact"] .kpi-card strong { font-size: 21px; }
[data-density="compact"] .teacher-row { min-height: 40px; }

[data-theme="dark"] {
  --canvas: #111816;
  --surface: #19221f;
  --surface-2: #202d29;
  --ink: #e8f0ed;
  --muted: #9aa9a4;
  --muted-2: #73837e;
  --line: #2b3934;
  --line-strong: #3a4b45;
  --primary: #6bc8b6;
  --primary-soft: #223d37;
  --good-soft: #1b3c2c;
  --warning-soft: #423417;
  --risk-soft: #432726;
  --shadow-1: none;
  --shadow-2: 0 16px 44px rgba(0,0,0,.34);
  color-scheme: dark;
}
[data-theme="dark"] .sidebar { background: #0a1210; }
[data-theme="dark"] .kpi-card.is-warning { background: #251f15; }

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }

@media (max-width: 1380px) {
  :root { --sidebar-width: 204px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1.45fr .9fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Full prototype views */
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.page-stack { display: grid; gap: 16px; }
.section-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 78px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.section-summary h2 { margin-top: 5px; font-size: 20px; letter-spacing: -.02em; }
.section-summary p { max-width: 720px; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.summary-chips, .tag-list, .view-tabs, .report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.summary-chips span, .tag-list span, .privacy-badge { padding: 6px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 700; }
.health-risk { background: var(--risk-soft); color: var(--risk); }
.health-good { background: var(--good-soft); color: var(--good); }
.kpi-grid-wide { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-card.is-good { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); background: linear-gradient(180deg, var(--surface), var(--good-soft)); }
.kpi-card.is-risk { border-color: color-mix(in srgb, var(--risk) 35%, var(--line)); background: linear-gradient(180deg, var(--surface), var(--risk-soft)); }
.kpi-card.is-muted { opacity: .78; }
.kpi-note.good { color: var(--good); }
.kpi-note.risk { color: var(--risk); }
.mini-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--content-gap); }
.mini-kpi-grid .kpi-card { min-height: 112px; }
.panel h2, .modal h2, .confirm-modal h2 { margin-top: 4px; font-size: 16px; }
.muted-text { color: var(--muted); font-size: 10px; }
.primary-cell { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 4px; }
.primary-cell strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primary-cell small { max-width: 100%; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.mono-id { margin-top: 7px; color: var(--muted); font: 10px/1.4 "SFMono-Regular", monospace; }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-pending { background: var(--surface-2); color: var(--muted); }

.line-chart { position: relative; height: 245px; margin-top: 14px; padding-bottom: 24px; }
.line-chart svg { position: absolute; inset: 5px 0 27px; width: 100%; height: calc(100% - 32px); overflow: visible; }
.line-chart polyline { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.series-primary { stroke: var(--primary); stroke-width: 2.4; }
.series-secondary { stroke: var(--warning); stroke-width: 1.8; stroke-dasharray: 4 4; }
.chart-grid { position: absolute; inset: 6px 0 26px; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid i { border-top: 1px solid var(--line); }
.chart-labels { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; color: var(--muted-2); font-size: 9px; }
.funnel-compact { margin-top: 10px; }
.overview-table { display: grid; gap: 0; margin-top: 12px; }

.wide-table, .video-table, .data-table { margin-top: 12px; overflow-x: auto; }
.wide-row, .video-row, .data-row { display: grid; align-items: center; min-width: 960px; min-height: 49px; border-top: 1px solid var(--line); font-size: 10px; text-align: left; }
.wide-row { grid-template-columns: 1.55fr repeat(9, minmax(76px, .72fr)); }
.wide-row.wide-head, .video-row.video-head, .data-row.data-head { min-height: 34px; border-top: 0; color: var(--muted-2); font-size: 9px; font-weight: 650; letter-spacing: .03em; }
.wide-row > span, .video-row > span, .data-row > span { padding: 0 8px; }
.creative-wide .wide-row { grid-template-columns: 1.4fr .55fr repeat(8, minmax(74px, .72fr)); }
.video-row { width: 100%; grid-template-columns: 1.65fr repeat(8, minmax(76px, .75fr)) 1fr; border-right: 0; border-bottom: 0; border-left: 0; background: transparent; cursor: pointer; }
.video-row:not(.video-head):hover, .video-row.is-selected { background: var(--primary-soft); }
.video-row.video-head { cursor: default; }
.data-row { min-width: 760px; grid-template-columns: 1fr .8fr 2fr .55fr .65fr; }

.ranking-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.ranking-card { display: grid; gap: 10px; min-height: 140px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.ranking-card header { display: flex; justify-content: space-between; align-items: center; }
.ranking-card header b { color: var(--muted-2); font: 700 11px/1 monospace; }
.ranking-card h3 { font-size: 15px; }
.ranking-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ranking-card dt { color: var(--muted); font-size: 9px; }
.ranking-card dd { margin-top: 3px; font-size: 11px; font-weight: 700; }

.video-focus { display: grid; grid-template-columns: .95fr 1.6fr; gap: var(--content-gap); }
.video-profile h2 { margin-top: 8px; font-size: 19px; }
.focus-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.focus-kpis div { padding: 10px; border-radius: 7px; background: var(--surface-2); }
.focus-kpis span, .focus-kpis strong { display: block; }
.focus-kpis span { color: var(--muted); font-size: 9px; }
.focus-kpis strong { margin-top: 5px; font-size: 14px; }
.retention-chart { display: flex; align-items: end; justify-content: space-around; gap: 12px; height: 205px; margin-top: 18px; padding-top: 15px; border-bottom: 1px solid var(--line); }
.retention-step { display: grid; grid-template-rows: 16px 1fr 16px; align-items: end; justify-items: center; height: 100%; color: var(--muted); font-size: 9px; }
.retention-step i { align-self: end; width: 32px; height: var(--h); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--primary); opacity: .78; }
.retention-step strong { color: var(--ink); font-size: 9px; }

.crm-grid, .split-layout, .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--content-gap); }
.intent-bars { display: grid; gap: 13px; margin-top: 17px; }
.intent-bars > div { display: grid; grid-template-columns: 25px 1fr 30px; align-items: center; gap: 10px; font-size: 10px; }
.intent-bars i { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.intent-bars b { display: block; width: var(--w); height: 100%; border-radius: inherit; background: var(--primary); }
.definition-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 15px; }
.definition-grid div { padding: 12px; border-radius: 7px; background: var(--surface-2); }
.definition-grid strong, .definition-grid span { display: block; }
.definition-grid strong { font-size: 11px; }
.definition-grid span { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.5; }

.view-tabs { padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.view-tabs button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; }
.view-tabs button.is-active { background: var(--surface-2); color: var(--ink); font-weight: 700; }
.roi-kpis { grid-template-columns: repeat(4, 1fr); }
.form-grid, .settings-form { display: grid; gap: 12px; margin-top: 16px; }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid label, .settings-form label, .field-label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.form-grid input, .form-grid select, .settings-form input, .field-label input { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.form-grid button { align-self: end; }
.payment-list { display: grid; margin-top: 12px; }
.payment-list > div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; min-height: 55px; border-top: 1px solid var(--line); }
.payment-list > div:first-child { border-top: 0; }
.payment-list span strong, .payment-list span small { display: block; }
.payment-list span small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.payment-list > div > button { border: 0; background: transparent; color: var(--risk); font-size: 9px; cursor: pointer; }

.suggestion-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--content-gap); }
.suggestion-card { min-height: 215px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.suggestion-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; }
.suggestion-meta b { margin-left: auto; color: var(--line-strong); font: 700 25px/1 monospace; }
.priority-pill { padding: 4px 7px; border-radius: 999px; font-weight: 700; }
.priority-high { background: var(--risk-soft); color: var(--risk); }
.priority-medium { background: var(--warning-soft); color: var(--warning); }
.priority-low { background: var(--surface-2); color: var(--muted); }
.suggestion-card h3 { margin-top: 18px; font-size: 16px; }
.suggestion-card dl { display: grid; gap: 10px; margin-top: 15px; }
.suggestion-card dl div { display: grid; grid-template-columns: 68px 1fr; gap: 10px; }
.suggestion-card dt { color: var(--muted); font-size: 9px; }
.suggestion-card dd { font-size: 10px; line-height: 1.6; }
.suggestion-card > label { display: flex; align-items: center; gap: 7px; margin-top: 15px; color: var(--muted); font-size: 9px; }

.report-layout { max-width: 1180px; margin: 0 auto; }
.report-paper { padding: 46px 58px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-1); line-height: 1.8; }
.report-paper h1 { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--ink); font-size: 28px; }
.report-paper h2 { margin: 28px 0 9px; font-size: 17px; }
.report-paper li { list-style: none; font-size: 11px; }
.report-action { display: grid; gap: 4px; margin: 12px 0; padding: 12px; border-left: 3px solid var(--primary); background: var(--surface-2); font-size: 11px; }
.report-action span { color: var(--muted); }
.report-history { display: grid; margin-top: 12px; }
.report-history > div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; min-height: 54px; padding: 0 8px; border-top: 1px solid var(--line); }
.report-history > div:first-child { border-top: 0; }
.report-history > div.is-active { border-radius: 7px; background: var(--primary-soft); }
.report-history span strong, .report-history span small { display: block; }
.report-history span small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.report-history button { border: 0; background: transparent; color: var(--primary); font-size: 9px; cursor: pointer; }
.report-history button:last-child { color: var(--risk); }

.settings-form label { grid-template-columns: 1fr 110px; align-items: center; }
.settings-form label small { grid-column: 1; color: var(--muted-2); }
.settings-form label input { grid-row: 1 / span 2; grid-column: 2; }
.danger-zone { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-zone strong { font-size: 11px; }
.danger-zone p { margin: 5px 0 12px; color: var(--muted); font-size: 9px; }
.danger-button { border-color: color-mix(in srgb, var(--risk) 40%, var(--line)); background: var(--risk-soft); color: var(--risk); }
.schedule-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.schedule-form label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; }
.schedule-form select { min-height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.schedule-form small { grid-column: 1 / -1; color: var(--muted-2); font-size: 9px; line-height: 1.5; }

.import-hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.upload-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.upload-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 12px; min-height: 150px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: left; }
.upload-card:hover { border-color: var(--primary); }
.upload-card .file-type { justify-self: start; padding: 5px 7px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font: 700 9px/1 monospace; }
.upload-card h3 { grid-column: 1; font-size: 14px; }
.upload-card p { grid-column: 1 / -1; color: var(--muted); font-size: 9px; line-height: 1.55; }
.upload-card .button { grid-row: 1 / span 2; grid-column: 2; }
.import-hero > div { padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.import-hero > div h2 { margin-top: 7px; font-size: 20px; }
.import-hero > div p { margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.import-hero > .button { align-self: stretch; min-height: 84px; font-size: 13px; }
.rank-top { display: flex; align-items: center; justify-content: space-between; }
.rank-number { color: var(--muted-2); font: 700 18px/1 monospace; }
.spend-bar { height: 5px; overflow: hidden; border-radius: 999px; background: var(--line); }
.spend-bar i { display: block; width: var(--w); height: 100%; border-radius: inherit; background: var(--primary); }
.danger-chip { background: var(--risk-soft) !important; color: var(--risk) !important; }
.notice-chip { padding: 6px 9px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 10px; font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.privacy-panel { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.privacy-panel h3 { font-size: 14px; }
.privacy-panel p, .privacy-panel li { color: var(--muted); font-size: 10px; line-height: 1.7; }
.privacy-panel ul { margin: 12px 0 0 18px; }
.privacy-panel .privacy-badge { display: inline-flex; margin-bottom: 12px; }

.empty-state { display: grid; place-items: center; min-height: 210px; padding: 30px; text-align: center; }
.empty-state .empty-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.empty-state h3 { margin-top: 12px; font-size: 14px; }
.empty-state p { max-width: 420px; margin: 7px 0 14px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.loading-state { display: grid; place-items: center; min-height: 65vh; color: var(--muted); }
.loading-state span { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-state p { margin-top: 10px; font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal, .confirm-modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity 150ms ease; }
.modal.is-open, .confirm-modal.is-open { opacity: 1; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9, 20, 17, .48); backdrop-filter: blur(2px); }
.modal-card, .confirm-card { position: relative; z-index: 1; width: min(590px, calc(100vw - 32px)); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 22px 64px rgba(0,0,0,.22); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head > button { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal-body { display: grid; gap: 14px; padding: 20px; }
.dropzone { display: grid; place-items: center; min-height: 240px; padding: 24px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); text-align: center; outline: none; }
.dropzone.is-dragging { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .drop-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 10px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 20px; }
.dropzone p { margin: 7px 0 16px; color: var(--muted); font-size: 10px; }
.upload-feedback { min-height: 36px; padding: 10px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 10px; line-height: 1.5; }
.upload-feedback.is-error { background: var(--risk-soft); color: var(--risk); }
.upload-feedback.is-success { background: var(--good-soft); color: var(--good); }
.confirm-card { width: min(420px, calc(100vw - 32px)); padding: 22px; }
.confirm-card p { margin: 10px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.confirm-card > div { display: flex; justify-content: flex-end; gap: 8px; }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; }
.switch-row span strong, .switch-row span small { display: block; }
.switch-row span small { margin-top: 3px; color: var(--muted-2); }
.tweaks-note { margin-top: 16px; color: var(--muted-2); font-size: 9px; line-height: 1.5; }

@media (max-width: 1500px) {
  .kpi-grid-wide { grid-template-columns: repeat(3, 1fr); }
  .ranking-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
  :root { --sidebar-width: 184px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .dashboard-grid, .crm-grid, .split-layout, .settings-grid, .video-focus, .import-hero { grid-template-columns: 1fr; }
  .definition-grid { grid-template-columns: repeat(3, 1fr); }
  .content-view { padding-right: 18px; padding-left: 18px; }
}
@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }
  .sidebar { position: static; width: 100%; min-height: auto; padding-bottom: 10px; }
  .app-shell { display: block; }
  .workspace { margin-left: 0; }
  .brand, .sidebar-foot { display: none; }
  .nav-list { display: flex; overflow-x: auto; padding: 8px; }
  .nav-item { flex: 0 0 auto; }
  .topbar { position: static; flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .date-switch { overflow-x: auto; }
  .kpi-grid, .kpi-grid-wide, .mini-kpi-grid, .roi-kpis, .suggestion-grid, .ranking-grid, .upload-grid { grid-template-columns: 1fr 1fr; }
  .section-summary { align-items: flex-start; flex-direction: column; }
  .definition-grid { grid-template-columns: 1fr 1fr; }
  .report-paper { padding: 26px 22px; }
}

@media print {
  .sidebar, .topbar, .tweaks-trigger, .tweaks-panel, .section-summary, .toast { display: none !important; }
  .workspace { margin: 0; }
  .content-view { padding: 0; }
  .report-layout { display: block; max-width: none; }
  .report-paper { border: 0; box-shadow: none; }
}
