/* Tally — warm paper, ink, restrained vermilion */
:root {
  --paper: #F3EEE4;
  --paper-2: #EBE4D7;
  --paper-3: #E2D9C8;
  --sheet: #FAF7F1;
  --ink: #1B1916;
  --ink-2: #4E473E;     /* secondary text; AA on paper */
  --ink-3: #776E62;     /* tertiary meta */
  --rule: #DCD2C0;
  --rule-2: #CFC3AE;
  --waiting: #865307;
  --verm: #D2421B;
  --verm-soft: rgba(210, 66, 27, .10);
  --sel: rgba(27, 25, 22, .055);
  --focus: rgba(210, 66, 27, .55);
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --row: 40px;
  --rail: 232px;
  --detail: 392px;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161412; --paper-2: #1E1B18; --paper-3: #2A2622; --sheet: #1C1916;
    --ink: #EDE6D9; --ink-2: #BDB3A4; --ink-3: #8F8576;
    --rule: #2E2A25; --rule-2: #3B352F;
    --waiting: #EDBB6B;
    --verm: #FF6A3D; --verm-soft: rgba(255, 106, 61, .13);
    --sel: rgba(237, 230, 217, .06); --focus: rgba(255, 106, 61, .6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink); font: 14px/1.4 var(--sans);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
kbd { font: 11px/1 var(--sans); padding: 2px 5px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-3); background: var(--sheet); }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: 4px; }
[hidden] { display: none !important; }

.demo-band { height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; letter-spacing: .02em; color: var(--ink-3); background: var(--paper-2); border-bottom: 1px solid var(--rule); }

.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: calc(100vh - 22px); height: calc(100dvh - 22px); }
.app.has-detail { grid-template-columns: var(--rail) minmax(0, 1fr) var(--detail); }

/* ---------- rail ---------- */
.rail { border-right: 1px solid var(--rule); padding: 18px 10px 12px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px; height: 28px; }
.brand .mark svg { width: 20px; height: 20px; stroke-width: 1.7; }
.brand .mark .slash { stroke: var(--verm); }
.brand .word { font: italic 600 21px/1 var(--serif); letter-spacing: -.01em; }
.nav-i { width: 100%; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--r); color: var(--ink-2); text-align: left; }
.nav-i:hover { background: var(--sel); color: var(--ink); }
.nav-i.on { background: var(--paper-3); color: var(--ink); font-weight: 600; }
.nav-i > span:not(.n):not(.dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-i .n { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.nav-i .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--verm); margin-left: auto; }
.nav-i .dot + .n { margin-left: 6px; }
.nav-sep { height: 1px; background: var(--rule); margin: 8px 10px; }
.rail-sec { display: flex; flex-direction: column; gap: 1px; }
.rail-h { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.cat-i .hash { color: var(--ink-3); font-weight: 400; width: 16px; text-align: center; }
.cat-i input { width: 100%; border: 0; background: transparent; outline: none; padding: 0; }
.rail-foot { margin-top: auto; padding: 0 10px; }
.kbd-hint { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r); color: var(--ink-2); }
.icon-btn:hover { background: var(--sel); color: var(--ink); }
.icon-btn.sm { width: 22px; height: 22px; font-size: 16px; line-height: 1; }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 28px 6px; max-width: 860px; width: 100%; margin: 0 auto; }
.top h1 { margin: 0; font: 600 26px/1.1 var(--serif); letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; padding: 2px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; }
.seg button { height: 26px; padding: 0 10px; border-radius: 6px; font-size: 12.5px; color: var(--ink-2); }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); font-weight: 600; }
.acct { position: relative; }
.acct-btn { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 8px 0 4px; border-radius: 16px; border: 1px solid var(--rule); background: var(--sheet); }
.acct-btn .chev { width: 12px; height: 12px; color: var(--ink-3); }
.acct-n { font-size: 13px; font-weight: 600; }
.av { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .02em; background: var(--ink); color: var(--paper); flex: none; }
.av.dev { background: #5B6B5A; color: #F3EEE4; } .av.priya { background: #8A5A44; color: #F3EEE4; }
.av.xs { width: 18px; height: 18px; font-size: 8px; }
.menu { position: absolute; right: 0; top: 38px; z-index: 50; min-width: 250px; background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 10px; padding: 6px; box-shadow: 0 12px 40px rgba(27, 25, 22, .14); }
.menu-h { font-size: 11px; color: var(--ink-3); padding: 6px 8px 6px; letter-spacing: .02em; }
.menu-i { width: 100%; display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 6px; text-align: left; }
.menu-i:hover, .menu-i:focus-visible { background: var(--sel); }
.menu-i .sub { font-size: 12px; color: var(--ink-3); }
.menu-i .ck { margin-left: auto; color: var(--verm); }
.menu-sep { height: 1px; background: var(--rule); margin: 6px 2px; }

/* ---------- capture ---------- */
.capture { max-width: 860px; width: 100%; margin: 0 auto; padding: 8px 28px 6px; }
.cap-row { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 10px; background: var(--sheet); transition: border-color .15s, box-shadow .15s; }
.cap-row:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--sel); }
.cap-plus { color: var(--verm); font-size: 20px; font-weight: 300; width: 16px; text-align: center; line-height: 1; }
#cap { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; caret-color: var(--verm); min-width: 0; }
#cap::placeholder { color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; padding: 0 2px; transition: min-height .15s; }
.chips.has { min-height: 34px; padding-top: 8px; }
.chip { display: inline-flex; align-items: center; height: 26px; border-radius: 13px; background: var(--paper-2); border: 1px solid var(--rule); font-size: 12.5px; animation: chipIn .18s ease-out; max-width: 100%; }
.chip .cv { padding: 0 4px 0 10px; display: inline-flex; gap: 5px; align-items: center; height: 100%; border-radius: 13px 0 0 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .cv:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--rule-2); }
.chip .cx { width: 24px; height: 100%; border-radius: 0 13px 13px 0; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; }
.chip .cx:hover { color: var(--verm); }
.chip .cx svg { width: 10px; height: 10px; stroke-width: 2; }
.chip.k-title { background: transparent; border-color: transparent; color: var(--ink-2); padding-right: 6px; }
.chip.k-title .cv { padding-left: 4px; }
.chip.k-date, .chip.k-time { color: var(--ink); }
.chip.k-date.today .cv { color: var(--verm); }
.chip .ico { color: var(--ink-3); font-size: 12px; }
.chip.k-add { background: transparent; border-style: dashed; color: var(--ink-3); }
.chip.k-add .cv { padding: 0 10px; }
@keyframes chipIn { from { opacity: 0; transform: translateY(-3px); } }

