/* Layout: one calm mobile column. Header, month, add buttons, project chips, month summary, slip cards, export card. */
:root {
  --bg: #f1eee8;
  --panel: #ffffff;
  --ink: #1c2924;
  --muted: #68716c;
  --line: #e1dcd0;
  --accent: #1d5a48;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece7;
  --sel-bg: #1c2924;
  --sel-ink: #f4f1ea;
  --warn: #85470a;
  --warn-soft: #faefd2;
  --note-bg: #fbf0c8;
  --note-line: #ead98a;
  --bad: #a3262a;
  --t0: #e6edf6; --t1: #fbe8d8; --t2: #e2ece6; --t3: #eee5f2; --t4: #f5eed0;
  --shadow: 0 1px 2px rgba(30, 40, 35, .05), 0 10px 28px rgba(30, 40, 35, .06);
  --font-text: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613; --panel: #1b2420; --ink: #e8efeb; --muted: #9aa9a2; --line: #2c3833;
    --accent: #62c29f; --accent-ink: #08241a; --accent-soft: #1f342a; --sel-bg: #e8efeb; --sel-ink: #111613;
    --warn: #f0b45c; --warn-soft: #3b2b15; --note-bg: #3a3317; --note-line: #5d5226; --bad: #f2898c;
    --t0: #24303f; --t1: #3b2c20; --t2: #213428; --t3: #31283a; --t4: #38341d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613; --panel: #1b2420; --ink: #e8efeb; --muted: #9aa9a2; --line: #2c3833;
  --accent: #62c29f; --accent-ink: #08241a; --accent-soft: #1f342a; --sel-bg: #e8efeb; --sel-ink: #111613;
  --warn: #f0b45c; --warn-soft: #3b2b15; --note-bg: #3a3317; --note-line: #5d5226; --bad: #f2898c;
  --t0: #24303f; --t1: #3b2c20; --t2: #213428; --t3: #31283a; --t4: #38341d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-text); font-size: 16px; line-height: 1.45;
  padding-block: 20px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 1.05; letter-spacing: -0.02em; margin: 8px 0 0; }
.pchip .pen { display: inline-flex; width: 16px; height: 16px; margin-left: 6px; opacity: .8; }
.pchip .pen svg { width: 16px; height: 16px; }
.owed { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 8px; }
.owed span { color: var(--muted); font-size: 15px; } .owed b { font-size: 17px; }
.titlerow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 8px; }
.titlerow h1 { margin: 0; }
#bookName { text-align: right; font-size: 16px; max-width: 45%; overflow-wrap: anywhere; }
.lede { margin: 10px 0 0; color: var(--muted); font-size: 18px; }
.brandlogo { display: block; height: 40px; width: auto; }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.choice { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; min-height: 44px; }
.choice b { font-size: 17px; } .choice span { color: var(--muted); font-size: 15px; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
h2 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 14px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
select, input[type="text"], input[type="date"], textarea {
  width: 100%; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px;
}
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; text-align: left; min-height: 52px; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2368716c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }

.card { background: var(--panel); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 999px; border: 2px solid transparent; padding: 0 22px; min-height: 54px; font-size: 18px; font-weight: 600; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.dark { background: var(--sel-bg); color: var(--sel-ink); }
.btn.small { min-height: 44px; font-size: 15px; padding: 0 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--accent); font-weight: 600; font-size: 15px; padding: 10px 16px; min-height: 44px; }

