/* Work Board v2. The control board's own styles, moved over unchanged; v2 additions are at the end.
   Layout: a header strip with progress, three tabs, and a four-column board that stacks on phones.
   Makoli's own palette: deep green ink, cream paper, sun yellow. */
:root {
  --paper: #FBF3E2;
  --card: #FFFFFF;
  --ink: #06231D;
  --soft: #4A5A55;
  --line: #06231D22;
  --sun: #FFD43B;
  --leaf: #2F8F5B;
  --leaf-tint: #DDF1E4;
  --warn: #B4570A;
  --warn-tint: #FCE9D6;
  --red: #B3261E;
  --red-tint: #F9DEDC;
  --blue: #285E9C;
  --blue-tint: #DDE8F5;
  --chip: #06231D0D;
  --display: "Bricolage Grotesque", "Rubik", system-ui, sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17302A; --card: #20403A; --ink: #F3EBDA; --soft: #B6C4BE; --line: #F3EBDA2E;
    --sun: #F2C94C; --leaf: #5CC48A; --leaf-tint: #173A2A; --warn: #F0A35E; --warn-tint: #3A2A17;
    --red: #F2867E; --red-tint: #3D1F1D; --blue: #8DB6E8; --blue-tint: #1A2C40; --chip: #F3EBDA14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17302A; --card: #20403A; --ink: #F3EBDA; --soft: #B6C4BE; --line: #F3EBDA2E;
  --sun: #F2C94C; --leaf: #5CC48A; --leaf-tint: #173A2A; --warn: #F0A35E; --warn-tint: #3A2A17;
  --red: #F2867E; --red-tint: #3D1F1D; --blue: #8DB6E8; --blue-tint: #1A2C40; --chip: #F3EBDA14;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 1760px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 48px; }
@media (min-width: 1100px) { .wrap { padding-inline: 32px; } }
header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 36px); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 span { background: var(--sun); color: #06231D; padding: 0 8px; border-radius: 8px; }
.sub { color: var(--soft); margin: 4px 0 0; font-size: 14px; }
.progress { min-width: 240px; flex: 0 1 360px; }
.progress .nums { display: flex; justify-content: space-between; font-size: 13px; color: var(--soft); font-variant-numeric: tabular-nums; }
.progress .nums b { color: var(--ink); font-family: var(--display); font-size: 20px; }
.bar { height: 10px; border-radius: 10px; background: var(--chip); overflow: hidden; margin-top: 6px; border: 1.5px solid var(--ink); }
.bar i { display: block; height: 100%; background: var(--leaf); width: 0; transition: width .4s ease; }
nav { display: flex; gap: 6px; margin: 20px 0 14px; flex-wrap: wrap; }
nav button { font: 600 15px var(--body); color: var(--ink); background: transparent; border: 2px solid var(--ink); border-radius: 999px; padding: 7px 16px; cursor: pointer; }
nav button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
nav button .n { font-variant-numeric: tabular-nums; opacity: .7; margin-inline-start: 4px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 13px var(--body); border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--sun); color: #06231D; }
.sortby { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--soft); }
.sort { font: 500 13px var(--body); color: var(--ink); background: var(--card); border: 1.5px solid var(--ink); border-radius: 999px; padding: 5px 10px; }
.add { display: flex; flex-wrap: wrap; gap: 8px; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 10px; margin-bottom: 16px; }
.add input, .add select, .add textarea { font: 15px var(--body); color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.add input[name="title"] { flex: 1 1 260px; }
.add textarea { flex: 1 1 100%; min-height: 60px; resize: vertical; }
.btn { font: 700 14px var(--body); border: 2px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 4px 10px; font-size: 13px; border-width: 1.5px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (min-width: 1100px) { .board { gap: 20px; } .col { padding: 14px; } .list { gap: 12px; } .card { padding: 14px 16px; } .card .title { font-size: 16px; } }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .board { grid-template-columns: minmax(0, 1fr); } }
.col { background: var(--chip); border-radius: 18px; padding: 10px; min-width: 0; }
.col h2 { margin: 2px 4px 10px; }
.col.shut h2 { margin-bottom: 2px; }
.colhead { font: 800 16px var(--display); color: var(--ink); background: none; border: 0; padding: 4px 0; width: 100%; display: flex; align-items: center; gap: 8px; cursor: pointer; text-align: start; }
.colhead .chev { margin-inline-start: auto; font-size: 14px; color: var(--soft); }
.col h2 .count { font: 600 12px var(--body); background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.col h2 .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); }
.list { display: grid; gap: 8px; }
.empty { color: var(--soft); font-size: 13px; padding: 10px 6px; }
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; min-width: 0; position: relative; }
.card .newdot { position: absolute; top: 6px; inset-inline-end: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--sun); border: 1.5px solid var(--ink); }
.card.open { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.card .top { display: flex; gap: 10px; align-items: flex-start; }
.tick { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--ink); background: var(--card); cursor: pointer; display: grid; place-items: center; margin-top: 1px; padding: 0; }
.tick[aria-checked="true"] { background: var(--leaf); border-color: var(--leaf); }
.tick svg { width: 14px; height: 14px; opacity: 0; }
.tick[aria-checked="true"] svg { opacity: 1; }
.card .title { flex: 1; min-width: 0; font-weight: 500; cursor: pointer; overflow-wrap: anywhere; background: none; border: 0; padding: 0; text-align: start; color: inherit; font: 500 15px var(--body); }
.done .card .title, .card.isdone .title { text-decoration: line-through; color: var(--soft); }
.meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; padding-inline-start: 32px; }
.prog { margin-top: 9px; padding-inline-start: 32px; display: grid; gap: 3px; }
.prog .track { height: 6px; border-radius: 6px; background: var(--chip); border: 1px solid var(--line); overflow: hidden; }
.prog .fill { height: 100%; border-radius: 6px; background: var(--leaf); transition: width .4s ease; }
.prog .fill.wait { background: var(--warn); }
.prog .label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--soft); font-variant-numeric: tabular-nums; }
.tag { font-size: 11.5px; font-weight: 600; letter-spacing: .02em; border-radius: 6px; padding: 1px 7px; background: var(--chip); color: var(--soft); }
.tag.ref { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--sun); color: #06231D; }
.tag.p1 { background: var(--red-tint); color: var(--red); }
.tag.p2 { background: var(--warn-tint); color: var(--warn); }
.tag.from-QA { background: var(--blue-tint); color: var(--blue); }
.tag.from-Security { background: var(--red-tint); color: var(--red); }
.tag.from-PM { background: var(--warn-tint); color: var(--warn); }
.tag.from-Marketing { background: var(--leaf-tint); color: var(--leaf); }
.tag.from-Design { background: var(--sun); color: #06231D; }
.btn.go { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.tag.queued { background: var(--sun); color: #06231D; }
.tag.working { background: var(--blue-tint); color: var(--blue); }
.tag.waiting { background: var(--warn-tint); color: var(--warn); }
.startbox { display: grid; gap: 8px; background: var(--chip); border-radius: 12px; padding: 10px; }
.startbox label { font-size: 13px; font-weight: 600; }
.startbox textarea { font: 14px var(--body); color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 64px; resize: vertical; width: 100%; }
.startbox .hint { font-size: 12.5px; color: var(--soft); margin: 0; }
.comments { display: grid; gap: 6px; align-content: start; height: min(360px, 50vh); overflow-y: auto; overscroll-behavior: auto; padding: 6px; border: 1.5px solid var(--line); border-radius: 12px; }
.comment { border-inline-start: 3px solid var(--line); padding-inline-start: 8px; font-size: 13.5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment.mine { border-inline-start-color: var(--sun); }
.comment b { font-size: 12px; color: var(--soft); display: block; white-space: normal; }
.reply { display: grid; gap: 6px; }
.latest { margin-top: 8px; padding-inline-start: 32px; display: grid; gap: 2px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.latest b { font-size: 12px; color: var(--soft); font-weight: 600; }
.latest span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap; }
.fold { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.more { background: none; border: 0; padding: 2px 0; color: var(--leaf); font: 600 13px var(--body); cursor: pointer; justify-self: start; }
.reply textarea { font: 14px var(--body); color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 56px; resize: vertical; width: 100%; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.shot { margin: 0; display: grid; gap: 4px; min-width: 0; }
.shot button { padding: 0; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--chip); cursor: zoom-in; aspect-ratio: 3 / 4; max-width: 100%; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot figcaption { font-size: 12px; color: var(--soft); overflow-wrap: anywhere; }
.files { border-top: 1.5px solid var(--line); padding-top: 4px; display: grid; gap: 8px; }
.filesbar { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 44px; padding: 0 4px; background: none; border: 0; font: 600 14px var(--body); color: var(--ink); cursor: pointer; }
.upload { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.docs { display: grid; gap: 6px; }
.docs > .label { font-size: 12px; color: var(--soft); }
.doc { flex-wrap: nowrap; }
.doc .name { font-size: 13px; overflow-wrap: anywhere; flex: 1 1 0; min-width: 0; }
.doc .tag, .doc .btn { flex: none; }
a.btn { text-decoration: none; display: inline-block; }
.note .body + h3 { margin-top: 16px; }
.upload input[type="text"] { font: 13px var(--body); color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 8px; flex: 1 1 160px; min-width: 0; }
.lightbox { position: fixed; inset: 0; background: #000000D9; display: grid; place-items: center; padding: 16px; z-index: 10; padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 12px; background: #fff; }
.lightbox .cap { color: #fff; margin-top: 10px; text-align: center; font-size: 14px; }
.lightbox .stage { display: grid; justify-items: center; max-width: 100%; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border-radius: 14px; border: 0; background: #FFFFFFE6; color: #06231D; font: 800 34px/1 var(--display); cursor: pointer; }
.lightbox .nav.prev { inset-inline-start: 8px; }
.lightbox .nav.next { inset-inline-end: 8px; }
.lightbox .btn { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); inset-inline-end: 12px; background: #fff; color: #06231D; border-color: #fff; }
.detail { margin-top: 10px; padding-inline-start: 32px; display: grid; gap: 10px; }
.detail p { margin: 0; color: var(--soft); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail .decision { background: var(--leaf-tint); color: var(--ink); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.moves { display: flex; flex-wrap: wrap; gap: 6px; }
.moves .label { font-size: 12px; color: var(--soft); align-self: center; margin-inline-end: 2px; }
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.notes-grid { display: grid; gap: 12px; }
.note { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; min-width: 0; }
.note h3 { font: 700 17px var(--display); margin: 0 0 4px; text-wrap: balance; }
.note .when { font-size: 12px; color: var(--soft); margin-bottom: 8px; }
.note .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; max-width: 75ch; }
.notice { background: var(--warn-tint); color: var(--ink); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.who { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; margin-bottom: 14px; }
.agentbtn { display: flex; align-items: center; gap: 10px; text-align: start; font: 600 15px var(--body); color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; min-height: 56px; }
.agentbtn[aria-selected="true"] { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.agentbtn .av { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font: 800 14px var(--display); color: #06231D; }
.agentbtn small { display: block; font-weight: 400; font-size: 12px; color: var(--soft); }
.agentbtn .dotnew { margin-inline-start: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; }
.chat { background: var(--card); border: 2px solid var(--ink); border-radius: 18px; display: grid; min-width: 0; }
.chat-head { padding: 12px 14px; border-bottom: 1.5px solid var(--line); }
.chat-head b { font: 800 17px var(--display); }
.chat-head p { margin: 2px 0 0; font-size: 13px; color: var(--soft); }
.thread { display: grid; gap: 10px; padding: 14px; max-height: 60vh; overflow-y: auto; align-content: start; min-height: 160px; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { justify-self: end; background: var(--sun); color: #06231D; border-end-end-radius: 4px; }
.bubble.them { justify-self: start; background: var(--chip); border-end-start-radius: 4px; }
.bubble .t { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }
.rcpt { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.rcpt.ok { color: var(--leaf); }
.rcpt.no { color: var(--warn); }
.pc { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--soft); margin-top: 6px; }
.pc i { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); display: inline-block; }
.pc.on i { background: var(--leaf); }
.waiting { justify-self: start; font-size: 13px; color: var(--soft); font-style: italic; }
.compose { display: flex; gap: 8px; padding: 10px; border-top: 1.5px solid var(--line); align-items: end; }
.compose textarea { flex: 1; min-width: 0; font: 15px var(--body); color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 10px; min-height: 46px; max-height: 160px; resize: vertical; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }

/* ---- v2 additions (only what the spec asks for), in the board's existing tag and chip styles ---- */
/* Owning agent chip on each card, with a one-tap reassign menu. */
.owner { position: relative; display: inline-flex; }
.tag.ownerchip { border: 0; cursor: pointer; font-family: var(--body); line-height: inherit; }
.tag.ownerchip:not([class*="from-"]) { background: var(--chip); color: var(--soft); }
.menu { position: absolute; top: calc(100% + 4px); inset-inline-start: 0; z-index: 5; display: grid; gap: 4px; min-width: 150px; max-width: calc(100vw - 32px); background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 6px; box-shadow: 3px 3px 0 var(--ink); }
.menu .chip { text-align: start; }
.menu .hint { font-size: 11.5px; color: var(--soft); padding: 0 4px 2px; }
/* Delivery state under each owner message; Overdue in the warning colour. */
.bubble.me .rcpt { color: #06231D; }
.bubble.me .rcpt.no { color: #8F4407; }
/* Sign-in page. */
.add input[type="email"] { flex: 1 1 260px; }
.signin { max-width: 640px; }
.signin .add { margin-top: 20px; }
/* Today's spending, next to the Watcher light. */
.costs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; margin-inline-start: 10px; vertical-align: middle; }
.costs:empty { display: none; }
.costs .menu { min-width: 170px; }
.menu .chip:disabled { opacity: .5; cursor: default; }
.signin #codeForm input { flex: 1 1 200px; }
.add[hidden] { display: none; }

/* Card bar above the chat, small thumbnails, Poke (owner, 20 Oct) */
.cardbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.files { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; display: grid; gap: 10px; }
.files .shots { grid-template-columns: repeat(auto-fill, 72px); gap: 6px; }
.files .shot button { aspect-ratio: 1 / 1; border-radius: 8px; }
.files .shot button:hover, .files .shot button:focus-visible { border-color: var(--ink); }
.pokerow { display: flex; justify-content: flex-end; margin-top: 6px; }
.btn.poke { white-space: nowrap; }

/* Card layout, 21 Oct: Start at the right end of the comment row; Pictures & docs as one long dropdown at the bottom */
.replyrow { justify-content: space-between; }
.detail > .filesbar { width: 100%; justify-content: space-between; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; }

/* Chat like a messaging app (owner, 21 Oct): the owner on the left, answers on the right; text 10% bigger */
.comments { gap: 8px; padding: 10px; }
.comment { border-inline-start: 0; padding: 8px 12px; font-size: 14.85px; line-height: 1.45; border-radius: 14px; max-width: 85%; justify-self: end; background: var(--chip); color: var(--ink); border-end-end-radius: 4px; }
.comment.mine { justify-self: start; background: var(--sun); color: #06231D; border-end-end-radius: 14px; border-end-start-radius: 4px; }
.comment b { font-size: 13.2px; margin-bottom: 2px; }
.comment.mine b { color: #06231D; opacity: .7; }
.comments > :has(> .comment) { display: grid; }
.comments > :has(> .comment.mine) { justify-items: start; }
.comments > :has(> .comment:not(.mine)) { justify-items: end; }
.comment.mine .rcpt { color: #06231D; opacity: .8; }
.comment.mine .rcpt.no { color: #8A2A12; opacity: 1; }

/* White cards with dark text in every theme (owner, 21 Oct: keep the green page, cards easier to read).
   The light palette is set on the card itself, so everything inside it follows. */
.card {
  --paper: #F6EEDC; --card: #FCF7EC; --ink: #06231D; --soft: #4A5A55; --line: #06231D22; --sun: #FFD43B; --leaf: #2F8F5B;
  --leaf-tint: #DDF1E4; --warn: #B4570A; --warn-tint: #FCE9D6; --red: #B3261E; --red-tint: #F9DEDC;
  --blue: #285E9C; --blue-tint: #DDE8F5; --chip: #06231D0D;
  background: var(--card); color: var(--ink); color-scheme: light;
}

/* New task: title on its own line, the description under it, then the choices and Add (owner, 21 Oct) */
#addTask input[name="title"] { flex: 1 1 100%; }
#addTask textarea[name="detail"] { flex: 1 1 100%; min-height: 72px; }

/* Wider chat on phones (owner, 23 Oct: "only 2 words fit"): the open card's chat uses the card's full width
   instead of sitting under the checkbox indent, and messages may use almost the whole row. */
.comment, .bubble { width: fit-content; }
@media (max-width: 620px) {
  .col { padding: 6px; }
  .card.open { padding-inline: 8px; }
  .detail { padding-inline-start: 0; }
  .comments { padding: 6px; height: min(540px, 64vh); }
  .comment, .bubble { max-width: 94%; }
}

/* Paperclip and link chips on cards (owner, 24 Oct) */
.tag.clip, .tag.linkchip { background: var(--chip); color: var(--ink); }
/* Linked cards: a stack. The card behind peeks out above the front one; when the front card is open it rises to
   show its title. Tapping it brings that card to the front. */
.stack { position: relative; display: grid; padding-top: 12px; transition: padding-top .2s ease; }
.stack.up { padding-top: 34px; }
.stack > .card { position: relative; z-index: 1; }
.stack .under { position: absolute; top: 0; left: 10px; right: 10px; height: 40px; z-index: 0; border: 1.5px solid #06231D33;
  border-bottom: 0; border-radius: 14px 14px 0 0; background: #E9E1CF; color: #06231D; font: 600 12.5px var(--body);
  text-align: start; padding: 4px 12px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  transition: background .2s; }
.stack .under span { opacity: 0; transition: opacity .2s; }
.stack.up .under span, .stack .under:hover span, .stack .under:focus-visible span { opacity: 1; }
.stack .under:hover { background: #F2EBDA; }
.linkbox select { width: 100%; font: 14px var(--body); padding: 8px; border-radius: 10px; border: 1.5px solid var(--ink); background: var(--card); color: var(--ink); }
/* Red flag button (stuck check) */
.btn.flag { color: #B3261E; border-color: #B3261E66; }
.pokerow { gap: 6px; }

/* Topics side list (owner, 25 Oct): open cards grouped by job, in the order the work has to happen. Left column on
   wide screens; on phones a "Topics" button opens it as a panel from the left. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.topicsbtn { display: none; margin-bottom: 10px; }
.topics { display: grid; gap: 8px; align-content: start; }
.topics .thead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.topics .thead b { font: 800 17px var(--display); }
.topics .thead small { color: var(--soft); font-size: 12px; }
.topic { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.topic > button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: none; border: 0; color: var(--ink); font: 700 14px var(--body); text-align: start; cursor: pointer; }
.topic > button .count { font: 600 12px var(--body); background: var(--chip); border-radius: 999px; padding: 1px 8px; }
.topic ol { list-style: none; margin: 0; padding: 0 8px 8px; display: grid; gap: 4px; }
.topic li button { width: 100%; text-align: start; background: none; border: 0; border-radius: 10px; padding: 6px 8px; color: var(--ink); font: 500 13.5px/1.35 var(--body); cursor: pointer; display: grid; grid-template-columns: 10px 1fr; gap: 0 8px; }
.topic li button:hover, .topic li button:focus-visible { background: var(--chip); }
.topic li .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; border: 1.5px solid var(--ink); }
.topic li .note { grid-column: 2; font-size: 12px; color: var(--soft); }
@media (min-width: 860px) {
  .layout { grid-template-columns: 270px minmax(0, 1fr); }
  .tclose, .tbackdrop { display: none !important; }
  .topics { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}
@media (max-width: 859px) {
  .topicsbtn { display: inline-block; }
  .topics { position: fixed; inset: 0 auto 0 0; width: min(330px, 88vw); z-index: 40; background: var(--paper, #F6EEDC); padding: max(14px, env(safe-area-inset-top, 0px)) 12px 14px max(12px, env(safe-area-inset-left, 0px)); overflow-y: auto; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 6px 0 24px #0005; }
  .topics.open { transform: none; }
}
.tphase { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--soft); }
.tphasehead { margin-top: 6px; font: 700 11.5px var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
.topic li.titem { display: grid; grid-template-columns: 1fr auto; align-items: start; }
.topic .tmove { background: none; border: 0; color: var(--soft); font-size: 15px; padding: 6px; cursor: pointer; border-radius: 8px; }
.topic .tmove:hover, .topic .tmove:focus-visible { background: var(--chip); color: var(--ink); }
.tmovebox { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 8px 8px; }
.tmovebox select, .tmovebox input { flex: 1 1 140px; min-width: 0; font: 13px var(--body); padding: 6px 8px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.topic.alike { border-color: #FFD23F; }
.topic .pair { padding: 4px 8px 10px; display: grid; gap: 4px; border-top: 1px solid var(--line); }
.topic .pair .tcard { width: 100%; text-align: start; background: none; border: 0; border-radius: 8px; padding: 4px 6px; color: var(--ink); font: 500 13px/1.35 var(--body); cursor: pointer; }
.topic .pair .tcard:hover { background: var(--chip); }
.topic .pair .note { margin: 0 6px; font-size: 12px; color: var(--soft); }
.topic .pair .moves { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 2px 6px; }

.tclose { background: none; border: 0; color: var(--ink); font-size: 20px; line-height: 1; padding: 4px 8px; cursor: pointer; border-radius: 8px; }
.tclose:focus-visible { outline: 3px solid var(--sun, #FFD23F); }
.tbackdrop { position: fixed; inset: 0; z-index: 39; background: #0006; }
/* Scrolling inside the list (owner, 25 Oct): the sections keep their full height and the list scrolls. */
.topics { display: flex; flex-direction: column; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.topics > * { flex-shrink: 0; }
@media (min-width: 860px) { .topics { align-self: start; } }