/* ---------- list ---------- */
.list { flex: 1; overflow-y: auto; padding: 6px 28px 120px; max-width: 860px; width: 100%; margin: 0 auto; outline: none; }
.grp { margin-top: 18px; }
.grp-h { display: flex; align-items: baseline; gap: 8px; height: 28px; padding: 0 4px; border-bottom: 1px solid var(--rule); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); width: 100%; text-align: left; }
.grp-h .gd { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-size: 12px; }
.grp-h .gc { margin-left: auto; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.grp-h.overdue, .grp-h.today { color: var(--verm); }
.grp-h.toggle { cursor: pointer; }
.grp-h.toggle:hover { color: var(--ink); }
.grp-h .tw { width: 10px; height: 10px; align-self: center; transition: transform .15s; color: var(--ink-3); }
.grp-h.closed .tw { transform: rotate(-90deg); }

.row { position: relative; display: flex; align-items: center; gap: 10px; min-height: var(--row); padding: 0 8px 0 calc(6px + var(--depth, 0) * 24px); border-bottom: 1px solid var(--rule); cursor: default; outline: none; }
.row:hover { background: var(--sel); }
.row.sel { background: var(--sel); box-shadow: inset 2px 0 0 var(--ink); }
.row.arrange { box-shadow: inset 2px 0 0 var(--verm); background: var(--verm-soft); }
.row .fold { width: 14px; height: 14px; margin-right: -6px; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.row .fold svg { width: 10px; height: 10px; transition: transform .15s; }
.row .fold.closed svg { transform: rotate(-90deg); }
.row .fold.none { visibility: hidden; }
.ck { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ink-3); flex: none; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s; position: relative; }
.ck::after { content: ''; position: absolute; inset: -12px; }
.ck:hover { border-color: var(--ink); }
.ck.incoming { border-style: dotted; border-color: var(--ink-3); }
.row .acts { margin-left: 4px; }
.ck svg { width: 11px; height: 11px; stroke-width: 2.2; opacity: 0; color: var(--paper); }
.row.done .ck { background: var(--ink-3); border-color: var(--ink-3); }
.row.done .ck svg { opacity: 1; }
.row.overdue .ck { border-color: var(--verm); }
.row .tt { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 0; }
.row .tl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .glyph { color: var(--ink-3); display: inline-flex; flex: none; }
.row .glyph svg { width: 13px; height: 13px; }
.row .meta { display: flex; align-items: center; gap: 10px; flex: none; font-size: 12.5px; color: var(--ink-3); }
.row .meta .d { color: var(--ink-2); min-width: 0; white-space: nowrap; }
.row .meta .d.today { color: var(--verm); }
.row .meta .d.over { color: var(--verm); }
.row .meta .rc { display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.row .meta .cat { color: var(--ink-3); white-space: nowrap; }
.row .meta .tg { color: var(--ink-3); white-space: nowrap; }
.row .wait { font-size: 12px; font-weight: 500; color: var(--waiting); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; gap: 4px; align-items: center; min-width: 0; }
.row .wait svg { width: 12px; height: 12px; }
.row.waiting:not(.done)::before, .row.overdue::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--waiting); border-radius: 2px;
}
.row.overdue::before { background: var(--verm); }
.row .who { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.row.delegated .ck { border-style: dashed; }
.row.delegated .tl { color: var(--ink-2); }
.row.done .tl { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-3); }
.row.leaving { animation: leave .7s ease forwards .35s; }
@keyframes leave { to { opacity: 0; height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; border-width: 0; } }
.row.arriving { animation: arrive .9s ease; }
@keyframes arrive { 0% { background: var(--verm-soft); } 100% { background: transparent; } }
.pill { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--rule-2); color: var(--ink-2); white-space: nowrap; }
.pill.pending { border-style: dashed; }
.pill.rej { border-color: var(--verm); color: var(--verm); }
.pill.act { background: var(--paper-2); }
.btn { height: 28px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--rule-2); background: var(--sheet); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.pri { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.pri:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--sel); }
.btn.danger:hover { color: var(--verm); border-color: var(--verm); }
.acts { display: flex; gap: 6px; flex: none; }

