/* Daystub — off-white paper, ink, one marigold. One typeface: IBM Plex Mono,
   caps for titles and numbers, like a pay stub or a concert ticket. */
:root {
  --paper: #FAF9F6; --paper2: #F2F0EB; --card: #FFFEFC;
  --ink: #111; --ink2: rgba(17,17,17,.62); --ink3: rgba(17,17,17,.36); --line: rgba(17,17,17,.12);
  --mari: #EAA221; --mari-soft: rgba(234,162,33,.2);
  --side: 248px; --r: 14px;
  --top: env(safe-area-inset-top); --bot: env(safe-area-inset-bottom);
  --display: 'IBM Plex Mono', ui-monospace, Menlo, monospace; --text: 'IBM Plex Mono', ui-monospace, Menlo, monospace; --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font: 14.5px/1.5 var(--text); overscroll-behavior: none; }
body { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: .3; }
input, textarea { font: inherit; color: inherit; background: transparent; border: 0; outline: 0; padding: 0; resize: none; width: 100%; }
::placeholder { color: var(--ink3); }
@media (pointer: coarse) { input, select, textarea { font-size: max(16px, 1em) !important; } }

.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic .fill { fill: currentColor; stroke: none; }
.ic.mari { color: var(--mari); }

/* ---- layout ---- */
#app { display: flex; height: 100vh; height: 100dvh; }
.side { width: var(--side); flex: none; overflow-y: auto; background: var(--paper2); border-right: 1px solid var(--line);
  padding: calc(var(--top) + 18px) 12px calc(var(--bot) + 40px); -webkit-overflow-scrolling: touch; }
.main { flex: 1; min-width: 0; overflow-y: auto; position: relative; padding: calc(var(--top) + 18px) clamp(18px, 4vw, 44px) calc(var(--bot) + 140px); -webkit-overflow-scrolling: touch; }
.main > * { max-width: 720px; margin-left: auto !important; margin-right: auto !important; }
.narrow .side { width: 100%; border: 0; }
.narrow.show-side .main, .narrow.show-main .side { display: none; }

