:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2ef;
  --soft-line: #e9edf5;
  --card: #ffffff;
  --soft: #f8fbff;
  --brand: #1664ff;
  --brand-2: #00a6a6;
  --accent: #087f8c;
  --green: #10a66a;
  --green-soft: #e9f8f0;
  --blue: #2367d1;
  --blue-soft: #eaf2ff;
  --amber: #f59e0b;
  --amber-soft: #fff7e6;
  --red: #fe2c55;
  --red-soft: #fff0f4;
  --shadow: 0 12px 30px rgba(28, 44, 74, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(22, 100, 255, 0.14), transparent 27%),
    radial-gradient(circle at 82% 0%, rgba(254, 44, 85, 0.09), transparent 24%),
    linear-gradient(180deg, #edf3ff 0, #f7f9fc 100%);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

mark {
  padding: 0;
  background: transparent;
  color: #d97706;
  font-weight: 900;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  width: min(1500px, calc(100% - 24px));
  height: 100vh;
  margin: 0 auto;
  padding: 10px 0;
  display: grid;
  grid-template-rows: 122px minmax(0, 1fr);
  gap: 8px;
}

.toolbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 0.62fr) minmax(620px, 1.28fr) 132px;
  align-items: center;
  gap: 14px;
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background:
    radial-gradient(circle at 8% 15%, rgba(254, 44, 85, 0.22), transparent 26%),
    radial-gradient(circle at 76% 12%, rgba(0, 242, 234, 0.2), transparent 30%),
    linear-gradient(110deg, #0b1020 0%, #122b6f 44%, #0a7f96 100%);
  color: #fff;
  box-shadow:
    0 16px 36px rgba(15, 23, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.toolbar-brand {
  min-width: 0;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 760;
}

h1 {
  margin-top: 6px;
  color: #fff;
  font-size: 25px;
  line-height: 1.08;
  font-weight: 920;
  letter-spacing: 0;
}

h2 {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 860;
}

.toolbar-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  justify-self: end;
  padding: 42px 0 0;
}

.icon-button,
.primary-button,
.admin-button,
.reset-main-button {
  height: 36px;
  border-radius: 8px;
}

.icon-button {
  width: 36px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 19px;
}

.primary-button {
  padding: 0 14px;
  background: #fff;
  color: #0a5f5b;
  font-size: 13px;
  font-weight: 820;
}

.admin-button {
  position: absolute;
  top: 16px;
  right: 34px;
  z-index: 5;
  width: 78px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.38);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.18);
  backdrop-filter: blur(8px);
}

.admin-button:hover {
  background: rgba(17, 24, 39, 0.66);
}

.reset-main-button {
  width: 124px;
  min-width: 124px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(254, 44, 85, 0.58), rgba(0, 242, 234, 0.58)) border-box;
  color: #155eef;
  font-size: 13px;
  font-weight: 950;
  box-shadow:
    0 14px 26px rgba(2, 6, 23, 0.22),
    0 0 0 6px rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.reset-main-button:hover {
  background: #fff;
  transform: translateY(-1px);
}

.screen-tabs {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.screen-tabs button {
  height: 32px;
  border-radius: 8px;
  background: transparent;
  color: #526071;
  font-size: 13px;
  font-weight: 900;
}

.screen-tabs button.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 100, 255, 0.18);
}

.screen-stage,
.screen {
  min-height: 0;
}

.screen-stage {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(390px, 1.05fr);
  gap: 8px;
}

.screen {
  display: grid;
  height: 100%;
}

.screen.active {
  display: grid;
}

.screen-input {
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
}

.screen-result {
  min-height: 0;
}

.panel,
.input-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.policy-map {
  padding: 9px 12px;
  overflow: hidden;
}

.policy-map .section-title {
  display: none;
}

.precheck-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  align-self: stretch;
  min-width: 0;
  border-color: rgba(255, 255, 255, 0.32);
  border-top: 0;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 255, 0.9)),
    rgba(255, 255, 255, 0.88);
  box-shadow:
    0 12px 28px rgba(2, 6, 23, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.precheck-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 0;
  border-bottom: 0;
}

.precheck-title strong {
  color: #111827;
  font-size: 13px;
  line-height: 1;
  font-weight: 950;
  white-space: nowrap;
}

.precheck-title strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fe2c55, #ff8a00);
  box-shadow: 0 0 0 4px rgba(254, 44, 85, 0.1);
}

.precheck-title span {
  color: #667085;
  font-size: 10px;
  font-weight: 820;
  white-space: nowrap;
}

