:root {
  --ink: #141821;
  --muted: #697180;
  --line: #dde1e8;
  --soft-line: #eceef2;
  --paper: #ffffff;
  --canvas: #f3f4f6;
  --blue: #1c61f0;
  --blue-soft: #eaf1ff;
  --orange: #ff5a3d;
  --orange-soft: #fff0ec;
  --green: #168a65;
  --shadow: 0 18px 44px rgba(30, 37, 52, .08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1180px; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button, select, input { outline: none; }

.topbar {
  height: 84px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px);
}
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: #11151d; display: grid; grid-template-columns: repeat(3,1fr); padding: 7px; gap: 3px; transform: rotate(-4deg); }
.brand-mark span:nth-child(1) { background: var(--blue); border-radius: 3px; }
.brand-mark span:nth-child(2) { background: #f9fafb; border-radius: 3px; }
.brand-mark span:nth-child(3) { background: var(--orange); border-radius: 3px; }
.eyebrow, .step-label, .kicker { margin: 0 0 4px; color: var(--muted); font-size: 10px; letter-spacing: .15em; font-weight: 750; }
h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.model-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.algorithm-button { border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff; padding: 8px 13px; cursor: pointer; font-size: 12px; font-weight: 700; }
.algorithm-button:hover { background: #2a303b; }

.workspace { display: grid; grid-template-columns: 460px minmax(700px,1fr); gap: 18px; padding: 18px; max-width: 1800px; margin: 0 auto; }
.control-panel, .results-panel { min-height: calc(100vh - 120px); }
.control-panel {
  align-self: start;
  position: sticky;
  top: 102px;
  height: calc(100vh - 120px);
  background: transparent;
}
.control-panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: -10px;
  width: 1px;
  height: 100%;
  background: var(--line);
}
.control-panel-scroll {
  width: calc(100% - 6px);
  height: 100%;
  padding: 12px 10px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #d5d9e1 transparent;
}
.control-panel-scroll::-webkit-scrollbar { width: 8px; }
.control-panel-scroll::-webkit-scrollbar-track,
.control-panel-scroll::-webkit-scrollbar-corner { background: transparent; }
.control-panel-scroll::-webkit-scrollbar-thumb { background: #d5d9e1; border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }
.panel-heading, .results-heading {
  display: flex;
  height: 92px;
  padding: 8px 8px 18px;
  justify-content: space-between;
  align-items: flex-end;
}
h2 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.panel-heading h2, .results-heading h2 { font-size: 30px; }
.text-button { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 8px 0; font-weight: 650; }

.form-section { padding: 22px 24px 24px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.section-heading { display: flex; align-items: center; margin-bottom: 18px; padding-left: 12px; border-left: 2px solid var(--ink); }
.section-heading h3, .card-heading h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: span 2; }
.field { display: grid; gap: 7px; color: #3f4653; font-size: 12px; font-weight: 650; }
.field > span { display: flex; align-items: center; gap: 6px; }
.field small, .switch-line small { color: #9aa1ad; font-weight: 600; }
.field em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.field-note { color: #9299a5; font-size: 10px; font-weight: 500; line-height: 1.45; }
.field input, .field select, .days-field input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; min-height: 39px; padding: 0 11px; color: var(--ink); transition: border-color .16s, box-shadow .16s;
}
.field input:focus, .field select:focus, .days-field input:focus { border-color: #8cabf6; box-shadow: 0 0 0 3px var(--blue-soft); }
.group-size-field { border: 1px dashed #ccd3df; background: #f8f9fb; border-radius: 9px; padding: 10px 12px; transition: opacity .16s, border-color .16s; }
.group-size-field:not(.is-disabled) { border-color: #9eb6ef; background: #fbfdff; }

.resource-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resource-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: #fff; margin-bottom: 10px; position: relative; overflow: hidden; }
.resource-card::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #ff927f; opacity: .9; }
.push-resource-section .resource-card::after { background: var(--green); }
.gift-card, .wide-resource { margin-bottom: 10px; }
.switch-line { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.switch-line > span { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.switch-line input { position: absolute; opacity: 0; pointer-events: none; }
.switch-line i { width: 35px; height: 20px; border-radius: 999px; background: #d8dce3; position: relative; transition: background .18s; }
.switch-line i::after { content: ""; position: absolute; width: 14px; height: 14px; top: 3px; left: 3px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.22); transition: transform .18s; }
.switch-line input:checked + i { background: var(--orange); }
.switch-line input:checked + i::after { transform: translateX(15px); }
.resource-fields { display: grid; grid-template-columns: 1fr 92px; gap: 9px; align-items: end; margin-top: 12px; transition: opacity .16s; }
.resource-fields.three-cols { grid-template-columns: 88px minmax(0,1fr) 72px; }
.days-field { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted); transition: opacity .16s; }
.days-field input { min-height: 34px; padding: 0 8px; }
.resource-grid .days-field { display: grid; grid-template-columns: minmax(36px,1fr) 72px; }
.resource-grid .days-field > span { white-space: nowrap; }
.is-disabled { opacity: .35; pointer-events: none; filter: grayscale(.25); }
.check-field { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 39px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; cursor: pointer; }
.check-field input { accent-color: var(--orange); }
.results-panel { padding: 12px 10px 40px; }
.support-meter { min-width: 170px; text-align: right; }
.support-meter > span { font-size: 11px; color: var(--muted); }
.support-meter strong { display: block; margin: 3px 0 6px; font-size: 19px; }
.support-meter > div { height: 5px; border-radius: 9px; background: #e2e5ea; overflow: hidden; }
.support-meter i { display: block; width: 0; height: 100%; background: linear-gradient(90deg,var(--orange),#f5b43b,var(--green)); transition: width .25s; }
.summary-strip { display: none; grid-template-columns: 2fr 1fr 1fr; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #fff; margin: 0 8px 14px; }
.summary-strip div { padding: 13px 16px; border-right: 1px solid var(--soft-line); }
.summary-strip div:last-child { border-right: 0; }
.summary-strip span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.summary-strip strong { font-size: 12px; }

.hero-metrics { display: none; grid-template-columns: repeat(5,1fr); gap: 10px; margin: 0 8px 14px; }
.hero-card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 15px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent,var(--blue)); }
.hero-card span { color: var(--muted); font-size: 10px; }
.hero-card strong { display: block; font-size: 24px; margin: 8px 0 4px; letter-spacing: -.04em; }
.hero-card small { color: #6c7481; font-size: 10px; white-space: nowrap; }

.results-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; padding: 0 8px; }
.data-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-heading { min-height: 65px; padding: 15px 17px; border-bottom: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; gap: 5px; align-items: center; }
.point-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.range-line { width: 17px; height: 4px; background: #cad7f8; border-radius: 4px; }
.metric-table-wrap { overflow: auto; }
.metric-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.metric-table th { color: var(--muted); text-align: left; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; background: #fafbfc; }
.metric-table th, .metric-table td { padding: 11px 14px; border-bottom: 1px solid var(--soft-line); }
.metric-table tbody tr:last-child td { border-bottom: 0; }
.metric-table td:nth-child(2) { font-weight: 800; font-size: 12px; }
.metric-name { display: flex; align-items: center; gap: 8px; }
.metric-group-dot { width: 2px; height: 18px; border-radius: 2px; background: var(--blue); }
.metric-group-dot.ugc { background: var(--orange); }
.metric-group-dot.conversion { background: var(--green); }
.range-cell { min-width: 145px; }
.range-values { display: flex; justify-content: space-between; color: #515967; font-variant-numeric: tabular-nums; }
.range-track { height: 4px; background: #e9edf5; border-radius: 5px; margin-top: 6px; position: relative; }
.range-track i { position: absolute; inset: 0; background: #c8d6f8; border-radius: 5px; }
.range-track b { position: absolute; width: 7px; height: 7px; top: -1.5px; transform: translateX(-50%); border-radius: 50%; background: var(--blue); }
.quality-tag { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: #eef1f5; color: #596171; font-size: 9px; }
.quality-tag.good { background: #e5f6ef; color: #0f7857; }
.quality-tag.weak { background: #fff0ec; color: #ad3e29; }

.insight-column { display: none; gap: 12px; align-content: start; }
.drivers-list { padding: 8px 15px 15px; }
.driver-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 10px 0; border-bottom: 1px solid var(--soft-line); }
.driver-item:last-child { border-bottom: 0; }
.driver-item strong { font-size: 11px; }
.driver-item span { font-size: 10px; color: var(--muted); }
.driver-item b { grid-row: span 2; align-self: center; font-size: 11px; }
.driver-item b.positive { color: var(--green); }
.driver-item b.negative { color: var(--orange); }
.empty-drivers { padding: 22px 0; text-align: center; color: var(--muted); font-size: 11px; }
.caveat-card ul { padding: 10px 30px 3px; margin: 0; color: #58606d; font-size: 10px; line-height: 1.65; }
.caveat-card li { margin: 6px 0; }
.outline-button { margin: 8px 15px 15px; width: calc(100% - 30px); border: 1px solid var(--line); border-radius: 9px; background: white; padding: 10px; color: var(--ink); cursor: pointer; font-weight: 650; font-size: 11px; }
.outline-button:hover { border-color: #aab2bf; background: #fafbfc; }

dialog { width: min(720px,calc(100vw - 40px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 90px rgba(20,26,38,.28); }
dialog::backdrop { background: rgba(18,23,33,.48); backdrop-filter: blur(4px); }
.dialog-heading { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-heading button { border: 0; background: #f1f3f6; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 22px; }
.dialog-content { padding: 20px 22px 26px; color: #4f5764; font-size: 12px; line-height: 1.8; white-space: pre-line; max-height: 70vh; overflow: auto; }
.dialog-content h3 { color: var(--ink); margin: 18px 0 6px; }
.dialog-content code { background: #f2f4f7; padding: 2px 5px; border-radius: 4px; }

@media (max-width: 1280px) {
  body { min-width: 1040px; }
  .workspace { grid-template-columns: 420px 1fr; }
  .hero-metrics { grid-template-columns: repeat(3,1fr); }
  .results-grid { grid-template-columns: 1fr; }
  .insight-column { grid-template-columns: 1fr 1fr; }
}
