/* Colours: the day look. Every page draws from these tokens, and the night look below swaps their values. */
:root,
:root[data-theme="night"] .note:not(.answered) {
  --ink: #1D1A16;
  --ink-2: #5D564C;
  --ink-3: #7A7266;
  --ink-rgb: 29, 26, 22;
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --card-rgb: 255, 255, 255;
  --on-ink: #FFFFFF;
  --paper: #FAF8F3;
  --wash: #FBFAF6;
  --fill: #F4F1EA;
  --fill-2: #F7F5EF;
  --hover: #F3EFE6;
  --rule: #F1ECE2;
  --line: #EFEAE0;
  --line-2: #E9E3D6;
  --mute: #CFC7B6;
  --butter: #FFE17A;
  --butter-hover: #FFD94F;
  --butter-ink: #3A2A00;
  --on-butter: #3A2A00;
  --butter-soft: #FFF8D6;
  --butter-pale: #FFF4C2;
  --butter-line: #F3E3A0;
  --butter-edge: #F2D873;
  --question-soft: #FFF6CF;
  --warm-soft: #FFF7E6;
  --pen: #2B4FD6;
  --rust: #C24F28;
  --rust-ink: #8A3517;
  --rust-soft: #FFEDE8;
  --mint: #E3FBF1;
  --mint-ink: #0F6B4C;
  --lilac: #F1ECFF;
  --lilac-ink: #4B2FA8;
  --lilac-line: #DCD2FB;
  --violet: #7C5CE0;
  --peach: #FFF6F2;
  --peach-soft: #FFF8F4;
  --peach-line: #FFD9CC;
  --peach-ink: #6E2A12;
  --quiet-bg: #EEF0F6;
  --quiet-ink: #3E4A72;
  --world-bg: #E3EAD3;
  --lift: 0 1px 0 rgba(29, 26, 22, .04), 0 16px 32px -26px rgba(29, 26, 22, .45);
}
:root {
  --ease: cubic-bezier(.16, 1, .3, 1);
  --radius: 22px;
  --sans: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
/*
 * The night look (theme.js turns it on in the evening, or when he picks it): warm near-black paper, cream ink,
 * the same order of light to dark as the day so hairlines stay faint and secondary text stays secondary. Accents
 * are lifted so they read on dark. The yellow question notes keep the day colours above, bright like a sticky
 * note under a desk lamp.
 */
:root[data-theme="night"] {
  color-scheme: dark;
  --ink: #F1EBE1;
  --ink-2: #CEC4B6;
  --ink-3: #A39A8D;
  --ink-rgb: 241, 235, 225;
  --bg: #15120F;
  --card: #1F1B17;
  --card-rgb: 31, 27, 23;
  --on-ink: #1D1A16;
  --paper: #1A1713;
  --wash: #1C1915;
  --fill: #2A251F;
  --fill-2: #25211C;
  --hover: #2A251F;
  --rule: #2B2620;
  --line: #312B24;
  --line-2: #3D362E;
  --mute: #5E554A;
  --butter: #FFD84D;
  --butter-hover: #FFCF2E;
  --butter-ink: #FFE08A;
  --on-butter: #2A1E00;
  --butter-soft: #2E2716;
  --butter-pale: #3A3119;
  --butter-line: #5A4A1E;
  --butter-edge: #6B5822;
  --question-soft: #342C17;
  --warm-soft: #2C251B;
  --pen: #A3B4FF;
  --rust: #E58358;
  --rust-ink: #F3A68A;
  --rust-soft: #3A221B;
  --mint: #15302A;
  --mint-ink: #86E3BE;
  --lilac: #262040;
  --lilac-ink: #C9BBFF;
  --lilac-line: #3D3460;
  --violet: #A88EFF;
  --peach: #2F211A;
  --peach-soft: #2B1F19;
  --peach-line: #4A3226;
  --peach-ink: #F3B79D;
  --quiet-bg: #222838;
  --quiet-ink: #BCC6EA;
  --world-bg: #2A3140;
  --lift: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 34px -24px rgba(0, 0, 0, .8);
}
/* The question notes read as day paper at night too, so their own text goes back to day ink. */
:root[data-theme="night"] .note:not(.answered) { color: var(--ink); color-scheme: light; }
:root[data-theme="night"] .note.answered { border-color: var(--butter-line); }
:root[data-theme="night"] .btn.ghost { border-color: var(--line-2); }
/* Each helper's pastel colour (set inline from the crew list) dims to a soft tint at night, under the mascot. */
:root[data-theme="night"] .ccard .panel-art { box-shadow: inset 0 0 0 999px rgba(31, 27, 23, .5); }
:root[data-theme="night"] .av { box-shadow: inset 0 0 0 99px rgba(31, 27, 23, .35); }
:root[data-theme="night"] .note:not(.answered) .btn.ghost { border-color: rgba(58, 42, 0, .25); }
/* While the look changes in front of him the colours ease over instead of snapping (theme.js adds the class). */
.theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after {
  transition: background-color .6s ease, border-color .6s ease, color .6s ease, fill .6s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  .theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after { transition: none !important; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--pen); }
img { display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hand { font-family: var(--hand); color: var(--pen); }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.rail { width: 248px; flex: none; background: var(--paper); border-right: 1px solid var(--line); padding: 28px 18px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 26px; font-weight: 800; letter-spacing: -0.04em; text-decoration: none; color: var(--ink); }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rust); margin-top: 10px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500; transition: background .25s var(--ease); }
.nav a:hover { background: var(--hover); }
.nav a.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 0 rgba(29,26,22,.05), 0 8px 18px -14px rgba(29,26,22,.4); }
.badge { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--butter); color: var(--on-butter); padding: 2px 8px; border-radius: 999px; }
.dot-sq { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.rail-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }

