/* Layout: account rail grouped by business (private below a rule) | tabbed unified stream | reader.
   On phones the rail stays open as a slim column and the reader goes full screen. */
:root {
  --bg: #eef0f4;
  --panel: #ffffff;
  --panel-2: #f6f7fa;
  --line: #dde1e9;
  --fg: #171b26;
  --muted: #5d6578;
  --faint: #8a91a3;
  --accent: #2f5bea;
  --accent-soft: #e3e9fd;
  --brand: #ee5a0e;
  --brand-soft: #fde8dc;
  --ok: #0f8a5f;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b4231b;
  --scrim: rgba(15, 18, 24, 0.45);
  --c0: #d8452f; --c1: #2f5bea; --c2: #0f8a5f; --c3: #b26a00; --c4: #8a3ffc; --c5: #0e7c99; --c6: #c2185b;
  --cp: #5d6578;
  --font-ui: "Onest", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --panel: #161a23; --panel-2: #1c212c; --line: #2a303d;
    --fg: #e7eaf1; --muted: #a0a8ba; --faint: #6f7789;
    --accent: #7d9bff; --accent-soft: #1f2a4a; --brand: #ff8a2b; --brand-soft: #3a2414; --ok: #4fd1a1;
    --warn: #f2b65a; --warn-soft: #33260f; --danger: #ff8a80;
    --scrim: rgba(0, 0, 0, 0.6);
    --c0: #ff7d68; --c1: #7d9bff; --c2: #4fd1a1; --c3: #f2b65a; --c4: #b794ff; --c5: #5bc8e3; --c6: #f48fb1; --cp: #a0a8ba;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 14px;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  height: 100%; display: grid; grid-template-rows: auto 1fr; gap: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px;
}
header.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; margin-right: auto; min-width: 0; }
.brand img { width: 30px; height: 30px; display: block; flex: none; }
.brand h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.brand .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.search { flex: 1 1 220px; max-width: 360px; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.search input { border: 0; background: transparent; outline: none; padding: 8px 0; width: 100%; min-width: 0; }
.search svg { flex: none; color: var(--faint); }
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--fg); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.icon { padding: 7px 9px; }
.btn.spin svg { animation: spin 0.9s linear infinite; }
.btn:disabled { opacity: 0.6; cursor: default; }
@keyframes spin { to { transform: rotate(360deg); } }
.google-btn { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 20px; padding: 8px 16px; font-weight: 500; text-decoration: none; }
.google-btn svg { flex: none; }

.body { min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px; }
.rail, .stream, .reader { min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }

/* account rail */
.rail { display: flex; flex-direction: column; overflow: hidden; }
.rail-scroll { overflow-y: auto; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.rail-foot { border-top: 1px solid var(--line); padding: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.rail-foot .btn { flex: 1; font-size: 13px; padding: 6px 8px; }
.sec-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); padding: 8px 8px 2px; font-weight: 600; }
.biz { display: flex; align-items: center; gap: 8px; padding: 12px 8px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.scope-row + .biz { border-top: 0; margin-top: 0; }
.biz .swatch { width: 4px; height: 14px; border-radius: 2px; flex: none; }
.biz h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.biz .edit { background: none; border: 0; padding: 2px 4px; color: var(--faint); font-size: 12px; border-radius: 4px; visibility: hidden; }
.biz:hover .edit, .biz .edit:focus-visible { visibility: visible; }
.private-rule { border: 0; border-top: 2px solid var(--line); margin: 12px 4px 0; }
.acct-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 8px; padding: 7px 8px 7px 20px; }
.acct-row:hover { background: var(--panel-2); }
.acct-row[aria-pressed="true"] { background: var(--accent-soft); }
.acct-row[aria-pressed="true"] .addr-name { color: var(--accent); font-weight: 600; }
.acct-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.acct-row .dot.off { background: transparent !important; border: 1.5px dashed var(--faint); width: 6px; height: 6px; }
.acct-row .txt { flex: 1; min-width: 0; display: grid; }
.addr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr-sub { font-size: 11px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-row .n { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.acct-row .n.unread { background: var(--accent); color: var(--panel); border-radius: 10px; padding: 1px 7px; }
.acct-row .off-tag { font-size: 10px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.acct-row .off-tag.warn { color: var(--warn); border-color: var(--warn); }
.scope-row { padding-left: 8px; font-weight: 600; margin-bottom: 2px; }
.scope-row .scope-ic { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.add-link { background: none; border: 0; text-align: left; color: var(--accent); font-size: 12px; padding: 4px 8px 4px 20px; border-radius: 6px; }
.add-link:hover { background: var(--panel-2); }
.rail-note { font-size: 12px; color: var(--muted); padding: 6px 8px; line-height: 1.45; }
.rail-note.err { color: var(--warn); }

/* stream */
.stream { display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; align-items: flex-end; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 7px 12px; font-weight: 500;
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { background: var(--panel); border-color: var(--line); color: var(--fg); font-weight: 600; }
.tab .n { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.tab .x { margin-left: 2px; color: var(--faint); font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 4px; }
.tab .x:hover { color: var(--fg); background: var(--panel-2); }
.tab .swatch { width: 8px; height: 8px; border-radius: 50%; }
.stream-head { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); min-height: 18px; }
.stream-head #streamTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stream-head .fresh { margin-left: auto; font-family: var(--font-mono); white-space: nowrap; }
.list { overflow-y: auto; flex: 1; }
.day { position: sticky; top: 0; z-index: 1; background: var(--panel-2); border-block: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 5px 14px; margin-top: -1px; }
.row { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; column-gap: 12px; width: 100%;
  text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 14px 10px 0; }
.row:hover { background: var(--panel-2); }
.row[aria-selected="true"] { background: var(--accent-soft); }
.row .stripe { grid-row: span 3; border-radius: 0 3px 3px 0; }
.row .from { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .from, .row.unread .subj { font-weight: 700; }
.row .time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; align-self: center; }
.row .subj { grid-column: 2 / 4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.row .snip { grid-column: 2 / 4; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.row .ud { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: middle; }
.row .tags { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.tag { font-size: 10px; letter-spacing: 0.04em; padding: 1px 5px; border-radius: 4px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.tag.biz-tag { border-color: transparent; color: var(--panel); }
.skel { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.skel i { display: block; height: 10px; border-radius: 4px; background: var(--panel-2); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); line-height: 1.55; max-width: 48ch; margin: 0 auto; }
.empty strong { display: block; color: var(--fg); font-size: 15px; margin-bottom: 6px; }
.empty .acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.more { padding: 12px; text-align: center; }

/* reader */
.reader { display: flex; flex-direction: column; overflow: hidden; }
.reader-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.reader-head h2 { margin: 0; font-size: 18px; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; font-weight: 600; font-size: 11px; color: var(--panel); }
.reader-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn.tool { padding: 6px 10px; font-size: 13px; }
.btn.tool.danger:hover { border-color: var(--danger); color: var(--danger); }
.open-link { margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; }
.open-link:hover { text-decoration: underline; }
.composer { margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--panel-2); }
.composer-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.composer-head span { color: var(--muted); }
.composer-to { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--panel); }
.composer textarea { width: 100%; min-height: 140px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--panel); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-act { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; padding: 0; }
.reader-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.reader-actions a { color: var(--accent); font-weight: 500; text-decoration: none; font-size: 13px; }
.reader-actions a:hover { text-decoration: underline; }
.back { display: none; }
.reader-body { overflow-y: auto; flex: 1; padding: 4px 20px 20px; }
.msg { border-bottom: 1px solid var(--line); padding: 14px 0; display: grid; gap: 8px; }
.msg:last-child { border-bottom: 0; }
.msg .who { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.msg .who b { font-weight: 600; overflow-wrap: anywhere; }
.msg .who span { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.msg .to { font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }
.msg pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-ui); font-size: 14px; line-height: 1.6; max-width: 72ch; }
.msg pre a { color: var(--accent); }
.notice { margin: 14px 0; padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.5; }
.reader-idle { margin: auto; text-align: center; color: var(--muted); padding: 30px; line-height: 1.6; max-width: 34ch; }
.reader-idle kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--panel-2); }

/* sign-in + setup */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 16px; }
.auth-card .logo-row { display: flex; align-items: center; gap: 10px; }
.auth-card .logo-row img { width: 40px; height: 40px; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-card form { display: grid; gap: 14px; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--line); }
.qr svg { width: 200px; height: 200px; }
.secret { font-family: var(--font-mono); font-size: 13px; word-break: break-all; background: var(--panel-2); padding: 8px 10px; border-radius: 8px; user-select: all; }

/* dialogs + forms */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(480px, 100%); max-height: 100%; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.dialog form { padding: 20px; display: grid; gap: 14px; }
.dialog h2 { margin: 0; font-size: 17px; }
.dialog h3 { margin: 4px 0 0; font-size: 13px; }
.dialog ol { margin: 0; padding-left: 20px; line-height: 1.6; color: var(--muted); font-size: 13px; }
.dialog ol a, .dialog p a { color: var(--accent); }
.dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.field { display: grid; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 9px 10px; width: 100%; min-width: 0; }
.field .hint { font-size: 12px; color: var(--faint); line-height: 1.45; }
.copy-row { display: flex; gap: 6px; }
.copy-row code { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; overflow-wrap: anywhere; }
.domain-list { display: grid; gap: 6px; }
.domain-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.domain-item b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.domain-item .okmark { color: var(--ok); font-size: 12px; }
.link-box { display: grid; gap: 8px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.link-box .status { font-weight: 600; }
.link-box .status.ok { color: var(--ok); }
.link-box .status.warn { color: var(--warn); }
.row-acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.row-acts .spacer { margin-right: auto; }
.form-err { color: var(--danger); font-size: 13px; line-height: 1.45; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--fg); color: var(--panel); padding: 10px 16px; border-radius: 10px; font-size: 13px; max-width: min(90vw, 520px); line-height: 1.45; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- work hub ---------- */
.owner-only { display: none !important; }
body.is-owner .owner-only { display: inline-flex !important; }
body.is-owner .rail-foot.owner-only { display: flex !important; }
.whoami { font-size: 13px; color: var(--muted); white-space: nowrap; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.chip { padding: 5px 11px; font-size: 13px; border-radius: 999px; }
.btn.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.sub-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); padding: 6px 8px 0 20px; font-weight: 600; }
.lane-row { padding-left: 20px; }
.lane-row.scope-row { padding-left: 8px; }
.lane-ic { display: inline-flex; width: 16px; justify-content: center; color: var(--muted); flex: none; }
.lane-row[aria-pressed="true"] .lane-ic { color: var(--accent) !important; }
.acct-row .n.jobs { background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.off-tag.shop { color: var(--ok); border-color: var(--ok); }

.board { display: none; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; flex-direction: column; overflow: hidden; }
.app.board-mode .stream, .app.board-mode .reader { display: none !important; }
.app.board-mode .board { display: flex; grid-column: 2 / -1; }
.board-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.board-head h2 { margin: 0; font-size: 17px; margin-right: auto; text-wrap: balance; }
.board-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.board-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 10px; padding: 12px; overflow-x: auto; }
.board-col { display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.board-col.drop { border-color: var(--accent); background: var(--accent-soft); }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); }
.col-head .n { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-weight: 500; }
.board-col[data-stage="new"] .col-head { box-shadow: inset 0 3px 0 var(--brand); border-radius: 10px 10px 0 0; }
.board-col[data-stage="in_progress"] .col-head { box-shadow: inset 0 3px 0 var(--accent); border-radius: 10px 10px 0 0; }
.board-col[data-stage="ready"] .col-head { box-shadow: inset 0 3px 0 var(--c3); border-radius: 10px 10px 0 0; }
.board-col[data-stage="completed"] .col-head { box-shadow: inset 0 3px 0 var(--ok); border-radius: 10px 10px 0 0; }
.col-body { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.col-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 18px 6px; }
.job-card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--faint); border-radius: 8px; padding: 9px 10px; display: grid; gap: 5px; cursor: grab; }
.job-card:hover { border-color: var(--accent); }
.job-card.dragging { opacity: 0.5; }
.board-col[data-stage="completed"] .job-card { opacity: 0.75; }
.job-top { display: flex; gap: 4px; flex-wrap: wrap; }
.tag.src { color: var(--ok); border-color: var(--ok); background: transparent; }
.job-title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.job-cust { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.due { font-size: 11px; font-family: var(--font-mono); color: var(--muted); }
.due.today { color: var(--warn); font-weight: 600; }
.due.late { color: var(--danger); font-weight: 600; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; flex: none; margin-left: auto; }
.board-hint { color: var(--muted); padding: 0 16px 14px; margin: 0; font-size: 13px; }

.dialog:has(.job-form) { width: min(640px, 100%); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field textarea { border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 9px 10px; width: 100%; resize: vertical; font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
.stage-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.stage-opt { position: relative; }
.stage-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.stage-opt span { display: block; text-align: center; padding: 6px 4px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stage-opt input:checked + span { background: var(--panel); color: var(--fg); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.stage-opt input:focus-visible + span { outline: 2px solid var(--accent); }
.job-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.notes { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.note-list { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; }
.note { font-size: 13px; line-height: 1.45; }
.note span { color: var(--faint); font-size: 12px; }
.note div { margin-top: 2px; overflow-wrap: anywhere; }
.note-add { display: flex; gap: 6px; }
.note-add input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.staff-item { gap: 10px; }
.staff-item .avatar { margin-left: 0; }
.staff-item .who { display: grid; flex: 1; min-width: 0; }
.staff-item .who .hint { overflow: hidden; text-overflow: ellipsis; }
.staff-status { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.staff-status.active, .staff-status.owner { color: var(--ok); }
.staff-status.invited { color: var(--warn); }
.staff-status.switched-off { color: var(--danger); }
.job-btn { border-color: var(--brand); color: var(--brand); }
.off-tag.files { color: var(--c4); border-color: var(--c4); }
.linked-jobs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.linked-chip { border-left: 4px solid var(--faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-n { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.file-link { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.file-link .txt { flex: 1; min-width: 0; display: grid; font-size: 13px; }
.file-link .txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list { display: grid; gap: 4px; max-height: 340px; overflow-y: auto; }
.pick-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.pick-row:hover { background: var(--panel-2); }
.pick-row input { margin-top: 3px; }
.pick-row .txt { display: grid; min-width: 0; font-size: 13px; }
.pick-row .txt b { overflow-wrap: anywhere; }
.dialog .check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--muted); }
.dialog .check input { margin-top: 3px; }

/* tablet: reader overlays */
@media (max-width: 1080px) {
  .body { grid-template-columns: 230px minmax(0, 1fr); }
  .reader { display: none; }
  .app.reading .reader { display: flex; position: fixed; inset: 0; z-index: 30; border-radius: 0; border: 0;
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .back { display: inline-flex; justify-self: start; }
}
/* phone: rail stays open as a slim column beside the stream */
@media (max-width: 720px) {
  .app { gap: 8px; padding-block: 8px; }
  .body { grid-template-columns: minmax(118px, 36%) minmax(0, 1fr); gap: 6px; }
  .rail, .stream { border-radius: 10px; }
  .rail-scroll { padding: 4px; }
  .sec-label { padding: 6px 6px 2px; font-size: 10px; }
  .biz { padding: 10px 6px 3px; gap: 6px; }
  .biz h3 { font-size: 11px; }
  .biz .n, .biz .edit { display: none; }
  .acct-row { padding: 6px 6px 6px 10px; gap: 6px; font-size: 13px; }
  .scope-row { padding-left: 6px; }
  .addr-sub, .acct-row .off-tag { display: none; }
  .acct-row .n { font-size: 11px; }
  .acct-row .n.unread { padding: 0 5px; }
  .add-link { padding: 3px 6px 3px 10px; font-size: 11px; }
  .rail-foot { padding: 4px; gap: 4px; flex-direction: column; }
  .rail-foot .btn { font-size: 12px; padding: 5px 6px; }
  .tabs { padding: 6px 6px 0; }
  .tab { padding: 6px 8px; font-size: 13px; }
  .tab .n { display: none; }
  .stream-head { padding: 5px 10px; }
  .row { column-gap: 8px; padding: 8px 10px 8px 0; }
  .row .snip { display: none; }
  .row .tags .tag:not(.biz-tag) { display: none; }
  .row .time { font-size: 11px; }
  .day { padding: 4px 10px; }
  .search { max-width: none; order: 3; flex-basis: 100%; }
  .btn-label { display: none; }
  .tool-label { display: none; }
  .whoami { display: none; }
  .app.board-mode .board { grid-column: 2 / -1; }
  .board-cols { grid-template-columns: repeat(4, minmax(78vw, 1fr)); scroll-snap-type: x mandatory; padding: 8px; }
  .board-col { scroll-snap-align: start; }
  .board-head { padding: 8px 10px; }
  .board-head h2 { font-size: 15px; flex-basis: 100%; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .stage-opt span { font-size: 12px; padding: 6px 2px; }
  .brand .count { display: none; }
}
@media (prefers-reduced-motion: reduce) { .btn.spin svg { animation: none; } }
.more.muted { color: var(--muted, #888); font-size: 13px; }