.done-line { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px; margin-top: 18px; color: var(--ink-3); font-size: 12.5px; width: 100%; text-align: left; }
.done-line:hover { color: var(--ink); }
.done-line .tw { width: 10px; height: 10px; transition: transform .15s; }
.done-line.closed .tw { transform: rotate(-90deg); }

.notice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 14px; border: 1px solid var(--rule-2); border-left: 3px solid var(--verm); border-radius: 8px; background: var(--sheet); }
.notice .nt { flex: 1; min-width: 0; }
.notice .nt b { font-weight: 600; }
.notice .ns { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.notice.read { border-left-color: var(--rule-2); }

.empty { padding: 56px 0; text-align: center; color: var(--ink-3); font: italic 17px/1.4 var(--serif); }

/* things to watch */
.watch-cap { display: flex; gap: 8px; margin: 14px 0 4px; }
.watch-cap input { flex: 1; height: 40px; border: 0; border-bottom: 1px solid var(--rule-2); background: transparent; outline: none; font: italic 16px var(--serif); caret-color: var(--verm); }
.watch-cap input::placeholder { color: var(--ink-3); }
.wi { display: flex; align-items: flex-start; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--rule); }
.wi .eye { color: var(--ink-3); margin-top: 2px; }
.wi .wt { flex: 1; font: 16px/1.35 var(--serif); }
.wi .ws { font: 12px var(--sans); color: var(--ink-3); margin-top: 3px; }
.wi .x { opacity: 0; transition: opacity .15s; }
.wi:hover .x, .wi:focus-within .x { opacity: 1; }
.wi.gone .wt { color: var(--ink-3); }