.precheck-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.reset-button {
  display: none;
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(22, 100, 255, 0.22);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(22, 100, 255, 0.08);
  white-space: nowrap;
}

.reset-button:hover {
  background: var(--blue-soft);
}

.precheck-body {
  display: grid;
  gap: 5px;
  padding-top: 0;
  min-height: 0;
}

.precheck-body p {
  display: block;
  color: #475467;
  font-size: 9.5px;
  line-height: 1.25;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.precheck-body p strong {
  color: #ea580c;
  font-weight: 950;
}

.question-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.9fr 1.02fr;
  gap: 6px;
}

.question-grid article {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(234, 88, 12, 0.18);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.92), rgba(255, 255, 255, 0.82));
}

.question-grid article:nth-child(3) {
  grid-column: auto;
  border-color: rgba(254, 44, 85, 0.16);
  background: linear-gradient(135deg, rgba(255, 241, 242, 0.92), rgba(255, 255, 255, 0.82));
}

.question-grid b {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 930;
  white-space: nowrap;
}

.question-grid span {
  display: block;
  color: #344054;
  font-size: 9.5px;
  line-height: 1.25;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
}

.logic-grid article {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.logic-grid strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 860;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logic-grid p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.input-panel,
.results .panel {
  min-height: 0;
  padding: 12px;
}

.input-panel {
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  border-top: 4px solid var(--red);
}

.customer-sticky {
  position: sticky;
  top: -12px;
  z-index: 20;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 0.85fr 0.85fr 0.85fr 0.85fr 0.95fr 0.95fr;
  gap: 5px;
  margin: -4px -4px 2px;
  padding: 7px;
  border: 1px solid var(--soft-line);
  border-top: 4px solid var(--red);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(28, 44, 74, 0.1);
}

.customer-sticky .section-title {
  grid-column: 1 / -1;
  margin: 0;
  padding: 5px 8px;
  border-radius: 8px;
  background: #f2f7f8;
}

.customer-sticky label {
  gap: 3px;
}

.customer-sticky input,
.customer-sticky select {
  height: 28px;
  border-radius: 7px;
  font-size: 11px;
}

.customer-sticky label span {
  font-size: 10px;
}

.customer-sticky label em {
  font-size: 9px;
}

.client-name-field {
  grid-column: span 1;
}

.results {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 104px minmax(0, 1fr);
  gap: 6px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.input-panel > .section-title {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f2f7f8;
}

.section-title span {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  white-space: nowrap;
}

.section-title.compact {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 4px;
  margin: 0;
}

label span,
.matrix-label {
  color: #526071;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 800;
}

label em {
  margin-top: -2px;
  color: #8a96a6;
  font-size: 10px;
  line-height: 1.15;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input,
select {
  width: 100%;
  height: 34px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
  font-size: 12px;
}

.money-input,
.percent-input,
.rate-input {
  padding-right: 34px;
}

label:has(.money-input),
label:has(.percent-input),
label:has(.rate-input) {
  position: relative;
}

label:has(.money-input)::after,
label:has(.percent-input)::after,
label:has(.rate-input)::after {
  position: absolute;
  right: 9px;
  bottom: 9px;
  color: #8492a6;
  font-size: 11px;
  font-weight: 820;
  pointer-events: none;
}

label:has(.money-input)::after {
  content: "万";
}

label:has(.percent-input)::after,
label:has(.rate-input)::after {
  content: "%";
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(8, 117, 111, 0.12);
}

.two-cols {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.two-cols label:only-child {
  grid-column: span 2;
}

.spend-matrix {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 128px repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: #f8fafc;
}

.matrix-head {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: 999px;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: #c2410c;
  font-size: 12px;
  font-weight: 920;
  text-align: center;
}

.matrix-head-spacer,
.matrix-head:empty {
  min-width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.spend-matrix input,
.matrix-input-unit input {
  height: 32px;
}

.spend-matrix .money-input,
.matrix-input-unit .money-input {
  padding-right: 46px;
}

.spend-matrix .money-input::placeholder {
  color: #b0bac8;
}

.matrix-input-unit {
  position: relative;
  min-width: 0;
}

.matrix-input-unit span {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #d97706;
  font-size: 11px;
  font-weight: 900;
  pointer-events: none;
}

.muted-label {
  color: #98a2b3;
}

input:disabled {
  background: #eef2f6;
  color: #98a2b3;
}

.ghost-input {
  visibility: hidden;
}

.locked {
  border-color: #e3e8ef;
  background: #eef2f6;
  color: var(--muted);
}

.validation-box {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
}

.validation-box.empty {
  display: none;
}

.validation-box p {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  line-height: 1.35;
}

.split-preview {
  grid-column: 1 / -1;
  display: block;
}

.split-tree {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    ". total total ."
    "short short live live"
    ". . videoLive direct"
    "material material liveRange liveRange"
    "talent talent talent talent";
  gap: 5px;
  padding: 7px 9px 9px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.split-tree::before,
.split-tree::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-color: #cbd8e5;
  opacity: 0.9;
}

.split-tree::before {
  top: 52px;
  left: 25%;
  right: 25%;
  height: 28px;
  border-top: 2px solid #cbd8e5;
  border-left: 2px solid #cbd8e5;
  border-right: 2px solid #cbd8e5;
}

.split-tree::after {
  top: 111px;
  left: 62.5%;
  right: 12.5%;
  height: 24px;
  border-top: 2px dashed #d7dee9;
  border-left: 2px dashed #d7dee9;
  border-right: 2px dashed #d7dee9;
}

.split-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 6px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.split-total {
  grid-area: total;
  min-height: 46px;
  border-color: rgba(22, 100, 255, 0.28);
  background: #eef5ff;
  color: var(--ink);
}

.split-short {
  grid-area: short;
  border-color: rgba(22, 100, 255, 0.3);
  background: #edf3ff;
}

.split-live {
  grid-area: live;
  border-color: rgba(245, 158, 11, 0.35);
  background: #fff7e8;
}

.split-video-live {
  grid-area: videoLive;
  border-color: rgba(22, 100, 255, 0.18);
  background: rgba(237, 243, 255, 0.62);
}

.split-direct {
  grid-area: direct;
  border-color: rgba(254, 44, 85, 0.18);
  background: rgba(255, 240, 244, 0.62);
}

.split-node span,
.split-range b {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 860;
}

.split-node strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  font-weight: 940;
}

.split-node small,
.split-range span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
  font-weight: 720;
}

.split-total span,
.split-total strong,
.split-total small {
  color: var(--ink);
}

.split-range {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 25px;
  padding: 4px 7px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
}

.split-material {
  grid-area: material;
  border-color: rgba(22, 100, 255, 0.28);
  background: rgba(237, 243, 255, 0.72);
}

.split-live-range {
  grid-area: liveRange;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(255, 247, 230, 0.76);
}

.split-talent-range {
  grid-area: talent;
  justify-content: flex-start;
  border-style: dashed;
  background: #f8fafc;
}

.dynamic-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 8px 10px;
}

.dynamic-split::before,
.dynamic-split::after {
  display: none;
}

.split-total-card {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 10px;
  border: 2px solid rgba(22, 100, 255, 0.24);
  border-radius: 9px;
  background: #eef5ff;
  text-align: center;
}

.split-total-card span,
.split-label b,
.split-range b {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 880;
}

.split-total-card strong,
.split-label strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  font-weight: 940;
}

.split-total-card small,
.split-label small,
.split-range span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
  font-weight: 760;
}

