/* VetCareLog design system: "The Family Ledger".
   Quiet everywhere, one signature (the ledger page), color only where it means something. */
:root {
  --ink: #18242F;          /* Ledger Ink: text, top bar */
  --paper: #F6F7F4;        /* Record Paper: page background (cool, not cream) */
  --sheet: #FFFFFF;        /* the ledger page itself */
  --green: #1E4A3D;        /* Ledger Green: the one main action, the year total */
  --green-hover: #163A30;
  --brass: #8C6D32;        /* Brass: ledger rules, receipt tick, focus ring. Never body text. */
  --rule: #CDD5CF;         /* Ruling: hairlines instead of boxes */
  --rust: #9A3324;         /* Rust: real errors only */
  --muted: #46525E;        /* 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(--green); 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(--green); 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: #EEF3F0; border-left: 4px solid var(--green); 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(--green); 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(--green); 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(--green); }
.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: #DCE2DD; }
@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: #DCE2DD; }
