/* My Writeoffs: calm, warm, mobile-first. No frameworks, no web fonts (fast, private). */
:root {
  --bg: #f4f8f6; --card: #ffffff; --line: #d5e5dc; --ink: #2b2622; --muted: #6f655c;
  --accent: #1f7a5c; --accent-d: #176349; --accent-l: #dceee6; --sage: #5d7a5f; --sage-l: #e7efe5;
  --err: #a23b2a; --err-l: #fbe9e4; --r: 16px; --shadow: 0 1px 2px rgba(60,40,20,.05), 0 4px 16px rgba(60,40,20,.05);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
body.app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-d); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img, svg { max-width: 100%; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sec .ic { color: var(--accent); margin-right: 2px; }
.tabs a.tab-add .ic { stroke-width: 2.4; }
:focus-visible { outline: 3px solid rgba(194,97,63,.45); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); } .small { font-size: .88rem; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }

/* ---------- Top bar & bottom tabs ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(250,246,240,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 960px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.brand:hover { color: var(--ink); }
.logo { width: 30px; height: 30px; }
.nav { display: none; }
.nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; }
.nav a[aria-current] { color: var(--ink); background: var(--accent-l); }
.top-links { display: flex; align-items: center; gap: 14px; }
.top-links a:not(.btn) { color: var(--ink); text-decoration: none; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: .74rem; color: var(--muted); text-decoration: none; }
.tabs a .ic { width: 24px; height: 24px; }
.tabs a[aria-current] { color: var(--accent-d); }
.tabs a.tab-add .ic { background: var(--accent); color: #fff; border-radius: 10px; padding: 3px; width: 30px; height: 26px; }
@media (min-width: 760px) {
  .nav { display: block; } .tabs { display: none; } body.app { padding-bottom: 0; }
}

/* ---------- Layout ---------- */
.wrap { max-width: 640px; margin: 0 auto; padding: 20px 18px 40px; }
.wrap.narrow { max-width: 460px; }
.wrap.wide { max-width: 1040px; }
.foot { max-width: 640px; margin: 0 auto; padding: 8px 18px 32px; text-align: center; color: var(--muted); font-size: .82rem; }
.foot a { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.center { text-align: center; }
.block { margin: 28px 0 0; }
.sec { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; color: var(--ink); margin-bottom: 12px; }
.sec .ic { color: var(--accent); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; color: var(--muted); margin: 0 0 4px; }
.hello { margin: 6px 0 18px; }
.hello h1 { font-size: 2rem; }
.lead { font-size: 1.12rem; }
.back { margin: 0 0 12px; font-size: .92rem; } .back a { text-decoration: none; color: var(--muted); }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pagehead h1 { margin: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: 600 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: var(--accent-d); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.sm { min-height: 38px; padding: 7px 14px; font-size: .92rem; border-radius: 10px; }
.btn.big { min-height: 54px; padding: 14px 26px; font-size: 1.08rem; }
.btn.alt { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.alt:hover { background: var(--accent-l); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--accent-d); border-color: transparent; }
.btn.ghost:hover { background: var(--accent-l); color: var(--accent-d); }
.btn.wide { width: 100%; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.danger:hover { background: #862e20; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-d); text-decoration: underline; cursor: pointer; }
form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }

/* ---------- Forms ---------- */
.field { margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-weight: 600; font-size: .95rem; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=search], input[type=time], select, textarea {
  width: 100%; font: 400 1rem/1.4 var(--sans); color: var(--ink); background: #fff; border: 1px solid #c5d9ce; border-radius: 12px; padding: 11px 13px; min-height: 46px; }
textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,97,63,.18); }
.row2, .row3 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1.4fr 1fr 1fr; }
.code input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check:last-of-type { border-bottom: 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check b { display: block; font-weight: 600; } .check small { color: var(--muted); }
.checks { margin-bottom: 14px; }
[hidden] { display: none !important; }
.flash { border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; background: var(--sage-l); color: #2f4a31; border: 1px solid #cddcca; }
.flash-err { background: var(--err-l); color: var(--err); border-color: #f0c9bf; }

/* ---------- Auth pages ---------- */
.auth { padding: 28px 22px; }
.auth h1 { text-align: center; }
.big-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; background: var(--accent-l); color: var(--accent); }
.big-ic .ic { width: 30px; height: 30px; }
.big-ic.ok { background: var(--sage-l); color: var(--sage); }

/* ---------- Today ---------- */
.avatar { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--accent-l); color: var(--accent-d);
  font: 600 1.15rem/1 var(--serif); }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 0 0 12px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.pcard-main { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; flex: 1 1 200px; min-width: 0; }
.pcard-txt { display: flex; flex-direction: column; min-width: 0; }
.pname { font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.pwhy { color: var(--muted); font-size: .9rem; }
.pcard-act { display: flex; gap: 6px; align-items: center; }
.calm { background: var(--sage-l); border-color: #d3e0cf; }
.calm .lead { font-family: var(--serif); color: #2f4a31; margin-bottom: .3em; }
.empty { text-align: center; padding: 30px 22px; }
.season { background: linear-gradient(135deg, #fbefe4, #ffffff); border-color: #efd5c0; margin-top: 28px; }
.season-christmas { background: linear-gradient(135deg, #e9f0e6, #ffffff); border-color: #d3e0cf; }
.upcoming { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.upcoming li + li { border-top: 1px solid var(--line); }
.upcoming a { display: flex; gap: 14px; align-items: center; padding: 12px 16px; text-decoration: none; color: inherit; }
.upcoming a > span:last-child { display: flex; flex-direction: column; }
.ud { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 50px; border-radius: 12px; background: var(--bg);
  border: 1px solid var(--line); font: 600 1.15rem/1 var(--serif); flex: none; }
.ud b { font: 600 .66rem/1 var(--sans); text-transform: uppercase; color: var(--accent); letter-spacing: .06em; margin-bottom: 3px; }

/* ---------- Reach out (composer) ---------- */
.phead { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.phead > div { flex: 1; min-width: 0; } .phead h1 { margin: 0; } .phead p { margin: 0; }
.phead .avatar { width: 56px; height: 56px; font-size: 1.4rem; }
.note { background: #fff8e8; border: 1px solid #f0e2bd; border-radius: 12px; padding: 10px 14px; font-size: .94rem; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .9rem; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.compose textarea { font-size: 1.05rem; line-height: 1.5; margin-top: 6px; }
.row-links { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; font-size: .92rem; }
.verse { margin: 0 0 14px; padding: 12px 16px; border-left: 3px solid var(--sage); background: var(--sage-l); border-radius: 0 12px 12px 0; }
.verse blockquote { margin: 0; font-family: var(--serif); font-style: italic; }
.verse figcaption { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.send { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.send .btn { flex: 1 1 140px; }
.done-card h2 { font-size: 1.15rem; }
.later { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ---------- People ---------- */
.filter { margin-bottom: 12px; }
.plist, .slist, .dlist, .hlist { list-style: none; margin: 0 0 16px; padding: 0; }
.plist { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.plist li + li { border-top: 1px solid var(--line); }
.plist a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: inherit; }
.plist a:hover { background: #fdf8f2; }
.plist a > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pdate { font-size: .82rem; color: var(--accent-d); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.pform .bday { margin-bottom: 4px; }
.dlist li, .hlist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dlist li:last-child, .hlist li:last-child { border-bottom: 0; }
.dlist li > span, .hlist li > span, .dlist li > div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.adddate { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 6px; }
.adddate summary { cursor: pointer; font-weight: 600; color: var(--accent-d); padding: 4px 0; }
.card.danger { border-color: #f0c9bf; }
.card.danger h2 { color: var(--err); }

/* ---------- Lists (Thanksgiving / Christmas) ---------- */
.seg { display: flex; background: #f1e9dd; border-radius: 12px; padding: 4px; margin: 0 0 16px; }
.seg a { flex: 1; text-align: center; padding: 9px 8px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; }
.seg a[aria-current] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.mileage-preview { margin: -4px 0 16px; min-height: 1.3em; color: var(--accent-d); font-weight: 600; font-size: .95rem; }
#mileage-cat-label { margin: 0 0 12px; }
.quickadd .row2 { grid-template-columns: 1fr 1.3fr; }
.slist li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.slist li > .pcard-txt { flex: 1 1 160px; }
.slist li .pcard-act { flex-wrap: wrap; }
.dlist li .pwhy, .slist li .pwhy { color: var(--muted); font-size: .9rem; }
.dlist li:last-child, .hlist li:last-child, .slist li:last-child { border-bottom: 0; }
.slist li.done .pname { text-decoration: line-through; text-decoration-color: rgba(93,122,95,.6); color: var(--muted); }
.slist li.done .avatar { background: var(--sage-l); color: var(--sage); }

/* ---------- Settings ---------- */
.codes { background: #fff8e8; border-color: #f0e2bd; }
.codes-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font: 1.05rem/1.4 ui-monospace, Menlo, Consolas, monospace; list-style: none; padding: 0; margin: 0 0 12px; }
.totp ol { padding-left: 1.2em; }
.qr { width: 200px; height: 200px; margin: 8px auto 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.qr img, .qr svg { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.secret { font: .95rem ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 8px; }

/* ---------- Admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { display: block; font: 600 1.6rem/1.1 var(--serif); }
.stat span { color: var(--muted); font-size: .85rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; }
.tblwrap { overflow-x: auto; }

/* ---------- Privacy / prose ---------- */
.prose h2 { margin-top: 1.4em; font-size: 1.2rem; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }

/* ---------- Landing ---------- */
.landing .wrap { padding-top: 8px; }
.hero { display: grid; gap: 14px; align-items: start; padding: 26px 22px 22px; }
.hero h1 { font-size: 2.35rem; line-height: 1.15; max-width: 16ch; }
.hero .lead, .hero-txt .lead { color: #4c443d; font-size: 1.15rem; max-width: 38rem; line-height: 1.55; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; }
.cta .small { width: 100%; margin: 0; }
.demo-mail { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 10px 40px rgba(60,40,20,.10); padding: 18px; max-width: 420px; margin: 0 auto; transform: rotate(-.6deg); }
.demo-from { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.demo-from .logo { width: 22px; height: 22px; }
.demo-subj { font: 600 1.1rem/1.3 var(--serif); margin: 6px 0 12px; }
.demo-card { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.demo-card .avatar { width: 38px; height: 38px; font-size: 1rem; }
.demo-card b { display: block; } .demo-card small { color: var(--muted); font-size: .82rem; }
.demo-card p { margin: 6px 0 0; font-size: .93rem; font-family: var(--serif); font-style: italic; color: #4c443d; }
.demo-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-btns .btn { pointer-events: none; }
.how { padding: 26px 0 8px; }
.how > h2, .grid3-wrap > h2 { text-align: center; }
.steps { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; counter-reset: s; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px 16px 62px; position: relative; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 16px; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-l); color: var(--accent-d);
  display: grid; place-items: center; font: 600 1rem/1 var(--serif); }
.steps b { display: block; font-family: var(--serif); font-size: 1.08rem; margin-bottom: 2px; }
.grid3 { display: grid; gap: 14px; margin: 18px 0; }
.grid3 .card { margin: 0; }
.grid3 h3 { display: flex; gap: 8px; align-items: center; }
.grid3 h3 .ic { color: var(--accent); }
.promise { background: var(--sage-l); border-color: #d3e0cf; }
.promise ul { margin: 0; padding-left: 1.2em; }
.closing { text-align: center; padding: 30px 0 10px; }
.closing h2 { font-size: 1.7rem; }
@media (min-width: 760px) {
  h1 { font-size: 2rem; }
  .hero { grid-template-columns: 1fr; padding: 36px 32px 30px; }
  .hero h1 { font-size: 2.75rem; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 380px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .hello h1 { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .top, .tabs, .foot, .btn { display: none !important; } }

/* ---------- My Writeoffs extras ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.35rem; font-family: var(--serif); }
.stat span { color: var(--muted); font-size: .85rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.row-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item a { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-item .amt { font-weight: 600; white-space: nowrap; }
.card.tight { padding: 8px 20px; }
.filters .field { margin-bottom: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.hero h1 { font-size: 2.2rem; }
.big-ic { font-size: 2rem; margin-bottom: 8px; color: var(--accent); }
.auth .big-ic .ic { width: 40px; height: 40px; }
.codes-list { columns: 2; gap: 8px; font-family: ui-monospace, monospace; }
.danger-zone { border-color: #f0cfc7; }
.flash { padding: 12px 14px; border-radius: 12px; margin: 0 0 14px; }
.flash-ok { background: var(--sage-l); color: var(--sage); }
.flash-err { background: var(--err-l); color: var(--err); }
.stack .field { margin-top: 10px; }
.report-head { margin-bottom: 16px; }
@media print {
  .top, .tabs, .foot, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .tbl th, .tbl td { font-size: 11pt; }
}

/* Optional saved routes and repeats on the mileage form. */
details.repeat-box { margin: 1.05rem 0; border: 1px solid var(--line); border-radius: .8rem; padding: .8rem 1rem; background: rgba(245,238,230,.38); }
details.repeat-box > summary { font-weight: 700; cursor: pointer; }
details.repeat-box[open] > summary { margin-bottom: .7rem; }
.saved-trip { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.saved-trip > button { flex: 1; text-align: left; }
.saved-trip .inline { flex-shrink: 0; }
.saved-trip span { font-weight: 400; }
#save-trip-fields { padding: .1rem 0 .25rem; }
#trip-name-field { margin-top: .6rem; }
