/* DIRT Method app. Visual language carried over from the staging build (tabletop art, shaped tokens,
   Nunito + Atkinson Hyperlegible, quadrant colors) and refined. Art motion lives in css/art.css. */
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-var.woff") format("woff"); font-weight: 200 1000; font-display: swap; }

:root {
  --bg: #FFF9EE;
  --card: #FFFFFF;
  --well: #F4ECDD;
  --ink: #263238;
  --muted: #5C6766;
  --faint: #8A928F;
  --border: #E8E0D2;
  --line: #9C8F7A;
  --action: #5E4486;
  --action-press: #3F2C5E;
  --action-soft: #EFE7F6;
  --ok: #2F7A60;
  --ok-soft: #DCEFE5;
  --warn-soft: #FBF0D2;
  --danger: #A6361A;
  --focus: #5E4486;
  --gold: #FCC14A;

  --D: #E8734A; --D-soft: #FBE4DA; --D-ink: #A4401E;
  --I: #E3B341; --I-soft: #FBF0D2; --I-ink: #7A5A00;
  --R: #5BAA83; --R-soft: #DFF1E7; --R-ink: #2C6E50;
  --T: #557DBD; --T-soft: #E1E9F6; --T-ink: #345C9C;

  --tint-empty: #D9ECF8; --tint-sort: #D5F0EA; --tint-see: #F7EBD3; --tint-act: #F8D9D7; --tint-return: #EFE8F6;

  --head: "Nunito", "Atkinson Hyperlegible", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 10px; --r: 14px; --r-lg: 22px; --r-xl: 28px;
  --shadow: 0 1px 0 rgba(38, 50, 56, .04), 0 12px 30px -18px rgba(38, 50, 56, .38);
  --shadow-lift: 0 2px 0 rgba(38, 50, 56, .05), 0 22px 44px -22px rgba(38, 50, 56, .45);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 17px/1.55 var(--body); min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 520px at 15% -10%, #FFF1D6 0%, transparent 60%), radial-gradient(900px 480px at 100% 0%, #F3ECFA 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
}
main { flex: 1; outline: none; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 900; line-height: 1.12; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.9rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.65rem); }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0 0 .8em; }
a { color: var(--action); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only { 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: 10px 14px; border-radius: var(--r-sm); z-index: 99; }
.skip:focus { left: 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 800 .78rem/1 var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .7em; }
.lede { color: var(--muted); font-size: 1.05rem; max-width: 58ch; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* ---------- header and stepper ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 249, 238, .9); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px clamp(14px, 3vw, 28px); padding-top: max(10px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { width: 38px; height: 38px; filter: drop-shadow(0 3px 0 rgba(38, 50, 56, .18)); }
.brand-text { font: 900 1.25rem/1 var(--head); letter-spacing: -.01em; }
.brand-text span { color: var(--muted); font-weight: 700; }
.steps { flex: 1; display: flex; justify-content: center; align-items: flex-start; }
.step { position: relative; flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font: 800 .82rem/1.1 var(--head); padding: 2px 0; min-height: 44px; }
.step .n { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2.5px solid var(--line); color: var(--ink); font: 900 .9rem var(--head); transition: transform .2s var(--ease), background .2s; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 16px; left: calc(50% + 17px); right: calc(-50% + 17px); height: 3px; border-radius: 3px; background: var(--border); }
.step.done:not(:last-child)::after { background: var(--ink); }
.step.done .n { background: var(--ink); border-color: var(--ink); color: #fff; }
.step.done .n svg { width: 15px; height: 15px; }
.step[aria-current="step"] { color: var(--ink); }
.step[aria-current="step"] .n { background: var(--action); border-color: var(--action); color: #fff; box-shadow: 0 0 0 5px var(--action-soft); transform: scale(1.06); }
.step:hover .n { transform: translateY(-2px); }
.progress-band { height: 5px; background: var(--border); }
.progress-band > i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--D), var(--I) 35%, var(--R) 65%, var(--T)); transition: width .5s var(--ease); border-radius: 0 3px 3px 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border); background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--ink); flex-shrink: 0; box-shadow: 0 3px 0 var(--border); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { border-color: var(--line); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }

/* ---------- layout ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: clamp(16px, 2.6vw, 30px) clamp(14px, 3vw, 28px) 120px; }
.grid-2 { display: grid; gap: clamp(16px, 2.4vw, 28px); }
@media (min-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1.12fr) minmax(330px, .88fr); align-items: start; }
  .grid-2.wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sticky { position: sticky; top: 118px; }
}
.empty-grid > *, .grid-2 > *, .card { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: clamp(16px, 2.2vw, 24px); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* chapter banner: tinted header card with the step's illustration */
.banner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: center; background: var(--tint, var(--tint-empty)); border-radius: var(--r-xl); border: 1px solid rgba(38, 50, 56, .08); overflow: hidden; margin-bottom: clamp(16px, 2.4vw, 26px); box-shadow: var(--shadow); }
.banner-text { padding: clamp(18px, 3vw, 32px); position: relative; z-index: 1; }
.banner-text h1 { margin: 0 0 6px; }
.banner-text .lede { margin: 0; }
.banner-text .row { margin-top: 14px; }
.banner-art { align-self: stretch; display: flex; align-items: flex-end; justify-content: center; }
.banner-art svg { width: 100%; height: auto; display: block; }
.banner .eyebrow { background: rgba(255, 255, 255, .7); padding: 6px 10px; border-radius: 999px; color: var(--ink); }
.banner .eyebrow .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--action); }
@media (min-width: 760px) { .banner { grid-template-columns: minmax(0, 1fr) minmax(260px, 380px); } .banner-art { padding: 14px 14px 0 0; } .banner-art svg { border-radius: 20px 20px 0 0; } }
@media (max-width: 759px) { .banner-art { order: -1; max-height: 170px; overflow: hidden; } .banner-art svg { margin-top: -8%; } }
.tint-empty { --tint: var(--tint-empty); } .tint-sort { --tint: var(--tint-sort); } .tint-see { --tint: var(--tint-see); } .tint-act { --tint: var(--tint-act); } .tint-return { --tint: var(--tint-return); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; font: 800 .95rem/1 var(--head); box-shadow: 0 3px 0 var(--border); transition: transform .12s var(--ease), box-shadow .12s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink); }
@media (hover: hover) { .btn:hover { transform: translateY(-1px); } }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--action); border-color: var(--action); color: #fff; box-shadow: 0 4px 0 var(--action-press); font-size: 1.02rem; padding: 12px 26px; }
.btn.primary:hover { background: #6B4F97; }
.btn.primary:active { box-shadow: 0 1px 0 var(--action-press); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--action); text-decoration: underline; text-underline-offset: 3px; padding-inline: 8px; }
.btn.sm { min-height: 38px; padding: 7px 14px; font-size: .85rem; }
.btn.ai::before { content: ""; width: 14px; height: 14px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.2 6.3L20 10l-5.8 1.7L12 18l-2.2-6.3L4 10l5.8-1.7z'/%3E%3C/svg%3E") center/contain no-repeat; }
.btn.ai { border-color: var(--action); color: var(--action); }
.btn.danger { color: var(--danger); border-color: #E3A99A; }
.btn.is-busy { pointer-events: none; opacity: .8; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: rgba(255, 249, 238, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.actionbar .btn.primary { flex: 1; max-width: 420px; }
.actionbar .hint { margin-right: auto; color: var(--muted); font-size: .88rem; }
@media (min-width: 960px) { .actionbar { position: static; background: none; border: 0; padding: 20px 0 0; backdrop-filter: none; } .actionbar .btn.primary { flex: 0 1 auto; } }

/* ---------- forms ---------- */
.lbl { display: block; font: 800 .95rem var(--head); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.input, .textarea, .select { width: 100%; padding: 11px 14px; border: 2px solid var(--border); border-radius: var(--r); background: #fff; min-height: 46px; transition: border-color .15s, box-shadow .15s; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--line); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--action); box-shadow: 0 0 0 4px var(--action-soft); outline: none; }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.dump { min-height: 250px; font-size: 1.08rem; line-height: 34px; padding: 4px 16px; background: #fff linear-gradient(to bottom, transparent 33px, #F1E8D8 33px, #F1E8D8 34px) 0 4px / 100% 34px local; }
.dump::placeholder { color: var(--faint); }
fieldset.choice { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
fieldset.choice legend { font: 900 1.02rem var(--head); margin-bottom: 4px; padding: 0; }
fieldset.choice .q { color: var(--muted); font-size: .93rem; margin: 0 0 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 15px; border: 2px solid var(--border); border-radius: 999px; background: #fff; font-weight: 700; font-size: .93rem; box-shadow: 0 2px 0 var(--border); transition: all .14s var(--ease); }
.chip:hover span { border-color: var(--line); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 2px 0 #11181B; }
.chip input:checked + span::before { content: ""; width: 12px; height: 7px; border: 2.5px solid currentColor; border-top: 0; border-right: 0; transform: rotate(-45deg) translateY(-2px); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.chip.ai-suggested span { border-style: dashed; border-color: var(--action); }
.chip .sug { font-style: normal; font: 900 .65rem var(--head); color: var(--action); background: var(--action-soft); padding: 2px 6px; border-radius: 999px; }
.chip input:checked + span .sug { background: rgba(255, 255, 255, .2); color: #fff; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--action); }

/* ---------- Empty ---------- */
.lenses { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lens { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; min-height: 50px; border-radius: var(--r); background: rgba(255, 255, 255, .6); border: 2px solid transparent; cursor: pointer; color: var(--ink); font: 700 .92rem/1.25 var(--body); transition: all .15s var(--ease); }
.lens svg { width: 26px; height: 26px; flex-shrink: 0; padding: 4px; border-radius: 8px; background: var(--well); }
.lens:hover { background: #fff; border-color: var(--border); }
.lens[aria-pressed="true"] { background: #fff; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.lens[aria-pressed="true"] svg { background: var(--gold); }
.lens-prompt { font: 900 1.22rem/1.25 var(--head); margin: 0 0 4px; }
.lens-follow { color: var(--muted); margin: 0 0 12px; }
.empty-grid { display: grid; gap: 22px; }
@media (min-width: 1060px) { .empty-grid { grid-template-columns: 220px minmax(0, 1fr); } }
@media (max-width: 1059px) {
  .lenses { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
  .lens { white-space: nowrap; background: #fff; border-color: var(--border); min-height: 46px; }
}
.plate-card { padding: 0; overflow: hidden; background: #FFF4E2; }
.plate-card .cap { padding: 10px 16px 14px; margin: 0; color: var(--muted); font-size: .88rem; text-align: center; }
svg.scene { width: 100%; height: auto; display: block; }
.plate .pl-pile { cursor: pointer; outline: none; }
.plate .pl-pile:hover .pl-card { stroke: var(--action); stroke-width: 3; }
.plate .pl-pile:focus-visible .pl-card { stroke: var(--action); stroke-width: 4; }
.slips { list-style: none; margin: 0; padding: 0; }
.slip-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.slip-row:last-child { border-bottom: 0; }
.slip-tok { width: 30px; height: 30px; flex-shrink: 0; }
.slip-title { width: 100%; border: 2px solid transparent; background: transparent; padding: 8px 10px; border-radius: var(--r-sm); font-size: 1rem; min-height: 44px; resize: none; field-sizing: content; line-height: 1.4; overflow: hidden; display: block; }
.slip-title:hover { border-color: var(--border); }
.slip-title:focus { border-color: var(--action); background: #fff; outline: none; }
.slip-tools { display: flex; gap: 4px; align-items: center; }
.slip-tools .select { width: auto; min-height: 38px; padding: 4px 8px; font-size: .85rem; max-width: 160px; }
.tool { min-width: 38px; min-height: 38px; border-radius: 50%; border: 2px solid transparent; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.tool:hover { border-color: var(--border); color: var(--ink); background: #fff; }
.tool svg { width: 18px; height: 18px; }
.tool[aria-pressed="true"] { color: #fff; background: var(--action); }
@media (max-width: 600px) { .slip-row { grid-template-columns: auto minmax(0, 1fr); } .slip-tools { grid-column: 2; flex-wrap: wrap; } }
details.stackbox { border: 2px solid var(--border); border-radius: var(--r); background: #fff; margin-bottom: 10px; }
details.stackbox > summary { cursor: pointer; padding: 10px 14px; list-style: none; display: flex; align-items: center; gap: 10px; font: 800 1.02rem var(--head); min-height: 50px; }
details.stackbox > summary::-webkit-details-marker { display: none; }
details.stackbox > summary::before { content: ""; width: 9px; height: 9px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(-45deg); transition: transform .2s var(--ease); flex-shrink: 0; }
details.stackbox[open] > summary::before { transform: rotate(45deg); }
details.stackbox .count { margin-left: auto; font: 900 .8rem var(--head); background: var(--action); color: #fff; border-radius: 999px; padding: 4px 10px; }
details.stackbox .count.plain { background: var(--well); color: var(--muted); }
details.stackbox .inner { padding: 0 14px 10px; }
.stack-rename { border: 2px solid transparent; background: transparent; font: inherit; padding: 2px 6px; border-radius: 8px; min-width: 0; flex: 1; max-width: 70%; }
.stack-rename:focus { border-color: var(--action); outline: none; background: #fff; }
.minis { display: inline-flex; gap: 3px; align-items: center; }
.minis svg { width: 16px; height: 16px; }

/* ---------- Sort ---------- */
.queue { list-style: none; margin: 0; padding: 0; max-height: 56vh; overflow: auto; }
.queue li button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: var(--r-sm); border: 0; background: transparent; cursor: pointer; min-height: 44px; }
.queue li button:hover { background: var(--well); }
.queue li button[aria-current="true"] { background: var(--action-soft); box-shadow: inset 4px 0 0 var(--action); }
.queue .tok { width: 22px; height: 22px; flex-shrink: 0; }
.progress { height: 10px; border-radius: 99px; background: var(--well); overflow: hidden; margin: 8px 0 14px; border: 2px solid var(--ink); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--D), var(--I), var(--R), var(--T)); transition: width .5s var(--ease); }
.item-title { font: 900 clamp(1.35rem, 1.1rem + 1vw, 1.8rem)/1.2 var(--head); border: 2px solid transparent; background: transparent; width: 100%; padding: 4px 8px; margin-left: -10px; border-radius: var(--r-sm); resize: none; field-sizing: content; overflow: hidden; display: block; }
.item-title:hover { border-color: var(--border); }
.item-title:focus { border-color: var(--action); outline: none; background: #fff; }
.quote { color: var(--muted); font-style: italic; border-left: 4px solid var(--I); padding: 2px 0 2px 12px; margin: 6px 0 18px; }
.landing { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r); background: var(--well); border: 2px dashed var(--line); margin: 6px 0 16px; min-height: 64px; }
.landing.ready { background: #fff; border-style: solid; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.landing .tok { width: 40px; height: 40px; flex-shrink: 0; }
.landing b { font-family: var(--head); font-weight: 900; font-size: 1.08rem; }
.evidence { font-size: .9rem; color: var(--ink); background: var(--action-soft); border-radius: var(--r-sm); padding: 10px 14px; margin: 6px 0 14px; }
.moment { border-radius: var(--r); overflow: hidden; margin: 0 0 16px; background: #FFF4E2; }
.moment svg { display: block; width: 100%; height: auto; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font: 800 .8rem/1 var(--head); padding: 6px 11px; border-radius: 999px; background: var(--well); color: var(--ink); white-space: nowrap; border: 1.5px solid transparent; }
.badge.d { background: var(--D-soft); border-color: var(--D); } .badge.i { background: var(--I-soft); border-color: var(--I); }
.badge.r { background: var(--R-soft); border-color: var(--R); } .badge.t { background: var(--T-soft); border-color: var(--T); }
.badge.ag { background: #fff; border-color: var(--line); }
.badge.done { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.badge.wait { background: var(--warn-soft); color: var(--I-ink); border-color: var(--I); }

/* ---------- Target board ---------- */
.target-card { background: linear-gradient(180deg, #FFF4E2, #FBEBD2); }
svg.target { width: 100%; height: auto; display: block; max-width: 760px; margin: 0 auto; touch-action: manipulation; }
.target .tb-edge { fill: #9C6238; stroke: var(--ink); stroke-width: 5; }
.target .tb-face { fill: #FFFDF8; stroke: var(--ink); stroke-width: 5; }
.target .tq-d { fill: var(--D-soft); } .target .tq-i { fill: var(--I-soft); } .target .tq-r { fill: var(--R-soft); } .target .tq-t { fill: var(--T-soft); }
.target .t-ring { fill: none; stroke: var(--ink); stroke-width: 5; }
.target .t-ring-inner { fill: rgba(255, 255, 255, .55); }
.target .t-axes line { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.target .t-axes path { fill: var(--ink); }
.target .t-axis-labels text { font: 900 30px var(--head); fill: var(--ink); paint-order: stroke; stroke: #FFF4E2; stroke-width: 8px; stroke-linejoin: round; }
.target .t-agency rect { fill: #fff; stroke: var(--ink); stroke-width: 2.5; }
.target .t-agency text { font: 800 19px var(--head); fill: var(--ink); }
.target .t-chip rect { stroke: var(--ink); stroke-width: 3; }
.target .t-chip text { font: 900 27px var(--head); fill: var(--ink); }
.target .t-chip-d rect { fill: var(--D); } .target .t-chip-d .t-chip-edge { fill: var(--D-ink); }
.target .t-chip-i rect { fill: var(--I); } .target .t-chip-i .t-chip-edge { fill: var(--I-ink); }
.target .t-chip-r rect { fill: var(--R); } .target .t-chip-r .t-chip-edge { fill: var(--R-ink); }
.target .t-chip-t rect { fill: var(--T); } .target .t-chip-t .t-chip-edge { fill: var(--T-ink); }
.target .t-dot { cursor: pointer; outline: none; transition: opacity .2s; }
.target .t-dot-in { transform-box: fill-box; transform-origin: center; transition: transform .15s var(--ease); }
.target .t-dot:hover .t-dot-in { transform: translateY(-3px); }
.target .tk-edge, .target .tk-face { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.target .q-d .tk-edge { fill: var(--D-ink); } .target .q-d .tk-face { fill: var(--D); } .target .q-d .tk-inner { fill: var(--D-soft); }
.target .q-i .tk-edge { fill: var(--I-ink); } .target .q-i .tk-face { fill: var(--I); } .target .q-i .tk-inner { fill: var(--I-soft); }
.target .q-r .tk-edge { fill: var(--R-ink); } .target .q-r .tk-face { fill: var(--R); } .target .q-r .tk-inner { fill: var(--R-soft); }
.target .q-t .tk-edge { fill: var(--T-ink); } .target .q-t .tk-face { fill: var(--T); } .target .q-t .tk-inner { fill: var(--T-soft); }
.target .tk-notch { stroke: #FFF9EE; stroke-width: 3; }
.target .t-dot-num { font-family: var(--head); font-weight: 900; fill: var(--ink); pointer-events: none; }
.target .t-dot-halo { fill: rgba(94, 68, 134, .14); stroke: var(--action); stroke-width: 4; }
.target .t-dot.is-hi .t-dot-halo { fill: rgba(252, 193, 74, .3); stroke: #C7922A; }
.target .t-dot:focus-visible .t-dot-in { transform: translateY(-3px) scale(1.08); }
.target .t-dot.is-dim { opacity: .25; }
.target .t-overflow { font: 800 22px var(--head); fill: var(--muted); }
.motion .target .t-dot-in { animation: tokDrop .5s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 22ms); }
@keyframes tokDrop { from { opacity: 0; transform: translateY(-26px) scale(.7); } to { opacity: 1; transform: none; } }

.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; padding: 3px; background: #fff; box-shadow: 0 3px 0 var(--ink); }
.seg button { min-height: 38px; padding: 6px 16px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; color: var(--ink); font: 800 .9rem var(--head); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.zoombar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.zoombar button { min-height: 38px; padding: 5px 13px; border-radius: 999px; border: 2px solid var(--border); background: #fff; cursor: pointer; font: 800 .82rem var(--head); display: inline-flex; gap: 6px; align-items: center; }
.zoombar button svg { width: 15px; height: 15px; }
.zoombar button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); }

.inspector h3 { font-size: 1.35rem; display: flex; gap: 12px; align-items: flex-start; font-weight: 900; }
.inspector .tok { width: 44px; height: 44px; flex-shrink: 0; margin-top: -4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 700; } .kv dd { margin: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--action); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; font-weight: 700; min-height: 32px; text-align: left; }
table.ledger { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ledger th, .ledger td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ledger th { font: 900 .74rem var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); position: sticky; top: 0; background: #fff; }
.ledger tr.is-sel td { background: var(--action-soft); }
.ledger .tok { width: 24px; height: 24px; vertical-align: middle; }
.ledger-wrap { max-height: 70vh; overflow: auto; }
@media (max-width: 640px) { .ledger .hide-sm { display: none; } }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.tile { border-radius: var(--r); padding: 12px 6px 10px; text-align: center; background: var(--well); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.tile svg { width: 26px; height: 26px; display: block; margin: 0 auto 4px; }
.tile b { display: block; font: 900 1.6rem/1.05 var(--head); }
.tile span { font: 800 .74rem var(--head); color: var(--muted); }
.tile.d { background: var(--D-soft); } .tile.i { background: var(--I-soft); } .tile.r { background: var(--R-soft); } .tile.t { background: var(--T-soft); }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.three .tile { box-shadow: none; border-width: 1.5px; border-color: var(--border); background: #fff; }
.insight { border-top: 1px solid var(--border); padding: 14px 0; }
.insight:first-of-type { border-top: 0; }
.insight h4 { font: 900 1.05rem var(--head); margin: 0 0 6px; }
.insight .interp { color: var(--muted); font-style: italic; }
.src { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.src button { min-height: 32px; min-width: 42px; border-radius: 999px; border: 2px solid var(--border); background: #fff; cursor: pointer; font: 900 .8rem var(--head); }
.src button[aria-pressed="true"] { background: var(--gold); border-color: var(--ink); }
.stale { background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 12px; font-size: .9rem; }

/* ---------- Act ---------- */
.proto-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.proto-tabs button { min-height: 70px; border-radius: var(--r); border: 2px solid var(--border); background: #fff; cursor: pointer; padding: 8px 6px; text-align: center; box-shadow: 0 3px 0 var(--border); transition: all .14s var(--ease); }
.proto-tabs button svg { width: 24px; height: 24px; display: block; margin: 0 auto 2px; }
.proto-tabs button b { display: block; font: 900 1.02rem var(--head); letter-spacing: .08em; }
.proto-tabs button span { font-size: .72rem; color: var(--muted); font-weight: 700; }
.proto-tabs button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.proto-tabs .d[aria-pressed="true"] { background: var(--D-soft); } .proto-tabs .i[aria-pressed="true"] { background: var(--I-soft); }
.proto-tabs .r[aria-pressed="true"] { background: var(--R-soft); } .proto-tabs .t[aria-pressed="true"] { background: var(--T-soft); }
.proto-art { border-radius: var(--r); overflow: hidden; margin: 0 0 14px; aspect-ratio: 400 / 190; }
.proto-art svg { display: block; width: 100%; height: auto; margin-top: -6%; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
@media (min-width: 720px) { .options { grid-template-columns: repeat(4, 1fr); } }
.options button { min-height: 82px; text-align: left; padding: 10px 12px; border-radius: var(--r); border: 2px solid var(--border); background: #fff; cursor: pointer; transition: all .14s var(--ease); }
.options button b { display: block; font: 900 1.02rem var(--head); }
.options button span { font-size: .8rem; color: var(--muted); }
.options button[aria-pressed="true"] { border-color: var(--action); background: var(--action-soft); box-shadow: 0 3px 0 var(--action); }
.note { border-radius: var(--r); padding: 12px 14px; background: var(--well); border-left: 5px solid var(--line); font-size: .93rem; margin-bottom: 14px; }
.note b { font-family: var(--head); font-weight: 900; }
.picker { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.picker h4 { font: 900 .74rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
.picker button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: var(--r-sm); border: 0; background: transparent; cursor: pointer; min-height: 44px; }
.picker button:hover { background: var(--well); }
.picker button[aria-current="true"] { background: var(--action-soft); box-shadow: inset 4px 0 0 var(--action); }
.picker .tok { width: 22px; height: 22px; flex-shrink: 0; }
.move { border: 2px solid var(--border); border-left: 6px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: #fff; margin-bottom: 10px; display: block; }
.move.d { border-left-color: var(--D); } .move.i { border-left-color: var(--I); } .move.r { border-left-color: var(--R); } .move.t { border-left-color: var(--T); }
.move h4 { margin: 0 0 4px; font: 900 1rem var(--head); }
.move .meta { font-size: .85rem; color: var(--muted); }
button.move { width: 100%; text-align: left; cursor: pointer; }
button.move[aria-current="true"] { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }

/* ---------- empty states, dialog, toast ---------- */
.empty-state { text-align: center; padding: 28px 16px; }
.empty-state .ill { width: min(280px, 80%); margin: 0 auto 14px; }
.empty-state .ill svg { width: 100%; height: auto; display: block; }
.empty-state p { color: var(--muted); max-width: 46ch; margin-inline: auto; }
.dialog { border: 2px solid var(--ink); border-radius: var(--r-xl); padding: 0; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: #fff; color: var(--ink); box-shadow: 0 6px 0 var(--ink), 0 40px 80px -20px rgba(0, 0, 0, .4); }
.dialog::backdrop { background: rgba(15, 37, 62, .45); backdrop-filter: blur(3px); }
.dialog .d-in { padding: clamp(18px, 3vw, 28px); }
.dialog .d-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dialog section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.motion .dialog[open] { animation: rise .28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; background: var(--ink); color: #fff; padding: 10px 12px 10px 18px; border-radius: 999px; display: flex; gap: 12px; align-items: center; box-shadow: 0 4px 0 #11181B, var(--shadow-lift); max-width: calc(100vw - 24px); font-weight: 700; }
.toast[hidden] { display: none; }
.toast button { background: var(--gold); border: 0; color: var(--ink); border-radius: 999px; min-height: 34px; padding: 4px 14px; cursor: pointer; font: 900 .85rem var(--head); }
@media (min-width: 960px) { .toast { bottom: 28px; } }
.motion .toast:not([hidden]) { animation: rise .25s var(--ease); }
.foot { border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; padding: 18px clamp(14px, 3vw, 28px) 110px; text-align: center; }
.foot p { max-width: 720px; margin: 0 auto 6px; }
@media (min-width: 960px) { .foot { padding-bottom: 24px; } }

/* page transition (staging panel motion) */
.motion .view { animation: dirtPanelIn var(--dirt-dur-panel, 320ms) var(--ease) both; }

/* ---------- phones ---------- */
@media (max-width: 959px) {
  .top-in { flex-wrap: wrap; gap: 6px 12px; padding-bottom: 6px; }
  .brand { margin-right: auto; }
  .steps { order: 3; flex-basis: 100%; }
  .step { font-size: .74rem; }
  .step .n { width: 26px; height: 26px; font-size: .8rem; }
  .step:not(:last-child)::after { top: 14px; left: calc(50% + 15px); right: calc(-50% + 15px); }
  .sticky { position: static; }
}

@media (prefers-reduced-motion: reduce) { .motion .view, .motion .target .t-dot-in, .motion .dialog[open], .motion .toast:not([hidden]) { animation: none !important; } }
:root.reduce-motion .motion .view, :root.reduce-motion .t-dot-in { animation: none !important; }
@media print { .top, .actionbar, .foot, .toast, .btn, .zoombar, .banner-art { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
.slip-id { display: flex; flex-direction: column; align-items: center; gap: 0; font: 800 .7rem var(--head); color: var(--muted); min-width: 34px; }
.slip-id .tok { width: 28px; height: 28px; }
@media (max-width: 759px) { .banner-art.desk { display: none; } }
.moment { max-width: 380px; margin-inline: auto; }
@media (min-width: 760px) {
  .banner { grid-template-columns: minmax(0, 1fr) auto; }
  .banner-art { padding: 12px 12px 0 0; }
  .banner-art svg { height: 228px; width: auto; max-width: 340px; }
  .banner-text { padding: 26px 30px; }
}
@media (max-width: 759px) { .banner-art { max-height: 150px; } .banner-art svg { margin-top: 0; } }
/* account button and recovery key */
.acct-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font: 800 .88rem var(--head); cursor: pointer; box-shadow: 0 3px 0 var(--ink); flex-shrink: 0; }
.acct-btn[hidden] { display: none; }
.acct-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.acct-btn[data-status="syncing"] .sync-dot { background: var(--I); animation: spin 1s linear infinite; border-radius: 3px; }
.acct-btn[data-status="offline"] .sync-dot, .acct-btn[data-status="error"] .sync-dot, .acct-btn[data-status="conflict"] .sync-dot { background: var(--D); }
@media (max-width: 520px) { .acct-btn .acct-label { display: none; } .acct-btn { padding: 6px 12px; } .acct-btn:not([data-status="off"])::after { content: ""; } .acct-btn[data-status="off"] .acct-label { display: inline; } }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.reckey { font-size: 1.15rem; font-weight: 700; background: var(--well); border: 2px dashed var(--line); border-radius: var(--r); padding: 14px; text-align: center; word-break: break-all; user-select: all; }
/* due check-ins bar */
.due-bar { max-width: 1184px; margin: 16px auto 0; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--I-soft); border: 2px solid var(--ink); border-radius: var(--r-lg); padding: 10px 14px; box-shadow: 0 3px 0 var(--ink); }
@media (max-width: 1240px) { .due-bar { margin: 14px clamp(14px, 3vw, 28px) 0; } }
.due-bar span { display: flex; align-items: center; gap: 10px; }
.due-bar .tok { width: 26px; height: 26px; flex-shrink: 0; }
/* history */
svg.trend { width: 100%; height: auto; display: block; }
.trend-lbl { font: 800 13px var(--head); fill: var(--muted); }
/* intro */
.intro-dialog { width: min(860px, calc(100vw - 24px)); background: #0F253E; color: #FEF0DB; border-color: #0F253E; box-shadow: 0 6px 0 #071526, 0 40px 80px -20px rgba(0, 0, 0, .5); }
.intro-dialog .d-in { padding: 0; }
.intro { display: grid; }
@media (min-width: 720px) { .intro { grid-template-columns: 1fr 1.1fr; align-items: center; } }
.intro-art svg { width: 100%; height: auto; display: block; max-height: 60vh; }
@media (max-width: 719px) { .intro-art { max-height: 38vh; overflow: hidden; } }
.intro-text { padding: clamp(20px, 3vw, 34px); }
.intro-text h2 { color: #FEF0DB; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
.intro-text p { color: #C9D4DE; }
.intro-step { font: 800 .78rem var(--head) !important; letter-spacing: .12em; text-transform: uppercase; color: #FCC14A !important; }
.intro-dots { display: flex; gap: 8px; margin: 18px 0; }
.intro-dots i { width: 8px; height: 8px; border-radius: 99px; background: #C9D4DE; opacity: .5; transition: width .25s var(--ease); }
.intro-dots i.on { width: 24px; opacity: 1; background: #FCC14A; }
.intro-dialog .btn.primary { background: #FCC14A; border-color: #FCC14A; color: #0F253E; box-shadow: 0 4px 0 #C7922A; }
.intro-dialog .btn.ghost { color: #FEF0DB; }
.intro-dialog :focus-visible { outline-color: #FCC14A; }
/* recap print */
@media print {
  .banner, .due-bar, .seg, .no-print, .acct-btn, .icon-btn { display: none !important; }
  .recap { border: 0; box-shadow: none; padding: 0; }
  .ledger-wrap { max-height: none; overflow: visible; }
  .page { padding: 0; }
}
svg.trend { max-width: 680px; margin: 0 auto; }
#cmpA, #cmpB { width: auto !important; max-width: 260px; flex: 0 1 auto; }