.note { padding: 14px 16px; border-radius: 16px; background: var(--note-bg); border: 1px solid var(--note-line); display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.note button { align-self: flex-start; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 9px 16px; min-height: 44px; font-weight: 500; font-size: 15px; display: inline-flex; gap: 8px; align-items: baseline; }
.pchip small { color: var(--muted); font-size: 13px; }
.pchip[aria-pressed="true"] { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--sel-bg); }
.pchip[aria-pressed="true"] small { color: inherit; opacity: .75; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
.stat label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.attn b { color: var(--warn); }
.cats { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.cat { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.cat .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.track { grid-column: 1 / -1; height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.fuelline { color: var(--muted); font-size: 15px; margin: 0; }
.fuelline b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.slips { display: flex; flex-direction: column; gap: 14px; }
.slip { background: var(--panel); border-radius: 22px; padding: 18px 18px 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; cursor: pointer; text-align: left; border: 0; width: 100%; color: inherit; }
.slip.ex { cursor: default; }
.slip:not(.ex):hover { outline: 2px solid var(--line); }
.slip .meta { color: var(--muted); font-size: 14px; grid-column: 1; }
.slip .title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; grid-column: 1; overflow-wrap: anywhere; }
.slip .detail { color: var(--muted); font-size: 15px; grid-column: 1; overflow-wrap: anywhere; }
.slip .thumb { grid-column: 2; grid-row: 1 / span 3; width: 60px; height: 60px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--bg); }
.slip .tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.slip .money { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.slip .money b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slip .money span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.slip .flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.tag.t0 { background: var(--t0); } .tag.t1 { background: var(--t1); } .tag.t2 { background: var(--t2); } .tag.t3 { background: var(--t3); } .tag.t4 { background: var(--t4); }
.tag.proj { border: 1px solid var(--line); font-weight: 500; background: transparent; }
.flag { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.flag.hard { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.flag.ok { background: var(--accent-soft); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--muted); }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.how { background: var(--accent-soft); border-radius: 22px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.how h2 { font-size: 18px; }
.how p { margin: 0; font-size: 15px; }
.how p.sub { font-size: 14px; }
textarea.copybox { min-height: 110px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; white-space: pre; }

details.help { font-size: 15px; }
details.help summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; min-height: 36px; }
details.help summary::-webkit-details-marker { display: none; }
details.help summary::before { content: "?"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 13px; line-height: 1; }
details.help[open] summary::before { content: "×"; font-size: 16px; }
details.help .body { margin-top: 6px; padding: 14px 16px; background: var(--accent-soft); border-radius: 16px; display: flex; flex-direction: column; gap: 10px; }
details.help .body p { margin: 0; }
.stat.good b { color: var(--accent); }
.stat.bad b { color: var(--bad); }
.jobrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--bg); border-radius: 16px; padding: 12px 14px; border: 0; width: 100%; text-align: left; color: inherit; }
.jobrow b { font-weight: 600; overflow-wrap: anywhere; }
.jobrow .p { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.good { color: var(--accent); } .bad { color: var(--bad); }
.incrow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; text-align: left; color: inherit; cursor: pointer; }
.incrow.ex { cursor: default; }
.incrow .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.batch .thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.batch .thumbs img, .batch .thumbs span { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: var(--bg); display: block; }
.batch .thumbs .q { opacity: .45; } .batch .thumbs .r { outline: 2px solid var(--accent); }
.overlay { position: fixed; inset: 0; background: rgba(12, 18, 15, .55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.overlay[hidden] { display: none; }
.overlay { overscroll-behavior: contain; touch-action: none; }
.sheet { overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
body.locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.sheet { background: var(--bg); width: 100%; max-width: 600px; max-height: 94%; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 26px; max-height: 90%; } }
.sheet h2 { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.photo { background: var(--panel); border: 2px dashed var(--line); border-radius: 20px; padding: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.photo.over { border-color: var(--accent); background: var(--accent-soft); }
.photo img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }
.photo .msg { flex: 1; min-width: 160px; font-size: 15px; }
.photo .bar { height: 5px; border-radius: 3px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.photo .bar i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.1s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 60%; } }
@media (prefers-reduced-motion: reduce) { .photo .bar i { animation: none; width: 100%; opacity: .5; } }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.linkbtn { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 0; text-align: left; }
.prow { background: var(--panel); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.prow .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.prow .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.zoom { position: fixed; inset: 0; background: rgba(8, 12, 10, .85); z-index: 60; display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.zoom[hidden] { display: none; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 10px; background: #fff; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--sel-bg); color: var(--sel-ink); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; z-index: 80; max-width: calc(100% - 32px); text-align: center; }
.toast[hidden] { display: none; }