/* ---------- detail ---------- */
.detail { border-left: 1px solid var(--rule); background: var(--sheet); overflow-y: auto; display: flex; flex-direction: column; }
.d-head { display: flex; align-items: center; gap: 6px; padding: 12px 12px 0 18px; color: var(--ink-3); font-size: 12px; min-height: 44px; }
.d-head .sp { flex: 1; }
.d-body { padding: 4px 20px 28px; display: flex; flex-direction: column; gap: 4px; }
.d-title { width: 100%; border: 0; outline: none; background: transparent; font: 600 21px/1.25 var(--serif); letter-spacing: -.01em; resize: none; padding: 6px 0; overflow: hidden; caret-color: var(--verm); }
.d-from { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.fld { display: grid; grid-template-columns: 96px 1fr; align-items: center; min-height: 38px; border-bottom: 1px solid var(--rule); gap: 8px; }
.fld > label, .fld > .fl { font-size: 12.5px; color: var(--ink-3); }
.fld .fv { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; padding: 4px 0; }
.fld input[type=date], .fld input[type=time], .fld select, .fld input[type=text], .fld input[type=number] { height: 30px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 0 6px; margin-left: -6px; outline: none; min-width: 0; }
.fld textarea { width: 100%; min-width: 0; resize: vertical; border: 1px solid transparent; border-radius: var(--r); background: transparent; padding: 5px 6px; margin-left: -6px; }
.fld textarea:hover, .fld input:hover, .fld select:hover { border-color: var(--rule); }
.fld textarea:focus, .fld input:focus, .fld select:focus { border-color: var(--ink-3); background: var(--paper); }
.fld input[type=number] { width: 56px; }
.fld .clear { color: var(--ink-3); font-size: 12px; }
.tagx { display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 4px 0 9px; border-radius: 12px; background: var(--paper-2); font-size: 12.5px; }
.tagx button { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); border-radius: 50%; }
.tagx button:hover { color: var(--verm); }
.tagx svg { width: 9px; height: 9px; stroke-width: 2; }
.tag-in { width: 90px !important; }
.d-sec { margin-top: 22px; }
.d-sec-h { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 6px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; }
.d-sec-h .r { margin-left: auto; letter-spacing: 0; text-transform: none; font-weight: 400; }
.d-sub .row { padding-left: 2px; }
.d-sub .row .tt { padding: 7px 0; }
.sub-add { display: flex; align-items: center; gap: 10px; height: 38px; border-bottom: 1px solid var(--rule); padding-left: 2px; }
.sub-add input { flex: 1; border: 0; outline: none; background: transparent; caret-color: var(--verm); }
.sub-add .p { color: var(--ink-3); width: 18px; text-align: center; }
.private-note { font-size: 12px; color: var(--ink-3); padding: 7px 0 0; display: flex; gap: 6px; align-items: center; }
.private-note svg { width: 12px; height: 12px; }
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 10px; height: 40px; border-bottom: 1px solid var(--rule); }
.person .pn { flex: 1; }
.person .pst { font-size: 12px; color: var(--ink-3); }
.log { list-style: none; margin: 0; padding: 4px 0 0; }
.log li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; font-size: 12.5px; color: var(--ink-2); }
.log li .lt { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.wait-box { display: flex; gap: 6px; align-items: center; width: 100%; }
.wait-box input[type=text] { flex: 1; }
.sw { width: 32px; height: 18px; border-radius: 9px; background: var(--rule-2); position: relative; flex: none; transition: background .15s; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--sheet); transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.sw.on { background: var(--ink); }
.sw.on::after { transform: translateX(14px); }
.d-foot { margin-top: 26px; display: flex; gap: 8px; }

/* ---------- popovers, toast, modal ---------- */
.pop { position: fixed; z-index: 80; background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 10px; padding: 8px; box-shadow: 0 12px 40px rgba(27, 25, 22, .16); min-width: 220px; max-width: calc(100vw - 16px); }
.pop .ph { font-size: 11px; color: var(--ink-3); padding: 2px 6px 6px; letter-spacing: .02em; }
.pop .po { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 6px; }
.pop .po:hover, .pop .po:focus-visible { background: var(--sel); }
.pop .po .s { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pop .po.on { font-weight: 600; }
.pop .prow { display: flex; gap: 6px; align-items: center; padding: 4px 6px; flex-wrap: wrap; }
.pop input { height: 30px; border: 1px solid var(--rule-2); border-radius: 6px; padding: 0 8px; background: var(--paper); outline: none; }
.pop input:focus { border-color: var(--ink-3); }
.pop input[type=number] { width: 60px; }
.pop select { height: 30px; border: 1px solid var(--rule-2); border-radius: 6px; background: var(--paper); padding: 0 6px; }
.pop .sep { height: 1px; background: var(--rule); margin: 6px 0; }
.dows { display: flex; gap: 3px; }
.dows button { width: 28px; height: 28px; border-radius: 6px; font-size: 11.5px; border: 1px solid var(--rule); }
.dows button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; background: var(--ink); color: var(--paper); border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); animation: toastIn .2s ease-out; max-width: calc(100vw - 24px); }
.toast .tb { color: var(--paper); font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.toast .tb:hover { background: rgba(255, 255, 255, .12); }
.toast .tk { opacity: .6; font-size: 11px; margin-left: -8px; white-space: nowrap; }
.toast .tm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 6px); } }
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(27, 25, 22, .28); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--sheet); border-radius: 12px; padding: 22px 24px; width: 460px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-card h2 { margin: 0 0 12px; font: 600 20px var(--serif); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; align-items: center; }
.keys kbd { justify-self: start; }
.keys .kh { grid-column: 1 / -1; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 8px; }
.arrange-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 8px 0 0; background: var(--ink); color: var(--paper); border-radius: 8px; font-size: 12.5px; }
.arrange-bar kbd { background: transparent; color: var(--paper); border-color: rgba(255, 255, 255, .35); }
.arrange-bar .sp { flex: 1; }

