/* VetCareLog design system: "The Family Ledger".
   Quiet everywhere, one signature (the ledger page), color only where it means something. */
:root {
  --ink: #0E1C36;          /* Ledger Ink: text, top bar */
  --paper: #F4F6FA;        /* Record Paper: page background (cool, not cream) */
  --sheet: #FFFFFF;        /* the ledger page itself */
  --green: #B22234;        /* Ledger Green: the one main action, the year total */
  --green-hover: #8E1B29;
  --brass: #A8812F;         /* Brass/gold: rules, receipt tick, focus ring, to-do notes. Never errors. */
  --navy: #1D3F7A;         /* totals and money figures */        /* Brass: ledger rules, receipt tick, focus ring. Never body text. */
  --rule: #CBD3E0;         /* Ruling: hairlines instead of boxes */
  --rust: #9A3324;         /* Rust: real errors only */
  --muted: #44506A;        /* secondary text, 7:1 on paper */
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Atkinson Hyperlegible', 'Segoe UI', Arial, sans-serif; /* Source Sans 3 is loaded as digits only */
  --tap: 52px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 19px/1.55 var(--sans); color: var(--ink); background: var(--paper); }
img { max-width: 100%; }
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }
.amt, .num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; }

/* ---- Top bar + wordmark ---- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 max(16px, calc((100% - 680px) / 2 + 16px)); min-height: 64px; background: var(--ink); color: #fff; }
.wordmark { font-family: var(--serif); font-weight: 600; font-size: 24px; letter-spacing: 0.01em; color: #fff; text-decoration: none; display: inline-flex; align-items: baseline; padding: 8px 0; }
.wordmark b { font-weight: 600; color: #D9C08A; } /* "Log" in pale brass: 9:1 on ink */
.top-btn { min-height: 48px; min-width: 48px; padding: 0 14px; background: none; border: 1px solid rgba(255,255,255,.45); border-radius: 6px; color: #fff; font: 700 18px var(--sans); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.top-btn:hover { border-color: #fff; }

/* ---- App layout ---- */
main { max-width: 680px; margin: 0 auto; padding: 20px 16px 8px; }
h1 { font: 600 32px/1.2 var(--serif); margin: 8px 0 12px; letter-spacing: -0.005em; }
h2 { font: 600 24px/1.25 var(--serif); margin: 36px 0 10px; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 17px; }

/* ---- Forms ---- */
label { display: block; font-weight: 700; margin: 22px 0 8px; }
input, select, textarea { width: 100%; font: 19px var(--sans); color: var(--ink); padding: 12px 14px; min-height: var(--tap); border: 1.5px solid #8E9A94; border-radius: 6px; background: var(--sheet); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--brass); outline-offset: 1px; border-color: var(--ink); }
textarea { min-height: 110px; }
.check { display: flex; gap: 14px; align-items: flex-start; font-weight: 400; margin: 18px 0 6px; min-height: 48px; cursor: pointer; }
.check input { width: 26px; height: 26px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--green); }
.choice { border: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 6px 0 14px; margin: 22px 0 0; }
.choice legend { font-weight: 700; padding: 14px 0 0; float: left; width: 100%; }
.choice legend + * { clear: both; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 420px) { .row { grid-template-columns: 1fr; gap: 0; } }

/* ---- Buttons: one green action per screen ---- */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; margin: 14px 0; padding: 12px 20px; border: 0; border-radius: 6px; background: var(--green); color: #fff; font: 700 19px var(--sans); text-align: center; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--green-hover); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.secondary:hover { background: #EAEDE9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--navy); font: 700 18px var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 12px 0; min-height: 48px; }
.quiet-actions { list-style: none; padding: 0; margin: 4px 0 8px; border-top: 1px solid var(--rule); }
.quiet-actions li { border-bottom: 1px solid var(--rule); }
.quiet-actions a { display: flex; align-items: center; min-height: 56px; font-weight: 700; text-decoration: none; }
.quiet-actions a:hover { text-decoration: underline; }

/* ---- Ruled rows instead of cards ---- */
.card { padding: 16px 0; margin: 0; border-top: 1px solid var(--rule); background: none; }
.card:last-of-type { border-bottom: 1px solid var(--rule); }
.item { display: block; color: inherit; text-decoration: none; }
.item:hover .line1 span:first-child { text-decoration: underline; }
.item .line1 { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.item .line1 span:last-child { font-family: var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .line2 { color: var(--muted); font-size: 17px; }
.tag { display: inline-block; font-size: 16px; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 4px; color: var(--muted); margin-top: 6px; background: var(--sheet); }
.tag.provisional { border-color: #B9A77F; color: #5B4A22; }

/* ---- Messages ---- */
.error { color: var(--rust); background: #FBF3F1; border-left: 4px solid var(--rust); padding: 12px 14px; margin: 14px 0; font-weight: 700; }
.error a { color: var(--rust); }
.notice { color: var(--ink); background: #EDF1F8; border-left: 4px solid #1D3F7A; padding: 12px 14px; margin: 14px 0; font-weight: 700; }
.provisional-note { font-size: 17px; color: #4A3D1C; background: #F6F1E4; border-left: 4px solid var(--brass); padding: 10px 12px; margin: 12px 0 0; }

/* ---- Summary block used by care + export screens (a closed ledger total) ---- */
.total { background: var(--sheet); border-top: 3px double var(--brass); border-bottom: 1px solid var(--rule); padding: 18px 16px; margin: 16px 0 10px; }
.total .sub { color: var(--muted); font-size: 17px; }
.total .big { font: 600 40px/1.15 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--navy); margin: 4px 0; }

/* ---- THE SIGNATURE: the ledger page ---- */
.ledger { background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--ink); margin: 18px 0 8px; padding: 0 16px; }
.ledger-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 0 10px; border-bottom: 1px solid var(--brass); font-size: 16px; color: var(--muted); }
.ledger-head strong { font: 600 18px var(--serif); color: var(--ink); }
.ledger-lines { list-style: none; margin: 0; padding: 0; }
.lline { display: grid; grid-template-columns: 58px 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: baseline; color: inherit; text-decoration: none; }
a.lline:hover .lline-what { text-decoration: underline; }
.lline-date { font: 500 16px var(--serif); color: var(--muted); font-variant-numeric: tabular-nums; }
.lline-what { font-weight: 700; overflow-wrap: anywhere; color: var(--ink); text-decoration: none; }
a.lline-what:hover { text-decoration: underline; }
.num { white-space: nowrap; }
.lline-amt { font: 600 19px var(--serif); font-variant-numeric: lining-nums tabular-nums; text-align: right; white-space: nowrap; }
.lline-meta { grid-column: 2 / 4; font-size: 16px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 14px; }
.proof { display: inline-flex; align-items: center; gap: 8px; }
.proof.yes::before { content: ''; flex: none; width: 13px; height: 7px; border-left: 2.5px solid var(--brass); border-bottom: 2.5px solid var(--brass); transform: rotate(-45deg) translateY(-2px); }
.proof.todo a { font-weight: 700; }
.ledger-close { border-top: 3px double var(--brass); margin-top: -1px; padding: 14px 0 16px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; }
.ledger-close .label { font: 600 18px/1.3 var(--serif); }
.ledger-close .amt { font-size: 38px; font-weight: 600; color: var(--navy); line-height: 1.1; }
.ledger-close .foot { grid-column: 1 / 3; font-size: 16px; color: var(--muted); }
.ledger-empty { padding: 18px 0; color: var(--muted); border-bottom: 1px solid var(--rule); }
.month { font: 600 20px var(--serif); margin: 28px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--brass); display: flex; justify-content: space-between; gap: 12px; }
.month .amt { font-size: 18px; color: var(--muted); }
.plain-list { list-style: none; padding: 0; margin: 0; }

/* A newly added line writes itself in, left to right. */
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.lline.writing { animation: write 900ms cubic-bezier(.3,.6,.2,1) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---- Menu sheet ---- */
.menu { position: fixed; inset: 0; background: rgba(24,36,47,.45); z-index: 20; display: flex; justify-content: flex-end; }
.menu-panel { background: var(--paper); width: min(380px, 100%); height: 100%; overflow-y: auto; padding: 0 20px 24px; }
.menu-top { display: flex; justify-content: space-between; align-items: center; min-height: 64px; border-bottom: 3px solid var(--ink); }
.menu-panel ul { list-style: none; padding: 0; margin: 0; }
.menu-panel li a, .menu-panel li button { display: flex; align-items: center; width: 100%; min-height: 56px; border: 0; border-bottom: 1px solid var(--rule); background: none; font: 700 19px var(--sans); color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; padding: 0; }
.menu-label { font: 600 16px var(--serif); color: var(--muted); margin: 22px 0 4px; }
.menu-close { background: none; border: 1.5px solid var(--ink); border-radius: 6px; min-height: 48px; padding: 0 14px; font: 700 18px var(--sans); cursor: pointer; color: var(--ink); }

/* ---- Footer: disclaimer + affiliation on every page ---- */
.disclaimer { max-width: 680px; margin: 40px auto 0; padding: 20px 16px 40px; font-size: 16px; color: var(--muted); border-top: 1px solid var(--rule); }
.disclaimer p { margin: 0 0 8px; }
.affiliation { font-weight: 700; color: var(--ink); }

.receipts a { display: flex; align-items: center; min-height: 48px; }
.member { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.big-amount { font: 600 30px var(--serif); font-variant-numeric: tabular-nums; color: var(--navy); }
.card.trial { display: block; padding: 14px 16px; border: 1px solid var(--rule); border-left: 4px solid var(--green); background: var(--sheet); font-size: 18px; margin-bottom: 8px; color: var(--ink); text-decoration: none; }
.card.trial.ended { border-left-color: var(--brass); }

/* App photos: calm scene-setters on sign-in, first setup, and an empty record */
.scene { display: block; width: calc(100% + 32px); margin: -20px -16px 18px; aspect-ratio: 16 / 9; height: auto; object-fit: cover; background: #D8DEE8; }
@media (min-width: 700px) { .scene { width: 100%; margin: 0 0 20px; } }
.ledger-empty img { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; margin: 0 0 12px; background: #D8DEE8; }

/* ---- Onboarding ---- */
.lede-app { font-size: 20px; }
.step-count { font: 600 16px var(--serif); color: #6E5627; margin: 0 0 4px; }
.welcome-steps { list-style: none; padding: 0; margin: 20px 0; border-top: 1px solid var(--rule); }
.welcome-steps li { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.welcome-steps strong { display: block; font: 600 20px var(--serif); }
.welcome-steps span:not(.ws-n) { color: var(--muted); }
.ws-n { font: 600 32px/1 var(--serif); color: var(--navy); }
.first-preview img { width: 100%; max-height: 320px; object-fit: contain; background: #fff; border: 1px solid var(--rule); margin-top: 8px; }
.notice.celebrate { background: #EDF1F8; border-left-color: var(--brass); font-size: 19px; }
.checklist { background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid #C9A45C; padding: 6px 16px 8px; margin: 18px 0; }
.checklist-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.checklist-head strong { font: 600 19px var(--serif); }
.checklist-head span { color: var(--muted); font-size: 16px; }
.checklist ul { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.checklist li.done { color: var(--muted); }
.checklist li a { font-weight: 700; }
.ck { width: 24px; height: 24px; border-radius: 50%; background: var(--green); position: relative; }
.ck::after { content: ''; position: absolute; left: 7px; top: 5px; width: 9px; height: 5px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg); }
.ck.open { background: none; border: 2px solid #8E9A94; }
.ck.open::after { display: none; }

/* ---- Receipts + account ---- */
.receipt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
details.danger { margin: 32px 0 10px; border: 1px solid #D8B7AF; padding: 0 16px; }
details.danger summary { min-height: 56px; display: flex; align-items: center; font-weight: 700; color: var(--rust); cursor: pointer; }
.danger-btn { background: var(--rust); }
.danger-btn:hover { background: #7E2A1D; }
.app-links { font-size: 16px; }

/* ---- Help + legal pages ---- */
.legal { max-width: 760px; }
.legal ul { padding-left: 22px; }
.legal li { margin: 8px 0; }
.faq-plain details { border-bottom: 1px solid var(--rule); }
.faq-plain details:first-child { border-top: 1px solid var(--rule); }
.faq-plain summary { min-height: 56px; display: flex; align-items: center; font: 600 20px/1.35 var(--serif); cursor: pointer; padding: 8px 0; }
.faq-plain details p { margin: 0 0 16px; }

/* ---- Export: official form details + ready sheet ---- */
.row3 { display: grid; grid-template-columns: 1fr 110px 1fr; gap: 12px; }
@media (max-width: 420px) { .row3 { grid-template-columns: 1fr; gap: 0; } }
.who-form .choice { padding-bottom: 18px; }
.ready { background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid #C9A45C; padding: 6px 16px 10px; margin: 20px 0; }
.ready-title { font: 600 22px var(--serif); margin: 14px 0 6px; }

/* Patriotic accents: a red, white and blue ribbon under the top bar and a star in the wordmark.
   Decorative only; no seals, emblems or government styling (VetCareLog is not affiliated with the VA). */
.top { position: relative; box-shadow: 0 3px 0 #fff, 0 6px 0 #B22234; margin-bottom: 6px; }
.wordmark::before { content: ''; width: 20px; height: 20px; margin-right: 8px; align-self: center; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.9 7.1.6-5.4 4.7 1.7 7.1L12 17.6 5.7 21.3l1.7-7.1L2 9.5l7.1-.6z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.9 7.1.6-5.4 4.7 1.7 7.1L12 17.6 5.7 21.3l1.7-7.1L2 9.5l7.1-.6z'/%3E%3C/svg%3E") center / contain no-repeat; }
.wordmark b { color: #E3C77F; }
