:root {
  color-scheme: light;
  --blue: #087cf0;
  --blue-soft: #edf6ff;
  --ink: #152033;
  --muted: #607086;
  --line: #d9e4f0;
  --green: #168a59;
  --danger: #d34132;
  --surface: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #f5f8fc;
  font-size: 15px;
  letter-spacing: 0;
}

button, input, textarea { font: inherit; letter-spacing: 0; }

.bill-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 7px max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.bill-topbar a {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  text-decoration: none;
}

.bill-topbar div { display: grid; gap: 1px; }
.bill-topbar strong { font-size: 16px; }
.bill-topbar span { color: var(--muted); font-size: 11px; }

.bill-main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 18px 14px calc(32px + env(safe-area-inset-bottom));
}

.bill-intro { padding: 2px 2px 14px; }
.bill-intro h1 { margin: 0 0 5px; font-size: 24px; line-height: 1.25; }
.bill-intro p { margin: 0; color: var(--muted); line-height: 1.55; }

.bill-form,
.bill-result,
.bill-help {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.bill-form { padding: 0 14px 14px; }
.bill-form fieldset { margin: 0; padding: 15px 0; border: 0; border-bottom: 1px solid var(--line); }
.bill-form legend { padding: 0 0 10px; font-weight: 700; }

.operator-options,
.issue-options { display: flex; flex-wrap: wrap; gap: 7px; }
.operator-options label,
.issue-options label { position: relative; }
.operator-options input,
.issue-options input { position: absolute; opacity: 0; pointer-events: none; }
.operator-options span,
.issue-options span {
  display: block;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #33445a;
  cursor: pointer;
}
.operator-options input:checked + span,
.issue-options input:checked + span {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: #075fbc;
  font-weight: 700;
}

.amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.amount-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.money-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(8, 124, 240, 0.12); }
.money-input b { padding-left: 9px; color: var(--muted); }
.money-input input { width: 100%; min-width: 0; padding: 9px 8px 9px 4px; border: 0; outline: 0; background: transparent; }

.bill-note { display: grid; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.bill-note textarea,
.summary-box textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  line-height: 1.5;
}
.privacy-tip { margin: 7px 0 0; color: var(--danger); font-size: 11px; }
.form-message { min-height: 18px; margin: 10px 0 5px; color: var(--danger); font-size: 12px; }

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.primary-action { width: 100%; color: #fff; background: var(--blue); }
.secondary-action { color: #075fbc; background: #fff; }

.bill-result { margin-top: 14px; padding: 14px; }
.result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.result-heading span { color: var(--muted); font-size: 12px; }
.result-heading h2 { margin: 3px 0 0; font-size: 20px; }
.result-heading > strong { color: var(--danger); font-size: 18px; white-space: nowrap; }
.result-block { padding: 13px 0 0; }
.result-block h3 { margin: 0 0 7px; font-size: 14px; }
.result-block ul,
.result-block ol { margin: 0; padding-left: 21px; color: #3b4a5e; line-height: 1.65; }
.evidence-block p { margin: 0; color: #3b4a5e; line-height: 1.6; }
.summary-box { display: grid; gap: 6px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.summary-box textarea { background: #f7f9fc; }
.secondary-action { margin-top: 8px; }

.contact-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 16px -14px -2px;
  padding: 15px 14px;
  border-top: 1px solid #b9ddc9;
  background: #effaf4;
}
.contact-band > div span { color: var(--green); font-size: 12px; }
.contact-band h2 { margin: 2px 0 4px; font-size: 18px; }
.contact-band p { margin: 0; color: #527063; font-size: 12px; }
.contact-band img { width: 88px; height: 88px; border: 1px solid #c4d8cd; background: #fff; object-fit: contain; }
.contact-band .primary-action { grid-column: 1 / -1; }
.contact-value { grid-column: 1 / -1; text-align: center; }
.result-disclaimer { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.bill-help { margin-top: 14px; padding: 14px; }
.bill-help h2 { margin: 0 0 8px; font-size: 16px; }
.bill-help details { border-top: 1px solid var(--line); }
.bill-help summary { padding: 11px 0; font-weight: 650; cursor: pointer; }
.bill-help details p { margin: -2px 0 12px; color: var(--muted); line-height: 1.6; }
.official-links { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.official-links a { color: #075fbc; font-size: 12px; }

@media (max-width: 520px) {
  body { font-size: 14px; }
  .bill-main { padding: 13px 10px calc(24px + env(safe-area-inset-bottom)); }
  .bill-intro h1 { font-size: 21px; }
  .amount-grid { grid-template-columns: 1fr 1fr; }
  .amount-grid label:last-child { grid-column: 1 / -1; }
  .operator-options span,
  .issue-options span { padding: 6px 9px; font-size: 12px; }
  .contact-band { grid-template-columns: minmax(0, 1fr) 76px; }
  .contact-band img { width: 76px; height: 76px; }
}

[hidden] { display: none !important; }
