:root {
  --bg: oklch(97.8% 0.006 235);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(95.8% 0.009 235);
  --fg: oklch(21% 0.025 245);
  --muted: oklch(50% 0.02 245);
  --border: oklch(89% 0.012 235);
  --accent: oklch(55% 0.13 170);
  --accent-strong: oklch(44% 0.12 170);
  --domain: oklch(57% 0.12 245);
  --success: oklch(52% 0.13 150);
  --warn: oklch(64% 0.14 75);
  --danger: oklch(55% 0.17 25);
  --sidebar: oklch(18% 0.025 225);
  --sidebar-muted: oklch(76% 0.016 225);
  --shadow: 0 18px 45px color-mix(in oklch, var(--fg) 7%, transparent);
  --radius: 8px;
  --font-display: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { letter-spacing: 0.02em; }

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }
h1 { font-size: clamp(30px, 3vw, 42px); line-height: 1.12; letter-spacing: -0.02em; font-weight: 600; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; font-weight: 600; }
h3 { font-size: 17px; line-height: 1.35; font-weight: 600; }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.small { font-size: 13px; letter-spacing: 0.01em; }
.eyebrow {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.btn:hover { background: var(--surface-2); border-color: color-mix(in oklch, var(--border) 60%, var(--fg)); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-strong); color: white; border-color: var(--accent-strong); }
.btn-primary:hover { background: color-mix(in oklch, var(--accent-strong) 88%, black); border-color: transparent; }
.btn-dark { background: var(--fg); color: white; border-color: var(--fg); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-icon { width: 40px; padding: 0; }
.btn svg { width: 17px; height: 17px; stroke-width: 1.8; }
.btn[disabled] { opacity: .48; cursor: not-allowed; transform: none; }

.field { display: grid; gap: 7px; }
.field > label { font-size: 13px; font-weight: 550; letter-spacing: 0.02em; }
.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--fg);
  padding: 9px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.textarea { min-height: 140px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: color-mix(in oklch, var(--muted) 70%, white); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 16%, transparent);
  outline: none;
}
.field-error { min-height: 18px; color: var(--danger); font-size: 12px; letter-spacing: 0.01em; }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(420px, .9fr); background: var(--surface); }
.login-story {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background: var(--sidebar);
  color: white;
  padding: clamp(40px, 6vw, 88px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-story::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image: linear-gradient(color-mix(in oklch, white 24%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in oklch, white 24%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
}
.login-story > * { position: relative; z-index: 1; }
.brand-lockup {
  position: relative;
  display: block;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-size: contain;
}
.brand-lockup > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.login-story .brand-lockup {
  width: 112px;
  height: 112px;
  background-image: url("LOGO_竖版带名字.png");
  background-position: left top;
}
.story-copy { max-width: 660px; display: grid; gap: 22px; }
.story-copy h1 { font-size: clamp(44px, 5vw, 72px); line-height: 1.02; letter-spacing: -0.03em; max-width: 10ch; }
.story-copy p { max-width: 56ch; color: color-mix(in oklch, white 72%, var(--sidebar)); font-size: 17px; }
.flow-preview { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 22px; max-width: 640px; }
.flow-step { border-top: 1px solid color-mix(in oklch, white 25%, transparent); padding-top: 12px; color: color-mix(in oklch, white 64%, var(--sidebar)); font-size: 12px; letter-spacing: 0.02em; }
.flow-step.is-active { border-color: var(--accent); color: white; }
.login-meta { color: color-mix(in oklch, white 52%, var(--sidebar)); font-size: 12px; letter-spacing: 0.02em; }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 36px; background: var(--bg); }
.login-card { width: min(420px, 100%); display: grid; gap: 26px; }
.login-card header { display: grid; gap: 10px; }
.login-card form { display: grid; gap: 16px; }
.login-actions { display: grid; gap: 10px; margin-top: 4px; }
.login-actions .btn { min-height: 46px; }
.demo-note { border-top: 1px solid var(--border); padding-top: 18px; display: flex; gap: 10px; color: var(--muted); font-size: 13px; }
.demo-note svg { width: 17px; flex: 0 0 auto; margin-top: 2px; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 244px; z-index: 30;
  background: var(--sidebar); color: white; padding: 22px 14px; display: flex; flex-direction: column;
}
.sidebar .brand-lockup {
  width: 190px;
  height: 68px;
  margin: 0 8px 8px;
  background-image: url("LOGO_横版带名字.png");
  background-position: left center;
}
.side-nav { display: grid; gap: 3px; margin-top: 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px; }
.nav-label { padding: 18px 11px 8px; color: color-mix(in oklch, white 42%, var(--sidebar)); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-link {
  min-height: 42px; padding: 0 11px; border-radius: 6px; display: flex; align-items: center; gap: 11px;
  color: var(--sidebar-muted); font-size: 14px; font-weight: 510; letter-spacing: 0.01em;
}
.nav-link svg { width: 18px; height: 18px; stroke-width: 1.7; }
.nav-link:hover { color: white; background: color-mix(in oklch, white 7%, transparent); }
.nav-link.active { color: white; background: color-mix(in oklch, var(--accent) 18%, transparent); }
.sidebar-foot { margin-top: auto; border-top: 1px solid color-mix(in oklch, white 9%, transparent); padding: 16px 8px 0; display: grid; gap: 12px; }
.account-mini { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: color-mix(in oklch, var(--domain) 55%, white); color: white; display: grid; place-items: center; font-weight: 600; flex: 0 0 auto; }
.account-mini div { min-width: 0; }
.account-mini strong, .account-mini span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-mini strong { font-size: 13px; font-weight: 550; }
.account-mini span { color: color-mix(in oklch, white 45%, var(--sidebar)); font-size: 11px; letter-spacing: .01em; }
.app-body { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 66px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 28px;
}
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mobile-menu { display: none; }
.project-switch { max-width: 260px; }
.guest-chip { display: none; align-items: center; gap: 6px; min-height: 30px; border: 1px solid color-mix(in oklch, var(--warn) 45%, var(--border)); background: color-mix(in oklch, var(--warn) 12%, white); color: color-mix(in oklch, var(--warn) 62%, var(--fg)); border-radius: 999px; padding: 0 10px; font-size: 12px; font-weight: 550; }
.guest-chip svg { width: 14px; }
.guest-chip.is-visible { display: inline-flex; }
.content { width: min(1440px, 100%); margin: 0 auto; padding: 30px 28px 54px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading-copy { display: grid; gap: 7px; }
.page-heading-copy p { max-width: 65ch; color: var(--muted); }
.heading-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 20px; }
.card-header { min-height: 58px; padding: 16px 19px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.card-header-copy { display: grid; gap: 3px; }
.card-header-copy p { color: var(--muted); font-size: 12px; letter-spacing: 0.01em; }
.card-body { padding: 19px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { min-height: 132px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.metric-top svg { width: 18px; height: 18px; }
.metric-value { font: 600 32px/1.1 var(--font-mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric-foot { color: var(--muted); font-size: 12px; letter-spacing: 0.01em; }
.status-up { color: var(--success); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 12px; margin-top: 12px; }
.chart-card { min-height: 340px; }
.trend-chart { height: 220px; display: flex; align-items: flex-end; gap: clamp(10px, 2vw, 22px); padding: 12px 4px 0; border-bottom: 1px solid var(--border); background-image: linear-gradient(to bottom, transparent calc(25% - 1px), var(--border) 25%, transparent calc(25% + 1px), transparent calc(50% - 1px), var(--border) 50%, transparent calc(50% + 1px), transparent calc(75% - 1px), var(--border) 75%, transparent calc(75% + 1px)); }
.trend-bar { flex: 1; min-width: 12px; max-width: 42px; height: var(--h); background: color-mix(in oklch, var(--domain) 65%, white); border-radius: 3px 3px 0 0; position: relative; transition: height 400ms ease; }
.trend-bar:nth-child(3n) { background: var(--accent); }
.trend-bar::after { content: attr(data-label); position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%); color: var(--muted); font: 10px/1 var(--font-mono); letter-spacing: .01em; }
.chart-legend { display: flex; gap: 18px; align-items: center; margin-top: 28px; color: var(--muted); font-size: 12px; }
.legend-key { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--domain); }
.legend-dot.accent { background: var(--accent); }
.distribution { display: grid; gap: 18px; }
.platform-row { display: grid; grid-template-columns: 72px minmax(0,1fr) 36px; gap: 12px; align-items: center; }
.platform-row strong { font-size: 13px; font-weight: 550; }
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; width: var(--value); height: 100%; background: var(--domain); border-radius: inherit; }
.platform-row:nth-child(2) .progress > span { background: var(--accent); }
.platform-row code { text-align: right; color: var(--muted); font: 12px var(--font-mono); }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: 12px; margin-top: 12px; }
.pipeline-list { display: grid; }
.pipeline-item { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.pipeline-item:last-child { border-bottom: 0; }
.step-index { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 50%; display: grid; place-items: center; font: 11px var(--font-mono); color: var(--muted); }
.step-index.done { background: color-mix(in oklch, var(--success) 12%, white); border-color: color-mix(in oklch, var(--success) 32%, var(--border)); color: var(--success); }
.pipeline-item strong { display: block; font-size: 13px; font-weight: 550; }
.pipeline-item p { color: var(--muted); font-size: 12px; }
.keyword-list { display: grid; gap: 1px; }
.keyword-row { display: grid; grid-template-columns: minmax(0,1fr) 80px 68px; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--border); align-items: center; }
.keyword-row:last-child { border-bottom: 0; }
.keyword-row strong { font-size: 13px; font-weight: 550; }
.keyword-row span { color: var(--muted); font-size: 12px; }

/* Effect dashboard */
.effect-lead-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .65fr); gap: 12px; margin-top: 12px; }
.effect-chart { min-height: 386px; }
.effect-trend { height: 254px; gap: clamp(8px, 1.4vw, 18px); }
.effect-trend .trend-bar:nth-child(3n) { background: color-mix(in oklch, var(--domain) 65%, white); }
.effect-trend .trend-bar.is-highlight { background: var(--accent); }
.effect-summary { min-height: 386px; display: flex; flex-direction: column; }
.effect-summary .card-body { display: grid; gap: 18px; flex: 1; }
.effect-summary-block { display: grid; gap: 5px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.effect-summary-block:last-child { border-bottom: 0; padding-bottom: 0; }
.effect-summary-block strong { font: 600 26px/1.1 var(--font-mono); letter-spacing: -0.02em; }
.effect-summary-block span { color: var(--muted); font-size: 12px; letter-spacing: .01em; }
.insight-band { margin-top: 12px; padding: 24px; border-radius: var(--radius); background: var(--sidebar); color: white; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(130px, .45fr)); gap: 24px; align-items: center; }
.insight-copy { display: grid; gap: 7px; max-width: 60ch; }
.insight-copy p { color: color-mix(in oklch, white 64%, var(--sidebar)); }
.insight-stat { border-left: 1px solid color-mix(in oklch, white 13%, transparent); padding-left: 20px; display: grid; gap: 3px; }
.insight-stat strong { font: 600 24px/1.1 var(--font-mono); }
.insight-stat span { color: color-mix(in oklch, white 55%, var(--sidebar)); font-size: 11px; letter-spacing: .02em; }
.effect-detail-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); gap: 12px; margin-top: 12px; }
.keyword-signal { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.keyword-signal::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.keyword-signal.is-new::before { background: var(--domain); }
.coverage-list { display: grid; gap: 17px; }
.coverage-row { display: grid; gap: 8px; }
.coverage-row-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.coverage-row-top strong { font-size: 13px; font-weight: 550; }
.coverage-row-top span { color: var(--muted); font: 12px var(--font-mono); }

/* Platform authorization */
.platform-health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.health-card { padding: 18px; display: grid; gap: 18px; min-height: 164px; }
.health-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.health-card-top svg { width: 20px; height: 20px; color: var(--muted); }
.health-card strong { font: 600 30px/1 var(--font-mono); letter-spacing: -0.02em; }
.health-card p { color: var(--muted); font-size: 12px; }
.platform-cell { display: flex; align-items: center; gap: 11px; }
.platform-symbol { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--fg); font-weight: 600; font-size: 12px; }
.platform-cell strong, .platform-cell span { display: block; }
.platform-cell strong { font-size: 13px; font-weight: 550; }
.platform-cell span { color: var(--muted); font-size: 11px; letter-spacing: .01em; }
.quota-cell { display: grid; gap: 6px; min-width: 108px; }
.quota-cell span { color: var(--muted); font: 11px var(--font-mono); }
.authorization-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); gap: 12px; margin-top: 12px; align-items: start; }
.platforms-list-card .data-table { min-width: 790px; }
.platforms-list-card .data-table th, .platforms-list-card .data-table td { padding-left: 12px; padding-right: 12px; }
.issue-list { display: grid; }
.issue-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 11px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.issue-item:last-child { border-bottom: 0; }
.issue-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--warn); background: color-mix(in oklch, var(--warn) 10%, white); }
.issue-icon svg { width: 14px; height: 14px; }
.issue-item strong { display: block; font-size: 13px; font-weight: 550; }
.issue-item p { color: var(--muted); font-size: 12px; }
.authorization-form { display: grid; gap: 14px; }
.authorization-hint { padding: 12px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 12px; }