/* Claude plan usage: sits just above the Momo card, which keeps its place at the bottom of the rail. */
.fuel { margin-top: auto; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fuel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fuel-ago, .fuel-reset { font-size: 11px; color: var(--ink-3); }
.fuel-row { display: flex; flex-direction: column; gap: 5px; }
.fuel-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.fuel-top b { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.fuel-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.fuel-bar i { display: block; height: 100%; border-radius: inherit; background: currentColor; transition: width .6s var(--ease); }
.fuel-note { font-size: 19px; line-height: 1; }
.lvl-ok { color: #1F9E73; }
.lvl-mid { color: #D9A21B; }
.lvl-high { color: var(--rust); }
.chip.fuel-chip { display: none; }
.fuel-ring { width: 14px; height: 14px; border-radius: 50%; flex: none; -webkit-mask: radial-gradient(circle, transparent 3px, #000 3.5px); mask: radial-gradient(circle, transparent 3px, #000 3.5px); }

.main { flex: 1; min-width: 0; padding: 28px clamp(20px, 3.5vw, 56px) 32px; display: flex; flex-direction: column; gap: 36px; }
.view { display: flex; flex-direction: column; gap: 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); background: var(--fill); padding: 8px 14px; border-radius: 999px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--ink); }
.icon-btn[aria-pressed="false"] { color: var(--ink-3); }
.banner { display: flex; align-items: center; gap: 14px; background: var(--peach); border: 1px solid var(--peach-line); color: var(--peach-ink); border-radius: 18px; padding: 14px 18px; font-size: 15px; }
.banner img { width: 48px; height: 48px; object-fit: contain; }

/* ---------- headings ---------- */
.h1 { font-size: clamp(40px, 5vw, 72px); line-height: .98; font-weight: 800; letter-spacing: -0.045em; }
.lede { margin: 0; font-size: 19px; line-height: 1.5; color: var(--ink-2); max-width: 560px; }
.section { display: flex; flex-direction: column; gap: 20px; }
.section-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 28px; font-weight: 800; }
.section-head .aside { margin-left: auto; font-size: 14px; color: var(--ink-3); }

/* ---------- Today ---------- */
/* One piece at the top: the live garden fills the frame edge to edge, and the greeting sits on its open meadow
   over a soft paper wash. The world's status sits in the bottom corner, its open button in the top one. */
.today-hero { position: relative; height: clamp(300px, 30vw, 400px); border-radius: 28px; overflow: hidden; isolation: isolate; box-shadow: 0 1px 0 rgba(29, 26, 22, .04), 0 30px 60px -46px rgba(29, 26, 22, .5); }
.today-hero > .world-mini { position: absolute; inset: 0; height: auto; border-radius: 0; box-shadow: none; }
.today-hero .cw { border-radius: 0; }
.today-hero .cw.small .cw-status { top: auto; left: auto; right: 14px; bottom: 14px; }
.today-hero .cw.small .cw-narrator { top: auto; left: auto; right: 14px; bottom: 14px; max-width: min(46%, 520px); }
.today-hero-copy { position: absolute; inset: 0 auto 0 0; z-index: 1; width: min(60%, 640px); display: flex; align-items: center; padding: 0 clamp(28px, 4vw, 56px); pointer-events: none;
  background: linear-gradient(90deg, rgba(var(--card-rgb), .95) 0%, rgba(var(--card-rgb), .86) 42%, rgba(var(--card-rgb), 0) 100%); }
.today-greet { font-size: clamp(40px, 4.4vw, 68px); white-space: nowrap; }
/* A thin inner line keeps the frame crisp against the white page. */
.today-hero::after { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(29, 26, 22, .06); pointer-events: none; }

/* Conversation is the main column; the crew list and updates sit in a narrow column on the right. */
.today-main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 28vw, 380px); gap: 22px; align-items: start; }
.today-side { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.today-main > .panel, .today-side > .panel { flex: none; }
/* The chat stays in view while he reads down the right column. Open, it is one screen tall and the messages scroll
   inside it; the chat box rests in the room left at its bottom, so it never covers the newest message. */
.today-convo { position: sticky; top: 20px; min-height: 420px; }
.today-convo .convo { max-height: clamp(340px, calc(100vh - 270px), 820px); }
@media (min-width: 861px) {
  .today-convo:has(> .fold-body:not(.closed)) { height: calc(100vh - 36px); padding-bottom: var(--composer-h, 66px); }
  .today-convo > .fold-body:not(.closed) { flex: 1 1 auto; min-height: 0; }
  .today-convo > .fold-body:not(.closed) > .fold-inner { height: 100%; }
  .today-convo > .fold-body:not(.closed) .convo { flex: 1 1 auto; min-height: 120px; max-height: none; }
  /* Over the chat column only, inside the panel's edges, never over the crew list and updates. It takes no room of
     its own below the chat (--composer-h is its height, set in app.js), so at the end of the page the chat still
     reaches the bottom of the screen instead of leaving an empty band above the box. */
  .main:has(.today-main) { padding-bottom: 16px; }
  .main:has(.today-main) > .composer-wrap { margin-top: calc(-36px - var(--composer-h, 66px)); padding: 0 calc(clamp(300px, 28vw, 380px) + 22px + 20px) 0 20px; }
}
.today-convo .brief { box-shadow: none; border-radius: 18px; }
.brief-btn { min-height: 34px; padding: 0 14px; border: 0; }
.brief-btn.on { background: var(--ink); color: var(--on-ink); }
.today-side .panel { padding: 18px; gap: 12px; border-radius: 22px; }
.today-side .panel-head h2 { font-size: 17px; }
/* On a project's chat tab: which project the column shows, and the way back to every project. */
.side-scope { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 2px 0 16px; border: 1px solid var(--line); border-radius: 23px; background: var(--paper); font-size: 13.5px; }
.side-scope-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.side-scope-ask { color: var(--ink-2); font-size: 12.5px; }
.side-scope-all { flex: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-size: 13px; }
.side-scope-all:hover { color: var(--ink); background: var(--hover); }
.side-scope-all:focus-visible { outline: 2px solid var(--pen); outline-offset: 1px; }

/* ---------- messages ---------- */
.bubble { font-size: 15px; line-height: 1.45; padding: 13px 17px; max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.you { align-self: flex-end; background: var(--fill); border-radius: 22px 22px 6px 22px; }
.bubble.momo { background: var(--card); border: 1px solid var(--line); border-radius: 6px 22px 22px 22px; box-shadow: 0 14px 30px -24px rgba(29,26,22,.5); }
.msg-row { display: flex; gap: 10px; align-items: flex-start; }
.msg-row > img { width: 30px; height: 30px; border-radius: 50%; background: var(--butter-pale); flex: none; }
.msg-col { min-width: 0; }
.msg-meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.typing-row > img.typing-momo { animation: momo-bob 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.typing-bubble { display: inline-flex; align-items: center; gap: 5px; padding: 14px 16px; }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: typing-dot 1.2s ease-in-out infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; }
.typing-bubble i:nth-child(3) { animation-delay: .3s; }
.typing-row.slow .typing-bubble i { animation-duration: 2s; }
.typing-status { display: flex; flex-direction: column; margin-top: 4px; }
.typing-line { font-family: var(--hand); font-size: 20px; line-height: 1.1; color: var(--ink-2); animation: rise .4s var(--ease); }
.typing-detail { font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }
.typing-detail:empty { display: none; }
/* Momo's formatted replies: built from text nodes by richBlocks() in app.js, never from HTML. */
.bubble.rich { white-space: normal; }
.bubble.rich > * { margin: 0; }
.bubble.rich > * + * { margin-top: 8px; }
.bubble.rich ul, .bubble.rich ol { padding-left: 20px; }
.bubble.rich li + li { margin-top: 3px; }
.bubble.rich .rt-h { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.bubble.rich code { font-family: var(--mono); font-size: 13px; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.bubble.rich pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.bubble.rich pre code { background: none; padding: 0; font-size: inherit; }
/* Tables in Momo's replies (chat, Agent mode, details): a wide one scrolls sideways inside its own box. */
.rt-table { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); }
.rt-table:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.rt-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.45; overflow-wrap: normal; }
.rt-table th, .rt-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); min-width: 80px; }
.rt-table th { background: var(--paper); font-weight: 700; white-space: nowrap; }
.rt-table tbody tr:last-child td { border-bottom: 0; }
.rt-table .al-center { text-align: center; }
.rt-table .al-right { text-align: right; font-variant-numeric: tabular-nums; }
.reply-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.rcard { display: flex; align-items: center; gap: 10px; width: 300px; max-width: 100%; padding: 8px 12px 8px 8px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); transition: border-color .2s var(--ease); }
.rcard:hover, .rcard:focus-within { border-color: var(--pen); }
.rcard-thumb { flex: none; width: 72px; height: 48px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line-2); background: var(--fill-2); }
.rcard-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.rcard-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--paper); color: var(--ink-3); display: grid; place-items: center; }
.rcard-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
.rcard-text b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcard-text small { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.convo { display: flex; flex-direction: column; gap: 12px; max-height: 460px; overflow-y: auto; padding-right: 4px; padding-bottom: 16px; }
.convo-earlier { align-self: center; flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: none; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.convo-earlier:hover { color: var(--ink); background: var(--fill-2); }
.convo-earlier:focus-visible { outline: 2px solid var(--pen); outline-offset: 1px; }
.convo-earlier:disabled { cursor: default; color: var(--ink-3); background: none; }

/* ---------- composer ---------- */
/* Always on screen at the bottom of the page, so he never scrolls to find it. */
.composer-wrap { position: sticky; bottom: 16px; z-index: 20; display: flex; justify-content: center; margin-top: auto; pointer-events: none; }
.composer { pointer-events: auto; width: min(720px, 100%); display: flex; align-items: center; gap: 10px; background: rgba(var(--card-rgb), .96); backdrop-filter: blur(8px); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 8px 8px 22px; box-shadow: 0 1px 0 rgba(29,26,22,.04), 0 22px 44px -24px rgba(29,26,22,.5); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; line-height: 22px; padding: 10px 0; resize: none; overflow-y: auto; max-height: 160px; }
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Several lines: the text takes the whole width and the buttons move to a row of their own underneath. */
.composer.tall { border-radius: 24px; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; padding: 12px 8px 8px 22px; }
.composer.tall textarea { flex-basis: 100%; padding: 4px 6px 0 0; }
.composer.tall .hint { margin-right: auto; }
.composer .hint { font-family: var(--mono); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 6px; white-space: nowrap; }
.mic { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; flex: none; }
.mic .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--violet); opacity: 0; }
.mic.listening .ring { animation: ring 1.8s var(--ease) infinite; }
.mic.listening .ring + .ring { animation-delay: .6s; }
.send { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--card); display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .4; cursor: default; }
.composer-wrap { flex-direction: column; align-items: center; gap: 10px; }
.composer.dropping { border-color: var(--pen); box-shadow: 0 0 0 4px rgba(43, 79, 214, .14), 0 22px 44px -24px rgba(29,26,22,.5); }
.tray { pointer-events: auto; width: min(720px, 100%); display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
.tray:empty { display: none; }
.att { position: relative; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: var(--card); box-shadow: 0 10px 20px -14px rgba(29,26,22,.5); }
.att img { width: 100%; height: 100%; object-fit: cover; }
.att.uploading img { opacity: .45; }
.att.uploading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); border-top-color: transparent; animation: spin .8s linear infinite; }
.att button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(29,26,22,.75); color: #FFFFFF; display: grid; place-items: center; padding: 0; }
.bubble-shots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.bubble-shots img { width: 140px; height: 96px; object-fit: cover; object-position: top; border-radius: 14px; border: 1px solid var(--line-2); }
.att.file, .bubble-file { display: flex; align-items: center; gap: 10px; max-width: 100%; text-align: left; }
.att.file { width: 220px; padding: 8px 34px 8px 10px; }
.att.file.uploading { opacity: .6; }
.att.file.uploading::after { inset: auto 10px 10px auto; width: 14px; height: 14px; margin: 0; }
.bubble-file { width: 240px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); text-decoration: none; }
.bubble-file:hover { border-color: var(--pen); }
.file-icon { position: relative; flex: none; width: 40px; height: 44px; display: grid; place-items: center; color: var(--ink-3); }
.file-icon svg { width: 36px; height: 36px; }
.file-icon b { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); padding: 0 3px; border-radius: 4px; background: var(--ink); color: var(--on-ink); font-size: 9px; line-height: 14px; letter-spacing: .02em; }
.file-text { min-width: 0; display: flex; flex-direction: column; }
.file-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--ink-3); }
/* A long paste: one card with its first lines, in the chat box and in the chat; a tap shows all of it. */
.att.paste { width: 260px; height: auto; overflow: visible; }
.att.paste.uploading { opacity: .6; }
.att.paste.uploading::after { inset: auto 12px 12px auto; width: 14px; height: 14px; margin: 0; }
.att.paste > button:last-child { top: 8px; right: 8px; width: 28px; height: 28px; }
.att.paste > button:last-child::after { content: ''; position: absolute; inset: -8px; }
.bubble-paste { width: 260px; max-width: 100%; border: 1px solid var(--line-2); border-radius: 14px; background: var(--card); }
.bubble-paste:hover { border-color: var(--pen); }
.paste-card { display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 14px; background: none; text-align: left; color: var(--ink); }
.att.paste .paste-card { position: relative; inset: auto; width: 100%; height: auto; padding: 10px 44px 10px 12px; border-radius: 14px; background: none; color: var(--ink); place-items: normal; }
.paste-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.paste-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; height: calc(1.35em * 2); overflow: hidden; font-size: 13px; line-height: 1.35; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.paste-size { font-size: 12px; color: var(--ink-3); }
.paste-viewer { width: min(760px, calc(100vw - 32px)); max-height: min(82vh, 900px); padding: 0; border: 0; border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: 0 28px 56px -28px rgba(0, 0, 0, .55); }
.paste-viewer[open] { display: flex; flex-direction: column; animation: rise .3s var(--ease) both; }
.paste-viewer::backdrop { background: rgba(29, 26, 22, .55); }
html:has(.paste-viewer[open]) { overflow: hidden; }
.paste-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.paste-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.paste-title h2 { font-size: 18px; }
.paste-meta { font-size: 13px; color: var(--ink-3); }
.paste-btn { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font-weight: 600; }
.paste-btn.dark { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.paste-body { flex: 1; min-height: 0; margin: 0; padding: 16px 20px 22px; overflow: auto; overscroll-behavior: contain; font-family: var(--sans); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- floating chat ---------- */
.dock { position: fixed; left: 0; top: 0; z-index: 40; width: min(380px, calc(100vw - 24px)); height: min(540px, calc(100vh - 24px)); display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(29,26,22,.04), 0 28px 56px -28px rgba(29,26,22,.55); overflow: hidden; animation: rise .4s var(--ease) both; }
.dock[hidden], .dock-bubble[hidden] { display: none; }
.dock-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); cursor: grab; touch-action: none; user-select: none; }
.dock.dragging .dock-head { cursor: grabbing; }
.dock-head img { width: 34px; height: 34px; border-radius: 50%; background: var(--butter-pale); flex: none; pointer-events: none; }
.dock-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dock-title b { font-size: 15px; }
.dock-title span { font-size: 12px; color: var(--ink-3); }
.dock-head .icon-btn { width: 34px; height: 34px; }
.dock-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px 12px; }
.dock-convo { flex: 1; max-height: none; min-height: 0; }
.dock .composer-wrap { position: static; margin: 0; }
.dock .composer { width: 100%; gap: 6px; padding: 6px 6px 6px 16px; }
.dock .composer .hint { display: none; }
.dock .composer:focus-within { border-color: var(--pen); }
.dock .tray { width: 100%; }
.dock-bubble { position: fixed; right: 24px; bottom: 96px; z-index: 40; width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--butter-pale); box-shadow: 0 18px 32px -18px rgba(29,26,22,.6); overflow: hidden; transition: transform .3s var(--ease); }
.dock-bubble:hover { transform: translateY(-3px); }
.dock-bubble img { width: 100%; height: 100%; object-fit: cover; }
.dock.resizing { user-select: none; }
.dock-resize { position: absolute; z-index: 2; touch-action: none; }
.dock-resize-n, .dock-resize-s { left: var(--radius); right: var(--radius); height: 8px; cursor: ns-resize; }
.dock-resize-e, .dock-resize-w { top: var(--radius); bottom: var(--radius); width: 8px; cursor: ew-resize; }
.dock-resize-n { top: 0; }
.dock-resize-s { bottom: 0; }
.dock-resize-e { right: 0; }
.dock-resize-w { left: 0; }
/* Corner handles span the rounded corner, since clicks outside the curve never reach the dock. */
.dock-resize-nw, .dock-resize-ne, .dock-resize-sw, .dock-resize-se { width: var(--radius); height: var(--radius); }
.dock-resize-nw { top: 0; left: 0; cursor: nwse-resize; }
.dock-resize-se { bottom: 0; right: 0; cursor: nwse-resize; background: linear-gradient(135deg, transparent 40%, var(--ink-3) 40%, var(--ink-3) 45%, transparent 45%, transparent 56%, var(--ink-3) 56%, var(--ink-3) 61%, transparent 61%); opacity: .45; }
.dock-resize-ne { top: 0; right: 0; cursor: nesw-resize; }
.dock-resize-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.dock button:focus-visible, .dock-bubble:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }

/* ---------- sticky notes ---------- */
.notes { display: flex; flex-wrap: wrap; gap: 22px; align-items: stretch; }
.note { flex: 1 1 300px; min-width: 0; max-width: 520px; background: var(--butter); border-radius: 6px 6px 18px 6px; padding: 22px 22px 20px; box-shadow: 0 1px 0 rgba(58,42,0,.06), 0 18px 30px -22px rgba(58,42,0,.55); display: flex; flex-direction: column; gap: 12px; color: var(--butter-ink); transition: transform .4s var(--ease); }
.note:nth-child(3n+1) { transform: rotate(-1.1deg); }
.note:nth-child(3n+2) { transform: rotate(.8deg); }
.note:nth-child(3n) { transform: rotate(-.4deg); }
.note:hover { transform: rotate(0) translateY(-4px); }
.note .who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.note h3 { font-family: var(--hand); font-size: 30px; line-height: 1.02; font-weight: 700; color: var(--ink); letter-spacing: 0; overflow-wrap: anywhere; }
.note p { margin: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.note pre { margin: 0; font-family: var(--mono); font-size: 12px; background: rgba(var(--card-rgb), .55); border-radius: 12px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow: auto; }
.note .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.note-own { display: flex; align-items: flex-end; gap: 6px; background: rgba(var(--card-rgb), .55); border: 1px solid rgba(58,42,0,.18); border-radius: 22px; padding: 4px 4px 4px 14px; transition: background .2s var(--ease), border-color .2s var(--ease); }
.note-own:focus-within { background: rgba(var(--card-rgb), .9); border-color: var(--pen); }
.note-own textarea { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; line-height: 22px; padding: 7px 0; resize: none; overflow-y: auto; max-height: 132px; color: var(--ink); }
.note-own textarea::placeholder { color: rgba(58,42,0,.62); }
.note-own .send { width: 36px; height: 36px; border: 0; background: var(--ink); color: var(--on-ink); }
.note-own .send:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.btn { border: 0; background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 600; padding: 0 18px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn.ghost { background: transparent; color: inherit; border: 1px solid rgba(58,42,0,.25); }
.btn.light { background: var(--card); color: var(--ink); border: 1px solid var(--line-2); }
.btn:disabled { opacity: .5; cursor: default; }
.calm { display: flex; align-items: center; gap: 16px; background: var(--paper); border-radius: 22px; padding: 14px 22px; color: var(--ink-2); font-size: 16px; }
.calm img { width: 64px; height: 64px; object-fit: contain; }

/* ---------- status pills ---------- */
.pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.s-working { background: var(--lilac); color: var(--lilac-ink); }
.s-checking { background: var(--lilac); color: var(--lilac-ink); }
.s-waiting { background: var(--butter-pale); color: var(--butter-ink); }
.s-queued { background: var(--fill); color: var(--ink-2); }
.s-done { background: var(--mint); color: var(--mint-ink); }
.s-failed { background: var(--rust-soft); color: var(--rust-ink); }
/* A working task with no progress report past the threshold: a hushed tag with a slow ember, quiet but visible. */
.s-quiet { background: var(--peach); color: var(--peach-ink); box-shadow: inset 0 0 0 1px var(--peach-line); font-weight: 500; font-variant-numeric: tabular-nums; }
.s-quiet i { width: 6px; height: 6px; border-radius: 50%; background: var(--rust); animation: ember 2.8s var(--ease) infinite; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s var(--ease) infinite; }

/* ---------- updates + panels ---------- */
.split { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.panel { flex: 1 1 380px; min-width: 0; background: var(--paper); border-radius: 26px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.panel.white { background: var(--card); border: 1px solid var(--line); }
/* Panels stacked straight in a page column must not take the side-by-side flex height. */
.view > .panel { flex: none; }
.panel-head { display: flex; align-items: center; gap: 12px; }
.panel-head img { width: 42px; height: 42px; border-radius: 50%; background: var(--butter-pale); flex: none; object-fit: cover; }
.panel-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.panel-head span { font-size: 13px; color: var(--ink-3); }
.urow { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 18px; padding: 12px 16px 12px 12px; }
.urow .text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.urow b { font-size: 15px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.urow small { font-size: 13px; color: var(--ink-2); line-height: 1.4; overflow-wrap: anywhere; }
.urow time { font-size: 12px; color: var(--ink-3); flex: none; align-self: flex-start; }
.shot { width: 96px; height: 62px; flex: none; border-radius: 10px; border: 1px solid var(--line-2); background: var(--fill-2); overflow: hidden; display: grid; place-items: center; }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shot.big { width: 200px; height: 128px; }
.proof-link { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; align-self: flex-start; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.proof-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-link svg { flex: none; }
.proof-link:hover { color: var(--ink); }
.proof-link:hover span { text-decoration: underline; }
.doc-link { min-height: 44px; color: var(--ink); font-weight: 600; }
/* A doc's name in running text. The padding only grows the tap area to about 44 px; inline padding leaves the lines where they are. */
.doc-ref { padding-block: 12px; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--violet); text-decoration-thickness: 2px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.doc-ref:hover { color: var(--violet); }
.checked { display: inline-flex; align-items: center; gap: 5px; color: var(--mint-ink); font-weight: 600; }
.empty { font-size: 15px; color: var(--ink-3); padding: 6px 2px; }

/* ---------- task detail ---------- */
.back { align-self: flex-start; font-size: 14px; color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 16px; }
.tl .rail-col { display: flex; flex-direction: column; align-items: center; }
.tl .node { width: 28px; height: 28px; border-radius: 50%; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; flex: none; overflow: hidden; }
.tl .node img { width: 28px; height: 28px; object-fit: cover; }
.tl .stem { width: 2px; flex: 1; background: var(--line); min-height: 16px; }
.tl .body { display: flex; flex-direction: column; gap: 4px; padding-bottom: 20px; min-width: 0; }
.tl .body b { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.tl .body span { font-size: 13px; color: var(--ink-3); }

/* ---------- crew ---------- */
.crew-grid { flex: 3 1 600px; min-width: 0; display: flex; flex-wrap: wrap; gap: 20px; }
.ccard { flex: 1 1 260px; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--lift); }
.ccard .panel-art { position: relative; height: 136px; overflow: hidden; }
.ccard .panel-art .peek-img { position: absolute; left: 0; bottom: 0; height: 136px; width: auto; transition: transform .6s var(--ease); }
.ccard .panel-art .round-img { position: absolute; left: 20px; bottom: 14px; width: 104px; height: 104px; object-fit: contain; transition: transform .6s var(--ease); }
.ccard:hover .panel-art img { transform: translateY(-6px) scale(1.03); }
.ccard .tag { position: absolute; right: 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: rgba(var(--card-rgb), .9); padding: 5px 10px; border-radius: 999px; }
.ccard .tag.top { top: 14px; }
.ccard .tag.bottom { bottom: 14px; background: var(--card); }
.ccard .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.ccard h2 { font-size: 24px; font-weight: 800; }
.ccard .role { font-size: 14px; color: var(--ink-2); }
.ccard .label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.ccard .nowtext { font-size: 15px; line-height: 1.4; font-weight: 500; }
.ccard .next { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--rule); margin-top: auto; }
.ccard .next span { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.ccard .next span::before { content: ''; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--mute); flex: none; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.room { flex: 1 1 340px; min-width: 0; background: var(--paper); border-radius: 26px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.room-row { display: flex; gap: 10px; align-items: flex-start; }
.room-row .msg { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 6px 18px 18px 18px; padding: 9px 13px; display: flex; flex-direction: column; gap: 3px; }
.room-row.momo .msg { background: var(--butter-soft); border-color: transparent; }
.room-row .msg b { font-size: 12px; color: var(--ink-2); }
.room-row .msg span { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.av { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none; background: var(--card); position: relative; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.av img.peek { position: absolute; left: -6px; top: -2px; width: 52px; height: auto; }
.av img.round { width: 100%; height: 100%; object-fit: cover; }

/* ---------- settings ---------- */
.setting-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--rule); }
.setting-row:first-of-type { border-top: 0; }
.setting-text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.setting-text b { font-size: 15px; }
.setting-text span { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.setting-text small { font-size: 13px; color: var(--ink-3); line-height: 1.45; overflow-wrap: anywhere; }
.setting-text code, .setting-row > code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); background: var(--fill); padding: 4px 8px; border-radius: 8px; overflow-wrap: anywhere; align-self: flex-start; }
.setting-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setting-note { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.setting-steps { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.panel select, .panel input[type="time"] { font: inherit; font-size: 14px; border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px; background: var(--card); min-height: 44px; }
.switch { position: relative; width: 48px; height: 28px; border-radius: 999px; border: 0; background: var(--line-2); padding: 0; flex: none; transition: background .25s var(--ease); }
.switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(29,26,22,.3); transition: transform .25s var(--ease); }
.switch.on { background: var(--ink); }
.switch.on span { transform: translateX(20px); }
.chip-btn { border: 0; cursor: pointer; }
.chip-btn.on { background: var(--lilac); color: var(--lilac-ink); }

/* ---------- collapsible sections ---------- */
.fold-title { margin: 0; min-width: 0; }
.fold-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; letter-spacing: inherit; text-align: left; border-radius: 8px; }
.fold-btn:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; }
.fold-chev { display: inline-grid; place-items: center; flex: none; color: var(--ink-3); transition: transform .22s var(--ease); }
.fold-btn[aria-expanded="false"] .fold-chev { transform: rotate(-90deg); }
.fold-label { min-width: 0; }
/* Panel heads style every span as a subtitle; the folding title must keep the heading's own look. */
.panel-head .fold-label { font-size: inherit; color: inherit; }
.panel-head .fold-chev { font-size: inherit; color: var(--ink-3); }
.fold-sum { display: none; font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fold-btn[aria-expanded="false"] .fold-sum { display: inline; }
.fold-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* minmax(0, 1fr) keeps wide content (the sideways-scrolling board) from stretching the page. */
.fold-body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; transition: grid-template-rows .26s var(--ease), opacity .2s var(--ease); }
.fold-body.closed { grid-template-rows: 0fr; opacity: 0; }
.fold-inner { min-height: 0; display: flex; flex-direction: column; gap: var(--fold-gap, 16px); }
/* Clipped only while folded, so card shadows and tilted notes are never cut off when open. */
.fold-body.closed > .fold-inner { overflow: hidden; }
.section { --fold-gap: 20px; }
.room { --fold-gap: 14px; }
.fuel { --fold-gap: 10px; }
:is(.panel, .section, .room, .fuel):has(> .fold-body.closed) { row-gap: 0; }
.room .fold-title { font-size: 22px; font-weight: 800; }
.fuel .fold-title { font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.fuel .fold-sum { font-size: 12px; }

/* ---------- Momo's brief ---------- */
.brief { background: var(--card); border: 1px solid var(--line); border-radius: 6px 22px 22px 22px; box-shadow: 0 14px 30px -24px rgba(29,26,22,.5); padding: 14px 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.brief-head { display: flex; align-items: center; gap: 8px; }
.brief-head img { width: 26px; height: 26px; border-radius: 50%; background: var(--butter-pale); flex: none; }
.brief-head b { font-size: 14px; }
.brief-head span { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.brief ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.brief li { display: flex; gap: 10px; align-items: baseline; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.brief li a { color: inherit; text-decoration: none; }
.brief li a:hover { text-decoration: underline; }
.brief-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; background: var(--line-2); }
.tone-needs .brief-dot { background: var(--butter); }
.tone-done .brief-dot { background: #1F9E73; }
.tone-next .brief-dot { background: var(--pen); }
.brief-last { align-self: flex-start; border: 0; background: none; padding: 0; font-size: 12px; color: var(--ink-3); }
.brief-last:hover { color: var(--ink); }

/* ---------- orbit + undo ---------- */
.orow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.orow:first-of-type { border-top: 0; }
.otitle { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.opri { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.urow-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; align-self: flex-start; }
.urow-side time { font-size: 12px; color: var(--ink-3); }
.undo { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); font-size: 12px; padding: 4px 9px; border-radius: 999px; }
.undo:hover { color: var(--ink); border-color: var(--ink-3); }
.delete-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; animation: rise .3s var(--ease) both; }
.delete-ask { font-size: 12px; color: var(--ink-2); }
.undo.delete-yes { color: var(--rust); border-color: var(--rust); }
.undo.delete-yes:hover { color: var(--on-ink); background: var(--rust); }
@media (prefers-reduced-motion: reduce) { .delete-confirm { animation: none; } }

/* ---------- approvals ---------- */
.levels { display: flex; flex-wrap: wrap; gap: 12px; }
.level { flex: 1 1 220px; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 18px; padding: 16px 18px; transition: border-color .25s var(--ease), background .25s var(--ease); }
.level:hover { border-color: var(--ink-3); }
.level.on { border-color: var(--ink); background: var(--paper); }
.level b { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.level-text { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.restart-note { margin: 0; font-size: 14px; color: var(--butter-ink); background: var(--butter-soft); border-radius: 14px; padding: 10px 14px; }

/* ---------- projects ---------- */
.pv-page-head { display: flex; flex-direction: column; gap: 12px; }
.pv-page-head .lede { max-width: 760px; }
.pv-name { display: flex; align-items: center; gap: 14px; }
.pv-name .dot-sq { width: 16px; height: 16px; }
.pv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.pv-card { min-width: 0; min-height: 44px; display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; text-decoration: none; color: var(--ink); transition: border-color .25s var(--ease); }
.pv-card:hover { border-color: var(--ink-3); }
.pv-card-head { display: flex; align-items: center; gap: 10px; }
.pv-card-head .dot-sq { width: 12px; height: 12px; }
.pv-card-head b { flex: 1; min-width: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.pv-card small { font-size: 13px; color: var(--ink-2); }
.pv-calm { margin: 0; font-size: 17px; color: var(--ink-2); padding: 14px 18px; border: 1px dashed var(--line-2); border-radius: 18px; }
.pv-taghead { padding: 8px 16px 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--paper); letter-spacing: .02em; }
.pv-line + .pv-taghead { border-top: 1px solid var(--line); }
.pv-group { display: flex; flex-direction: column; gap: 10px; }
.pv-head { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.pv-count { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--paper); border-radius: 999px; padding: 2px 9px; letter-spacing: 0; }
.pv-needs .pv-count { background: var(--butter); color: var(--on-butter); }
.pv-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: var(--card); overflow: hidden; }
.pv-needs .pv-lines { border-color: var(--butter-line); }
.pv-line + .pv-line { border-top: 1px solid var(--line); }
.pv-row { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border: 0; background: transparent; text-align: left; }
.pv-row:hover, .pv-line.open .pv-row { background: var(--paper); }
.pv-row:focus-visible { outline: 2px solid var(--pen); outline-offset: -2px; }
.pv-kind { flex: none; width: 52px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.pv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pv-title { font-size: 15px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.pv-why { font-size: 13px; color: var(--butter-ink); }
.pv-side { flex: none; display: flex; align-items: center; gap: 8px; }
.pv-side time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.pv-chev { flex: none; display: inline-flex; color: var(--ink-3); transform: rotate(-90deg); transition: transform .25s var(--ease); }
.pv-line.open .pv-chev { transform: none; }
.pv-done .pv-title, .pv-older .pv-title { font-weight: 500; color: var(--ink-2); }
.pv-older .pv-lines { opacity: .75; }
.pv-detail { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 16px 80px; background: var(--paper); }
.pv-now { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.pv-more { margin: 0; font-size: 13px; color: var(--ink-3); }
.pv-update, .pv-doc { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.pv-update b { font-size: 14px; line-height: 1.4; }
.pv-update p, .pv-doc p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
.pv-update small, .pv-doc small { font-size: 12px; color: var(--ink-3); line-height: 1.45; overflow-wrap: anywhere; }
.pv-shots { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-shot { display: block; width: 160px; max-width: 100%; height: 100px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--fill-2); overflow: hidden; }
.pv-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pv-doc-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 44px; color: var(--ink); text-decoration: none; }
.pv-doc-title .pv-kind { width: auto; }
.pv-doc-title b { flex: 1 1 200px; min-width: 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.pv-doc-title:hover b { text-decoration: underline; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-toggle { align-self: flex-start; min-height: 44px; border: 1px dashed var(--line-2); background: transparent; color: var(--ink-2); font-size: 14px; border-radius: 12px; padding: 0 16px; }
.pv-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.pv-team-link { font-size: 14px; display: inline-flex; align-items: center; min-height: 44px; }
.pv-note h3 { font-size: 16px; font-weight: 700; margin: 4px 0 6px; }
/* The Projects overview: every project on one screen, each a short list of plain lines grouped by topic. */
.cv-list { display: flex; flex-direction: column; gap: 26px; }
.cv-proj { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cv-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 44px; color: var(--ink); text-decoration: none; }
.cv-head .dot-sq { width: 12px; height: 12px; }
.cv-head b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.cv-head small { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.cv-head:hover b { text-decoration: underline; }
.cv-head:focus-visible, .cv-row:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.cv-proj.has-needs .pv-lines { border-color: var(--butter-line); }
a.cv-row { color: var(--ink); text-decoration: none; }
button.cv-row { color: var(--ink); font: inherit; cursor: pointer; }
.cv-state { flex: none; width: 84px; justify-content: center; align-self: center; }
.cv-said { font-size: 13px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }
.cv-done .pv-title { font-weight: 500; color: var(--ink-2); }
.pv-chev.cv-out { transform: none; }
@media (max-width: 860px) {
  .pv-row { flex-wrap: wrap; row-gap: 4px; padding: 10px 14px; }
  .pv-kind { width: auto; flex-basis: 100%; }
  .pv-text { flex-basis: calc(100% - 28px); }
  .pv-side { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .pv-chev { order: 2; }
  .pv-detail { padding: 4px 14px 14px; }
  .cv-state { width: auto; }
  .cv-row .pv-side { order: 1; flex: 1 1 auto; }
  .cv-row .pv-text { order: 3; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .pv-chev { transition: none; } }

/* ---------- markdown ---------- */
.md { font-size: 15px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.md h3, .md h4, .md h5, .md h6 { margin: 14px 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.md p { margin: 0 0 10px; }
.md ul { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 4px 0; }
.md li.md-done { color: var(--ink-3); text-decoration: line-through; }
.md code { font-family: var(--mono); font-size: 13px; background: var(--fill); padding: 1px 5px; border-radius: 5px; }

/* ---------- days ---------- */
/* Simple mode: the small tabs inside a main tab, the More page, a task's result, short question cards. */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 -8px; }
.subtab { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); font-size: 15px; font-weight: 500; text-decoration: none; transition: border-color .2s var(--ease), background .2s var(--ease); }
.subtab:hover { border-color: var(--ink-3); color: var(--ink); }
.subtab.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.subtab:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.more-list { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.more-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); text-decoration: none; box-shadow: var(--lift); transition: transform .3s var(--ease), border-color .2s var(--ease); }
.more-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.more-card:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; }
.more-icon { flex: none; width: 48px; height: 48px; border-radius: 16px; background: var(--paper); display: grid; place-items: center; color: var(--ink-2); }
.more-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.more-text b { font-size: 18px; }
.more-text span { font-size: 15px; color: var(--ink-2); line-height: 1.4; }
.task-result { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 22px 24px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
.task-result-now { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.3; }
.task-result-body { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.task-result-body b { font-size: 17px; }
.task-result-body p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.task-result .sent-files { width: 100%; max-width: 560px; }
.task-result-comment { width: 100%; max-width: 760px; }
.task-actions { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; max-width: 100%; }
.task-actions .proof-link { min-height: 44px; font-size: 14px; }
.task-main { min-height: 48px; padding: 0 22px; font-size: 15px; }
/* The step sketch: four small dots on a thin line, the step it is on lit. */
.task-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; max-width: 520px; }
.task-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); text-align: center; }
.task-step::before { content: ''; position: absolute; top: 6px; right: 50%; width: 100%; height: 2px; background: var(--line-2); }
.task-step:first-child::before { display: none; }
.task-step.past::before, .task-step.now::before { background: var(--ink-2); }
.task-step-dot { position: relative; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--mute); }
.task-step.past .task-step-dot { background: var(--ink-2); border-color: var(--ink-2); }
.task-step.now { color: var(--ink); font-weight: 600; }
.task-step.now .task-step-dot { background: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 5px rgba(var(--ink-rgb), .1); }
.task-step.now.tone-you .task-step-dot { background: var(--butter); border-color: var(--butter-edge); box-shadow: 0 0 0 5px var(--butter-pale); }
.task-step.now.tone-stuck .task-step-dot { background: var(--rust); border-color: var(--rust); box-shadow: 0 0 0 5px var(--rust-soft); }
.task-step.now.tone-done .task-step-dot { background: var(--mint-ink); border-color: var(--mint-ink); box-shadow: 0 0 0 5px var(--mint); }
/* The newest result, once: its picture beside the words on a computer, above them on a phone. */
.task-latest { position: relative; display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; width: 100%; max-width: 760px; padding: 16px 64px 16px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.task-latest-shot { flex: none; display: block; width: 220px; aspect-ratio: 16 / 10; border-radius: 12px; border: 1px solid var(--line-2); background: var(--fill-2); overflow: hidden; }
.task-latest-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.task-latest .task-result-body { flex: 1 1 260px; min-width: 0; }
.task-latest .row-more { position: absolute; top: 8px; right: 8px; }
/* Opened, its small buttons take their own row under the result instead of covering it. */
.task-latest .row-more.open { position: static; flex: 1 0 100%; }
@media (max-width: 640px) {
  .task-result { padding: 18px 16px; }
  .task-result-now { font-size: 19px; }
  .task-latest { flex-direction: column; padding: 14px; }
  .task-latest .task-result-body { flex: none; padding-right: 44px; }
  .task-latest-shot { width: 100%; }
  .task-latest:has(.task-latest-shot) { padding-bottom: 56px; }
  .task-latest:has(.task-latest-shot) .task-result-body { padding-right: 0; }
  .task-latest:has(.task-latest-shot) .row-more { top: auto; bottom: 8px; }
}
.note-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.note-skip { margin-left: auto; border: 0; background: none; padding: 0 12px; min-height: 44px; min-width: 44px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 500; color: var(--butter-ink); opacity: .75; cursor: pointer; transition: opacity .2s var(--ease), background-color .2s var(--ease); }
.note-skip:hover { opacity: 1; background: rgba(58,42,0,.08); }
.note-skip:focus-visible { opacity: 1; outline: 2px solid var(--pen); outline-offset: 1px; }
.note-skip:disabled { cursor: default; opacity: .5; }
.note-more { border: 0; background: none; padding: 6px 0; min-height: 32px; font-size: 14px; font-weight: 600; color: var(--butter-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.settings-group { margin: 18px 0 -6px; font-size: 15px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.days-more { margin-top: 12px; }
.settings-fuel { margin-top: 0; padding: 0; background: none; border: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--card); font-size: 14px; padding: 0 16px; border-radius: 999px; min-height: 40px; }
.filter.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.day-head { display: flex; align-items: baseline; gap: 12px; margin: 10px 0 14px; }
.day-head h2 { font-size: 24px; font-weight: 800; }
.jrow { display: flex; gap: 16px; }
.jrow time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); width: 66px; flex: none; padding-top: 4px; text-align: right; }
.jrow .rail-col { display: flex; flex-direction: column; align-items: center; }
.jrow .sq { width: 12px; height: 12px; border-radius: 4px; margin-top: 4px; flex: none; }
.jrow .stem { width: 2px; flex: 1; background: var(--line); min-height: 14px; }
.jrow .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-bottom: 22px; }
.jrow .body > span { font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.jrow .body small { font-size: 13px; color: var(--ink-3); }
.recap { background: var(--butter-soft); border-radius: 26px; padding: 24px; display: flex; flex-direction: column; gap: 12px; color: var(--butter-ink); }
.recap h2 { font-family: var(--hand); font-size: 32px; font-weight: 700; letter-spacing: 0; color: var(--ink); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.bar .name { width: 130px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { flex: 1; height: 10px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; }
.bar .n { width: 24px; text-align: right; font-weight: 600; }

/* ---------- lock + toast ---------- */
.lock { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 100; padding: 20px; }
.lock form { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.lock img { width: 150px; }
.lock input { width: 100%; border: 1px solid var(--line-2); border-radius: 999px; padding: 14px 20px; font-size: 16px; }
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--on-ink); padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 16px 30px -16px rgba(29,26,22,.6); animation: rise .5s var(--ease) both; }
.toast.error { background: var(--rust-ink); }

/* ---------- screenshot viewer ---------- */
.viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; overflow: hidden; }
.viewer::backdrop { background: rgba(29, 26, 22, .82); }
.viewer[open] { animation: rise .3s var(--ease) both; }
html:has(.viewer[open]) { overflow: hidden; }
/* Auto margins (not place-items) keep a zoomed picture's left and top edges reachable by scrolling. */
.viewer-stage { position: absolute; inset: 0; display: flex; overflow: auto; overscroll-behavior: contain; padding: calc(64px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.viewer-stage img { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 14px; background: var(--card); box-shadow: 0 28px 56px -28px rgba(0, 0, 0, .7); cursor: zoom-in; }
.viewer.zoomed .viewer-stage img { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; z-index: 1; }

/* ---------- phone ---------- */
.bnav { display: none; }
@media (max-width: 860px) {
  .rail { display: none; }
  .chip.fuel-chip { display: inline-flex; }
  .main { padding: 20px 16px 24px; gap: 28px; }
  .view { gap: 32px; }
  .h1 { font-size: 40px; }
  .lede { font-size: 16px; }
  /* Phone: the greeting, the crew, then the conversation first and the crew list and updates under it. */
  /* Phone: the greeting on the page, the garden full width under it. */
  .today-hero { height: auto; display: flex; flex-direction: column; gap: 16px; border-radius: 0; overflow: visible; box-shadow: none; }
  .today-hero::after { display: none; }
  .today-hero-copy { position: static; order: -1; width: auto; padding: 0; background: none; }
  .today-hero > .world-mini { position: relative; inset: auto; height: clamp(220px, 62vw, 300px); border-radius: 22px; overflow: hidden; box-shadow: 0 1px 0 rgba(29, 26, 22, .04), 0 24px 48px -40px rgba(29, 26, 22, .5); }
  .today-hero .cw.small .cw-status { right: auto; left: 10px; top: 10px; bottom: auto; }
  .today-hero .cw.small .cw-narrator { right: auto; left: 10px; top: 10px; bottom: auto; max-width: 62%; }
  .today-main { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .today-convo { position: static; min-height: 0; }
  .today-convo .convo { max-height: min(62vh, 560px); }
  .today-side .panel { padding: 16px; }
  .composer-wrap { bottom: 86px; }
  .composer .hint { display: none; }
  /* Longer messages get the full width; the buttons move to a row underneath. */
  .composer.tall { padding: 10px 8px 8px 18px; }
  .composer.tall textarea { padding: 6px 4px 0 0; }
  .dock, .dock-bubble { display: none; }
  .bnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: 74px; padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); background: rgba(var(--card-rgb), .97); border-top: 1px solid var(--rule); justify-content: space-around; align-items: center; }
  .bnav a { width: 52px; height: 52px; display: grid; place-items: center; color: var(--ink-3); border-radius: 16px; }
  .bnav a.active { color: var(--ink); background: var(--fill); }
  .shell { padding-bottom: 74px; }
  .note h3 { font-size: 27px; }
  .note { max-width: none; }
  /* Update rows stack: picture and time on top, then the words, link and files at full width. */
  .urow { flex-wrap: wrap; row-gap: 10px; }
  .urow > .urow-side { margin-left: auto; }
  .urow > .text { flex: 1 0 100%; order: 1; }
  .urow > .row-more { order: 2; }
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }
@keyframes ring { 0% { transform: scale(1); opacity: .45; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ember { 0%, 100% { opacity: .9; } 50% { opacity: .3; } }
@keyframes typing-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes momo-bob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-3px) rotate(-4deg); } 75% { transform: translateY(-1px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
