:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #657084;
  --line: #d9e0ea;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --blue: #1f6feb;
  --green: #0f8f70;
  --amber: #b36b00;
  --red: #c93c37;
  --shadow: 0 18px 55px rgba(31, 45, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.1), transparent 38%),
    linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 42px;
}

.hero {
  padding: 26px 0 28px;
}

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

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  margin: 0;
  color: #52657a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.brand-mark strong {
  color: var(--blue);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.summary {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ghost-button {
  min-width: 56px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.primary-button,
.text-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
  font-weight: 700;
}

.primary-button:hover {
  background: #185cc4;
}

.text-button {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
}

.text-button:hover {
  color: var(--ink);
  background: var(--soft);
}

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

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.label-with-help,
.tax-burden-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #9aa8ba;
  border-radius: 50%;
  padding: 0;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.help-button.inverse {
  border-color: rgba(255, 255, 255, 0.78);
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.help-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 10;
  width: min(280px, 78vw);
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff;
  background: #263246;
  box-shadow: 0 10px 26px rgba(31, 45, 61, 0.18);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(0, 6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.help-button:hover::after,
.help-button:focus-visible::after {
  opacity: 1;
  transform: translate(0, 0);
}

.field input,
.field select,
.cost-row input,
.cost-row select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.field input:focus,
.field select:focus,
.cost-row input:focus,
.cost-row select:focus {
  outline: 3px solid rgba(31, 111, 235, 0.16);
  border-color: var(--blue);
}

.money-input {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.money-input span {
  text-align: center;
  color: var(--muted);
}

.money-input input {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
}

.costs {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
}

.cost-row {
  display: grid;
  grid-template-columns: minmax(88px, 0.8fr) minmax(120px, 1fr) minmax(140px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.cost-row:first-child {
  border-top: 0;
}

.cost-row label {
  color: var(--ink);
  font-weight: 700;
}

.header-row {
  min-height: 42px;
  color: var(--muted);
  background: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.settings {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.settings summary {
  cursor: pointer;
  font-weight: 700;
}

.settings-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.settings .field-grid {
  margin-top: 16px;
}

.calculate-actions {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.calculate-button {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}

.calculate-actions small {
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.checkbox-field {
  grid-template-columns: 20px 1fr;
  align-items: center;
  min-height: 44px;
  margin-top: 22px;
}

.checkbox-field input {
  min-height: 18px;
}

.total-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #1f6feb, #0f8f70);
}

.total-card span,
.total-card small {
  opacity: 0.88;
}

.total-card strong {
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span,
.breakdown dt {
  color: var(--muted);
  font-size: 13px;
}

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

.breakdown {
  margin-top: 20px;
  padding: 18px;
  border-radius: 8px;
  background: var(--soft);
}

.breakdown dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.breakdown dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.notice {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.notice p {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--blue);
  background: rgba(31, 111, 235, 0.08);
  color: #263246;
  line-height: 1.6;
}

.notice p.warning {
  border-color: var(--amber);
  background: rgba(179, 107, 0, 0.1);
}

.notice p.danger {
  border-color: var(--red);
  background: rgba(201, 60, 55, 0.1);
}

.survey {
  margin-top: 18px;
  border: 1px solid rgba(31, 111, 235, 0.22);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(31, 111, 235, 0.08), rgba(255, 255, 255, 0.96));
}

.survey h3 {
  margin-bottom: 8px;
}

.survey p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.survey .survey-privacy {
  margin-top: 8px;
  font-size: 13px;
}

.survey-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.survey-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.survey-form {
  display: grid;
  gap: 16px;
}

.survey-question {
  display: grid;
  gap: 10px;
}

.survey-question > span,
.survey-message > span {
  color: var(--ink);
  font-weight: 700;
}

.choice-grid,
.choice-list {
  display: grid;
  gap: 8px;
}

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

.choice-grid label,
.choice-list label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344055;
  font-size: 14px;
  line-height: 1.4;
}

.choice-grid input,
.choice-list input {
  margin-top: 2px;
}

.survey-message {
  display: grid;
  gap: 10px;
}

.survey-message textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  line-height: 1.6;
  font: inherit;
}

.survey-message textarea:focus {
  outline: 3px solid rgba(31, 111, 235, 0.16);
  border-color: var(--blue);
}

.survey-submit {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.survey-submit small {
  color: var(--muted);
  line-height: 1.5;
}

.survey-thanks {
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  background: rgba(15, 143, 112, 0.1);
}

.hidden {
  display: none;
}

.policy {
  margin-top: 22px;
  padding: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.policy article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.policy p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.disclaimer {
  margin-top: 16px;
  font-size: 13px;
}

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

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .hero-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

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

  .field-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .cost-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .header-row {
    display: none;
  }

  .survey-intro,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .survey-actions,
  .survey-submit {
    align-items: stretch;
    flex-direction: column;
  }
}