/* ---------- mobile ---------- */
.only-m { display: none !important; }
.tabbar, .sheet-back, .moremenu { display: none; }
@media (max-width: 1100px) { .app.has-detail { grid-template-columns: 200px minmax(0, 1fr) 360px; } :root { --rail: 200px; } }
@media (max-width: 860px) {
  .only-m { display: flex !important; }
  .only-d { display: none !important; }
  .app, .app.has-detail { grid-template-columns: minmax(0, 1fr); height: auto; min-height: calc(100dvh - 22px); }
  .rail { display: none; }
  .main { overflow: visible; }
  .top { padding: 10px 12px 2px; gap: 6px; position: sticky; top: 0; z-index: 20; background: var(--paper); }
  .top h1 { font-size: 22px; flex: 1; }
  .top-r { gap: 6px; }
  .acct-n { display: none; }
  .acct-btn { padding: 0 6px 0 3px; height: 34px; }
  .seg button { padding: 0 8px; font-size: 12px; height: 28px; }
  .capture { padding: 6px 12px 2px; position: sticky; top: 52px; z-index: 19; background: var(--paper); }
  .cap-row { height: 46px; }
  #cap { font-size: 16px; }
  .list { padding: 0 12px calc(96px + env(safe-area-inset-bottom)); overflow: visible; }
  .row { min-height: 48px; gap: 12px; }
  .row .tt { flex-wrap: wrap; row-gap: 0; padding: 8px 0; }
  .row .meta .cat, .row .meta .tg { display: none; }
  .row .meta { gap: 6px; }
  .row .wait { max-width: 140px; }
  .row.stack { flex-wrap: wrap; column-gap: 12px; }
  .row.stack .tt { flex: 1 1 calc(100% - 80px); padding-bottom: 2px; }
  .row.stack .tt .tl { white-space: normal; }
  .row.stack .meta { flex: 1 1 auto; padding: 0 0 9px 26px; }
  .row.stack .acts { padding-bottom: 9px; }
  .row .acts .btn { height: 34px; }
  .ck { width: 20px; height: 20px; }
  .tabbar { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--sheet); border-top: 1px solid var(--rule); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 52px; font-size: 10.5px; color: var(--ink-3); position: relative; }
  .tab svg { width: 20px; height: 20px; }
  .tab.on { color: var(--ink); font-weight: 600; }
  .tab .dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 7px; height: 7px; border-radius: 50%; background: var(--verm); }
  .tab .n { position: absolute; top: 3px; left: calc(50% + 7px); font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 600; }
  .detail { position: fixed; inset: auto 0 0 0; top: 8vh; z-index: 60; border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: sheetUp .22s ease-out; padding-bottom: env(safe-area-inset-bottom); }
  .detail::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--rule-2); margin: 8px auto 0; flex: none; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
  .sheet-back:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(27, 25, 22, .3); }
  .moremenu:not([hidden]) { display: block; position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 61; background: var(--sheet); border-radius: 14px; padding: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); max-height: 70vh; overflow-y: auto; }
  .moremenu .nav-i { height: 44px; font-size: 15px; }
  .fld { grid-template-columns: 88px 1fr; min-height: 44px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .notice { flex-wrap: wrap; }
  .notice .acts { width: 100%; }
  .notice .acts .btn { height: 34px; flex: 1; }
  .wi .x { opacity: 1; }
  .pop { left: 8px !important; right: 8px; }
  .btn { height: 34px; }
}
@media (max-width: 380px) { .seg button { padding: 0 6px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
