:root {
  color-scheme: light;
  --bg: #eef5ff;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #63718a;
  --line: #d8e6f7;
  --accent: #1267d8;
  --accent-dark: #0b4fa8;
  --gold: #2f7de1;
  --red: #b42318;
  --green: #1267d8;
  --shadow: 0 18px 48px rgba(18, 72, 130, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 8%, rgba(45, 126, 225, 0.18), transparent 28%),
    linear-gradient(180deg, #f6fbff 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

.privacy-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 24px 72px rgba(18, 72, 130, 0.22);
}

.privacy-dialog::backdrop {
  background: rgba(23, 32, 51, 0.52);
}

.privacy-dialog form {
  padding: 26px;
}

.privacy-dialog h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.privacy-dialog p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.privacy-dialog button {
  width: 100%;
  margin-top: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 29px;
  font-weight: 800;
}

.brand-slogan {
  display: grid;
  justify-items: end;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-slogan span {
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 42px);
  letter-spacing: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 22px;
  padding: 22px clamp(18px, 4vw, 48px) 40px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 22px;
}

.report-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  overflow: hidden;
}

.section-heading {
  margin: 22px 0 12px;
}

.section-heading:first-child {
  margin-top: 0;
}

.section-heading h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.section-heading p,
.message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

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

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

label {
  display: grid;
  gap: 7px;
  color: #34443c;
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd8d1;
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input,
select {
  min-height: 42px;
}

textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.6;
}

.date-parts {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.9fr;
  gap: 7px;
}

.date-part {
  text-align: center;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

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

.algorithm-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
}

.algorithm-card .section-heading {
  margin-top: 0;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.manager-grid {
  margin-top: 12px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.secondary:hover {
  background: #eef5f1;
}

.print-btn {
  white-space: nowrap;
}

.export-box {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.export-status {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.export-status a {
  color: var(--accent);
  font-weight: 700;
}

.public-footer {
  padding: 24px 20px 30px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  text-align: center;
}

.public-footer p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.public-footer a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.public-footer a:hover,
.public-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

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

.record-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
}

.record-item strong {
  display: block;
  margin-bottom: 4px;
}

.record-item span {
  color: var(--muted);
  font-size: 12px;
}

.record-item button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.record-item button.delete {
  background: #fff;
  color: var(--red);
  border: 1px solid #f0c7c2;
}

.summary-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: #fff;
}

.summary-table th,
.summary-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

.summary-table th {
  color: #34443c;
  background: #edf5ff;
  font-weight: 800;
}

.summary-table tr:last-child td {
  border-bottom: 0;
}

.report {
  padding: 28px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.report-title {
  margin: -28px -28px 18px;
  padding: 28px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, #0964d8 0%, #0f7fe8 58%, #1f9af1 100%);
  color: #fff;
}

.report-title p {
  margin-bottom: 8px;
  color: #e7f2ff;
  font-weight: 800;
}

.report-title h2 {
  margin-bottom: 0;
  font-size: 28px;
  color: #fff;
}

.summary-strip,
.metric-grid,
.detail-grid {
  display: grid;
  gap: 12px;
}

.summary-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0;
}

.summary-strip div,
.metric,
.detail-grid div,
.progress-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
}

span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

strong {
  word-break: break-word;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.metric.primary {
  color: #fff;
  background: linear-gradient(135deg, #1267d8 0%, #2f8af0 100%);
  border-color: #67a8f3;
}

.metric.primary span,
.metric.primary strong {
  color: #fff;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.progress-card {
  margin: 14px 0;
}

.progress-card strong {
  display: block;
  margin: 6px 0 10px;
  font-size: 22px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e2;
}

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

.progress-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.progress-card .calculation-basis {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--accent-dark);
  font-weight: 700;
}

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

.advice {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #b9d8ff;
  border-left: 6px solid var(--accent);
  background: linear-gradient(135deg, #eef6ff 0%, #ffffff 100%);
}

.advice h3 {
  margin-bottom: 10px;
}

.advice p {
  margin-bottom: 8px;
  color: #33443d;
  line-height: 1.65;
  white-space: pre-wrap;
}

.advice p:last-child {
  margin-bottom: 0;
}

.manager-card {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #c9ddf7;
}

.manager-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
}

.methodology-section {
  padding: 0 clamp(18px, 4vw, 48px) 42px;
}

.methodology-inner {
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
}

.methodology-inner > h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.methodology-inner details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.methodology-inner summary {
  padding: 16px 18px;
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.methodology-content {
  padding: 4px 18px 18px;
  border-top: 1px solid var(--line);
}

.methodology-content h3 {
  margin: 18px 0 8px;
  font-size: 16px;
}

.methodology-content p,
.privacy-stats-note p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.75;
}

.privacy-stats-note {
  margin-top: 18px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}

.privacy-stats-note h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.privacy-stats-note .local-stats {
  margin-bottom: 0;
  color: var(--ink);
}

.local-stats strong {
  color: var(--accent);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .methodology-section {
    padding-bottom: 28px;
  }

  .report-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .grid.two,
  .grid.three,
  .summary-strip,
  .metric-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .actions {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .form-panel {
    display: none;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .panel,
  .report {
    border: 0;
    box-shadow: none;
  }

  .report-panel {
    position: static;
  }
}
