:root {
  --paper: #f4f1e9;
  --surface: #fbfaf5;
  --ink: #221d1a;
  --muted: #6f675e;
  --faint: #a39a8e;
  --line: #ddd5c6;
  --line-soft: #e8e2d6;
  --accent: #c80d18;
  --brand: #e90d19;
  --accent-soft: #ece6da;
  --ok: #2f6b45;
  --warn: #9a5b00;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1816; --surface: #23201d; --ink: #efe9df; --muted: #a79e92; --faint: #6f675e;
    --line: #3a352f; --line-soft: #2a2622; --accent: #ff4a52; --brand: #e90d19; --accent-soft: #2a2622; --ok: #7cc196; --warn: #e0a64a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1a1816; --surface: #23201d; --ink: #efe9df; --muted: #a79e92; --faint: #6f675e;
  --line: #3a352f; --line-soft: #2a2622; --accent: #ff4a52; --brand: #e90d19; --accent-soft: #2a2622; --ok: #7cc196; --warn: #e0a64a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }



/* banner */
.banner { max-width: 1040px; margin: 12px auto 0; padding: 0 16px; }
.banner > div { border: 1px solid var(--warn); background: var(--surface); border-radius: 10px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.banner button, .btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 14px; font-weight: 600; }
.btn.primary, .banner button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }

/* breadcrumbs + zoom title */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs span.sep { color: var(--faint); }
.zoomhead { margin-bottom: 14px; }
.zoomhead .t { font: 600 30px/1.2 var(--serif); letter-spacing: -.015em; outline: none; }
.zoomhead .note { margin: 6px 0 0; padding-left: 0; }