.split-bar,
.split-label-row,
.split-live-detail,
.split-range-grid {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.split-bar {
  height: 18px;
}

.split-bar i {
  display: block;
  min-width: 3px;
  border-radius: 8px;
}

.seg-short {
  background: linear-gradient(135deg, #dce8ff, #b8ceff);
  border: 1px solid rgba(22, 100, 255, 0.28);
}

.seg-live {
  background: linear-gradient(135deg, #fff2dc, #ffd69a);
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.seg-video-live {
  background: linear-gradient(135deg, #edf3ff, #c7d8ff);
  border: 1px solid rgba(22, 100, 255, 0.2);
}

.seg-direct {
  background: linear-gradient(135deg, #fff0f4, #ffc6d4);
  border: 1px solid rgba(254, 44, 85, 0.2);
}

.split-label {
  min-width: 0;
  display: grid;
  gap: 3px;
  justify-items: center;
  min-height: 56px;
  padding: 6px 8px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.split-short-label,
.split-video-live-label {
  border-color: rgba(22, 100, 255, 0.18);
  background: rgba(237, 243, 255, 0.62);
}

.split-live-label {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(255, 247, 230, 0.72);
}

.split-direct-label {
  border-color: rgba(254, 44, 85, 0.18);
  background: rgba(255, 240, 244, 0.62);
}

.split-live-detail > div:last-child {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.split-range-grid .split-range {
  min-width: 0;
}

.dynamic-split .split-talent-range {
  grid-area: auto;
}

.flow-branch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.flow-node,
.cap-card {
  position: relative;
  overflow: hidden;
  padding: 9px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: #fff;
}

.flow-node::before,
.cap-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
}

.flow-live::before,
.flow-video-live::before {
  background: var(--blue);
}

.flow-direct::before {
  background: var(--amber);
}

.flow-video::before {
  background: var(--green);
}

.flow-total {
  display: grid;
  align-content: center;
  background: linear-gradient(135deg, #10212c, #0f766e);
}

.flow-total span,
.flow-total strong,
.flow-total small {
  color: #fff !important;
  opacity: 1;
}

.flow-total mark {
  color: #fff;
}

.split-preview span,
.cap-card span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-preview strong,
.cap-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.1;
  font-weight: 880;
}

.flow-node small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.22;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-formulas {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 8px 10px;
  border: 1px dashed #cbd8e5;
  border-radius: 9px;
  background: #f8fafc;
}

.flow-formulas b {
  color: var(--ink);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 880;
}

.flow-formulas span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.business-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.business-fields.hidden,
.hidden {
  display: none;
}

.business-fields .section-title {
  grid-column: 1 / -1;
}

.lead-incentive-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 0.86fr) minmax(0, 1.28fr);
  gap: 8px;
}

.incentive-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(28, 44, 74, 0.05);
}

.incentive-card header {
  display: grid;
  gap: 2px;
  padding-left: 8px;
  border-left: 3px solid var(--brand);
}

.incentive-card header b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.15;
  font-weight: 930;
}

.incentive-card header small,
.auto-service-note span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 720;
}

.search-incentive {
  border-color: rgba(217, 119, 6, 0.26);
  background: linear-gradient(180deg, #fffaf0, #fff);
}

.search-incentive header {
  border-left-color: #d97706;
}

.coverage-incentive {
  border-color: rgba(8, 127, 140, 0.22);
  background: linear-gradient(180deg, #f0fdfa, #fff);
}

.coverage-incentive header {
  border-left-color: var(--accent);
}

.penetration-incentive {
  border-color: rgba(22, 100, 255, 0.22);
  background: linear-gradient(180deg, #f3f7ff, #fff);
}

.penetration-incentive header {
  border-left-color: var(--brand);
}

.incentive-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.auto-service-note {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px dashed rgba(8, 127, 140, 0.28);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.8);
}

.auto-service-note b {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.incentive-card-grid.hidden,
.auto-service-note.hidden {
  display: none;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1.15fr 0.88fr 0.97fr;
  gap: 8px;
  min-height: 0;
}

.result-hero {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 9px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(22, 100, 255, 0.92) 55%, rgba(254, 44, 85, 0.86)),
    #1664ff;
  box-shadow: var(--shadow);
}

.structure-panel {
  display: none;
}

.results > .panel:nth-child(3) {
  grid-column: 1;
  grid-row: 2;
  overflow: hidden;
  padding: 10px;
}

.results > .panel:nth-child(4) {
  display: none;
}

.result-hero span {
  display: block;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 820;
}

.result-hero strong {
  display: block;
  margin-top: 5px;
  color: #fff;
  font-size: 48px;
  line-height: 0.92;
  font-weight: 950;
  letter-spacing: 0;
}

.hero-meta {
  display: grid;
  gap: 7px;
  justify-items: end;
  text-align: right;
  flex: 0 0 auto;
}

.hero-meta b {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.hero-meta small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 760;
  white-space: nowrap;
}

.result-hero mark,
.stack-bar mark {
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}

.structure-panel {
  overflow: visible;
}

.structure-viz {
  display: grid;
  gap: 10px;
  height: calc(100% - 30px);
  grid-template-rows: 38px minmax(0, 1fr);
}

.stack-bar {
  display: flex;
  min-width: 0;
  height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #eef3fb;
}

.stack-bar span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 0 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-video {
  background: linear-gradient(135deg, #16a66a, #0d8b68);
}

.bar-video-live {
  background: linear-gradient(135deg, #1664ff, #00a6a6);
}

.bar-direct {
  background: linear-gradient(135deg, #f59e0b, #fe2c55);
}

.structure-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.structure-cards article {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.structure-cards span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
}

.structure-cards strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  font-weight: 920;
}

.structure-cards small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.18;
}

.summary-strip article {
  min-width: 0;
  padding: 14px;
  border-radius: 10px;
  color: #fff;
  display: grid;
  align-content: space-between;
  box-shadow: var(--shadow);
}

.summary-strip article:nth-child(1) {
  background: linear-gradient(135deg, #142635, #08756f);
}

.summary-strip article:nth-child(2) {
  background: linear-gradient(135deg, #273f67, #315b91);
}

.summary-strip article:nth-child(3) {
  background: linear-gradient(135deg, #744c14, #b66a12);
}

.summary-strip span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 780;
}

.summary-strip strong {
  color: #fff;
  font-size: 29px;
  line-height: 1;
  font-weight: 920;
  letter-spacing: 0;
}

.cap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  height: auto;
}

.cap-card.selected {
  border-color: rgba(8, 117, 111, 0.34);
  background: var(--green-soft);
}

.breakdown {
  height: calc(100% - 30px);
  overflow: auto;
  display: block;
  padding-right: 0;
}

.metric-section {
  overflow: visible;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: #fff;
  margin-bottom: 4px;
}

.metric-section:last-child {
  margin-bottom: 0;
}

.metric-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 10px;
  background: linear-gradient(90deg, #f5f8ff, #fff);
  border-bottom: 1px solid var(--soft-line);
}

.metric-section header span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.metric-section header b {
  color: var(--brand);
  font-size: 14px;
  line-height: 1;
  font-weight: 950;
}

.metric-head {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 84px;
  gap: 7px;
  align-items: center;
  padding: 3px 10px;
  border-bottom: 1px solid var(--soft-line);
  background: #fbfdff;
}

.metric-head span {
  color: #7a8799;
  font-size: 10px;
  line-height: 1;
  font-weight: 860;
  text-align: right;
}

.metric-head span:first-child {
  text-align: left;
}

.metric-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 84px;
  gap: 7px;
  align-items: center;
  min-height: 25px;
  padding: 2px 10px;
  border-bottom: 1px solid var(--soft-line);
  background: #fff;
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-main {
  min-width: 0;
}

.metric-type {
  color: #526071;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 820;
}

.metric-row strong {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 860;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.metric-row small {
  display: none;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-meta {
  margin-top: 2px;
  color: #7a8799 !important;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e7f3f1;
  color: #075b56;
  font-size: 10px;
  font-weight: 860;
}

.metric-got {
  justify-self: end;
  white-space: nowrap;
  text-align: right;
}

.metric-got {
  color: var(--brand);
  font-size: 15px;
  line-height: 1;
  font-weight: 900;
}

.metric-got.hit,
.metric-got.miss {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.metric-got.miss {
  color: #98a2b3;
}

.metric-got.cost {
  color: #c2410c;
}

.hit,
.miss,
#healthBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 860;
}

.hit,
#healthBadge.good {
  background: var(--green-soft);
  color: #076046;
}

.miss {
  background: #edf2f7;
  color: var(--muted);
}

#healthBadge.bad {
  background: var(--red-soft);
  color: var(--red);
}

.notes {
  height: auto;
  max-height: 54px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 4px;
}

.notes p {
  margin: 0;
  padding: 6px 9px;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
  color: #2b3744;
  font-size: 11px;
  line-height: 1.42;
}

.auth-locked .app-shell {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.auth-gate,
.admin-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 20% 12%, rgba(254, 44, 85, 0.2), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(0, 242, 234, 0.22), transparent 28%),
    rgba(8, 14, 32, 0.66);
  backdrop-filter: blur(8px);
}

.auth-gate.hidden,
.admin-drawer.hidden {
  display: none;
}

.auth-card,
.admin-panel {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.32);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.auth-brand {
  display: grid;
  gap: 5px;
}

.auth-brand span,
.admin-panel header span {
  color: #d97706;
  font-size: 12px;
  font-weight: 900;
}

.auth-brand strong {
  color: var(--ink);
  font-size: 25px;
  line-height: 1.1;
  font-weight: 950;
}

.auth-brand small,
.auth-card p,
.admin-content p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 760;
}

.auth-card input,
.admin-login input,
.admin-create input {
  height: 42px;
  border-radius: 10px;
  font-size: 14px;
}

.auth-card button,
.admin-login button,
.admin-create button,
.admin-panel header button,
.admin-table button {
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #111827, #1664ff 58%, #00a6a6);
  color: #fff;
  font-size: 13px;
  font-weight: 930;
}

.auth-card-actions {
  display: flex;
  justify-content: center;
  margin-top: -4px;
}

.auth-card .auth-admin-button {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(234, 88, 12, 0.28);
  background: #fff7ed;
  color: #c2410c;
  box-shadow: none;
}

.auth-card button:hover,
.admin-login button:hover,
.admin-create button:hover,
.admin-panel header button:hover,
.admin-table button:hover {
  transform: translateY(-1px);
}

.admin-panel {
  width: min(880px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  padding: 16px;
}

.admin-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.admin-panel header strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
}

.admin-panel header button {
  width: 68px;
  background: #eef2f7;
  color: var(--ink);
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
  padding-top: 14px;
}

.admin-content {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.admin-login.hidden,
.admin-content.hidden {
  display: none;
}

.admin-create {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 150px 116px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(217, 119, 6, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.9), rgba(255, 255, 255, 0.96));
}

.admin-create label {
  gap: 5px;
}

.admin-create label span {
  color: #7c2d12;
  font-size: 11px;
  font-weight: 900;
}

.admin-create p {
  grid-column: 1 / -1;
  color: #7c2d12;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 780;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-summary article {
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #f8fafc;
}

.admin-summary span,
.admin-table small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.admin-summary b {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
}

.admin-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr 0.78fr 1.5fr 1.1fr 128px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--soft-line);
  background: #fff;
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-row.header {
  background: #f2f6fb;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.admin-row b {
  color: var(--ink);
  font-size: 12px;
}

.license-code-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  align-items: center;
}

.license-code-cell small {
  grid-column: 1 / 2;
}

.admin-table .copy-code-button {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  width: 46px;
  height: 26px;
  justify-self: end;
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(255, 247, 237, 0.95);
  color: var(--warm);
}

.admin-row em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.admin-row .status-ok {
  color: var(--green);
}

.admin-row .status-bad {
  color: var(--red);
}

.admin-table button {
  width: 58px;
  height: 30px;
  justify-self: end;
  background: #eef2f7;
  color: var(--ink);
  box-shadow: none;
}

.admin-actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.results .panel:last-child .cap-grid {
  height: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 8px;
}

.results .panel:last-child .cap-card {
  padding: 8px 10px;
}

@media (max-width: 1120px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .precheck-title {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  .precheck-title span {
    white-space: normal;
  }

  .precheck-actions {
    display: none;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .results {
    grid-template-columns: 1fr;
    grid-template-rows: 104px minmax(0, 1fr);
  }

  .structure-panel,
  .results > .panel:nth-child(3),
  .results > .panel:nth-child(4) {
    grid-column: 1;
  }

  .structure-panel {
    display: none;
  }

  .results > .panel:nth-child(3) {
    grid-row: 2;
  }

  .results > .panel:nth-child(4) {
    display: none;
  }
}

@media (max-width: 900px) {
  .screen-stage {
    grid-template-columns: 1fr;
    grid-template-rows: 250px minmax(0, 1fr);
  }

  .screen-input {
    display: grid;
  }

  .screen-result {
    display: grid;
  }

  .screen-tabs {
    display: none;
  }

  .app-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 16px, 1500px);
    padding-top: 8px;
  }

  .toolbar {
    align-items: center;
    flex-direction: row;
    height: auto;
    padding: 10px 12px;
  }

  h1 {
    font-size: 18px;
  }

  .eyebrow {
    display: none;
  }

  .toolbar-actions {
    width: auto;
    flex: 0 0 auto;
  }

  .primary-button {
    width: auto;
  }

  .logic-grid,
  .question-grid,
  .two-cols,
  .split-preview,
  .business-fields,
  .summary-strip,
  .cap-grid {
    grid-template-columns: 1fr;
  }

  .input-panel {
    grid-template-columns: 1fr;
  }

  .screen-input {
    grid-template-rows: minmax(0, 1fr);
  }

  .precheck-body {
    display: grid;
  }

  .question-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .spend-matrix {
    grid-template-columns: 1fr;
  }

  .matrix-head {
    display: none;
  }

  .result-hero {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .result-hero strong {
    font-size: 38px;
  }

  .hero-meta {
    gap: 6px;
  }

  .hero-meta small {
    font-size: 10px;
  }

  .structure-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .structure-cards article {
    padding: 8px;
  }

  .structure-cards strong {
    font-size: 15px;
  }

  .structure-cards small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .metric-row {
    grid-template-columns: 76px minmax(0, 1fr) 58px;
    gap: 6px;
  }

  .metric-head {
    grid-template-columns: 76px minmax(0, 1fr) 58px;
    gap: 6px;
  }
}