/* Tables and workspace */
.filters { padding: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { width: min(300px, 100%); }
.filters .select { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 840px; }
.data-table th, .data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); background: color-mix(in oklch, var(--bg) 68%, white); font-size: 11px; font-weight: 550; letter-spacing: 0.06em; text-transform: uppercase; }
.data-table td { font-size: 13px; }
.data-table tbody tr:hover { background: color-mix(in oklch, var(--bg) 70%, white); }
.table-title { display: grid; gap: 2px; }
.table-title strong { font-weight: 550; }
.table-title span { color: var(--muted); font: 11px var(--font-mono); }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.table-actions .btn { min-height: 34px; padding: 0 10px; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); font-size: 11px; font-weight: 550; letter-spacing: .02em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); background: color-mix(in oklch, var(--success) 8%, white); border-color: color-mix(in oklch, var(--success) 25%, var(--border)); }
.badge-warn { color: color-mix(in oklch, var(--warn) 75%, var(--fg)); background: color-mix(in oklch, var(--warn) 10%, white); border-color: color-mix(in oklch, var(--warn) 28%, var(--border)); }
.badge-danger { color: var(--danger); background: color-mix(in oklch, var(--danger) 7%, white); border-color: color-mix(in oklch, var(--danger) 22%, var(--border)); }
.badge-info { color: var(--domain); background: color-mix(in oklch, var(--domain) 8%, white); border-color: color-mix(in oklch, var(--domain) 22%, var(--border)); }
.completion { display: flex; align-items: center; gap: 9px; }
.completion .progress { width: 70px; }
.empty-state { display: none; padding: 64px 24px; text-align: center; color: var(--muted); }
.empty-state svg { width: 32px; height: 32px; margin-bottom: 10px; }