/* ---- sidebar ---- */
.brand { padding: 4px 8px 16px; }
.stub-logo { display: inline-block; position: relative; background: var(--ink); color: var(--paper); padding: 6px 44px 3px 18px; font: 600 18px/1 var(--display); letter-spacing: .06em;
  -webkit-mask: radial-gradient(circle 7px at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 7px at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 7px at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat; }
.stub-logo::after { content: ''; position: absolute; top: 4px; bottom: 4px; right: 24px; border-left: 2px dashed var(--mari); }
.brand em { display: block; font: italic 13px var(--text); color: var(--ink2); margin-top: 8px; }
.search-b { display: flex; align-items: center; gap: 10px; margin: 0 4px 14px; padding: 9px 12px; border-radius: 12px; background: var(--card); color: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; }
.nav-g { margin-bottom: 16px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; font-weight: 500; }
.nav span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav b { font: 600 11px/1 var(--display); color: var(--ink2); letter-spacing: .03em; }
.nav.today b { color: var(--ink); background: var(--mari); border-radius: 99px; padding: 3px 8px 1px; }
.nav.on { background: rgba(17,17,17,.08); }
.nav.area { font: 600 11px var(--display); letter-spacing: .08em; color: var(--ink2); margin-top: 6px; }
.nav.area .ic { width: 18px; height: 18px; }
.nav.sub { padding-left: 14px; }
.prog { color: var(--mari); }
.prog circle:first-child { stroke: var(--ink2); }
.side-adds { display: flex; gap: 8px; padding: 0 6px 14px; flex-wrap: wrap; }
.side-fold { padding: 0 6px; }
.fine { font-size: 13px; color: var(--ink2); margin: 10px 0; }
.side-fold .chip { margin: 0 6px 8px 0; }

/* ---- chips + buttons (outlined mono caps, ink-filled when set) ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 5px; border-radius: 99px; border: 1px solid var(--line);
  font: 600 11px/1 var(--text); letter-spacing: .06em; color: var(--ink2); background: var(--card); text-transform: uppercase; white-space: nowrap; cursor: pointer; }
.chip .ic { width: 15px; height: 15px; stroke-width: 2; }
.chip.set { background: var(--ink); color: var(--paper); }
.chip.ghost { border-color: transparent; color: var(--ink2); }
summary.chip { list-style: none; }
summary::-webkit-details-marker { display: none; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 15px 18px; border-radius: 14px; font: 600 13px/1 var(--display); letter-spacing: .06em; }
.btn.primary { background: var(--mari); color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.btn.primary:active { transform: translateY(2px); box-shadow: none; }
.btn.ghost { color: var(--ink2); font-size: 18px; }
.icon-b { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; }
.icon-b:active { background: var(--line); }

/* ---- view header ---- */
.vh { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.vh-t { flex: 1; min-width: 0; }
.vh h1 { display: flex; align-items: center; gap: 12px; margin: 0; font: 600 28px/1 var(--display); letter-spacing: .02em; }
.vh h1 .ic { width: 32px; height: 32px; stroke-width: 1.6; }
.vh h1 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: 4px; }
.uline { display: block; width: min(220px, 70%); height: 10px; margin: 2px 0 0 44px; }
.uline path { fill: none; stroke: var(--mari); stroke-width: 3; stroke-linecap: round; }
.vh-sub { margin: 6px 0 0 44px; color: var(--ink2); font-size: 14px; }
.vh-r { display: flex; gap: 4px; }
.back { width: 40px; height: 46px; display: grid; place-items: center; margin-left: -10px; }
.back .ic { width: 26px; height: 26px; }

.sec { display: flex; align-items: center; gap: 8px; font: 600 13px/1 var(--display); letter-spacing: .05em; margin: 28px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.sec a { display: flex; align-items: center; gap: 8px; }
.muted { color: var(--ink2); }
.pad { padding: 8px 2px; }

/* slim fold row — secondary stuff stays one line until opened */
.slim { display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 0 0 14px; border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; cursor: pointer; }
.slim span { flex: 1; font-weight: 600; }
.slim em { font: 13px var(--text); color: var(--ink2); font-style: normal; }
.slim i { font-style: normal; color: var(--ink2); }
.fold { margin-top: 22px; }
.fold[open] > summary i { transform: rotate(180deg); }

/* ---- to-dos ---- */
.todos { display: flex; flex-direction: column; }
.todo { border-radius: var(--r); transition: background .2s, box-shadow .2s, margin .2s; }
.todo-line { display: flex; align-items: center; gap: 11px; min-height: 34px; padding: 2px 8px; cursor: pointer; }
@media (pointer: coarse) { .todo-line { min-height: 42px; } }
.tick { width: 30px; height: 30px; flex: none; display: grid; place-items: center; margin: -4px; }
.box { width: 21px; height: 21px; overflow: visible; }
.box-edge { fill: var(--card); stroke: var(--ink); stroke-width: 1.7; stroke-linejoin: round; }
.box-tick { fill: none; stroke: var(--mari); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .35s cubic-bezier(.6,.1,.3,1); }
.box:not(.on) .box-tick { opacity: 0; }
.box.on .box-tick { stroke-dashoffset: 0; }
.box.on .box-edge { stroke: var(--ink2); }
.t-title { flex: 1; min-width: 0; font-size: 16.5px; }
span.t-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-title i { color: var(--ink3); font-style: normal; }
.todo.done span.t-title { color: var(--ink3); text-decoration: line-through; text-decoration-color: var(--ink3); }
.t-meta { display: flex; align-items: center; gap: 8px; flex: none; color: var(--ink2); font-size: 12.5px; }
.m-ic { width: 15px; height: 15px; }
.m-ck, .m-dead { display: inline-flex; align-items: center; gap: 3px; }
.m-dead.late { color: var(--ink); background: var(--mari-soft); border-radius: 6px; padding: 1px 5px; }
.m-proj, .m-when { color: var(--ink2); white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.m-tag { border: 1px solid var(--ink3); border-radius: 99px; padding: 0 7px; }
.todo.open { background: var(--card); box-shadow: 0 6px 26px rgba(17,17,17,.10), 0 0 0 1px var(--line); margin: 10px -8px; padding: 6px 8px 12px; }
.todo-body { padding: 0 4px 0 40px; }
.t-notes { display: block; color: var(--ink2); min-height: 24px; margin: 2px 0 10px; }
.cklist { margin-bottom: 8px; }
.ck { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ck .box { width: 18px; height: 18px; }
.ck.done input { color: var(--ink3); text-decoration: line-through; }
.ck-x { color: var(--ink3); }
.ck-x .ic { width: 16px; height: 16px; }
.t-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.t-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.t-set { display: flex; flex-wrap: wrap; gap: 4px 14px; min-height: 28px; align-items: center; }
.t-val { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink2); padding: 3px 0; }
.t-val .ic { width: 15px; height: 15px; }
.t-val.late { color: var(--ink); }
.t-val.late .ic { color: var(--mari); }
.t-val.tag { padding: 1px 8px; border-radius: 99px; background: var(--paper2); }
.t-tools { display: flex; gap: 0; margin-left: auto; }
.t-tool { width: 32px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--ink3); }
.t-tool .ic { width: 18px; height: 18px; stroke-width: 1.7; }
.t-tool:hover { color: var(--ink); background: var(--paper2); }
@media (pointer: coarse) { .t-tool { width: 38px; height: 38px; } }
.t-linked { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mini-entry { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; border-radius: 10px; background: var(--paper); color: var(--ink2); }
.mini-entry .ic { width: 15px; height: 15px; }

/* empty state */
.empty { display: flex; flex-direction: column; align-items: center; padding: 60px 20px; color: var(--ink2); text-align: center; }
.empty-loop { width: 70px; height: 70px; }
.empty-loop path, .loop path { fill: none; stroke: var(--mari); stroke-width: 2.6; stroke-linecap: round; }
.empty p { max-width: 260px; }

/* upcoming */
.up-day { margin-bottom: 6px; }
.up-h { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.up-h b { font: 600 20px/1 var(--display); }
.up-h span { font: 600 14px var(--text); color: var(--ink2); }
.up-day.quiet .up-h { opacity: .45; }
.up-day.quiet .up-h b { font-size: 24px; }

/* project + area */
.proj-prog { display: flex; align-items: center; gap: 8px; color: var(--ink2); font-size: 14px; margin: -6px 0 14px 2px; }
.proj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.proj-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r); background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; }
.proj-card .ic { width: 28px; height: 28px; }
.proj-card b { font: 600 14px/1 var(--display); letter-spacing: .03em; }
.proj-card em { font-style: normal; color: var(--ink2); font-size: 13px; }

/* ---- journal ---- */
.j-day { display: flex; gap: 16px; margin-bottom: 26px; }
.j-date { flex: none; width: 58px; text-align: center; position: sticky; top: 0; align-self: flex-start; }
.j-date b { display: block; font: 600 29px/0.9 var(--display); }
.j-date span { font: 700 10.5px/1.3 var(--text); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.entry-grid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.entry-card { display: block; padding: 14px 16px; border-radius: var(--r); background: var(--card); box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line) inset; }
.entry-card p { margin: 0 0 8px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ec-media { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.ec-media img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--paper); }
.ec-foot { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--ink2); }
.ec-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* entry editor */
.entry-h { align-items: center; position: sticky; top: calc(-1 * (var(--top) + 18px)); z-index: 3; background: var(--paper); padding: 8px 0; margin-top: -8px; }
.entry-h .back { margin-right: 4px; }
.wide .entry-h .back { display: grid; }
.date-chip { flex: none; }
.entry-h .vh-r { margin-left: auto; }
.entry-doc { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.b-text { display: block; font-size: 18px; line-height: 1.55; min-height: 30px; }
.b-text:first-child { min-height: 140px; }
.b-photo, .b-draw { position: relative; margin: 0; }
.b-photo img, .b-draw img { display: block; width: 100%; border-radius: var(--r); box-shadow: 0 0 0 1px var(--line); background: var(--card); }
.b-draw img { max-width: 420px; }
.b-draw figcaption { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink2); margin-top: 6px; }
.b-draw figcaption .ic { width: 15px; height: 15px; }
.b-draw { cursor: pointer; }
.b-x { position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; background: rgba(17,17,17,.7); color: var(--paper); }
.b-x .ic { width: 16px; height: 16px; }
.b-voice { position: relative; padding: 12px 14px 12px 50px; border-radius: var(--r); background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; }
.b-voice .b-x { top: 50%; transform: translateY(-50%); left: 10px; background: none; color: var(--ink3); }
.pins { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pins .prog { color: var(--mari); }
.entry-bar { position: sticky; bottom: calc(var(--bot) + 14px); display: flex; justify-content: space-around; gap: 4px; padding: 8px; border-radius: 18px; background: var(--ink); color: var(--paper); box-shadow: 0 10px 30px rgba(17,17,17,.25); z-index: 4; }
.entry-bar > * { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 10px; border-radius: 12px; font: 700 10.5px var(--text); letter-spacing: .07em; text-transform: uppercase; cursor: pointer; }
.entry-bar > *:active { background: rgba(242,237,227,.15); }
.main[data-view="entry"] { padding-bottom: calc(var(--bot) + 20px); }

/* voice player */
.vp { display: flex; align-items: center; gap: 12px; }
.vp-play { position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.vp-loop { position: absolute; inset: 0; width: 100%; height: 100%; }
.vp-loop path { stroke: var(--ink); stroke-width: 2.2; }
.vp-ic .ic { width: 20px; height: 20px; }
.vp-wave { flex: 1; min-width: 0; height: 40px; cursor: pointer; }
.vp-time { font: 600 11px/1 var(--display); letter-spacing: .04em; color: var(--ink2); min-width: 36px; text-align: right; }

/* ---- day ---- */
.week { display: flex; align-items: center; gap: 4px; margin: -4px 0 16px; }
.ws { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ws-d { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 12px; }
.ws-d span { font: 700 11px var(--text); color: var(--ink2); }
.ws-d b { font: 600 16px/1 var(--display); }
.ws-d i { width: 5px; height: 5px; border-radius: 9px; }
.ws-d i.dot { background: var(--mari); }
.ws-d.now b { color: var(--mari); }
.ws-d.on { background: var(--ink); color: var(--paper); }
.ws-d.on span { color: rgba(242,237,227,.7); }
.ws-d.on.now b { color: var(--mari); }
.ws-nav { width: 30px; height: 44px; display: grid; place-items: center; color: var(--ink2); }
.flip .ic { transform: scaleX(-1); }
.stub-b { margin: 4px 0 8px; }

/* ---- search ---- */
.search-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1.5px var(--ink) inset; margin-bottom: 16px; }

/* ---- FAB ---- */
.fab { position: fixed; right: max(22px, env(safe-area-inset-right)); bottom: calc(var(--bot) + 24px); width: 62px; height: 62px; border-radius: 99px; display: grid; place-items: center;
  background: var(--mari); color: var(--ink); box-shadow: 0 3px 0 var(--ink), 0 10px 24px rgba(17,17,17,.2); z-index: 5; }
.fab .ic { width: 30px; height: 30px; stroke-width: 2.4; }
.fab:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }

/* ---- sheets ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(17,17,17,.32); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(var(--bot) + 22px); transform: translateY(100%); transition: transform .24s cubic-bezier(.3,.8,.3,1); outline: 0; }
.sheet-wrap.open .sheet-back { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; padding-bottom: 22px; transform: translateY(30px) scale(.97); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet-wrap.open .sheet { opacity: 1; }
}
.grab { width: 44px; height: 5px; border-radius: 9px; background: var(--ink3); margin: 0 auto 10px; touch-action: none; padding: 0; box-shadow: 0 -12px 0 12px transparent; }
.sheet-title { font: 600 18px/1 var(--display); letter-spacing: .03em; margin: 6px 0 16px; }
.pick-list { display: flex; flex-direction: column; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 13px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.pick-row span { flex: 1; font-weight: 500; }
.pick-row em { font-style: normal; color: var(--ink2); font-size: 13px; }
.pick-row.on { font-weight: 700; }
.pick-check { color: var(--mari); stroke-width: 3; }
.ask-in { display: block; padding: 14px 16px; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1.5px var(--ink) inset; margin-bottom: 14px; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.cal-head h4 { margin: 0; font: 600 16px/1 var(--display); letter-spacing: .04em; }
.cal-head h4 i { font-style: normal; color: var(--ink2); }
.cal-nav { width: 40px; height: 40px; display: grid; place-items: center; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-dow span { font: 700 11px var(--text); color: var(--ink2); padding: 4px 0; }
.cal-d { position: relative; height: 44px; display: grid; place-items: center; font: 600 13px/1 var(--display); }
.cal-d b { position: relative; z-index: 1; font-weight: 400; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 99px; padding-top: 3px; }
.cal-d.past { color: var(--ink3); }
.cal-d.sel b { background: var(--mari); color: var(--ink); }
.cal-today { position: absolute; width: 44px; height: 44px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.when-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.when-b { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; font: 600 12px var(--text); }
.when-b:first-child .ic { color: var(--mari); }
.when-clear { margin-top: 8px; }

/* quick add */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 4px; border-radius: 16px; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; font: 600 12px/1 var(--display); letter-spacing: .05em; }
.quick .ic { width: 30px; height: 30px; }

/* recorder */
.rec-sheet { text-align: center; }
.rec-time { font: 600 38px/1 var(--display); letter-spacing: .04em; }
.rec-wave { width: 100%; height: 90px; margin: 10px 0 18px; }
.rec-stop { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin: 0 auto; }
.rec-stop .ic { width: 34px; height: 34px; color: var(--ink); }
.rec-loop { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 6s linear infinite; }
.rec-loop path { stroke-width: 2.6; }
.rec-hint { color: var(--ink2); font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--bot) + 100px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--paper); font-size: 14px; max-width: calc(100vw - 32px); transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: var(--mari); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }

/* ---- the stub (pay stub) ---- */
.stub-sheet { background: var(--paper2); }
.stub-paper { position: relative; font: 14px/1.5 var(--mono); background: var(--card); padding: 26px 22px 22px; margin: 6px 0 18px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x, conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x; }
.st-big { font: 600 31px/1 var(--display); text-align: center; letter-spacing: .08em; }
.st-center { text-align: center; font-weight: 700; letter-spacing: .1em; font-size: 12.5px; }
.st-rule { border-top: 1.5px dashed var(--ink); margin: 10px 0; }
.st-head { font-weight: 700; letter-spacing: .08em; }
.st-row { display: flex; justify-content: space-between; gap: 10px; }
.st-item { color: var(--ink2); padding-left: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-stamp { position: absolute; right: 20px; bottom: 16px; transform: rotate(-9deg); border: 3.5px solid var(--mari); color: var(--mari); font: 600 24px/1 var(--display); padding: 6px 12px 2px; letter-spacing: .06em; opacity: .9; mix-blend-mode: multiply; }
.st-stamp.grey { border-color: var(--ink3); color: var(--ink3); }
.st-foot { margin-top: 64px; max-width: 55%; font-size: 11px; color: var(--ink2); letter-spacing: .06em; }

/* ---- drawing ---- */
.draw { position: fixed; inset: 0; z-index: 40; background: #2b2a28; display: flex; flex-direction: column; opacity: 0; transition: opacity .2s; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.draw.open { opacity: 1; }
.draw-top { display: flex; align-items: center; gap: 12px; padding: calc(var(--top) + 10px) 14px 8px; color: var(--paper); }
.draw-done { font: 600 13px/1 var(--display); letter-spacing: .06em; background: var(--mari); color: var(--ink); padding: 9px 16px 6px; border-radius: 10px; }
.draw-title { flex: 1; text-align: center; font-size: 13px; opacity: .7; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.draw-acts { display: flex; align-items: center; gap: 6px; }
.draw-acts button:not(.chip) { width: 40px; height: 40px; display: grid; place-items: center; color: var(--paper); }
.draw-acts .chip { border-color: rgba(242,237,227,.6); color: var(--paper); }
.draw-rail { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 6px; border-radius: 18px; background: rgba(20,20,19,.88); color: var(--paper); box-shadow: 0 8px 24px rgba(0,0,0,.3); max-height: calc(100% - 90px); overflow-y: auto; }
.brush-b { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; }
.brush-b.on { background: var(--mari); color: var(--ink); }
.rail-sep { width: 26px; border-top: 1px solid rgba(242,237,227,.2); margin: 4px 0; }
.vslider { --f: .5; position: relative; width: 16px; height: 96px; border-radius: 9px; background: rgba(242,237,227,.15); touch-action: none; margin: 4px 0; }
.vs-fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--f) * 100%); border-radius: 9px; background: rgba(242,237,227,.55); }
.vs-knob { position: absolute; left: -4px; width: 24px; height: 10px; bottom: calc(var(--f) * 100% - 5px); border-radius: 6px; background: var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.sw { width: 28px; height: 28px; flex: none; border-radius: 99px; background: var(--c); box-shadow: 0 0 0 2px rgba(242,237,227,.25); }
.sw.on { box-shadow: 0 0 0 2px #2b2a28, 0 0 0 4px var(--mari); }
.draw-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding-left: 64px; }
.draw-page { position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.45); border-radius: 4px; overflow: hidden; touch-action: none; }
.draw-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.draw-hint { text-align: center; color: rgba(242,237,227,.45); font-size: 12px; padding: 6px 0 calc(var(--bot) + 8px); }

