:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #66736c;
  --line: #d9e2dc;
  --panel: #ffffff;
  --page: #f3f6f4;
  --accent: #0f766e;
  --accent-2: #b45309;
  --navy: #1e3a4a;
  --good: #16803c;
  --bad: #b42318;
  --warn: #a15c07;
  --soft: #edf5f1;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), transparent 30%),
    linear-gradient(315deg, rgba(30, 58, 74, 0.08), transparent 38%),
    linear-gradient(180deg, #fbfcfa 0, var(--page) 420px);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: 100%;
  margin: 0;
  padding: 28px 0 0;
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.tool-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 36px rgba(21, 47, 38, 0.07);
}

.tool-brand {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.tool-brand img {
  width: 96px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.tool-brand span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tool-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tool-tabs span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--muted);
  background: #fbfdfb;
  font-size: 13px;
  font-weight: 750;
}

.tool-tabs .active {
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--accent);
  background: var(--soft);
}

.tool-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(237, 245, 241, 0.84)),
    radial-gradient(circle at 86% 20%, rgba(180, 83, 9, 0.1), transparent 28%);
  box-shadow: 0 18px 55px rgba(21, 47, 38, 0.08);
}

.hero-copy {
  min-width: 0;
}

.breadcrumb {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.05;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

.hero-subtitle {
  max-width: 620px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.feature-chips span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 800;
}

.quick-summary {
  min-width: 172px;
  display: grid;
  align-content: center;
  padding: 16px 18px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.quick-summary span,
.metric span,
.field span,
.result-hero span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.quick-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 55px rgba(21, 47, 38, 0.08);
}

.input-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.result-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-title.compact {
  margin-top: 2px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-kicker,
.decision-head span {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: var(--soft);
  cursor: pointer;
  font-size: 20px;
}

.primary-button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.primary-button:disabled {
  border-color: #9bb3aa;
  background: #9bb3aa;
  cursor: wait;
}

.rate-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.rate-tools p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rate-tools p[data-tone="success"] {
  color: var(--good);
}

.rate-tools p[data-tone="error"] {
  color: var(--bad);
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd8d1;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfdfb;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.result-hero {
  min-height: 148px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 22px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #0f766e, #164e63);
}

.decision-head {
  display: grid;
  gap: 0;
  padding: 2px 2px 0;
}

.result-hero.loss {
  background: linear-gradient(135deg, #a11d16, #7f1d1d);
}

.result-hero.warn {
  background: linear-gradient(135deg, #9a5b0a, #854d0e);
}

.result-hero span,
.result-hero small {
  color: rgba(255, 255, 255, 0.78);
}

.result-hero strong {
  font-size: clamp(38px, 6vw, 58px);
  line-height: 0.95;
}

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

.metric {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.metric strong {
  font-size: 22px;
}

.breakdown,
.target-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.breakdown-head span {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.bar-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.bar-row b {
  color: var(--ink);
  text-align: right;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ece8;
}

.bar-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

#platformBar {
  background: #2563eb;
}

#logisticsBar {
  background: var(--accent-2);
}

#marketingBar {
  background: #7c3aed;
}

.target-box p {
  color: var(--muted);
  line-height: 1.55;
}

.target-box strong {
  color: var(--ink);
}

.hint {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.tool-footer {
  margin-top: 28px;
  padding: 28px max(18px, calc((100% - 1180px) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 16px;
  font-weight: 650;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 16px 0 0;
  }

  .workspace {
    width: min(100% - 20px, 1180px);
  }

  .tool-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .tool-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-tabs {
    justify-content: flex-start;
  }

  h1 {
    font-size: 36px;
  }

  .field-grid.two,
  .field-grid.three,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .result-panel {
    padding: 14px;
  }

  .quick-summary {
    width: 100%;
  }

  .rate-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-footer {
    padding: 28px 14px;
    font-size: 14px;
  }
}