.workspace-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(460px, 1.28fr); gap: 12px; align-items: start; }
.config-panel { position: sticky; top: 84px; }
.form-stack { display: grid; gap: 15px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; background: var(--surface-2); border-radius: 7px; }
.segmented button { min-height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 550; }
.segmented button.active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px color-mix(in oklch, var(--fg) 10%, transparent); }
.platform-checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-tile { min-height: 48px; border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; gap: 9px; padding: 10px; cursor: pointer; }
.check-tile:has(input:checked) { border-color: var(--accent-strong); background: color-mix(in oklch, var(--accent) 7%, white); }
.check-tile input { accent-color: var(--accent-strong); }
.readiness { display: grid; gap: 12px; padding: 14px; background: var(--surface-2); border-radius: 7px; }
.readiness-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.readiness-top strong { font: 600 18px var(--font-mono); }
.readiness-list { display: flex; flex-wrap: wrap; gap: 7px; }
.readiness-list span { font-size: 11px; color: var(--muted); }
.work-stage { min-height: 640px; }
.stage-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 7px; }
.stage-tabs button { min-height: 38px; flex: 1; border: 0; background: transparent; border-radius: 5px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 550; }
.stage-tabs button.active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 4px color-mix(in oklch, var(--fg) 9%, transparent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: reveal 240ms ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.generation-idle { min-height: 480px; display: grid; place-items: center; text-align: center; padding: 40px; }
.idle-content { max-width: 440px; display: grid; justify-items: center; gap: 12px; }
.signal-mark { width: 54px; height: 54px; border: 1px solid color-mix(in oklch, var(--accent) 35%, var(--border)); border-radius: 12px; color: var(--accent-strong); display: grid; place-items: center; background: color-mix(in oklch, var(--accent) 7%, white); }
.signal-mark svg { width: 24px; height: 24px; }
.generation-progress { display: none; padding: 26px; }
.generation-progress.is-visible { display: block; }
.progress-steps { display: grid; gap: 13px; margin-top: 22px; }
.progress-step { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.progress-step svg { width: 18px; }
.progress-step.done { color: var(--success); }
.progress-step.current { color: var(--fg); }
.article-preview { display: grid; gap: 18px; }
.article-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.article-score { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 7px; }
.score-ring { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) 0 86%, var(--surface-2) 86%); position: relative; }
.score-ring::after { content: ""; position: absolute; inset: 7px; background: var(--surface); border-radius: 50%; }
.score-ring strong { position: relative; z-index: 1; font: 600 18px var(--font-mono); }
.score-bars { display: grid; gap: 8px; }
.score-row { display: grid; grid-template-columns: 88px minmax(0,1fr) 30px; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.article-editor { min-height: 310px; border: 1px solid var(--border); border-radius: 7px; padding: 22px; outline: none; line-height: 1.75; }
.article-editor:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 14%, transparent); }
.article-editor h3 { margin-bottom: 14px; }
.article-editor p + p { margin-top: 12px; }
.review-actions, .publish-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.timeline { display: grid; }
.timeline-item { display: grid; grid-template-columns: 18px minmax(0,1fr) auto; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--border); box-shadow: 0 0 0 4px var(--surface-2); }
.timeline-item.done .timeline-dot { background: var(--success); }
.timeline-item.current .timeline-dot { background: var(--warn); }
.timeline-item strong { display: block; font-size: 13px; font-weight: 550; }
.timeline-item p, .timeline-item time { color: var(--muted); font-size: 12px; }