/* ---- camera ---- */
.cam { position: fixed; inset: 0; z-index: 45; background: #000; color: var(--paper); display: flex; flex-direction: column; }
.cam-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-v.mirror { transform: scaleX(-1); }
.cam-top { position: relative; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--top) + 12px) 16px 0; }
.cam-x { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 99px; background: rgba(0,0,0,.4); }
.cam-loc { border-color: rgba(242,237,227,.7); color: var(--paper); background: rgba(0,0,0,.35); }
.cam-loc.set { background: var(--mari); border-color: var(--mari); color: var(--ink); }
.cam-code { position: relative; margin: auto 16px 14px; align-self: flex-start; font: 700 13px var(--mono); letter-spacing: .06em; background: var(--card); color: var(--ink); padding: 6px 10px; border-radius: 4px; }
.cam-bar { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 24px calc(var(--bot) + 24px); background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.cam-shoot { width: 78px; height: 78px; border-radius: 99px; border: 4px solid var(--paper); display: grid; place-items: center; }
.cam-shoot i { width: 62px; height: 62px; border-radius: 99px; background: var(--mari); }
.cam-shoot:active i { transform: scale(.9); }
.cam-flip { justify-self: end; width: 50px; height: 50px; border-radius: 99px; display: grid; place-items: center; background: rgba(0,0,0,.4); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .18s; }
.cam.flash .cam-flash { opacity: .8; transition: none; }
.stub-code { display: inline-block; margin-top: 8px; font: 700 12px var(--mono); letter-spacing: .05em; background: var(--card); box-shadow: 0 0 0 1px var(--line); padding: 4px 8px; border-radius: 3px; color: var(--ink2); }
.main[data-view="entry"] { display: flex; flex-direction: column; }
.main[data-view="entry"] > * { width: 100%; }
.main[data-view="entry"] .entry-doc { flex: 1 0 auto; }

/* ---- capture icons, top right ---- */
.capture { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--line) inset; margin-left: 6px; }
.cap-b { width: 40px; height: 38px; display: grid; place-items: center; border-radius: 11px; }
.cap-b:active, .cap-b.on { background: var(--ink); color: var(--paper); }
.brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.side-end { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

/* keyboard-picked to-do */
.todo.sel { background: var(--mari-soft); }

/* ---- settings ---- */
.set-card { background: var(--card); border-radius: 18px; box-shadow: 0 0 0 1px var(--line) inset; padding: 18px 20px; margin-bottom: 16px; }
.set-h { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font: 600 16px/1 var(--display); letter-spacing: .04em; }
.set-h b { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 99px; background: var(--mari); font-weight: 400; padding-top: 3px; }
.set-card .muted { margin: 4px 0 12px; }
.set-sub { font: 700 11.5px var(--text); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); margin: 16px 0 4px; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); column-gap: 24px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.keycap { min-width: 54px; padding: 6px 10px 5px; border-radius: 8px; background: var(--paper); box-shadow: 0 2px 0 var(--ink3), 0 0 0 1px var(--ink3) inset; font: 600 14px var(--text); letter-spacing: .04em; }
.keycap.listening { background: var(--mari); box-shadow: 0 2px 0 var(--ink); }
.steps { margin: 6px 0 10px; padding-left: 22px; }
.steps li { margin: 8px 0; padding-left: 4px; }
.steps li::marker { font: 600 11px var(--display); color: var(--mari); }
.copy-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
.copy-row span { width: 70px; font-size: 13px; color: var(--ink2); }
.copy-row code { font: 13px var(--mono); background: var(--paper); padding: 4px 8px; border-radius: 6px; word-break: break-all; }
.warn { background: var(--mari-soft); padding: 10px 12px; border-radius: 10px; }
@media (max-width: 520px) { .vh h1 { font-size: 38px; } .cap-b { width: 36px; } }

