﻿:root {
  --navy: #173f35;
  --blue: #2f6a58;
  --blue-600: #245648;
  --blue-100: #eef5ef;
  --gold: #c29a5b;
  --gold-soft: #e8d3ac;
  --ink: #222c26;
  --muted: #68746d;
  --line: #d9d9ce;
  --bg: #f5f1e7;
  --card: #fffefa;
  --green: #2e7d5b;
  --green-bg: #edf6ef;
  --red: #a33b2f;
  --red-bg: #fbefec;
  --amber: #a96f22;
  --shadow: 0 18px 44px rgba(35, 47, 36, 0.08);
  --shadow-soft: 0 8px 22px rgba(35, 47, 36, 0.06);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  position: relative;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(194, 154, 91, 0.13), transparent 30rem),
    radial-gradient(circle at 96% 16%, rgba(47, 106, 88, 0.11), transparent 32rem),
    radial-gradient(circle at 50% 100%, rgba(194, 154, 91, 0.06), transparent 36rem),
    linear-gradient(180deg, #fbf8f0 0%, var(--bg) 42%, #f4efe3 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    repeating-linear-gradient(0deg, rgba(50, 52, 43, 0.018) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 7px);
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 32px 32px;
  color: #fffdf6;
  background:
    radial-gradient(circle at 93% 4%, rgba(232, 211, 172, 0.27), transparent 17rem),
    radial-gradient(circle at 2% 100%, rgba(255, 255, 255, 0.08), transparent 19rem),
    linear-gradient(126deg, #102e27 0%, #1b4b3f 54%, #2f6a58 100%);
  border: 1px solid rgba(232, 211, 172, 0.38);
  border-radius: 26px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -24px 46px rgba(8, 24, 20, 0.12),
    0 28px 62px rgba(18, 54, 46, 0.24);
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(232, 211, 172, 0.30);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgba(232, 211, 172, 0.035), 0 0 0 76px rgba(232, 211, 172, 0.025);
}

.brand { display: flex; gap: 18px; align-items: center; position: relative; z-index: 1; }

.logo {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.20), rgba(194, 154, 91, 0.22));
  border: 1px solid rgba(232, 211, 172, 0.62);
  color: #fff9eb;
  font-size: 27px;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -10px 20px rgba(20, 45, 39, 0.16),
    0 10px 22px rgba(8, 24, 20, 0.15);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero .eyebrow { color: #e8d3ac; }

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 12px rgba(5, 20, 16, 0.20);
}

