/* Carbon Copy — vintage typewriter, clean, chic. No radius, no shadow, no gradient. */
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 400; font-display: swap; src: url('/lora-400.woff') format('woff'); }
@font-face { font-family: 'Lora'; font-style: italic; font-weight: 400; font-display: swap; src: url('/lora-400i.woff') format('woff'); }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 600; font-display: swap; src: url('/lora-600.woff') format('woff'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/plexmono-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/plexmono-500.woff2') format('woff2'); }

:root {
  --paper: #F4EFE6;
  --ink: #1C1A17;
  --orange: #C05621;
  --aub: #4A2545;
  --rule: rgba(28, 26, 23, 0.22);
  --rule-strong: rgba(28, 26, 23, 0.6);
  --muted: rgba(28, 26, 23, 0.6);
  --faint: rgba(28, 26, 23, 0.08);
  --serif: 'Lora', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --gutter: 20px;
  --tabbar: 58px;
  color-scheme: light;
}
* { box-sizing: border-box; border-radius: 0 !important; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
p a, .prose a, .detail-sub a, .row-sub a, .muted a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
pre, code { font-family: var(--mono); }
code { font-size: 0.85em; }
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }
h1, h2, h3 { font-weight: 400; margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
::selection { background: var(--aub); color: var(--paper); }

.mono-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.spacer { flex: 1; }
.lede { font-style: italic; margin: 0 0 8px; }
.prose { margin: 0; white-space: pre-wrap; }

/* ---------- layout ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { padding: 40vh var(--gutter); text-align: center; color: var(--muted); }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--paper); display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px; border-bottom: 1px solid var(--ink); }
.topbar-left { display: flex; gap: 12px; align-items: baseline; }
.topbar-title { font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.pending { color: var(--aub); }
.failed { color: var(--orange); text-decoration: underline; }
.syncing { animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.iconbtn { display: inline-flex; padding: 4px; color: var(--ink); }
.main { flex: 1; padding: 14px var(--gutter) calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); max-width: 720px; width: 100%; margin: 0 auto; }
.screen > * + * { margin-top: 16px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--paper); border-top: 1px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; color: var(--muted); position: relative; }
.tab.is-active { color: var(--aub); }
.tab.is-active::after { content: ''; position: absolute; left: 26%; right: 26%; bottom: calc(4px + env(safe-area-inset-bottom)); height: 2px; background: var(--aub); }
.tab-label { font-size: 9.5px; }
.tab-badge { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--aub); color: var(--paper); font-size: 9px; padding: 1px 4px; letter-spacing: 0.05em; }

.install-hint { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 var(--gutter); padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 14px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 14px; z-index: 20; max-width: 90vw; line-height: 1.35; }

/* ---------- buttons, marks, inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange); border: 1px solid var(--orange); background: transparent; padding: 10px 14px; line-height: 1; white-space: nowrap; }
.btn:active { background: var(--orange); color: var(--paper); }
.btn-primary { background: var(--orange); color: var(--paper); }
.btn-primary:active { background: var(--ink); border-color: var(--ink); }
.btn-small { padding: 7px 10px; font-size: 11px; }
.btn-quiet { color: var(--muted); border-color: var(--rule); }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.mark { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.mark-aub { color: var(--aub); }
.mark-ink { color: var(--muted); }
.mark-orange { color: var(--orange); }
.mark-action { font-weight: 500; }
.mark-aub.mark-action { border-bottom: 1px solid var(--aub); padding-bottom: 1px; }
.input { width: 100%; font-family: var(--serif); font-size: 17px; line-height: 1.4; color: var(--ink); background: transparent; border: 1px solid var(--ink); padding: 10px 12px; -webkit-appearance: none; appearance: none; }
.input:focus { outline: none; border-color: var(--aub); }
.input::placeholder { color: var(--muted); font-style: italic; }
textarea.input { resize: vertical; }
.select { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231C1A17' stroke-width='1.1'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select-inline { width: auto; padding: 5px 30px 5px 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; border-color: var(--rule-strong); background-position: right 8px center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .select { flex: 1 1 130px; width: auto; padding: 8px 30px 8px 10px; font-size: 15px; }
.filters .btn { flex: 1 1 100%; }
.field { display: block; }
.field + .field { margin-top: 14px; }
.field-label { display: block; color: var(--muted); margin-bottom: 6px; }
.field-hint { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col .field + .field { margin-top: 0; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.status-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.any-row { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.any-row .input { flex: 1; min-width: 0; }
.any-row .select { flex: 0 0 auto; width: auto; }
.input-num { width: 110px; text-align: right; font-family: var(--mono); font-size: 15px; padding: 6px 8px; }
.savestate { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.savestate-saved { color: var(--aub); }
.savestate-queued { color: var(--aub); }
.savestate-error { color: var(--orange); }
.note { font-size: 14px; color: var(--muted); border-left: 1px solid var(--rule-strong); padding-left: 10px; margin: 0; }
.note-warn { color: var(--aub); border-left-color: var(--aub); }
.empty { color: var(--muted); font-style: italic; margin: 8px 0; }

/* ---------- sections, toggles ---------- */
.section { border-top: 1px solid var(--ink); padding-top: 10px; }
.section > * + * { margin-top: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { font-weight: 500; }
.toggle { display: flex; border-bottom: 1px solid var(--rule); }
.toggle-item { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 8px 14px 8px 0; margin-right: 14px; color: var(--muted); position: relative; display: inline-flex; gap: 8px; align-items: center; }
.toggle-item.is-active { color: var(--ink); }
.toggle-item.is-active::after { content: ''; position: absolute; left: 0; right: 14px; bottom: -1px; height: 1px; background: var(--ink); }
.toggle-count { color: var(--aub); }
.collapsible-head { display: flex; gap: 8px; text-align: left; align-items: baseline; width: 100%; }
.collapsible-body { margin-top: 8px; }

/* ---------- dump ---------- */
.dump-frame { border: 1px solid var(--ink); padding: 14px; position: relative; }
.dump-frame::before { content: ''; position: absolute; inset: 5px; border: 1px solid var(--rule); pointer-events: none; }
.dump-box { width: 100%; border: 0; background: transparent; font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink); resize: none; min-height: 180px; padding: 4px; }
.dump-box:focus { outline: none; }
.dump-box::placeholder { color: var(--muted); font-style: italic; }
.dump-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }
.fragment { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.fragment-text { margin: 0 0 8px; white-space: pre-wrap; }
.fragment-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- cards & rows ---------- */
.cards { display: grid; grid-template-columns: 1fr; gap: 0; }
.card { display: block; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.card-top, .row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-title, .row-title { font-size: 20px; line-height: 1.25; margin-top: 4px; display: block; }
.card-line { margin: 6px 0 0; color: var(--muted); font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-themes, .themeline { margin: 8px 0 0; color: var(--aub); }
.list { display: block; }
.row { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.row-sub { margin: 2px 0 0; color: var(--muted); }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.row-flags { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; align-items: baseline; }
.row .row-actions, .row .status-actions { margin-top: 10px; }
.row-follow .row-title { text-decoration: none; }
.row-week .mono-label { display: block; }
.history-row { display: block; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.history-main { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.history-market { font-size: 17px; }
.history-meta { margin-top: 3px; }
.suggest { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.suggest-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.suggest-title { font-size: 17px; }
.result { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.result-title { font-size: 17px; }
.search-input { font-size: 20px; }

/* ---------- detail ---------- */
.screen-detail > * + * { margin-top: 14px; }
.backlink { display: inline-block; color: var(--muted); }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title { font-size: 28px; line-height: 1.2; }
.detail-sub { margin: -6px 0 0; color: var(--muted); }
.detail-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.piece-text { font-family: var(--serif); font-size: 17px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; margin: 0; padding: 16px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.notes { color: var(--muted); white-space: pre-wrap; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.facts div { border-top: 1px solid var(--rule); padding-top: 6px; }
.facts dt { margin: 0 0 2px; }
.facts dd { margin: 0; font-size: 16px; }
.title-input { font-size: 22px; border-width: 0 0 1px 0; padding-left: 0; padding-right: 0; }
.editor { width: 100%; border: 1px solid var(--rule); padding: 12px; font-family: var(--serif); font-size: 17px; line-height: 1.6; background: transparent; color: var(--ink); min-height: 40vh; resize: vertical; }
.editor:focus { outline: none; border-color: var(--ink); }
.editor-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--rule-strong); color: var(--muted); padding: 5px 9px; }
.chip.is-on { border-color: var(--aub); color: var(--aub); background: rgba(74, 37, 69, 0.07); }
.savestate-slot { min-height: 1em; }

.accept-panel { border-top: 2px solid var(--aub); }
.accept-panel .section-head h2 { color: var(--aub); }
.withdraw { border: 1px solid var(--rule-strong); padding: 12px; }
.withdraw + .withdraw { margin-top: 12px; }
.withdraw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.email { font-family: var(--serif); font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; margin: 0 0 10px; padding: 12px; border: 1px solid var(--rule); background: rgba(255,255,255,0.35); }

/* ---------- milestones, stats, money ---------- */
.milestones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 10px 0; }
.milestones.is-compact .stat-value { font-size: 22px; }
.milestone-cats { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); padding-top: 4px; border-top: 1px solid var(--rule); }
.milestone-cats b { color: var(--ink); font-weight: 500; }
.stat-value { font-family: var(--mono); font-size: 26px; line-height: 1.1; }
.stat-label { color: var(--muted); margin-top: 3px; }
.stat-sub { font-size: 13px; color: var(--muted); }
.money-summary { border-top: 1px solid var(--ink); }
.money-line { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.money-line .money { align-items: flex-end; text-align: right; }
.money-net { border-bottom: 1px solid var(--ink); }
.money { display: inline-flex; flex-direction: column; line-height: 1.15; }
.money-usd { font-family: var(--mono); }
.money-myr { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.05em; }
.money-big .money-usd { font-size: 24px; }
.progress { height: 10px; border: 1px solid var(--ink); position: relative; }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--aub); }
.progress-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.tap-group + .tap-group { margin-top: 12px; }
.tap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.tap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; border: 1px solid var(--orange); color: var(--ink); padding: 10px 12px; }
.tap:active { background: var(--orange); color: var(--paper); }
.tap:active .tap-price { color: var(--paper); }
.tap-name { font-size: 15px; line-height: 1.25; }
.tap-price { color: var(--orange); }
.any-amount { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; grid-column: 1 / -1; }
.bar { height: 6px; border: 1px solid var(--rule-strong); position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.fees-by-type { margin-top: 12px; }
.fee-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.ledger-row { display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.ledger-entry { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- rewards ---------- */
.reward { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.reward.is-locked .reward-name, .reward.is-locked .reward-meta { opacity: 0.45; }
.reward-name { font-size: 18px; line-height: 1.3; }
.reward-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; }
.reward-note { font-size: 14px; color: var(--aub); margin-top: 3px; }
.reward-action { flex: 0 0 auto; padding-top: 3px; }

/* ---------- kit ---------- */
.kit-item { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.kit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.kit-name { font-size: 18px; }
.credit { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.credit-title { font-style: italic; }

/* ---------- settings, index ---------- */
.token-input { font-family: var(--mono); font-size: 13px; }
.counts { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.counts b { font-weight: 500; color: var(--ink); }
.queue-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: center; }
.queue-row.is-failed { color: var(--orange); }
.setting-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: center; }
.setting-edit { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.index-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: baseline; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.index-n { color: var(--muted); }
.index-title { font-size: 22px; }
.colophon { margin-top: 32px; }

/* ---------- token gate ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; padding: 40px var(--gutter); }
.gate-inner { max-width: 440px; margin: 0 auto; width: 100%; }
.gate-inner > * + * { margin-top: 14px; }
.gate-title { font-family: var(--mono); font-size: 26px; letter-spacing: 0.06em; text-transform: uppercase; }

@media (min-width: 600px) {
  :root { --gutter: 28px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 0 28px; }
  .tap-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- additions: tally, confirm, payment, rewards +, dump gestures ---------- */
.tally { margin: 0; }
.confirm { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.confirm-q { font-size: 14px; color: var(--aub); }
.ledger-row { grid-template-columns: 62px 1fr auto; }
.ledger-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.pay-panel { border-top: 2px solid var(--orange); }
.pay-panel .section-head h2 { color: var(--orange); }
.add-reward { border: 1px solid var(--rule-strong); padding: 12px; }
.add-reward > * + * { margin-top: 12px; }
.add-reward .input-num { width: 150px; text-align: left; }
.section-aside-row { display: inline-flex; align-items: center; gap: 12px; }
.plus { font-family: var(--mono); font-size: 16px; line-height: 1; color: var(--orange); border: 1px solid var(--orange); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.plus:active { background: var(--orange); color: var(--paper); }
.section-aside .toggle { border-bottom: 0; }
.section-aside .toggle-item { padding: 0 0 0 0; margin-right: 12px; }
.section-aside .toggle-item:last-child { margin-right: 0; }
.section-aside .toggle-item.is-active::after { bottom: -4px; right: 0; }
.fragment { touch-action: pan-y; transition: transform 160ms ease-out; user-select: none; -webkit-user-select: none; position: relative; }
.fragment.is-armed { border-left: 2px solid var(--aub); padding-left: 10px; }
.fragment.is-filed .fragment-text { color: var(--muted); }
.fragment-confirm { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); color: var(--aub); font-size: 15px; }


/* ---------- markdown fields ---------- */
.mdfield { border: 1px solid var(--rule-strong); }
.mdfield-area { display: block; width: 100%; border: 0; background: transparent; font-family: var(--serif); font-size: 17px; line-height: 1.55; color: var(--ink); padding: 10px 12px; resize: vertical; white-space: pre-wrap; }
.mdfield-area:focus { outline: none; }
.mdfield-area::placeholder { color: var(--muted); font-style: italic; }
.mdfield:focus-within { border-color: var(--aub); }
.mdbar { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--rule); padding: 4px 8px; }
.mdbtn { font-family: var(--serif); font-size: 15px; width: 30px; height: 26px; color: var(--orange); border: 1px solid transparent; line-height: 1; }
.mdbtn:active { border-color: var(--orange); }
.mdbtn-b { font-weight: 600; }
.mdbtn-i { font-style: italic; }
.mdbar-hint { margin-left: auto; font-size: 9.5px; }
.richtext { white-space: pre-wrap; }
/* single-line previews keep their own wrapping */
.entry-preview.richtext { white-space: nowrap; }
/* the draft editor: Dump's field, at the old editor's size */
.editor-md { display: flex; flex-direction: column; }
.editor-md .mdfield-area { min-height: 40vh; padding: 12px; line-height: 1.6; }
/* a poem is long and the phone is short: the bar sits on top and stays in reach */
.editor-md .mdbar { order: -1; border-top: 0; border-bottom: 1px solid var(--rule); position: sticky; top: calc(51px + env(safe-area-inset-top, 0px)); z-index: 2; background: var(--paper); }

/* ---------- stars ---------- */
.stars { letter-spacing: 1px; font-size: 12px; color: var(--rule); }
.star.is-on { color: var(--aub); }

/* ---------- toast with undo ---------- */
.toast { display: flex; align-items: center; gap: 12px; }
.toast-text { flex: 1 1 auto; min-width: 0; }
.toast-undo, .toast-close { flex: 0 0 auto; }
.toast-undo { color: var(--paper); border-bottom: 1px solid var(--paper); letter-spacing: 0.12em; text-transform: uppercase; font-size: 10.5px; font-family: var(--mono); }
.toast-close { color: var(--paper); opacity: 0.6; font-size: 16px; line-height: 1; padding: 0 2px; }

/* ---------- dump: title + fragments ---------- */
.dump-title { width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); padding: 4px 4px 8px; margin-bottom: 8px; }
.dump-title:focus { outline: none; border-bottom-color: var(--aub); }
.dump-title::placeholder { color: var(--muted); text-transform: none; letter-spacing: 0.04em; font-style: italic; }
.dump-md { border: 0; }
.dump-md .mdfield-area { min-height: 150px; font-size: 18px; padding: 4px; }
.dump-md .mdbar { border-top: 1px solid var(--rule); padding-left: 0; padding-right: 0; }
.fragment-title { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--aub); margin: 0 0 4px; }

/* ---------- to do ---------- */
.todo-add { border: 1px solid var(--ink); padding: 12px; }
.todo-add-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.todo-due-label { flex: 0 0 auto; }
.input-date { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; padding: 8px 10px; }
.todo { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.todo-box { flex: 0 0 auto; width: 18px; height: 18px; border: 1px solid var(--rule-strong); display: inline-flex; align-items: center; justify-content: center; align-self: center; }
.todo-tick { font-family: var(--mono); font-size: 14px; line-height: 1; color: var(--aub); }
.todo.is-done .todo-box { border-color: var(--aub); }
.todo-body { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-task { line-height: 1.35; }
.todo-due { font-size: 10px; color: var(--muted); }
.todo.is-overdue .todo-task { color: var(--aub); }
.todo.is-overdue .todo-due { color: var(--aub); }
.todo.is-overdue .todo-box { border-color: var(--aub); border-width: 2px; }
.todo.is-done .todo-task { color: var(--aub); text-decoration: line-through; text-decoration-color: var(--aub); text-decoration-thickness: 1px; }
.todo.is-cleared { opacity: 0.55; }
.todo-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- themes ---------- */
.themepicker > * + * { margin-top: 10px; }
.row-theme .row-title { display: inline-block; }
.theme-count { color: var(--aub); }

/* ---------- collection ---------- */
.row-collection .progress { margin-top: 8px; }
.collection-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.collection-progress .progress { flex: 1 1 140px; }
.collection-section { margin-top: 18px; }
.collection-section-head { display: flex; align-items: baseline; gap: 10px; border-top: 1px solid var(--aub); padding-top: 8px; margin-bottom: 4px; }
.collection-section-title { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--aub); font-weight: 500; }
.section-rename-btn { margin-left: auto; color: var(--orange); font-size: 10px; }
.section-rename { margin: 8px 0; }
.addbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 8px 0; }
.entry { border-bottom: 1px solid var(--rule); padding: 9px 0; position: relative; }
.entry.drop-before::before, .entry.drop-after::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--aub); }
.entry.drop-before::before { top: -1px; }
.entry.drop-after::after { bottom: -1px; }
.entry-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entry-handle { color: var(--muted); cursor: grab; touch-action: none; display: inline-flex; }
.entry-title { flex: 1 1 160px; min-width: 0; display: flex; align-items: baseline; gap: 8px; text-align: left; }
.entry-pos { flex: 0 0 auto; min-width: 1.6em; }
.entry-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-kind { color: var(--muted); font-size: 9.5px; }
.entry-preview { margin: 3px 0 0 34px; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry.is-open { border-bottom-width: 1px; padding-bottom: 14px; }
.entry-body { margin-top: 10px; }
.entry-body > * + * { margin-top: 10px; }
.entry-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.entry-move { display: inline-flex; gap: 2px; }
.entry-move .iconbtn[disabled] { opacity: 0.25; pointer-events: none; }
.entry-divider { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--aub); }
.entry-divider-label { color: var(--aub); font-size: 12px; letter-spacing: 0.14em; }
.picker-list { max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--rule); }
.picker-row { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.entry-text-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facing-toggle .toggle { border-bottom: 0; }
.facing-toggle .toggle-item { padding: 4px 10px 4px 0; margin-right: 8px; font-size: 10.5px; }
.dual { display: grid; gap: 12px; }
.dual-pane > * + * { margin-top: 4px; }
.dual-label { display: block; }
.dual.has-facing .dual-facing { display: none; }
.dual.has-facing.side-facing .dual-main { display: none; }
.dual.has-facing.side-facing .dual-facing { display: block; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { display: block; border: 1px solid var(--rule-strong); max-width: 160px; }
.thumb img { display: block; width: 100%; height: auto; }
.entry-images > * + * { margin-top: 10px; }

/* ---------- duplicate guard ---------- */
.dupe-warn { border-left: 2px solid var(--aub); padding-left: 10px; }
.dupe-warn > * + * { margin-top: 6px; }
.dupe-list { list-style: none; margin: 0; padding: 0; color: var(--aub); }
.dupe-list li + li { margin-top: 2px; }
.dupe-list a { text-decoration: underline; text-underline-offset: 2px; }
.ack { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--aub); }
.ack input { width: 18px; height: 18px; accent-color: #4A2545; }
.row-market.is-shut { opacity: 0.5; }
.result-title.is-done { text-decoration: line-through; text-decoration-color: var(--aub); color: var(--aub); }

/* ---------- wide screens: dual text side by side ---------- */
@media (min-width: 700px) {
  .dual.has-facing { grid-template-columns: 1fr 1fr; }
  .dual.has-facing .dual-facing { display: block; }
  .dual.has-facing.side-facing .dual-main { display: block; }
  .facing-toggle { display: none; }
}

/* ---- a reply the nightly mail sweep found -------------------------------- */
/* Aubergine throughout: this is the state of things, not a thing to press. The only
   orange in here comes from the status buttons, which are things you press. */
.reply-flag { border-left: 2px solid var(--aub); padding: 10px 0 10px 12px; margin: 12px 0; }
.reply-reads { margin: 6px 0 2px; color: var(--aub); font-size: 16px; }
.reply-subject { margin: 0 0 2px; font-size: 15px; }
.reply-snippet { margin: 8px 0; padding: 0 0 0 10px; border-left: 1px solid var(--rule); font-size: 15px; color: var(--muted); font-style: italic; white-space: pre-wrap; }
.reply-flag .status-actions { margin-top: 10px; }
.row-reply { padding-bottom: 6px; }
.row-reply + .row-reply { border-top: 1px solid var(--rule); padding-top: 12px; }

/* ---- the du'a on the empty capture field ------------------------------- */
/* Sits over the textarea rather than inside its placeholder, so it can be set in two
   voices. pointer-events: none — a tap anywhere on it lands in the field beneath. */
.mdfield { position: relative; }
.mdfield-note { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: center; padding: 4px 6px; }
.duaa { margin: 0; border-left: 2px solid var(--aub); padding: 2px 0 2px 14px; }
.duaa-ar { margin: 0 0 7px; font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.45; color: var(--ink); }
.duaa-en { margin: 0; font-family: var(--serif); font-size: 14.5px; line-height: 1.5; color: var(--muted); }
@media (min-width: 520px) { .duaa-ar { font-size: 19px; } }

/* ---- kit editor -------------------------------------------------------- */
.kit-add { margin: 14px 0 4px; }
.kit-form .mdfield { margin-top: 2px; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 12px 0 2px; font-size: 15px; }
.check-row input[type="checkbox"] { accent-color: var(--aub); width: 16px; height: 16px; }
.kit-head .row-actions { display: inline-flex; flex-wrap: nowrap; gap: 8px; align-items: flex-start; }

/* ---- from this week, before ------------------------------------------------ */
.past { border-left: 2px solid var(--rule); padding-left: 12px; }
.past-row + .past-row { border-top: 1px solid var(--rule); margin-top: 10px; padding-top: 10px; }
.past-text { font-size: 15.5px; color: var(--muted); white-space: pre-wrap; margin: 3px 0 0; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; }

/* ---- reading log ----------------------------------------------------------- */
.read-row { padding: 2px 0 8px; }
.read-row + .read-row { border-top: 1px solid var(--rule); padding-top: 12px; }
.read-title { font-size: 16.5px; }
.read-note { font-size: 15px; color: var(--muted); margin: 5px 0 2px; white-space: pre-wrap; }
.read-states { margin: 12px 0 6px; }
.read-tabs { margin: 26px 0 8px; }
.read-form.is-compact .dump-title { margin-bottom: 0; }
.read-tabs .toggle { flex-wrap: wrap; }
.read-row .row-top .mark { margin-left: 10px; }
.read-of-theirs { padding: 3px 0; }
.manuscript { display: block; margin-top: 3px; }
.row-owed .row-title { text-decoration: none; }

/* ---------- editing in place ---------- */
/* Anything that can be written down can be corrected without being retyped. The editors
   sit where the row sat, so the list does not jump under her thumb. */
.todo-task { line-height: 1.35; font: inherit; color: inherit; background: transparent; border: 0; padding: 0; margin: 0; text-align: left; width: 100%; -webkit-appearance: none; }
.todo-task:active { color: var(--orange); }
.todo.is-editing { display: block; border-left: 2px solid var(--aub); padding-left: 10px; }
.todo.is-editing .todo-add-row { margin-top: 8px; }
.fragment.is-editing { border-left: 2px solid var(--aub); padding-left: 10px; user-select: text; -webkit-user-select: text; touch-action: auto; }
.fragment.is-editing .dump-title { margin-bottom: 6px; }
.fragment.is-editing .fragment-meta { margin-top: 8px; }
.dump-frame.is-editing { border-left: 2px solid var(--aub); padding-left: 10px; }
.ledger-entry { font: inherit; color: inherit; background: transparent; border: 0; padding: 0; margin: 0; text-align: left; -webkit-appearance: none; }
.ledger-entry:active { color: var(--orange); }
.ledger-row.is-editing { grid-template-columns: 1fr; gap: 8px; border-left: 2px solid var(--aub); padding-left: 10px; }
.ledger-row.is-editing .input-num { width: 150px; }
.correct { border-left: 2px solid var(--aub); padding-left: 10px; }

/* A new build can be waiting behind an app that is never closed. Say so, don't reload
   under her hands. */
.update-hint { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 var(--gutter); padding: 10px 0; border-bottom: 1px solid var(--aub); font-size: 14px; color: var(--aub); }
.update-reload { color: var(--orange); border: 1px solid var(--orange); background: transparent; padding: 6px 10px; line-height: 1; }
.update-reload:active { background: var(--orange); color: var(--paper); }
