/* ============================================================
   City of Linton — Resident Bill Pay (citizen-facing)
   Friendly municipal portal. Mobile-first.
   ============================================================ */

:root {
  --navy: #102a43;
  --navy-2: #1c3a5e;
  --steel: #486581;
  --slate: #627d98;
  --mist: #f0f4f8;
  --line: #d9e2ec;
  --ink: #243b53;
  --gold: #b58a2c;
  --green: #18794e;
  --green-soft: #e3f3ea;
  --red: #b42318;
  --red-soft: #fdeceb;
  --amber: #b25c00;
  --amber-soft: #fcefdc;
  --blue: #1d4ed8;
  --blue-soft: #e6edfd;
  --shadow: 0 1px 3px rgba(16,42,67,.08), 0 8px 24px rgba(16,42,67,.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--mist); display: flex; flex-direction: column; min-height: 100vh; -webkit-font-smoothing: antialiased; }
.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 18px; }

/* ---------- Header ---------- */
.site-header { background: linear-gradient(180deg, var(--navy), var(--navy-2)); color: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.seal { font-size: 30px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text strong { font-size: 16px; }
.logo-text em { font-size: 12px; color: #9fb3c8; font-style: normal; letter-spacing: .02em; }
.header-right { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: #cdd9e5; }
.header-right .acct-chip { background: rgba(255,255,255,.12); padding: 6px 12px; border-radius: 20px; color: #fff; font-weight: 600; }
.header-right a { color: #9fb3c8; text-decoration: none; cursor: pointer; }
.header-right a:hover { color: #fff; text-decoration: underline; }

main.wrap { flex: 1; padding-top: 30px; padding-bottom: 50px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #9fb3c8; font-size: 12.5px; padding: 22px 0; line-height: 1.7; }
.site-footer .demo-note { color: #627d98; margin-top: 6px; font-style: italic; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--font); font-size: 15px; font-weight: 600; padding: 12px 20px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: filter .12s, background .12s; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-pay { background: var(--green); color: #fff; font-size: 16px; }
.btn-pay:hover { filter: brightness(1.08); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(1.05); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--mist); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 26px; margin-bottom: 20px; }
.card h2 { font-size: 19px; color: var(--navy); margin-bottom: 4px; }
.card .sub { color: var(--slate); font-size: 14px; margin-bottom: 18px; }

/* ---------- Login ---------- */
.login-hero { text-align: center; padding: 14px 0 26px; }
.login-hero .big-seal { font-size: 54px; }
.login-hero h1 { font-size: 27px; color: var(--navy); margin: 8px 0 6px; }
.login-hero p { color: var(--slate); font-size: 15px; max-width: 460px; margin: 0 auto; }
.login-card { max-width: 460px; margin: 0 auto; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--steel); }
.field input, .field select { font-family: var(--font); font-size: 16px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(72,101,129,.13); }
.demo-helper { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.demo-helper .dh-lab { font-size: 12.5px; color: var(--slate); font-weight: 600; margin-bottom: 9px; }
.demo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-chip { font-family: var(--font); font-size: 13px; font-weight: 600; padding: 8px 13px; border-radius: 20px; border: 1px solid var(--line); background: var(--mist); color: var(--steel); cursor: pointer; }
.demo-chip:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.err { color: var(--red); font-size: 13.5px; margin-top: 4px; min-height: 18px; }

/* ---------- Balance hero ---------- */
.balance-hero { background: linear-gradient(135deg, var(--navy), var(--steel)); color: #fff; border-radius: 16px; padding: 28px; margin-bottom: 22px; box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px; }
.balance-hero .bh-lab { font-size: 13.5px; color: #cdd9e5; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.balance-hero .bh-amt { font-size: 42px; font-weight: 800; margin-top: 4px; }
.balance-hero .bh-sub { font-size: 13.5px; color: #cdd9e5; margin-top: 6px; }
.balance-hero.zero { background: linear-gradient(135deg, var(--green), #2f9e6b); }

.acct-summary { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; color: var(--slate); margin-bottom: 22px; }
.acct-summary b { color: var(--navy); }

/* ---------- Invoice list ---------- */
.inv-list { display: flex; flex-direction: column; gap: 14px; }
.inv-item { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.inv-item .ii-main { flex: 1; min-width: 200px; }
.inv-item .ii-id { font-weight: 700; color: var(--navy); font-size: 15px; }
.inv-item .ii-meta { font-size: 13px; color: var(--slate); margin-top: 3px; }
.inv-item .ii-amt { text-align: right; }
.inv-item .ii-amt .amt { font-size: 20px; font-weight: 700; color: var(--navy); }
.inv-item .ii-amt .amt.due { color: var(--red); }
.inv-item .ii-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 26px 0 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-paid { background: var(--green-soft); color: var(--green); }
.badge-sent { background: var(--blue-soft); color: var(--blue); }
.badge-partial { background: var(--amber-soft); color: var(--amber); }
.badge-overdue { background: var(--red-soft); color: var(--red); }

/* ---------- Invoice document ---------- */
.invoice-doc { background: #fff; color: #1a2733; position: relative; }
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 20px; border-bottom: 3px solid var(--navy); gap: 16px; flex-wrap: wrap; }
.inv-city { display: flex; gap: 12px; align-items: center; }
.inv-city .s { font-size: 38px; }
.inv-city h3 { font-size: 18px; color: var(--navy); }
.inv-city p { font-size: 12px; color: var(--slate); line-height: 1.5; }
.inv-meta { text-align: right; }
.inv-meta h2 { font-size: 26px; color: var(--navy); letter-spacing: .04em; }
.inv-meta .num { font-size: 13px; color: var(--steel); font-weight: 600; }
.inv-parties { display: flex; justify-content: space-between; margin: 20px 0; gap: 24px; flex-wrap: wrap; }
.inv-parties .blk { font-size: 13px; line-height: 1.6; }
.inv-parties .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--slate); font-weight: 700; margin-bottom: 4px; }
.inv-parties strong { color: var(--navy); }
.inv-dates .row { display: flex; justify-content: space-between; gap: 22px; font-size: 13px; padding: 2px 0; }
.inv-dates .lab2 { color: var(--slate); }
table.lines { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.lines thead th { background: var(--navy); color: #fff; padding: 10px 12px; text-align: left; font-size: 12px; }
table.lines thead th.num, table.lines td.num { text-align: right; }
table.lines td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.inv-totals { display: flex; justify-content: flex-end; margin-top: 14px; }
.inv-totals .box { width: 270px; }
.inv-totals .row { display: flex; justify-content: space-between; padding: 6px 12px; font-size: 13.5px; }
.inv-totals .row.grand { background: var(--navy); color: #fff; font-weight: 700; font-size: 15px; border-radius: 6px; }
.inv-totals .row.paid { color: var(--green); }
.inv-totals .row.due { font-weight: 700; color: var(--red); border-top: 1px solid var(--line); padding-top: 8px; }
.inv-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--slate); line-height: 1.6; }
.mono { font-variant-numeric: tabular-nums; }
.inv-stamp { position: absolute; top: 42%; left: 50%; transform: translate(-50%,-50%) rotate(-15deg); font-size: 64px; font-weight: 800; color: rgba(24,121,78,.12); border: 6px solid rgba(24,121,78,.12); padding: 6px 24px; border-radius: 12px; pointer-events: none; }

.page-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--steel); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; margin-bottom: 14px; }
.back-link:hover { color: var(--navy); }

/* ---------- Payment ---------- */
.pay-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
.pay-summary { background: var(--mist); border: 1px solid var(--line); border-radius: 13px; padding: 20px; }
.pay-summary h3 { font-size: 14px; color: var(--navy); margin-bottom: 14px; }
.pay-summary .ps-row { display: flex; justify-content: space-between; font-size: 14px; padding: 7px 0; }
.pay-summary .ps-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 700; font-size: 17px; color: var(--navy); }
.method-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.method-tab { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: center; font-weight: 600; font-size: 14px; color: var(--steel); }
.method-tab.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lock-note { font-size: 12.5px; color: var(--slate); display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.radio-amt { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.radio-amt label { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14.5px; }
.radio-amt label.sel { border-color: var(--navy); background: var(--blue-soft); }
.radio-amt input { width: 18px; height: 18px; }
.radio-amt .ra-amt { margin-left: auto; font-weight: 700; color: var(--navy); }

/* ---------- Confirmation ---------- */
.confirm { text-align: center; padding: 20px 0; }
.confirm .check { width: 78px; height: 78px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 42px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.confirm h2 { font-size: 25px; color: var(--navy); }
.confirm .c-amt { font-size: 34px; font-weight: 800; color: var(--green); margin: 8px 0; }
.receipt { background: var(--mist); border: 1px solid var(--line); border-radius: 13px; padding: 20px; max-width: 420px; margin: 22px auto; text-align: left; }
.receipt .r-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.receipt .r-row:last-child { border-bottom: none; }
.receipt .r-row .lab { color: var(--slate); }
.receipt .r-row .val { font-weight: 600; color: var(--navy); }

.spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--navy); border-radius: 50%; margin: 30px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 40px 20px; color: var(--slate); }
.empty .ei { font-size: 38px; margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(16,42,67,.3); z-index: 200; }
.hidden { display: none !important; }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .page-actions, .back-link, .toast { display: none !important; }
  body, main.wrap { background: #fff; padding: 0; margin: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; }
  .inv-stamp, table.lines thead th, .inv-totals .row.grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 16mm; }
}

@media (max-width: 720px) {
  .pay-grid { grid-template-columns: 1fr; }
  .balance-hero .bh-amt { font-size: 34px; }
  .form-row { grid-template-columns: 1fr; }
  .inv-item { flex-direction: column; align-items: stretch; }
  .inv-item .ii-amt { text-align: left; }
}