/* stub type: titles and numbers in caps, like a ticket */
.vh h1, .sec, .sheet-title, .set-h, .btn, .draw-done, .stub-logo, .cal-head h4, .proj-card b, .quick button, .nav.area, .st-big { text-transform: uppercase; letter-spacing: .06em; }
.vh h1 { font-size: 26px; }
.t-title { font-size: 14.5px; }
.b-text { font-size: 15.5px; line-height: 1.65; }
.nav { font-weight: 400; font-size: 14px; }

/* ---- lock ---- */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--paper); display: grid; place-items: center; padding: 24px; }
.lock-in { width: 100%; max-width: 320px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lock-in p { color: var(--ink2); font-size: 13px; margin: 0 0 18px; }
html.locked #app, html.locked #sheets { visibility: hidden; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--paper2); gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 12px; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(17,17,17,.12); }
[hidden] { display: none !important; }
.btn { font-size: 15px; }
.btn.ghost { font-size: 13px; }

/* ---- camera: photo / video ---- */
.cam-modes { position: relative; display: flex; justify-content: center; gap: 22px; padding: 0 0 6px; }
.cam-modes button { font: 600 12px var(--text); letter-spacing: .12em; text-transform: uppercase; color: rgba(242,237,227,.65); padding: 6px 4px; }
.cam-modes button.on { color: var(--mari); }
.cam.video .cam-shoot i { background: #D9432B; }
.cam.recording .cam-shoot i { width: 30px; height: 30px; border-radius: 6px; }
.cam.recording .cam-modes { visibility: hidden; }
.cam-rec { font: 600 15px var(--text); letter-spacing: .06em; color: #fff; }
.cam.recording .cam-rec::before { content: '● '; color: #D9432B; }

/* ---- photos ---- */
.thumb { position: relative; display: block; }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--paper); display: block; }
.thumb em, .ph em { position: absolute; left: 5px; bottom: 5px; font: 600 10px var(--text); font-style: normal; color: #fff; background: rgba(17,17,17,.6); padding: 2px 5px; border-radius: 4px; }
.j-tabs { margin-bottom: 18px; }
.j-tabs a { padding: 6px 14px; border-radius: 8px; font-size: 12px; color: var(--ink2); }
.j-tabs a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(17,17,17,.12); }
.sec-n { margin-left: auto; font: 400 12px var(--text); font-style: normal; color: var(--ink3); }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; margin-bottom: 8px; }
.ph { position: relative; display: block; }
.ph img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--paper2); border-radius: 4px; }
.b-video video { display: block; width: 100%; border-radius: var(--r); background: #000; }
.b-save { position: absolute; top: 8px; right: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; background: rgba(17,17,17,.7); color: var(--paper); }
.b-save .ic { width: 16px; height: 16px; }
.entry-bar { gap: 0; padding: 6px; }
.entry-bar > * { padding: 6px 4px; font-size: 9.5px; letter-spacing: .04em; white-space: nowrap; flex: 1; min-width: 0; }
