:root {
  color-scheme: light;
  --bg: #edf2f5;
  --surface: #ffffff;
  --surface-soft: #f5f8fa;
  --ink: #172126;
  --muted: #60717c;
  --line: #d8e1e7;
  --primary: #0f6f6b;
  --primary-strong: #0a5655;
  --accent: #b24b39;
  --warning-bg: #fff6df;
  --warning-ink: #7a4c0d;
  --shadow: 0 24px 70px rgba(25, 43, 54, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 16px;
  background:
    linear-gradient(125deg, rgba(15, 111, 107, 0.12), rgba(15, 111, 107, 0) 34%),
    linear-gradient(205deg, rgba(178, 75, 57, 0.1), rgba(178, 75, 57, 0) 38%),
    var(--bg);
}

.tool-panel {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 18px;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.status-pill {
  flex: none;
  padding: 8px 10px;
  border-radius: 6px;
  background: #dff1ef;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.result-card,
.breakdown-panel,
.input-panel,
.detail-panel,
.error-panel {
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.result-card {
  min-height: 132px;
  padding: 16px;
  overflow: hidden;
}

.primary-result {
  background:
    linear-gradient(135deg, rgba(15, 111, 107, 0.95), rgba(10, 86, 85, 0.95)),
    var(--primary);
  color: #ffffff;
}

.money-result {
  background:
    linear-gradient(135deg, #ffffff, #f7fbfa 56%, #eef7f4),
    var(--surface);
}

.card-label {
  display: block;
  margin-bottom: 10px;
  color: currentColor;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.74;
}

.result-card strong {
  display: block;
  min-height: 42px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.result-card p {
  margin: 8px 0 0;
  color: currentColor;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.78;
}

.money-result strong {
  color: var(--accent);
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.breakdown-panel,
.input-panel,
.detail-panel,
.error-panel {
  margin-top: 12px;
  padding: 16px;
}

.breakdown-list {
  display: grid;
  gap: 10px;
}

.breakdown-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.breakdown-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.breakdown-item strong {
  color: var(--primary-strong);
  font-size: 18px;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.form-subtitle {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px dashed rgba(15, 111, 107, 0.35);
  border-radius: 8px;
  background: rgba(15, 111, 107, 0.06);
}

.form-subtitle strong {
  color: var(--primary-strong);
  font-size: 14px;
}

.form-subtitle small,
.toggle-copy small,
.detail-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field span {
  color: #31424b;
  font-size: 13px;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toggle-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.toggle-field input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-copy strong {
  color: #31424b;
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 111, 107, 0.14);
}

.field input.invalid,
.field select.invalid {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(178, 75, 57, 0.12);
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: #e7edf1;
  color: #25343c;
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-grid article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

li a {
  color: var(--primary-strong);
  font-size: 13px;
  line-height: 1.45;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.detail-note {
  margin-bottom: 14px;
}

.error-panel {
  background: #fff2ee;
  color: #8f2f20;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: none;
}

.error-panel ul {
  gap: 4px;
  padding-left: 18px;
  list-style: disc;
}

@media (min-width: 680px) {
  .app-shell {
    padding: 28px;
  }

  .tool-panel {
    padding: 24px;
  }

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

  .result-card {
    min-height: 150px;
    padding: 20px;
  }

  .result-card strong {
    font-size: 42px;
  }

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

  .form-subtitle {
    grid-column: 1 / -1;
  }

  .form-actions {
    grid-template-columns: auto auto auto;
    justify-content: end;
  }

  .primary-button,
  .secondary-button {
    min-width: 160px;
    padding: 0 18px;
  }
}

@media (min-width: 940px) {
  .tool-panel {
    padding-top: 36px;
  }

  h1 {
    font-size: 38px;
  }

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

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

  .breakdown-item {
    grid-template-columns: 1fr;
    align-content: space-between;
    min-height: 168px;
  }
}