/* outline */
ul.kids { list-style: none; margin: 0; padding: 0; }
ul.kids ul.kids { margin-left: 9px; padding-left: 17px; border-left: 1px solid var(--line-soft); }
.row { position: relative; }
.line { display: flex; align-items: flex-start; min-height: 30px; position: relative; }
.tog { position: absolute; left: -24px; top: 5px; width: 20px; height: 20px; border: 0; background: none; cursor: pointer; color: var(--faint); opacity: 0; border-radius: 4px; padding: 0; }
.tog::before { content: ""; display: block; width: 6px; height: 6px; margin: 6px auto; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); transition: transform .12s; }
.folded > .line > .tog::before { transform: rotate(-45deg); }
.line:hover > .tog, .tog:focus-visible { opacity: 1; }
.dot { flex: none; width: 20px; height: 20px; margin: 5px 6px 0 0; border-radius: 50%; display: grid; place-items: center; text-decoration: none; }
.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dotc, var(--muted)); }
.dot:hover { background: var(--line-soft); }
.folded > .line > .dot { background: var(--line); }
.folded > .line > .dot:hover { background: var(--faint); }
.t { flex: 1; min-width: 0; padding: 3px 0; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.row.biz > .line > .t { font: 600 18px/1.4 var(--serif); }
.row.biz > .line > .dot::before { width: 9px; height: 9px; }
.note { font-size: 13.5px; color: var(--muted); padding: 0 0 4px 26px; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.row.done > .line > .t { color: var(--faint); text-decoration: line-through; }
.row.done > .line > .t .tag, .row.done > .line > .t .at { color: var(--faint); }
mark { background: #f6e3a8; color: inherit; border-radius: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) mark { background: #5a4613; } }

/* inline tokens */
.tag { color: var(--accent); cursor: pointer; font-weight: 600; }
.tag[data-k="needs-alex"] { background: var(--accent-soft); border-radius: 4px; padding: 0 4px; }
.tag[data-k="live"] { color: var(--ok); }
.tag[data-k="blocked"], .tag[data-k="waiting"] { color: var(--warn); }
.tag[data-k="to-confirm"], .tag[data-k="idea"], .tag[data-k="draft"] { color: var(--muted); }
.at { color: #2f5d8a; cursor: pointer; font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .at { color: #8bb6e0; } }
.t a.url, .note a.url { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; }
.t a.url:hover { color: var(--accent); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.addrow { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 6px 0 6px 26px; font-size: 14px; }
.addrow:hover { color: var(--accent); }

/* home */
.hello h1 { font: 600 34px/1.15 var(--serif); letter-spacing: -.02em; margin: 0 0 6px; }
.hello p { margin: 0; color: var(--muted); font-size: 16px; }
.hello p b { color: var(--ink); }
section.block { margin-top: 34px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px; }
.block-h h2 { font: 600 13px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; margin: 0; color: var(--muted); }
.block-h a { font-size: 13px; color: var(--muted); text-decoration: none; }
.block-h a:hover { color: var(--accent); }

.bizlist { list-style: none; margin: 0; padding: 0; }
.bizlist a { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 14px; align-items: center; padding: 14px 4px; text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.bizlist a:hover .bn { color: var(--accent); }
.bizlist .bd { width: 10px; height: 10px; border-radius: 50%; }
.bizlist .bn { font: 600 19px/1.25 var(--serif); }
.bizlist .bf { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-left: 8px; font-family: var(--sans); }
.bizlist .stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.bizlist .stats b { color: var(--ink); font-size: 15px; }
.bizlist .stats .hot b { color: var(--accent); }
.bizlist .why { grid-column: 2 / 4; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bizlist .zero { color: var(--faint); }

.items { list-style: none; margin: 0; padding: 0; }
.items li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.items input[type="checkbox"] { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.items .it { cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.items .it:hover .txt { color: var(--accent); }
.items .where { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.items li.isdone .txt { text-decoration: line-through; color: var(--faint); }
.group-h { font-size: 13px; font-weight: 700; margin: 18px 0 2px; display: flex; align-items: center; gap: 8px; }
.group-h i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.addline { display: flex; gap: 8px; margin-top: 10px; }
.addline input { flex: 1; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.addline input:focus { outline: none; border-color: var(--accent); }

/* people */
.people { width: 100%; border-collapse: collapse; }
.people th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); }
.people td { padding: 12px 8px 12px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 14px; }
.people tr { cursor: pointer; }
.people tr:hover .pn { color: var(--accent); }
.people .pn { font-weight: 700; font-size: 15px; }
.people .role { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; }
.stretch { color: var(--accent); font-weight: 700; font-size: 12px; }
.ph h1 { font: 600 32px/1.15 var(--serif); margin: 0 0 4px; }
.ph p { margin: 0 0 6px; color: var(--muted); }

/* dialog */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 20px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(20 15 12 / .35); }
dialog h3 { font: 600 20px/1.2 var(--serif); margin: 0 0 4px; }
dialog p { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.revs { list-style: none; margin: 0 0 14px; padding: 0; max-height: 50vh; overflow: auto; }
.revs li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.revs small { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px; font-size: 14px; display: flex; gap: 12px; align-items: center; z-index: 30; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.keys { font-size: 12.5px; color: var(--faint); margin-top: 28px; line-height: 1.8; }
kbd { font: 600 11px/1 var(--sans); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--muted); background: var(--surface); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.card .lk { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 0 22px; }
.card h1 { font: 600 26px/1.2 var(--serif); margin: 14px 0 2px; }
.card .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.card label { font-size: 13px; font-weight: 700; display: block; margin-bottom: 6px; }
.card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink); }
.card button { width: 100%; margin-top: 12px; padding: 12px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.card button:hover { filter: brightness(.92); }
.card .fine { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
.card .ok, .card .warn { font-size: 14px; padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.card .ok { background: var(--accent-soft); }
.card .warn { border: 1px solid var(--warn); }

@media (max-width: 640px) {
  main { padding-top: 18px; }
  ul.kids ul.kids { margin-left: 4px; padding-left: 12px; }
  .tog { opacity: .6; left: -20px; }
  .bizlist a { grid-template-columns: 12px 1fr; }
  .bizlist .stats { grid-column: 2; }
  .bizlist .why { grid-column: 2; }
  .people .hide-sm { display: none; }
  .hello h1 { font-size: 28px; }
}
@media (max-width: 640px) { .keys { display: none; } }

/* logo swaps with the theme */
.lk-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lk-light { display: none !important; }
  :root:not([data-theme="light"]) .lk-dark { display: block !important; }
}
:root[data-theme="dark"] .lk-light { display: none !important; }
:root[data-theme="dark"] .lk-dark { display: block !important; }

/* ---------- shared bits for tickets / research ---------- */
.hot { color: var(--accent) !important; }
.pill { display: inline-block; font: 700 11px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); margin-right: 8px; vertical-align: 2px; white-space: nowrap; }
.pill.u-urgent { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill.u-high { border-color: var(--accent); color: var(--accent); }
.pill.u-low { color: var(--faint); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 22px 0 4px; }
.fright { display: flex; gap: 10px; align-items: center; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip, .seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.fchip i { width: 8px; height: 8px; border-radius: 50%; }
.fchip span, .seg button span { color: var(--faint); font-weight: 500; }
.fchip[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.fchip[aria-pressed="true"] span, .seg button[aria-pressed="true"] span { color: inherit; opacity: .7; }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
select, .tk-detail input, .tk-detail textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
select:focus, .tk-detail input:focus, .tk-detail textarea:focus { outline: none; border-color: var(--ink); }
.btn.primary:hover { filter: brightness(.92); }
.btn:disabled { opacity: .6; cursor: default; }

/* tickets */
.quick { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.quick input { flex: 1 1 320px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.quick input:focus { outline: none; border-color: var(--ink); }
.quick select { padding: 10px; }
.tk { list-style: none; margin: 0; padding: 0; }
.tk-row { border-bottom: 1px solid var(--line-soft); }
.tk-line { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.pos { width: 22px; flex: none; text-align: right; color: var(--faint); font-weight: 700; font-size: 14px; }
.tk-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 2px 0; cursor: pointer; }
.tk-title { display: block; font-weight: 600; font-size: 15px; line-height: 1.4; }
.tk-main:hover .tk-title { color: var(--accent); }
.tk-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tk-meta i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.tk-row.late .tk-time { color: var(--accent); font-weight: 700; }
.tk-acts { display: flex; gap: 4px; flex: none; }
.tk-acts button { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 5px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tk-acts button:hover { color: var(--ink); border-color: var(--faint); }
.tk-acts button.go { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tk-detail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; padding: 4px 0 18px 34px; }
.tk-detail label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.tk-detail .full { grid-column: 1 / -1; }
.tk-detail textarea { resize: vertical; line-height: 1.5; }
.tk-log { grid-column: 1 / -1; list-style: none; margin: 4px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.tk-log li { padding: 5px 0; font-size: 13.5px; display: flex; flex-direction: column; }
.tk-log li.c span { color: var(--ink); }
.tk-log li:not(.c) span { color: var(--muted); }
.tk-log small { color: var(--faint); font-size: 12px; }
.block-h h2 span { color: var(--faint); margin-left: 6px; }
.tk-sum { margin: 10px 0 2px; color: var(--muted); font-size: 14px; }
.tk-sum b { color: var(--ink); }

/* structure (org chart) */
.org { margin-top: 30px; }
main:has(> .org) { max-width: 1500px; }
.org-top { display: flex; justify-content: center; position: relative; padding-bottom: 28px; }
.org-top::after { content: ""; position: absolute; left: 50%; bottom: 0; height: 28px; border-left: 1.5px solid var(--faint); }
.org-root { display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 12px; padding: 18px 26px; }
.org-root .lk { height: 30px; width: auto; }
.org-root:hover { border-color: var(--brand); }
.org-rail { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 12px; position: relative; padding-top: 22px; }
.org-rail::before { content: ""; position: absolute; top: 0; left: calc(100% / var(--n) / 2); right: calc(100% / var(--n) / 2); border-top: 1.5px solid var(--faint); }
.org-col { position: relative; min-width: 0; }
.org-col::before { content: ""; position: absolute; top: -22px; left: 50%; height: 22px; border-left: 1.5px solid var(--faint); }
.org-card { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 10px; padding: 12px 10px; min-height: 84px; }
.org-card:hover { border-color: var(--ink); border-top-color: var(--c); }
.org-name { display: block; font: 600 15px/1.25 var(--serif); overflow-wrap: break-word; }
.org-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }
.org-sub b { color: var(--accent); }
.org-deps { list-style: none; margin: 0 0 0 14px; padding: 6px 0 0; border-left: 1.5px solid var(--line); }
.org-deps li { position: relative; padding: 6px 0 6px 14px; }
.org-deps li::before { content: ""; position: absolute; left: 0; top: 17px; width: 10px; border-top: 1.5px solid var(--line); }
.org-deps a { display: block; text-decoration: none; }
.org-deps .dn { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.org-deps a:hover .dn { color: var(--accent); }
.org-deps .dw { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.org-deps em { font-style: normal; color: var(--accent); font-weight: 600; margin-left: 4px; }
@media (max-width: 1400px) {
  .org-top { justify-content: flex-start; padding-bottom: 0; }
  .org-top::after { left: 20px; height: 100%; top: 100%; }
  .org-rail { grid-template-columns: 1fr; padding: 18px 0 0 40px; gap: 16px; }
  .org-rail::before { left: 20px; right: auto; top: 0; bottom: 40px; border-top: 0; border-left: 1.5px solid var(--faint); }
  .org-col::before { top: 40px; left: -20px; width: 20px; height: 0; border-left: 0; border-top: 1.5px solid var(--faint); }
}

/* research */
.rs-add { margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px; }
.rs-add textarea { width: 100%; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15px; resize: vertical; padding: 4px; }
.rs-add textarea:focus { outline: none; }
.rs-add-row { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 6px; }
.rs-add-row input { flex: 1 1 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 16px; }
.rs-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.rs-card.isdone { opacity: .75; }
.rs-thumb { display: block; aspect-ratio: 16 / 9; background: var(--line-soft); overflow: hidden; }
.rs-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rs-thumb.ph { display: grid; place-items: center; color: var(--muted); font-weight: 700; text-decoration: none; }
.rs-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rs-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--muted); }
.rs-meta .pill { margin-right: 0; }
.pill.k-short { border-color: var(--brand); color: var(--accent); }
.rs-title { font-weight: 700; font-size: 15px; line-height: 1.35; text-decoration: none; margin: 0; overflow-wrap: anywhere; }
a.rs-title:hover { color: var(--accent); }
.rs-note, .rs-sum { margin: 0; font-size: 13.5px; color: var(--muted); }
.rs-ins { margin: 0; padding-left: 18px; font-size: 13.5px; }
.rs-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.rs-acts select { font-size: 12.5px; padding: 5px 8px; }
.rs-acts button { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: 5px 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.rs-acts button:disabled { opacity: .55; cursor: default; }
.rs-acts .quiet { color: var(--faint); border-color: transparent; background: none; }

@media (max-width: 640px) {
  .tk-line { flex-wrap: wrap; }
  .tk-acts { width: 100%; padding-left: 34px; }
  .tk-detail { grid-template-columns: 1fr; padding-left: 0; }
  .fright { width: 100%; justify-content: space-between; }
}

.rs-err { margin: 0; font-size: 13px; color: var(--warn); }

.rs-h { margin: 4px 0 0; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rs-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.rs-more summary:hover { color: var(--accent); }
.rs-more .rs-ins { margin-top: 6px; }


/* phones: no sideways scroll, thumb-sized controls, only the numbers that matter */
@media (max-width: 640px) {
  .bizlist .stats { flex-wrap: wrap; gap: 4px 14px; }
  .bizlist .stats .zero { display: none; }
  .bizlist .bf { display: block; margin: 2px 0 0; }
  .quick input { flex-basis: 100%; }
  .quick select { flex: 1 1 0; min-width: 0; }
  .quick .btn { flex: none; }
  .filters .fright select { flex: 1 1 0; min-width: 0; }
  .tk-acts button { min-height: 40px; min-width: 44px; padding: 8px 12px; }
  .tk-detail input, .tk-detail select, .tk-detail textarea, .addline input, .addline .btn { min-height: 44px; font-size: 16px; }
  .quick input, .searchwrap input, .rs-add textarea, .rs-add-row input { font-size: 16px; }
  .rs-acts button, .rs-acts select { min-height: 40px; }
  .items input[type="checkbox"] { width: 22px; height: 22px; margin-top: 1px; }
  main > ul.kids { padding-left: 12px; }
  .tog { opacity: .8; width: 30px; height: 30px; left: -26px; top: 0; }
  .tog::before { margin: 11px auto; }
  .dot { width: 26px; height: 26px; margin: 2px 4px 0 0; }
}

/* ================= app shell ================= */
:root { --side: #ece7dc; --bar-h: 56px; --tab-h: 64px; --ease: cubic-bezier(.25, 1, .5, 1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --side: #141210; } }
:root[data-theme="dark"] { --side: #141210; }
html { -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge:empty, .badge[hidden] { display: none; }

/* desktop: sidebar */
.side { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--side); border-right: 1px solid var(--line); padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 14px; z-index: 20; }
.side-brand { padding: 4px 8px 6px; }
.side-brand .lk { height: 24px; width: auto; }
.new { height: 42px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font: 700 15px/1 var(--sans); cursor: pointer; transition: filter .15s; }
.new:hover { filter: brightness(.92); }
.new:active { filter: brightness(.85); }
.searchwrap input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 14px var(--sans); }
.searchwrap input:focus { outline: none; border-color: var(--ink); }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 9px; text-decoration: none; color: var(--muted); font: 600 15px var(--sans); transition: background .15s, color .15s; }
.side-nav a:hover { background: var(--line-soft); color: var(--ink); }
.side-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.side-nav svg { width: 20px; height: 20px; flex: none; }
.side-nav .badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--line); color: var(--ink); font: 700 12px/20px var(--sans); text-align: center; font-variant-numeric: tabular-nums; }
.side-nav [data-badge="home"] { background: var(--brand); color: #fff; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.side-foot button { border: 0; background: none; color: var(--muted); font: 600 14px var(--sans); cursor: pointer; padding: 8px 4px; }
.side-foot button:hover { color: var(--ink); }
.status { font-size: 12px; color: var(--faint); }
.status.bad { color: var(--warn); font-weight: 700; }
.appbar, .tabbar { display: none; }
body { padding-left: 248px; }
main { max-width: 1040px; margin: 0 auto; padding: 34px 40px 96px; }

/* sheets (add, more, history): bottom sheet on phones, centred panel on desktop */
dialog.sheet { padding: 0 0 20px; width: min(460px, calc(100vw - 32px)); border-radius: 16px; margin: 14vh auto auto; }
dialog.sheet[open] { animation: sheet-in .22s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } }
.sheet > :not(.sheet-grip), #addform > :not(.sheet-grip) { margin-left: 20px; margin-right: 20px; }
.sheet-grip { display: none; }
#addform h2, .sheet h3 { font: 600 21px/1.2 var(--serif); margin-top: 20px; margin-bottom: 14px; }
#addform { display: flex; flex-direction: column; gap: 12px; }
#addform h2 { margin-bottom: 0; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--line-soft); border-radius: 11px; }
.kinds label { position: relative; }
.kinds input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kinds span { display: block; text-align: center; padding: 9px 0; border-radius: 8px; font: 600 14px var(--sans); color: var(--muted); }
.kinds input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(30 20 10 / .12); }
.kinds input:focus-visible + span { outline: 2px solid var(--brand); }
#addform textarea { width: auto; min-height: 92px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); resize: none; }
#addform textarea:focus { outline: none; border-color: var(--ink); }
.add-opts { display: flex; gap: 8px; }
.add-opts[hidden] { display: none; }
.add-opts select { flex: 1 1 0; min-width: 0; height: 44px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.sheet-actions .btn { height: 44px; padding: 0 20px; }
.more-list { display: flex; flex-direction: column; margin-top: 12px; }
.more-list a, .more-list button { display: flex; align-items: center; min-height: 50px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; text-decoration: none; color: var(--ink); font: 500 16px var(--sans); cursor: pointer; padding: 0 4px; }
.more-list a:last-child { border-bottom: 0; color: var(--accent); }
.more-list [hidden] { display: none; }
.sheet-close { display: block; width: calc(100% - 40px); height: 46px; margin-top: 12px; }

/* ================= phones and small tablets ================= */
@media (max-width: 899px) {
  body { padding-left: 0; }
  .side { visibility: hidden; position: fixed; width: 0; padding: 0; border: 0; }
  .side .searchwrap { display: none; }
  body.searching .side .searchwrap { display: block; visibility: visible; position: fixed; z-index: 29; left: 0; right: 0; top: calc(var(--bar-h) + env(safe-area-inset-top)); padding: 8px 16px 10px; background: var(--paper); border-bottom: 1px solid var(--line); }
  body.searching .searchwrap input { height: 44px; font-size: 16px; }
  body.searching main { padding-top: 78px; }

  .appbar { display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 30; height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .appbar-mark { width: 28px; height: 28px; border-radius: 7px; margin-right: 8px; }
  .appbar-title { flex: 1; min-width: 0; margin: 0; font: 600 21px/1 var(--serif); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar .status:not(.bad) { display: none; }
  .icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--ink); border-radius: 12px; cursor: pointer; }
  .icon-btn:active { background: var(--line-soft); }
  .icon-btn svg { width: 23px; height: 23px; }

  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; text-decoration: none; color: var(--faint); font: 600 11px var(--sans); }
  .tabbar a svg { width: 25px; height: 25px; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.2; }
  .tabbar a:active { color: var(--ink); }
  .tabbar .badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ink); color: var(--paper); font: 700 11px/18px var(--sans); font-style: normal; text-align: center; font-variant-numeric: tabular-nums; }
  .tabbar [data-badge="home"] { background: var(--brand); color: #fff; }
  .tab-add { justify-self: center; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; transition: transform .15s var(--ease); }
  .tab-add:active { transform: scale(.94); }
  .tab-add svg { width: 26px; height: 26px; stroke-width: 2.4; }

  main { padding: 20px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px); }
  .hello:not(.home) h1 { display: none; }
  .hello:not(.home) p { margin-top: 0; }
  .hello.home h1 { font-size: 28px; }
  #tkq, #rsf, form[data-addto="decisions"] { display: none; }
  .toast { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); }

  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto; }
  dialog.sheet[open] { animation: sheet-up .26s var(--ease); }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .sheet-grip { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
  #addform h2, .sheet h3 { margin-top: 12px; }
  .sheet-actions .btn { flex: 1; height: 50px; font-size: 16px; }
  .add-opts select { height: 48px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }

/* ================= outline, Workflowy style ================= */
.rootline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.viewsw { flex: none; }
.viewsw a { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: 600 13px var(--sans); text-decoration: none; }
.viewsw a[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lede { color: var(--muted); margin: -4px 0 22px; }
main.push { animation: om-push .24s var(--ease); }
main.pop { animation: om-pop .24s var(--ease); }
@keyframes om-push { from { transform: translateX(32px); opacity: .25; } }
@keyframes om-pop { from { transform: translateX(-32px); opacity: .25; } }
.edbar { display: none; }
.appbar .back { display: none; }

@media (max-width: 899px) {
  /* app bar becomes "‹ Parent" inside the outline */
  .appbar .back:not([hidden]) { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; height: 44px; margin-left: -8px; padding: 0 6px 0 2px; border: 0; background: none; color: var(--ink); font: 600 17px var(--sans); cursor: pointer; }
  .appbar .back svg { width: 26px; height: 26px; flex: none; stroke-width: 2.2; }
  .appbar .back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.zoomed .appbar-mark, body.zoomed .appbar-title { display: none; }
  body.zoomed .crumbs { display: none; }

  /* roomier outline rows for thumbs */
  .zoomhead .t { font-size: 28px; }
  .row > .line { min-height: 40px; }
  .row > .line > .t { font-size: 17px; line-height: 1.45; padding: 7px 0; }
  .row.biz > .line > .t { font-size: 19px; }
  .dot { margin-top: 9px; }
  .tog { top: 6px; }
  .note { font-size: 15px; }
  .addrow { min-height: 44px; font-size: 16px; }

  /* editing toolbar above the keyboard; the tab bar steps aside */
  body.editing .tabbar { display: none; }
  body.editing .edbar { display: flex; }
  .edbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; align-items: center; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); transition: transform .12s linear; }
  .edbar button { flex: 1; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; }
  .edbar button:active { background: var(--line-soft); }
  .edbar svg { width: 22px; height: 22px; }
  .edbar .ed-done { flex: 0 0 auto; padding: 0 14px; font: 700 15px var(--sans); color: var(--brand); }
  body.editing main { padding-bottom: 120px; }
}
@media (prefers-reduced-motion: reduce) { main.push, main.pop { animation: none; } }
