:root {
  color: #18313a;
  background: #eef6f5;
  font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(100% - 28px, 760px); margin: 0 auto; padding: 36px 0 calc(36px + env(safe-area-inset-bottom)); }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 2px 28px; }
.eyebrow, .section-kicker { color: #0f766e; font-size: 12px; font-weight: 800; letter-spacing: .12em; margin: 0 0 5px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(28px, 7vw, 38px); letter-spacing: -.04em; margin-bottom: 8px; }
h2 { font-size: 19px; margin-bottom: 0; }
.subtitle { color: #587078; margin-bottom: 0; }
.card { background: #fff; border: 1px solid #dce9e8; border-radius: 18px; box-shadow: 0 6px 18px rgb(30 76 77 / 5%); margin-bottom: 16px; padding: 21px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.period-label { color: #517078; font-size: 13px; text-align: right; }
.bill-fields { display: grid; gap: 15px; grid-template-columns: 1fr 1fr; }
.bill-fields-three { grid-template-columns: repeat(3, 1fr); }
label { color: #49626a; display: grid; font-size: 13px; font-weight: 700; gap: 7px; }
input { background: #f9fcfc; border: 1px solid #cadbd9; border-radius: 10px; color: #18313a; min-width: 0; outline: none; padding: 10px 11px; transition: border-color .15s, box-shadow .15s; }
input::placeholder { color: #819497; opacity: .58; }
input:focus { border-color: #0f9187; box-shadow: 0 0 0 3px #d3f0ea; }
.method-options { border: 0; display: grid; gap: 9px; margin: 0; padding: 0; }
.method-option { align-items: center; border: 1px solid #d7e4e3; border-radius: 12px; cursor: pointer; display: flex; gap: 10px; padding: 11px; }
.method-option:has(input:checked) { background: #effbf8; border-color: #24a695; }
.method-option input { accent-color: #0f8b7e; height: 17px; min-width: 17px; padding: 0; }
.method-option span { display: grid; gap: 2px; }
.method-option strong { color: #193940; font-size: 14px; }
.method-option small, .hint { color: #688088; font-size: 12px; }
.hint { margin: 13px 0 0; }
.secondary-button, .primary-button, .icon-button { border: 0; border-radius: 10px; font-weight: 800; padding: 10px 14px; }
.secondary-button { background: #e4f4f1; color: #087468; white-space: nowrap; }
.primary-button { background: #08786d; color: #fff; }
.icon-button { background: #d9efeb; color: #087468; }
.empty-state { background: #f7fbfa; border: 1px dashed #c5dbd8; border-radius: 12px; color: #577279; padding: 26px 16px; text-align: center; }
.empty-state p { color: #294a52; font-weight: 800; margin-bottom: 5px; }
.empty-state span { font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 720px; width: 100%; }
th { color: #668087; font-size: 12px; font-weight: 700; padding: 0 6px 10px; text-align: left; }
td { border-top: 1px solid #e6eeee; padding: 10px 6px; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; text-align: right; }
td input { padding: 8px; width: 100%; }
.batch-panel { background: #f7fbfa; border: 1px solid #dbe9e6; border-radius: 13px; display: grid; gap: 15px; margin: 0 0 18px; padding: 16px; }
.batch-panel h3 { font-size: 15px; margin: 0 0 4px; }
.batch-panel p { color: #668087; font-size: 12px; margin: 0; }
.batch-range { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.count-mode-options { border: 0; display: flex; flex-wrap: wrap; gap: 13px; margin: 0; padding: 0; }
.count-mode-options legend { color: #49626a; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.count-mode-options label { align-items: center; color: #344f57; display: flex; font-weight: 600; gap: 6px; }
.count-mode-options input { accent-color: #0f8b7e; height: 16px; min-width: 16px; padding: 0; }
.count-inputs { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.count-inputs .input-note { color: #71878c; font-size: 12px; margin: 0; }
.amount-cell { color: #0f766e; font-feature-settings: "tnum"; font-weight: 800; white-space: nowrap; }
.delete-button, .text-button { background: transparent; border: 0; color: #b44745; font-size: 13px; padding: 6px; }
.summary { background: #155e75; border-radius: 18px; color: #dbf8f1; display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 17px; overflow: hidden; }
.summary div { min-width: 0; padding: 17px 14px; }
.summary div + div { border-left: 1px solid rgb(219 248 241 / 23%); }
.summary span { display: block; font-size: 12px; margin-bottom: 5px; opacity: .8; }
.summary strong { color: #fff; display: block; font-size: clamp(15px, 4.1vw, 20px); letter-spacing: -.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { align-items: center; display: flex; justify-content: space-between; }
.preview-dialog { background: #fff; border: 0; border-radius: 18px; box-shadow: 0 22px 60px rgb(18 47 52 / 28%); color: #18313a; max-height: min(760px, 88vh); padding: 20px; width: min(960px, calc(100% - 24px)); }
.preview-dialog::backdrop { background: rgb(14 34 37 / 45%); }
.preview-header { align-items: flex-start; display: flex; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.preview-content { overflow: auto; }
.preview-content h3 { font-size: 18px; margin: 0 0 12px; text-align: center; }
.preview-meta { display: flex; flex-wrap: wrap; font-size: 13px; gap: 12px 22px; margin-bottom: 14px; }
.preview-table { border-collapse: collapse; font-size: 13px; min-width: 760px; width: 100%; }
.preview-table th, .preview-table td { border: 1px solid #9ebbb7; padding: 8px; text-align: center; }
.preview-table th { color: #18313a; font-size: 13px; padding: 9px 6px; }
.preview-table .preview-total { font-weight: 800; text-align: right; }
.preview-signature { border: 1px solid #9ebbb7; border-top: 0; min-height: 64px; padding: 11px; }
.hidden { display: none !important; }
.sr-only { height: 1px; margin: -1px; overflow: hidden; position: absolute; width: 1px; clip: rect(0, 0, 0, 0); }

@media (max-width: 520px) {
  .app-shell { padding-top: 25px; }
  .card { border-radius: 15px; padding: 17px; }
  .bill-fields, .bill-fields-three, .batch-range { grid-template-columns: 1fr; }
  .households-heading { align-items: flex-start; }
  .summary div { padding: 14px 10px; }
  .actions { gap: 8px; }
  .secondary-button, .primary-button { padding: 10px 11px; }
}
