/* Donation Receipt Generator — screen styles (follows the Zunmao tool-site
 * conventions: wrap/max-width, cards, topbar, overlay paywall, toast).
 * Print rules live at the bottom: screen chrome is hidden and #print-area
 * (filled by app.js with the worksheet HTML) is all that prints. */
:root {
  --ink: #17202a;
  --muted: #5b6b7b;
  --line: #dbe3ea;
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --ok: #166534;
  --warn: #b45309;
  --bad: #b91c1c;
  --bg: #f4f7f5;
  --card: #ffffff;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.55; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
a { color: var(--brand); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 0.6rem; }
h2 { font-size: 1.3rem; margin: 0 0 0.8rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.4rem; }
p { margin: 0.4rem 0; }
label { display: block; font-weight: 600; font-size: 0.92rem; margin: 0.5rem 0; }
label input, label select, label textarea { margin-top: 0.3rem; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-weight: 400; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.topbar { background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding-top: 0.7rem; padding-bottom: 0.7rem; }
.brand { display: flex; gap: 0.7rem; align-items: center; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--brand-dark); display: grid; place-items: center; font-size: 1.3rem; font-weight: 800; }
.brand .tagline { display: block; font-size: 0.8rem; opacity: 0.85; font-weight: 400; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin: 1rem 0; box-shadow: 0 1px 2px rgba(16, 42, 67, 0.05); }
.hero h1 { color: var(--brand-dark); }
.privacy-badge { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 9px; padding: 0.55rem 0.8rem; }
.disclaimer-inline { background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; padding: 0.55rem 0.8rem; }
.edition-alert { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; padding: 0.55rem 0.8rem; }

.step { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: 1rem; }
.free-badge { font-size: 0.72rem; background: #dcfce7; color: var(--ok); border-radius: 999px; padding: 0.15rem 0.6rem; font-weight: 700; }
.pro-badge { font-size: 0.72rem; background: #fef3c7; color: var(--warn); border-radius: 999px; padding: 0.15rem 0.6rem; font-weight: 700; }
.verify-tag { font-size: 0.7rem; background: #fef3c7; color: var(--warn); border-radius: 4px; padding: 0.05rem 0.4rem; font-weight: 700; text-transform: uppercase; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.btn { display: inline-block; border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 10px; padding: 0.55rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: #f0fdfa; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-pro { background: #f59e0b; border-color: #f59e0b; color: #1c1005; }
.btn-pro:hover { background: #d97706; color: #fff; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f0; }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.row { display: flex; align-items: center; }
.gap { gap: 0.6rem; }
.wrap-row { flex-wrap: wrap; }

.check-row { display: flex; gap: 0.55rem; align-items: flex-start; font-weight: 400; margin: 0.45rem 0; cursor: pointer; }
.check-row input { margin-top: 0.3rem; }
.inline-label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.inline-label select { width: auto; }

.table-scroll { overflow-x: auto; }
.entries-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.93rem; }
.entries-table th, .entries-table td { border-bottom: 1px solid var(--line); padding: 0.4rem 0.5rem; text-align: left; vertical-align: top; }
.entries-table th { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }

.field-errors { color: var(--bad); font-weight: 600; min-height: 1.2em; }
.summary-line { font-weight: 700; margin: 0.6rem 0; }
.free-note-box { background: #f0fdf4; border: 1px dashed #86efac; border-radius: 9px; padding: 0.6rem 0.8rem; margin: 0.6rem 0; }

.glance { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0.6rem 0; }
.glance-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--line); }
.glance-row:last-child { border-bottom: none; }
.glance-row.dim { color: var(--muted); }
.glance-row.strong { background: #f0fdf4; font-size: 1.02rem; }

.verdict-box { border-radius: 10px; padding: 0.9rem 1rem; margin: 0.8rem 0; border: 1px solid var(--line); }
.verdict-pass { background: #f0fdf4; border-color: #86efac; }
.verdict-info { background: #eff6ff; border-color: #bfdbfe; }

.preview-box { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-top: 1rem; background: #fff; max-height: 70vh; overflow: auto; }

.faq-item h3 { margin-bottom: 0.2rem; }
.footer { color: var(--muted); font-size: 0.9rem; padding: 1rem 0 2.5rem; }

.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.overlay[hidden] { display: none; }
.overlay-card { background: #fff; border-radius: var(--radius); padding: 1.4rem; max-width: 480px; width: 100%; display: flex; flex-direction: column; gap: 0.7rem; }
.overlay-card h3 { margin: 0; }
.compare { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.compare td { border-bottom: 1px solid var(--line); padding: 0.4rem 0.2rem; }
.compare td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 0.65rem 1.1rem; border-radius: 999px; opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 60; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- print document (worksheet / reference from core.js) ---- */
#print-area { display: none; }
.p-section h1 { font-size: 1.35rem; margin: 0 0 0.2rem; }
.p-section h2 { font-size: 1.05rem; margin: 1rem 0 0.3rem; }
.p-law { color: #444; font-size: 0.9rem; margin: 0 0 0.6rem; }
.p-field { margin: 0.2rem 0; }
.p-section table { width: 100%; border-collapse: collapse; margin: 0.3rem 0 0.6rem; }
.p-section th, .p-section td { border-bottom: 1px solid #ccc; padding: 0.28rem 0.4rem; text-align: left; font-size: 0.92rem; }
.p-section td.num, .p-section th.num { text-align: right; }
.p-line { width: 3.2rem; color: #555; font-variant-numeric: tabular-nums; }
.p-total td { font-weight: 700; border-top: 2px solid #333; }
.p-note { font-size: 0.85rem; color: #444; margin-top: 0.8rem; }
.p-items li { margin: 0.25rem 0; font-size: 0.92rem; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .p-section { page-break-inside: avoid; }
  .p-reference { page-break-before: always; }
}

/* ---- tip-record additions ---- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin: 0.6rem 0; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; background: #fff; }
.stat .stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat .stat-value { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.net-preview { font-weight: 700; font-size: 1.05rem; }
.rule-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.6rem 0; }
.rule-chip { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.85rem; font-weight: 600; }
.sig-line { border-bottom: 1.5px solid #333; height: 2.2rem; }

/* ---- donation-receipt additions ---- */
[hidden] { display: none !important; }
.overlay[hidden] { display: none !important; }
.p-org { margin-bottom: 0.6rem; }
.p-stmt { margin: 0.5rem 0; }