/* Knowledge base and company profiles */
.completion-card { min-width: 260px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; align-items: center; gap: 12px; }
.completion-card > div { display: grid; gap: 2px; }
.completion-card > div strong { font-size: 13px; }
.completion-card p { color: var(--muted); font-size: 11px; }
.score-ring-small { width: 52px; height: 52px; flex: 0 0 auto; }
.score-ring-small::after { inset: 5px; }
.score-ring-small strong { font-size: 14px; }
.knowledge-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; align-items: start; }
.section-nav { padding: 8px; display: grid; gap: 3px; position: sticky; top: 84px; }
.section-nav button { min-height: 54px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; text-align: left; }
.section-nav button span { display: flex; align-items: center; gap: 9px; }
.section-nav button svg { width: 17px; height: 17px; }
.section-nav button strong { font: 11px var(--font-mono); }
.section-nav button.active { color: var(--fg); background: color-mix(in oklch, var(--accent) 9%, white); }
.section-stage { min-height: 470px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-span { grid-column: 1 / -1; }
.field-meta { color: var(--muted); font: 10px var(--font-mono); text-align: right; margin-top: -3px; }
.evidence-list, .settings-list { display: grid; }
.evidence-item, .setting-row { min-height: 76px; padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 13px; }
.evidence-item:last-child, .setting-row:last-child { border-bottom: 0; }
.evidence-item > div, .setting-row > div { min-width: 0; flex: 1; }
.evidence-item strong, .setting-row strong { display: block; font-size: 13px; }
.evidence-item p, .setting-row p { color: var(--muted); font-size: 12px; }
.evidence-icon { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; color: var(--domain); background: color-mix(in oklch, var(--domain) 9%, white); }
.evidence-icon svg { width: 18px; }
.missing-materials { margin-top: 12px; padding: 20px; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr) auto; gap: 20px; align-items: center; }
.missing-materials > div:first-child { display: grid; gap: 5px; }
.missing-list { display: flex; flex-wrap: wrap; gap: 7px; }
.missing-list span, .tag-list span { padding: 5px 8px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 11px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.profile-card { min-height: 350px; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.profile-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-monogram { width: 44px; height: 44px; border-radius: 9px; display: grid; place-items: center; color: white; background: var(--accent-strong); font-weight: 600; }
.profile-monogram.is-blue { background: var(--domain); }
.profile-card > div:nth-child(2) { display: grid; gap: 7px; }
.profile-card p { color: var(--muted); font-size: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-facts { margin: auto 0 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.profile-facts div { padding: 0 10px; border-right: 1px solid var(--border); }
.profile-facts div:first-child { padding-left: 0; }
.profile-facts div:last-child { border-right: 0; }
.profile-facts dt { color: var(--muted); font-size: 10px; }
.profile-facts dd { margin: 5px 0 0; font-size: 12px; }
.profile-actions { display: flex; gap: 7px; }
.profile-actions .btn:first-child { flex: 1; }
.profile-add { align-items: center; justify-content: center; text-align: center; border-style: dashed; cursor: pointer; }
.dialog-wide { width: min(920px, calc(100% - 28px)); max-height: calc(100vh - 32px); }
.dialog-wide .dialog-body { max-height: calc(100vh - 155px); overflow-y: auto; }
.profile-form { display: grid; gap: 22px; }
.form-section { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.form-section-head { display: flex; gap: 10px; align-items: flex-start; }
.form-section-head > span { color: var(--accent-strong); font: 11px var(--font-mono); }
.form-section-head h3 { font-size: 14px; }
.form-section-head p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.textarea-compact { min-height: 92px; }
.agreement-row { padding: 14px; border-radius: 7px; background: var(--surface-2); display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 12px; }
.agreement-row input { margin-top: 3px; accent-color: var(--accent-strong); }
.dialog-spacer { flex: 1; }

/* Media and keywords */
.asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.asset-card { overflow: hidden; }
.asset-preview { width: 100%; height: 180px; border: 0; cursor: pointer; }
.asset-visual, .asset-preview-large { display: grid; place-items: center; color: color-mix(in oklch, white 82%, var(--domain)); background-color: var(--sidebar); background-image: linear-gradient(135deg, color-mix(in oklch, var(--domain) 45%, transparent), transparent 58%), linear-gradient(color-mix(in oklch, white 7%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in oklch, white 7%, transparent) 1px, transparent 1px); background-size: auto, 24px 24px, 24px 24px; }
.visual-case { background-color: color-mix(in oklch, var(--sidebar) 75%, var(--accent-strong)); }
.visual-team { background-color: color-mix(in oklch, var(--sidebar) 78%, var(--domain)); }
.visual-cert { background-color: oklch(91% .025 90); color: var(--accent-strong); }
.asset-preview svg { width: 42px; height: 42px; stroke-width: 1.2; }
.asset-copy { padding: 15px; display: grid; gap: 13px; }
.asset-copy h3 { font-size: 14px; }
.asset-copy p { color: var(--muted); font-size: 10px; margin-top: 3px; }
.asset-actions { display: flex; gap: 5px; }
.asset-actions .btn:first-child { flex: 1; }
.upload-drop { min-height: 150px; border: 1px dashed color-mix(in oklch, var(--domain) 45%, var(--border)); border-radius: 8px; background: color-mix(in oklch, var(--domain) 5%, white); display: grid; justify-items: center; align-content: center; gap: 5px; cursor: pointer; text-align: center; }
.upload-drop svg { color: var(--domain); }
.upload-drop span { font-size: 11px; color: var(--muted); }
.upload-drop input { position: absolute; opacity: 0; pointer-events: none; }
.asset-preview-large { height: 260px; border-radius: 8px; }
.asset-preview-large svg { width: 58px; height: 58px; }
.keyword-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; margin-top: 12px; align-items: start; }
.pack-list { display: grid; gap: 6px; }
.pack-item { min-height: 66px; border: 1px solid transparent; border-radius: 7px; background: transparent; padding: 9px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; cursor: pointer; }
.pack-item:hover, .pack-item.active { border-color: color-mix(in oklch, var(--accent) 35%, var(--border)); background: color-mix(in oklch, var(--accent) 6%, white); }
.pack-icon { width: 36px; height: 36px; border-radius: 7px; display: grid; place-items: center; color: var(--domain); background: var(--surface-2); }
.pack-icon svg { width: 17px; }
.pack-item strong, .pack-item small { display: block; }
.pack-item strong { font-size: 12px; }
.pack-item small { color: var(--muted); margin-top: 3px; }
.pack-item b { color: var(--muted); font: 11px var(--font-mono); }

/* Article list and editor */
.article-status-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.article-status-strip button { min-height: 72px; border: 0; border-right: 1px solid var(--border); background: transparent; padding: 12px; display: grid; gap: 4px; text-align: left; cursor: pointer; }
.article-status-strip button:last-child { border-right: 0; }
.article-status-strip button span { color: var(--muted); font-size: 11px; }
.article-status-strip button strong { font: 600 18px var(--font-mono); }
.article-status-strip button.active { box-shadow: inset 0 -3px var(--accent-strong); background: color-mix(in oklch, var(--accent) 5%, white); }
.article-list { display: grid; }
.article-list-row { min-height: 118px; padding: 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 13px; align-items: center; }
.article-list-row:last-child { border-bottom: 0; }
.article-list-row > label { align-self: start; padding-top: 4px; }
.article-list-row input { accent-color: var(--accent-strong); }
.article-list-main { display: grid; gap: 6px; }
.article-list-title { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.article-list-title a:hover { color: var(--accent-strong); }
.article-list-main > p { color: var(--muted); font-size: 12px; }
.article-list-meta { display: flex; gap: 7px; flex-wrap: wrap; }
.article-list-meta span { color: var(--muted); font-size: 10px; }
.article-list-meta span + span::before { content: "·"; margin-right: 7px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.article-form { display: grid; gap: 16px; }
.article-title-input { min-height: 54px; font: 600 20px/1.3 var(--font-display); }
.editor-toolbar { min-height: 44px; border: 1px solid var(--border); border-bottom: 0; border-radius: 7px 7px 0 0; padding: 4px; display: flex; align-items: center; gap: 3px; }
.editor-toolbar button { min-width: 34px; min-height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; justify-content: center; cursor: pointer; }
.editor-toolbar button:hover { background: var(--surface-2); color: var(--fg); }
.editor-toolbar button svg { width: 15px; }
.editor-toolbar span { flex: 1; }
.article-editor-large { border-radius: 0 0 7px 7px; min-height: 620px; font-size: 16px; }
.article-editor-large h3 { margin-top: 24px; }
.editor-aside { display: grid; gap: 12px; position: sticky; top: 84px; }
.quality-number { color: var(--accent-strong); font-size: 22px; }
.check-list { display: grid; }
.check-list > div { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.check-list > div:last-child { border-bottom: 0; }
.check-list svg { width: 17px; color: var(--success); flex: 0 0 auto; margin-top: 2px; }
.check-list strong, .check-list small { display: block; }
.check-list strong { font-size: 12px; }
.check-list small { color: var(--muted); margin-top: 3px; }
.mobile-action-bar { display: none; }
.compute-cost { min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.compute-cost strong { color: var(--fg); font-size: 14px; }
.task-mini-list { margin-top: 18px; border-top: 1px solid var(--border); }
.task-mini-head, .task-mini-list > div:not(.task-mini-head) { min-height: 54px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); }
.task-mini-head { grid-template-columns: 1fr auto; }
.task-mini-head a { color: var(--accent-strong); font-size: 12px; }
.task-mini-list p, .task-mini-list time { color: var(--muted); font-size: 11px; }
.preflight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preflight-grid > div { padding: 12px; border: 1px solid var(--border); border-radius: 7px; display: flex; gap: 9px; align-items: flex-start; }
.preflight-grid svg { width: 17px; color: var(--success); flex: 0 0 auto; }
.preflight-grid strong, .preflight-grid small { display: block; }
.preflight-grid strong { font-size: 11px; }
.preflight-grid small { color: var(--muted); margin-top: 3px; }
.review-check-grid { display: grid; gap: 8px; }
.review-check-grid > div { min-height: 68px; padding: 12px; border: 1px solid var(--border); border-radius: 7px; display: flex; align-items: center; gap: 11px; }
.review-check-grid > div > div { flex: 1; }
.review-check-grid strong { font-size: 12px; }
.review-check-grid p { color: var(--muted); font-size: 11px; }

/* Dialog, toast, responsive */
.dialog { width: min(440px, calc(100% - 28px)); border: 0; border-radius: 10px; padding: 0; box-shadow: 0 30px 90px color-mix(in oklch, var(--fg) 25%, transparent); color: var(--fg); }
.dialog::backdrop { background: color-mix(in oklch, var(--sidebar) 58%, transparent); backdrop-filter: blur(3px); }
.dialog-head { padding: 20px 20px 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-body { padding: 8px 20px 20px; color: var(--muted); }
.dialog-foot { border-top: 1px solid var(--border); padding: 14px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; min-width: 260px; max-width: calc(100% - 44px); background: var(--fg); color: white; border-radius: 7px; padding: 13px 15px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); transform: translateY(18px); opacity: 0; pointer-events: none; transition: 180ms ease; }
.toast.is-visible { transform: none; opacity: 1; }
.toast svg { width: 17px; color: var(--accent); }
.sidebar-scrim { display: none; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid, .lower-grid { grid-template-columns: 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
  .effect-lead-grid, .effect-detail-grid, .authorization-layout { grid-template-columns: 1fr; }
  .knowledge-layout { grid-template-columns: 1fr; }
  .section-nav { position: static; grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keyword-layout { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-status-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .preflight-grid { grid-template-columns: 1fr; }
  .article-status-strip button:nth-child(3) { border-right: 0; }
  .article-status-strip button:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
  .profile-add { min-height: 230px; }
  .missing-materials { grid-template-columns: 1fr; }
  .insight-band { grid-template-columns: 1fr 1fr 1fr; }
  .insight-copy { grid-column: 1 / -1; }
  .platform-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-panel { position: static; }
}

@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { min-height: 44vh; padding: 34px 26px; }
  .login-story .brand-lockup { width: 88px; height: 88px; }
  .story-copy h1 { font-size: 42px; }
  .login-meta { display: none; }
  .login-panel { min-height: 56vh; padding: 34px 22px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform 180ms ease; }
  body.nav-open .sidebar { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: color-mix(in oklch, var(--sidebar) 58%, transparent); }
  body.nav-open .sidebar-scrim { display: block; }
  .app-body { grid-column: 1; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .content { padding: 24px 18px 44px; }
  .project-switch { max-width: 190px; }
}

@media (max-width: 600px) {
  .flow-preview { grid-template-columns: repeat(3, 1fr); }
  .flow-step:nth-child(n+4) { display: none; }
  .page-heading { flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .btn { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 112px; padding: 14px; }
  .metric-value { font-size: 26px; }
  .topbar-actions .btn:not(.btn-icon) { display: none; }
  .guest-chip span { display: none; }
  .filters { align-items: stretch; }
  .filters .input, .filters .select { width: 100%; }
  .platform-checks { grid-template-columns: 1fr; }
  .stage-tabs { overflow-x: auto; }
  .stage-tabs button { min-width: 88px; }
  .article-score { grid-template-columns: 1fr; }
  .score-ring { margin: auto; }
  .insight-band { grid-template-columns: 1fr; }
  .insight-stat { border-left: 0; border-top: 1px solid color-mix(in oklch, white 13%, transparent); padding: 14px 0 0; }
  .platform-health-grid { grid-template-columns: 1fr; }
  .completion-card { width: 100%; }
  .form-grid, .profile-grid { grid-template-columns: 1fr; }
  .form-section { grid-template-columns: 1fr; }
  .profile-form-actions { flex-wrap: wrap; }
  .dialog-spacer { display: none; }
  .profile-form-actions .btn { flex: 1 1 auto; }
  .section-nav { grid-template-columns: 1fr; }
  .asset-grid { grid-template-columns: 1fr; }
  .article-list-row { grid-template-columns: 20px minmax(0, 1fr); }
  .article-list-row > .table-actions { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
  .editor-aside { grid-template-columns: 1fr; }
  .article-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-status-strip button { border-bottom: 1px solid var(--border); }
  .article-detail-page { padding-bottom: 112px; }
  .mobile-action-bar { position: fixed; inset: auto 0 0 0; z-index: 24; min-height: 72px; padding: 10px 18px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: color-mix(in oklch, var(--surface) 94%, transparent); backdrop-filter: blur(14px); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}