.hero-sub {
  max-width: 730px;
  margin-bottom: 0;
  color: #e2ebe1;
  font-size: 15.5px;
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.version {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 14px;
  border: 1px solid rgba(255, 249, 235, 0.64);
  border-radius: 999px;
  background: linear-gradient(180deg, #ead3a5 0%, #c29a5b 100%);
  color: #16332a;
  font-weight: 800;
  font-size: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 7px 16px rgba(9, 29, 23, 0.20);
}

.local-badge {
  padding: 6px 11px;
  border: 1px solid rgba(232, 211, 172, 0.18);
  border-radius: 10px;
  background: rgba(8, 27, 22, 0.30);
  color: #f0efdf;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  margin: 18px 0 14px;
  padding: 7px;
  overflow-x: auto;
  background: rgba(255, 253, 247, 0.86);
  border: 1px solid rgba(216, 211, 196, 0.94);
  border-radius: 15px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 10px 28px rgba(35, 47, 36, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1 0 auto;
  min-width: 128px;
  min-height: 44px;
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: 160ms ease;
}

.tab:hover { background: #eff4eb; color: var(--blue); }
.tab.active {
  background: linear-gradient(180deg, #2f6a58 0%, #1b4b3f 100%);
  color: #fffdf6;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -3px 0 var(--gold),
    0 9px 20px rgba(18, 54, 46, 0.22);
}
.tab:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(194, 154, 91, 0.34);
  outline-offset: 2px;
}

.card, .panel > .card {
  background: linear-gradient(180deg, #fffefa 0%, #fffdf8 100%);
  border: 1px solid #e1ddce;
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 1px 2px rgba(35, 47, 36, 0.035),
    var(--shadow);
  padding: 24px;
}

.shared-card { margin-bottom: 16px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-head.compact { margin-bottom: 14px; }
.card-head h2 { margin-bottom: 0; font-size: 21px; color: var(--navy); }
.hint { color: var(--muted); font-size: 13px; }
.card-head .eyebrow { color: var(--gold); }

.panel { animation: panel-in 180ms ease; }
.panel[hidden] { display: none !important; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 2px 14px;
}

.section-head .eyebrow { color: var(--gold); }

.section-head h2 {
  margin-bottom: 5px;
  color: var(--navy);
  font-size: clamp(24px, 3vw, 31px);
  line-height: 1.25;
  letter-spacing: -0.022em;
}

.section-head p:last-child { margin-bottom: 0; color: var(--muted); font-size: 15px; }

.badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  margin-bottom: 4px;
  padding: 4px 11px;
  border: 1px solid #decda9;
  border-radius: 999px;
  background: linear-gradient(180deg, #fbf6e9, #f2e8d3);
  color: #765225;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 5px rgba(80, 60, 30, 0.05);
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field.full { margin-top: 14px; }
.field > span { color: #3d4a40; font-size: 13.5px; font-weight: 800; }
.field small { color: var(--muted); font-size: 12px; font-weight: 600; }

input[type="number"], input[type="text"], textarea {
  width: 100%;
  min-height: 47px;
  padding: 10px 12px;
  border: 1px solid #d4d1c1;
  border-radius: 11px;
  background: linear-gradient(180deg, #fffefa, #fbf8ef);
  color: var(--ink);
  font-size: 16px;
  box-shadow:
    inset 0 1px 2px rgba(35, 47, 36, 0.055),
    0 1px 0 rgba(255, 255, 255, 0.95);
  transition: 150ms ease;
}

input[type="number"]:focus, input[type="text"]:focus, textarea:focus {
  border-color: var(--blue);
  background: #fffefa;
  box-shadow:
    0 0 0 4px rgba(194, 154, 91, 0.17),
    inset 0 1px 2px rgba(35, 47, 36, 0.045);
  outline: 0;
}

textarea {
  min-height: 190px;
  resize: vertical;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 14px;
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid #d5cebb;
  border-radius: 11px;
  background: linear-gradient(180deg, #fffefa 0%, #f8f3e7 100%);
  color: var(--navy);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 2px 5px rgba(35, 47, 36, 0.045);
  transition: 150ms ease;
  user-select: none;
}

.btn:hover {
  border-color: #a8bda9;
  background: linear-gradient(180deg, #fffefa 0%, #f2f7ed 100%);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 7px 16px rgba(35, 47, 36, 0.08);
}
.btn:active { transform: none; box-shadow: inset 0 1px 3px rgba(35, 47, 36, 0.10); }
.btn.primary {
  border-color: #173f35;
  background: linear-gradient(180deg, #2f6a58 0%, #1b4b3f 100%);
  color: #fffdf6;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12),
    0 9px 20px rgba(23, 63, 53, 0.25);
}
.btn.primary:hover { background: linear-gradient(180deg, #35745f 0%, #214f43 100%); border-color: #214f43; }
.btn.ghost { border-style: dashed; background: transparent; color: var(--muted); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.file-btn { position: relative; }

.result-strip, .stat-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.result-strip { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat, .result-chip {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid #ddd9c9;
  border-radius: 13px;
  background: linear-gradient(180deg, #fdfbf4 0%, #f7f2e6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 4px 12px rgba(35, 47, 36, 0.04);
}

.stat-label, .result-chip .label { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.stat-value, .result-chip .value { display: block; margin-top: 3px; color: var(--navy); font-size: 23px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.stat-value.small { font-size: 16px; }
.stat.green { border-color: #c6ddca; background: linear-gradient(180deg, #f2f9f2, #e8f3e8); }
.stat.green .stat-value { color: var(--green); }
.stat.red { border-color: #ecc8c1; background: linear-gradient(180deg, #fdf3ef, #f8e9e4); }
.stat.red .stat-value { color: var(--red); }

.result-chip.ok { border-color: #c6ddca; background: linear-gradient(180deg, #f2f9f2, #e8f3e8); }
.result-chip.bad { border-color: #ecc8c1; background: linear-gradient(180deg, #fdf3ef, #f8e9e4); }
.result-chip.ok .value { color: var(--green); }
.result-chip.bad .value { color: var(--red); }

.chart-card {
  position: relative;
  margin-top: 16px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid #e0dccd;
  border-radius: 15px;
  background: linear-gradient(180deg, #fffefa 0%, #faf7ee 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 8px 18px rgba(35, 47, 36, 0.045);
}

.chart-card canvas { display: block; width: 100%; height: auto; }

.table-wrap { margin-top: 16px; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: linear-gradient(180deg, #f5f1e5, #f0ecdf); font-size: 12px; letter-spacing: 0.03em; }
tbody tr:hover { background: rgba(236, 243, 236, 0.58); }
td.num { font-variant-numeric: tabular-nums; }

.slider-block { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(180deg, #fcfaf3, #f7f2e6); }
.slider-label { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.slider-label strong { color: var(--navy); }

input[type="range"] {
  width: 100%;
  height: 28px;
  accent-color: var(--blue);
  cursor: pointer;
}

.inline-note { margin: 12px 2px 0; color: var(--muted); font-size: 13px; }

.report {
  max-height: 440px;
  margin: 18px 0 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, #fcfaf3, #f8f3e7);
  color: #2c3831;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 2px rgba(35, 47, 36, 0.04);
}

.footer { margin-top: 28px; padding: 10px 4px 0; color: var(--muted); font-size: 12px; text-align: center; }
.footer p { margin-bottom: 4px; }
.link-btn { padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(90vw, 520px);
  padding: 11px 16px;
  border: 1px solid rgba(232, 211, 172, 0.24);
  border-radius: 12px;
  background: rgba(17, 46, 39, 0.96);
  color: #fffdf6;
  font-size: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 14px 34px rgba(18, 54, 46, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: rgba(128, 42, 32, 0.97); }

.loading { position: relative; pointer-events: none; opacity: 0.65; }
.loading::after { content: "计算中…"; margin-left: 8px; font-size: 12px; font-weight: 600; }

@media (max-width: 860px) {
  .page-shell { width: min(100% - 22px, 760px); padding-top: 12px; }
  .hero { padding: 24px; border-radius: 22px; }
  .hero-meta { position: absolute; top: 20px; right: 20px; }
  .local-badge { display: none; }
  .brand { padding-right: 52px; }
  .section-head { align-items: flex-start; }
  .badge { display: none; }
  .field-grid.four, .field-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid.process-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .page-shell { width: calc(100% - 18px); padding-bottom: 28px; }
  .hero { padding: 21px 18px; border-radius: 19px; }
  .brand { gap: 10px; padding-right: 34px; }
  .logo { width: 46px; height: 46px; border-radius: 13px; font-size: 21px; }
  h1 { font-size: 22px; }
  .hero-sub { font-size: 14px; }
  .version { padding: 3px 10px; font-size: 12px; }
  .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 12px -4px; border-radius: 13px; overflow: visible; }
  .tab { min-width: 0; padding: 8px 3px; font-size: 13px; }
  .card { padding: 18px; border-radius: 17px; }
  .section-head { margin-top: 18px; }
  .section-head h2 { font-size: 25px; }
  .field-grid.three { grid-template-columns: 1fr; }
  .field-grid.four, .field-grid.process-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 20px; }
  .btn { flex: 1 1 auto; min-width: 120px; padding: 10px 13px; }
  .chart-card { padding: 6px; margin-left: -4px; margin-right: -4px; }
  textarea { min-height: 220px; }
  th, td { padding: 9px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}