/* ResQ Collab: a calm, flat workspace in the spirit of HighLevel's newer
   UI. Light sidebar, outline icons with text labels, white surfaces, thin
   borders, one coral accent. */
:root {
  --canvas: #f7f8fa;
  --bg: #ffffff;
  --bg-soft: #f8f9fb;
  --bg-hover: #f2f4f7;
  --border: #e6e8ec;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --accent: #e8542f;
  --accent-hover: #d4461f;
  --accent-soft: #fef3ef;
  --accent-text: #c4320a;
  --link: #1570ef;
  --mention: #fff8e6;
  --ink: #101828;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  /* Left sidebars sit on a soft grey in light mode (Joe, Nov 7); dark mode keeps the canvas. */
  --side-bg: #eef0f3;
  --side-hover: #e3e6eb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --canvas: #0c111d;
    --bg: #111827;
    --bg-soft: #161e2e;
    --bg-hover: #1f2937;
    --border: #283244;
    --text: #f2f4f7;
    --text-2: #d0d5dd;
    --muted: #98a2b3;
    --accent-soft: #3b1d14;
    --accent-text: #ff9c80;
    --link: #84adff;
    --mention: #33291a;
    --ink: #f2f4f7;
    --side-bg: var(--canvas);
    --side-hover: var(--bg-hover);
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --canvas: #0c111d;
  --bg: #111827;
  --bg-soft: #161e2e;
  --bg-hover: #1f2937;
  --border: #283244;
  --text: #f2f4f7;
  --text-2: #d0d5dd;
  --muted: #98a2b3;
  --accent-soft: #3b1d14;
  --accent-text: #ff9c80;
  --link: #84adff;
  --mention: #33291a;
  --ink: #f2f4f7;
  --side-bg: var(--canvas);
  --side-hover: var(--bg-hover);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--canvas); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; margin: 6px 0; }
blockquote { margin: 2px 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 6px 12px; font-weight: 500; font-size: 13.5px; color: var(--text-2); box-shadow: var(--shadow); transition: background 0.12s, border-color 0.12s; }
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--os-danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 6px; padding: 5px; color: var(--muted); font-size: 15px; transition: background 0.12s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px; background: var(--bg); box-shadow: var(--shadow); transition: border 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--os-accent); box-shadow: 0 0 0 3px rgba(232, 84, 47, 0.12); }
label.field { display: block; margin: 12px 0; }
label.field > span.row { display: flex; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.error { color: var(--os-danger); font-size: 13.5px; margin-top: 8px; }
.error-text { color: var(--os-danger); }

/* auth */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.brand-mark { display: block; width: 48px; height: 48px; border-radius: 12px; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(232, 84, 47, 0.28); }
.brand-mark.sm { width: 34px; height: 34px; margin: 0; border-radius: 9px; box-shadow: 0 3px 8px rgba(232, 84, 47, 0.25); }

.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-card .callout { margin: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 60px 264px minmax(0, 1fr); height: 100%; transition: grid-template-columns 0.22s ease; }
.shell.side-hidden { grid-template-columns: 60px 0 minmax(0, 1fr); }
.side { background: var(--side-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; overflow: hidden; min-width: 0; }
.shell.side-hidden .side { visibility: hidden; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 14px; }
.app-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.side-head .ws { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scroll { overflow-y: auto; flex: 1; padding: 2px 0 12px; }
.jump-box { display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 2px 8px 6px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); color: var(--muted); font-size: 13.5px; text-align: left; }
.jump-box:hover { border-color: var(--os-line-strong); color: var(--text-2); }
.jump-box span { flex: 1; }
.jump-box kbd { font: 11px Inter, sans-serif; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--bg); }
.jump-list { margin-top: 8px; display: flex; flex-direction: column; gap: 1px; max-height: 380px; overflow-y: auto; }
.jump-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--text-2); }
.jump-item .i { color: var(--muted); font-size: 16px; }
.jump-item.sel, .jump-item:hover { background: var(--bg-hover); }
.side-more { display: block; border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 3px 10px 3px 37px; margin: 1px 8px; text-align: left; border-radius: 6px; width: calc(100% - 16px); }
.side-more:hover { background: var(--bg-hover); color: var(--text-2); }
.sec-mode { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--bg-hover); border-radius: 4px; padding: 0 5px; margin-left: 2px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 14px; text-decoration: none !important; position: relative; }
.nav-item .i { font-size: 17px; color: var(--muted); }
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-item.active .i { color: var(--accent); }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.side-section { margin-top: 10px; }
.side-title { display: flex; align-items: center; padding: 2px 8px 3px 18px; font-size: 12px; font-weight: 600; color: var(--muted); }
.side-title > span { flex: 1; display: inline-flex; align-items: center; gap: 4px; }
.side-title .icon-btn { padding: 3px; font-size: 14px; }
.side-item { display: flex; align-items: center; gap: 9px; padding: 5px 10px; margin: 1px 8px; border-radius: 8px; color: var(--text-2); cursor: pointer; white-space: nowrap; overflow: hidden; font-size: 14px; text-decoration: none !important; }
.side-item:hover { background: var(--side-hover); }
.side-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.side-item.unread { color: var(--text); font-weight: 700; }
.side-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.side-item .sym { width: 18px; display: inline-flex; justify-content: center; color: var(--muted); flex: none; font-size: 15px; }
.side-item.active .sym { color: var(--accent); }
.item-more { display: none; padding: 1px 3px; }
.side-item:hover .item-more { display: inline-flex; }
.side-item:hover .side-pin { display: none; }
.side-item:hover .badge { display: none; }
.side-item:hover:has(.item-more) .count { display: none; }
.side-mode { display: flex; margin: 6px 8px 6px; flex: none; }
.side-mode button { flex: 1; justify-content: center; min-height: 32px; position: relative; }
.side-mode .nav-dot { position: absolute; top: 6px; right: 8px; }
.sec-toggle { cursor: pointer; user-select: none; flex: 1; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; min-height: 24px; }
.sec-toggle:hover { color: var(--text); }
.side-pin { font-size: 11px; color: var(--muted); margin-left: 4px; flex: none; }
.side-vip .side-title .i-star { color: var(--os-warn); }
.side-fav .side-title .i-heart { color: var(--os-danger); }
.drop-target { background: var(--accent-soft); border-radius: 10px; }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; }
.count { font-size: 12px; color: var(--muted); }
.side-group { padding: 8px 18px 2px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--os-line-strong); flex: none; }
.dot.on { background: #12b76a; border-color: #12b76a; }
.side-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.side-foot .me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; flex: 1; background: var(--bg); }
.main-head { display: flex; align-items: center; gap: 8px; padding: 16px 24px 12px; border-bottom: 1px solid var(--border); min-height: 66px; flex-wrap: wrap; }
.main-head h2 { margin: 0; font-size: 21px; letter-spacing: -0.01em; font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-head h2 .i { color: var(--muted); }
.main-head .topic { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle { display: none; }
input.search-box { width: 220px; flex: none; padding-top: 6px; padding-bottom: 6px; }

/* channel tabs */
.tabbar { display: flex; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; text-decoration: none !important; }
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.on { background: var(--bg-hover); color: var(--text); }
.tab.add { color: var(--accent-text); font-weight: 700; }
.menu-pop { position: fixed; z-index: 60; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 250px; max-width: 300px; animation: pop 0.14s ease-out; }
.menu-pop button { display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.menu-pop button:hover:not(:disabled) { background: var(--bg-hover); }
.menu-pop button:disabled { opacity: 0.55; cursor: default; }
.menu-pop .mi { width: 18px; display: inline-flex; justify-content: center; color: var(--muted); font-size: 16px; padding-top: 1px; }
.menu-pop .small { font-weight: 500; }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 6px; }
.doc-view { flex: 1; overflow-y: auto; }
.doc-inner { max-width: 760px; margin: 0 auto; padding: 28px 28px 60px; }
.doc-h { font-size: 28px; letter-spacing: -0.02em; margin: 0 0 4px; }
.doc-title { font-size: 24px !important; font-weight: 700; margin-bottom: 10px; }
.doc-edit { min-height: 50vh; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.doc-body { margin-top: 18px; font-size: 15.5px; line-height: 1.65; }

/* secrets */
.secret-card { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; max-width: 460px; margin: 4px 0; padding: 10px 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--border); }
.secret-card.dead { opacity: 0.6; }
.secret-icon { font-size: 20px; }
.secret-meta { font-size: 12px; color: var(--muted); }
.secret-value { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.secret-value code { flex: 1; padding: 6px 8px; word-break: break-all; }

/* email cards and Drive links */
.email-card { display: block; max-width: 520px; margin: 4px 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); }
.email-top { display: flex; gap: 10px; align-items: flex-start; }
.email-icon { font-size: 20px; }
.email-meta { font-size: 12px; color: var(--muted); }
.email-snippet { font-size: 14px; color: var(--muted); margin: 8px 0; }
.email-full { white-space: pre-wrap; font-size: 14.5px; line-height: 1.6; }
.drive-chip { display: inline-flex; gap: 10px; align-items: center; margin: 3px 0; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); text-decoration: none !important; line-height: 1.3; }
.drive-chip:hover { border-color: var(--os-line-strong); }
.drive-icon { font-size: 20px; }

/* Block Kit cards */
.bk { display: flex; flex-direction: column; gap: 6px; max-width: 620px; padding: 10px 12px; margin: 2px 0; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); box-shadow: var(--shadow); }
.bk-header { font-weight: 700; font-size: 15.5px; }
.bk-section { display: flex; gap: 10px; align-items: flex-start; }
.bk-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin-top: 4px; }
.bk-context { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.bk-context img { width: 16px; height: 16px; border-radius: 4px; }
.bk-divider { border: 0; border-top: 1px solid var(--border); margin: 2px 0; width: 100%; }
.bk-image { max-width: 100%; border-radius: 10px; }
.bk-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.bk-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.bk-select { width: auto; padding: 4px 10px; font-size: 13px; border-radius: 999px; font-weight: 600; }
.bk-overflow { width: 52px; }
.msg.ephemeral { background: color-mix(in srgb, var(--link) 7%, var(--bg)); }

/* files */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-tile { display: flex; flex-direction: column; gap: 6px; color: var(--text); font-size: 12px; font-weight: 600; text-decoration: none !important; }
.file-tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); }
.file-tile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* messages */
.messages { flex: 1; overflow-y: auto; padding: 10px 0 14px; }
.day { display: flex; justify-content: center; margin: 16px 0 8px; position: sticky; top: 4px; z-index: 2; pointer-events: none; }
.day span { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 6px 18px; margin: 0; border-radius: 0; position: relative; transition: background 0.12s; }
.msg:hover { background: var(--bg-soft); }
.msg.cont { padding-top: 1px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg.mentioned { background: var(--mention); box-shadow: inset 3px 0 0 #ff9f1c; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; letter-spacing: 0.02em; }
img.avatar { object-fit: cover; background: var(--bg-hover); }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 8px 0; }
.avatar-choice { border: 2px solid transparent; border-radius: 50%; padding: 2px; background: none; aspect-ratio: 1; }
.avatar-choice img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.avatar-choice:hover { border-color: var(--border); }
.avatar-choice.on { border-color: var(--accent); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head .name { font-weight: 700; letter-spacing: -0.005em; }
.msg-head .time { color: var(--muted); font-size: 12px; }
.msg-head .tag { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; background: var(--bg-hover); color: var(--muted); padding: 1px 6px; border-radius: 6px; }
.msg-body { word-wrap: break-word; overflow-wrap: anywhere; }
.msg-body .edited { color: var(--muted); font-size: 12px; }
.mention { background: rgba(61, 90, 254, 0.1); color: var(--link); border-radius: 6px; padding: 0 3px; font-weight: 600; }
.mention.me { background: var(--os-partial-bg); color: var(--os-partial-ink); }
.task-ref { display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: var(--bg-soft); font-weight: 600; color: var(--text); }
.msg-actions { position: absolute; right: 16px; top: -16px; display: none; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 3px; z-index: 3; }
.msg:hover .msg-actions { display: flex; }
.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.reaction { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 1px 9px; font-size: 13px; font-weight: 600; }
.reaction.mine { border-color: var(--os-accent); background: var(--accent-soft); color: var(--accent-text); }
.thread-link { margin-top: 5px; font-size: 13px; font-weight: 700; color: var(--link); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-img { max-width: 360px; max-height: 260px; border-radius: 10px; border: 1px solid var(--border); display: block; }
.file-chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 7px 12px; background: var(--bg-soft); font-weight: 600; color: var(--text); }
.load-older { text-align: center; margin: 8px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }

/* composer: floating pill */
.composer { padding: 0 18px 16px; position: relative; }
.composer-box { border: 1px solid var(--border); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow); position: relative; transition: border 0.15s, box-shadow 0.15s; }
.composer-box:focus-within { border-color: var(--os-accent); box-shadow: 0 0 0 3px rgba(232, 84, 47, 0.1); }
.composer textarea { border: 0; resize: none; padding: 12px 16px 4px; max-height: 240px; min-height: 46px; background: transparent; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: 4px; padding: 2px 8px 8px; }
.composer-bar .hint { font-size: 12px; }
.send-btn { margin-left: auto; width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; font-size: 16px; display: grid; place-items: center; }
.send-btn:hover { background: var(--accent-hover); }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.typing { height: 18px; font-size: 12px; color: var(--muted); padding: 4px 6px 0; }
.popup { position: absolute; bottom: 100%; left: 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 260px; max-height: 280px; overflow-y: auto; z-index: 20; padding: 4px; }
.popup div { padding: 7px 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; border-radius: 10px; }
.popup div.sel, .popup div:hover { background: var(--bg-hover); }
.popup div.none { cursor: default; }
.popup div.none:hover { background: none; }
.mention-wrap { position: relative; }
.mention-wrap .popup { left: 0; }
.drop-hint { position: absolute; inset: 0; background: rgba(255, 90, 60, 0.08); border: 2px dashed var(--accent); border-radius: 12px; display: grid; place-items: center; font-weight: 700; pointer-events: none; }
.readonly-note { padding: 14px 18px 18px; color: var(--muted); text-align: center; }

/* right panel */
.panel { width: 420px; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--border); min-height: 64px; }
.panel-head h3 { margin: 0; font-size: 16px; flex: 1; display: flex; gap: 8px; align-items: center; }
.panel-body { flex: 1; overflow-y: auto; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade 0.15s; }
/* Only the backdrop's color fades in; the dialog inside is opaque from the first frame. */
@keyframes fade { from { background-color: transparent; backdrop-filter: none; } }
.modal { background: var(--bg); border-radius: 10px; width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop 0.18s ease-out; }
/* Dialogs slide in but stay opaque from the first frame, so the page never shows through (Joe's review, Nov 9). */
@keyframes pop { from { transform: translateY(8px) scale(0.98); } }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; align-items: center; padding: 20px 22px 8px; }
.modal-head h3 { margin: 0; flex: 1; font-size: 19px; letter-spacing: -0.01em; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.pick-list { border: 1px solid var(--border); border-radius: 10px; max-height: 280px; overflow-y: auto; padding: 4px; }
.pick-list label { display: flex; gap: 10px; align-items: center; padding: 7px 10px; cursor: pointer; border-radius: 10px; }
.pick-list label:hover { background: var(--bg-hover); }
.tabs { display: flex; gap: 4px; margin: 4px 0 16px; padding: 4px; background: var(--bg-hover); border-radius: 10px; overflow-x: auto; width: fit-content; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 700; font-size: 14px; }
.tabs button.on { color: var(--text); background: var(--bg); box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px; border-bottom: 1px solid var(--border); }
table.grid td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.callout { background: var(--bg-soft); border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-size: 14px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 44px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.progress { height: 8px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.4s; }

table.grid.connectors td { vertical-align: top; }
table.grid.connectors td:last-child { max-width: 420px; }

/* tasks */
.board { flex: 1; display: flex; gap: 14px; overflow-x: auto; padding: 14px 18px 18px; align-items: flex-start; }
.col { width: 280px; flex: none; background: var(--bg-soft); border-radius: 12px; display: flex; flex-direction: column; max-height: 100%; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.col-head .muted { margin-left: auto; background: var(--bg); border-radius: 999px; padding: 0 8px; }
.col-body { padding: 4px 8px 10px; overflow-y: auto; min-height: 50px; display: flex; flex-direction: column; gap: 8px; }
.col.drag-over { box-shadow: inset 0 0 0 2px #ff9f1c; }
.card { background: var(--bg); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); border: 1px solid transparent; transition: transform 0.12s, box-shadow 0.12s; position: relative; }
.card:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(20, 26, 43, 0.1); }
.card.p1 { box-shadow: inset 3px 0 0 #ef4444, var(--shadow); }
.card.p2 { box-shadow: inset 3px 0 0 #f59e0b, var(--shadow); }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; background: var(--bg-hover); color: var(--text); white-space: nowrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.prio-1 { color: var(--os-danger); } .prio-2 { color: var(--os-warn); } .prio-3 { color: var(--os-link); } .prio-4 { color: var(--os-muted); }
.overdue { color: var(--os-danger); font-weight: 700; }
.task-table { flex: 1; overflow: auto; padding: 0 18px 18px; }
.task-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.task-table td, .task-table th { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.task-table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.task-table tr.group td { font-weight: 700; padding-top: 18px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.06em; }
.task-table tr.t:hover { background: var(--bg-soft); cursor: pointer; }
.task-detail { padding: 16px 18px 28px; }
.label-opt { cursor: pointer; border: 1px solid transparent; }
.label-opt.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--os-accent); }
.task-detail .title-input { resize: none; overflow: hidden; line-height: 1.3; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; border: 1px solid transparent; padding: 4px 8px; margin-left: -8px; background: transparent; }
.task-detail .title-input:hover { border-color: var(--border); }
.props { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; margin: 12px 0 16px; font-size: 14px; }
.props > .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; font-weight: 600; background: var(--bg-hover); }
.chip button { border: 0; background: none; padding: 0 4px; color: var(--muted); }
.md h1, .md h2, .md h3 { font-size: 16px; margin: 14px 0 4px; }
.md p { margin: 5px 0; }
.md ul, .md ol { margin: 5px 0; padding-left: 22px; }
.md li.check { list-style: none; margin-left: -20px; }
.md li.check.done { color: var(--muted); }
.md-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.md-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card, transparent); color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.md-tool:hover, .md-tool:focus-visible { background: var(--hover, rgba(0,0,0,.06)); }
@media (max-width: 600px) { .md-tool-label { display: none; } .md-tool { min-width: 44px; min-height: 44px; justify-content: center; } }
.desc-edit { min-height: 180px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.section-title { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 8px; }
.comment { padding: 10px 12px; margin: 6px 0; border-radius: 10px; background: var(--bg-soft); }
.comment .head { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.comment .routed { margin-top: 4px; display: flex; gap: 4px; align-items: center; }
.comment.agent { background: color-mix(in srgb, var(--link) 7%, var(--bg)); }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 360px; cursor: pointer; font-size: 14px; font-weight: 500; animation: pop 0.2s ease-out; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .side { position: fixed; inset: 0 auto 0 0; width: 290px; z-index: 40; transform: translateX(-105%); transition: transform 0.22s; border-radius: 0 22px 22px 0; }
  .shell.side-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .main { border-radius: 0; box-shadow: none; }
  .menu-toggle { display: inline-block; }
  .side-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
  .side-foot .me { flex: 1; font-weight: 700; }
  .panel { position: fixed; inset: 0; width: auto; z-index: 45; border-radius: 0; }
  input.search-box { display: none; }
  .main-head { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .main-head > .grow { min-width: 110px; }
  .main-head .btn { padding: 4px 9px; font-size: 13px; }
  .composer-bar .hint { display: none; }
  .secret-card { flex-wrap: wrap; }
  .secret-card > .grow { min-width: calc(100% - 40px); }
  .msg { margin: 0 4px; padding: 6px 10px; }
  .main-head .topic { display: none; }
  .main-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .composer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .file-img { max-width: 100%; }
  .props { grid-template-columns: 90px 1fr; }
}

/* Tasks: wider panel, inline controls, repeat */
.panel[data-kind=task] { width: min(620px, 44vw); }
.panel[data-kind=task].full { width: min(1080px, 74vw); }
.panel[data-kind=task] .props { grid-template-columns: 96px minmax(0, 1fr) 96px minmax(0, 1fr); }
.panel[data-kind=task] .props > div:not(.k) { min-width: 0; }
.panel[data-kind=task] .props select, .panel[data-kind=task] .props input[type=date] { max-width: 100%; }
.panel-head h3 .grow { flex: 1; }
.task-actions { gap: 8px; margin: 6px 0 2px; align-items: center; }
.tcheck { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--muted); background: var(--bg); color: transparent; display: inline-grid; place-items: center; padding: 0; cursor: pointer; font-size: 12px; transition: background 0.12s, color 0.12s, border-color 0.12s; }
.tcheck:hover { border-color: #16a34a; color: var(--os-success); }
.tcheck.on { background: #16a34a; border-color: #16a34a; color: #fff; }
.is-done [data-title] { text-decoration: line-through; color: var(--muted); }
.card-title { display: flex; gap: 8px; align-items: flex-start; }
.card-title .tcheck { margin-top: 1px; }
.task-table td.ck, .task-table th.ck { width: 28px; padding-right: 0; }
.task-table td.sel, .task-table th.sel { width: 32px; padding-right: 0; }
.task-table td.sel input, .task-table th.sel input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.task-table tr.is-sel { background: var(--accent-soft); }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 18px 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); font-size: 13px; position: sticky; top: 0; z-index: 2; }
.bulk-bar select, .bulk-bar input[type=date] { width: auto; min-height: 32px; font-size: 13px; }
.bulk-bar .bulk-date { display: inline-flex; align-items: center; gap: 4px; }
.bulk-bar .bulk-date span { color: var(--muted); }
.task-table td { vertical-align: middle; }
.title-cell { min-width: 220px; }
.inline-sel { width: auto; border: 1px solid transparent; background: transparent; padding: 3px 6px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: inherit; }
.inline-sel:hover, .inline-sel:focus { border-color: var(--border); background: var(--bg); }
.status-sel { background: color-mix(in srgb, var(--c) 14%, transparent); border-color: color-mix(in srgb, var(--c) 35%, transparent); text-transform: capitalize; }
.prio-sel.prio-0 { color: var(--muted); font-weight: 500; }
.prio-sel.prio-1 { color: var(--os-danger); } .prio-sel.prio-2 { color: var(--os-warn); } .prio-sel.prio-3 { color: var(--os-link); } .prio-sel.prio-4 { color: var(--muted); }
/* Priority flag and status pill (Joe, Nov 9): a picker instead of a dropdown. */
.prio-flag { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
button.prio-flag:hover, button.prio-flag:focus-visible { border-color: var(--border); background: var(--bg); }
.prio-flag.prio-1 { color: #dc2626; } .prio-flag.prio-2 { color: #d97706; } .prio-flag.prio-3 { color: #2563eb; } .prio-flag.prio-4 { color: #8a94a6; }
.prio-flag.prio-0 .i { opacity: .35; } tr.t:hover .prio-flag.prio-0 .i { opacity: .7; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 180px; min-height: 26px; padding: 2px 10px 2px 8px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, transparent); color: inherit; font: inherit; font-size: 12px; font-weight: 600; text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.status-pill::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.status-pill:hover, .status-pill:focus-visible { background: color-mix(in srgb, var(--c) 26%, transparent); }
.choose-item .status-dot { display: inline-block; width: 10px; height: 10px; background: var(--c); }
.choose-pop { padding: 4px; min-width: 180px; }
.choose-list { display: flex; flex-direction: column; }
.choose-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; text-transform: capitalize; cursor: pointer; }
.choose-item span:not(.prio-flag):not(.status-dot) { flex: 1; }
.choose-item:hover, .choose-item:focus-visible { background: var(--bg); outline: none; }
.choose-item.on { font-weight: 600; }
.choose-item .prio-flag { padding: 0; min-height: 0; }
.pop-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 2px 0 8px; }
.view-pop.sort-pop, .view-pop.choose-pop { width: auto; }
.view-pop.sort-pop .sort-row select { width: auto; }
.sort-pop { min-width: 320px; max-width: calc(100vw - 16px); }
.sort-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.sort-row select { flex: 1; min-width: 0; width: auto; }
.sort-n { width: 44px; flex: none; }
.due-cell { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 8px; cursor: pointer; white-space: nowrap; font-size: 13px; }
.due-cell:hover { background: var(--bg-hover); }
.due-cell.empty { color: var(--muted); opacity: 0.6; }
tr:hover .due-cell.empty, .card:hover .due-cell.empty { opacity: 1; }
.due-cell input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.due-cell input.shown { position: static; width: auto; height: auto; opacity: 1; pointer-events: auto; }
.assign-cell { border: 1px dashed transparent; background: none; padding: 2px 4px; border-radius: 999px; display: inline-flex; gap: 2px; align-items: center; cursor: pointer; color: var(--muted); min-width: 28px; min-height: 24px; }
.assign-cell:hover { border-color: var(--border); }
.inline-title { font: inherit; padding: 2px 6px; width: 100%; }
.quick-add { font-weight: 600; }
.popover { position: fixed; z-index: 90; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; width: 260px; }
.popover .pop-list { max-height: 260px; overflow-y: auto; margin-top: 6px; }
.pop-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.pop-item:hover { background: var(--bg-hover); }
.pop-item.hidden { display: none; }
@media (max-width: 900px) {
  .panel[data-kind=task], .panel[data-kind=task].full { width: auto; }
  .panel[data-kind=task] .props { grid-template-columns: 90px minmax(0, 1fr); }
  [data-act=widen] { display: none; }
}

/* Top bar tools: search, calendar, bell, settings */
.head-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.head-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.bell-count { position: absolute; top: -2px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.next-event { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-event.live { background: var(--os-live-bg); border-color: var(--os-line-strong); color: var(--os-live-ink); }
.note-list { padding: 4px 8px 16px; }
.note-item { display: flex; gap: 10px; padding: 10px 8px; border-radius: 10px; color: var(--text); text-decoration: none !important; align-items: flex-start; }
.note-item:hover { background: var(--bg-hover); }
.note-item > .i { margin-top: 3px; color: var(--muted); }
.note-item.unread { background: var(--accent-soft); }
.note-item.unread .note-title { font-weight: 700; }
.note-title { font-size: 14px; font-weight: 600; }
.note-body { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-day .section-title { margin-top: 16px; }
.cal-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.cal-item:hover { background: var(--bg-hover); }
.cal-item.past { opacity: 0.5; }
.cal-item.live { background: var(--os-live-bg); }
.cal-time { width: 64px; flex: none; font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.cal-bar { width: 3px; align-self: stretch; border-radius: 3px; flex: none; }
.cal-title { font-weight: 600; color: var(--text); display: block; }
@media (max-width: 900px) {
  .next-event { display: none; }
}
:root[data-theme=dark] .next-event.live, :root[data-theme=dark] .cal-item.live { background: #0b2e1d; border-color: #075e3a; color: #75e0a7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .next-event.live, :root:not([data-theme=light]) .cal-item.live { background: #0b2e1d; border-color: #075e3a; color: #75e0a7; } }

/* Admin: collapsible steps, archived people, delete choices */
.step-fold > summary, .archived-people > summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.step-fold > summary::-webkit-details-marker, .archived-people > summary::-webkit-details-marker { display: none; }
.step-fold > summary::after, .archived-people > summary::after { content: '▸'; color: var(--muted); font-size: 12px; order: -1; transition: transform 0.15s; }
.step-fold[open] > summary::after, .archived-people[open] > summary::after { transform: rotate(90deg); }
.archived-people { margin-top: 16px; }
.archived-people > summary { font-weight: 700; color: var(--text-2); padding: 6px 0; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 8px 0; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 4px; }

/* Layout: workspace rail, top bar with breadcrumbs, white sheet */
.rail { background: var(--side-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; }
.ws-tile { width: 38px; height: 38px; border-radius: 11px; display: block; position: relative; }
.ws-tile img { width: 100%; height: 100%; border-radius: 11px; display: block; }
.ws-tile.on::before { content: ''; position: absolute; left: -11px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.rail-sep { width: 26px; border-top: 1px solid var(--border); }
.ws-add { width: 32px; height: 32px; border-radius: 50%; border: 1.5px dashed var(--border); background: none; color: var(--muted); display: grid; place-items: center; }
.ws-add:hover { border-color: var(--muted); color: var(--text-2); }
.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 14px 0 8px; flex: none; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.crumb { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; padding: 5px 8px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; text-decoration: none !important; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.crumb .i { font-size: 13px; }
button.crumb:hover, a.crumb:hover { background: var(--bg-hover); color: var(--text-2); }
.crumb.cur { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--muted); font-size: 12px; opacity: 0.7; flex: none; }
.crumb-menu { max-height: 60vh; overflow-y: auto; }
.top-search { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 0 12px; background: var(--bg); color: var(--muted); height: 34px; margin-right: 4px; }
.top-search input { border: 0; outline: 0; background: none; padding: 0; width: 170px; box-shadow: none; }
.top-search:focus-within { border-color: var(--accent); }
.head-tools .icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; font-size: 17px; color: var(--text-2); }
.head-tools .cal-btn { width: auto; display: inline-flex; padding: 0 9px; border-radius: 999px; }
.head-avatar { border: 0; background: none; padding: 0; margin-left: 4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3px var(--border); }
.head-avatar .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.xs { width: 18px; height: 18px; font-size: 8px; }
.show-side { display: none; }
.shell.side-hidden .show-side { display: inline-grid; }
.sheet { flex: 1; display: flex; min-height: 0; background: var(--bg); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-top-left-radius: 14px; overflow: hidden; }
.shell.side-hidden .sheet { border-top-left-radius: 0; }
.sheet .panel { border-left: 1px solid var(--border); background: var(--bg); animation: slide-in 0.2s ease-out; }
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.menu-pop { animation: drop 0.14s ease-out; }
@keyframes drop { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.side-head { padding: 14px 10px 10px 16px; min-height: 52px; }
.side-head .app-name { font-size: 15px; }
.side .nav-item.active, .side .side-item.active { background: var(--bg); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(16, 24, 40, 0.05); }
.side .nav-item:hover:not(.active), .side .side-item:hover:not(.active) { background: var(--bg-hover); }
.side .jump-box { background: var(--bg); }
.side-nav { border-bottom: 0; }
.side-nav::after { content: ''; display: block; border-top: 1px solid var(--border); margin: 8px 4px 0; }
@media (max-width: 900px) {
  .shell, .shell.side-hidden { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .shell.side-hidden .side { visibility: visible; }
  .side { background: var(--bg); }
  .show-side, .shell.side-hidden .show-side, .hide-side { display: none; }
  .sheet { border-radius: 0; border-left: 0; }
  .top-search, .crumbs .crumb:not(.cur), .crumbs .crumb-sep { display: none; }
  .topbar { padding: max(0px, env(safe-area-inset-top)) 8px 0; }
}
.danger-zone { margin-top: 22px; border: 1px solid var(--os-danger); border-radius: 10px; padding: 12px 14px; background: color-mix(in srgb, #d92d20 5%, var(--bg)); }
.danger-zone .section-title { color: var(--os-danger); }

.main-head > .grow { min-width: min(240px, 100%); }
.main-head h2 { white-space: normal; }
.setup-steps { margin: 6px 0 14px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.setup-steps > summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
.setup-steps .steps { margin-top: 14px; }
.setup-steps .steps > li { color: var(--text-2); }
.setup-steps .copy-field { margin: 6px 0; max-width: 460px; }
.setup-steps pre { margin: 6px 0; }
.slack-list-import { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; }
.sync-line { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--border); }

/* Task views: saved-view tabs, toolbar, filter chips */
.view-box { padding: 6px 16px 0; }
.view-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); margin: 0 -16px; padding: 0 16px; }
.view-tab { border: 0; background: none; padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 5px; align-items: center; }
.view-tab:hover { color: var(--text-2); }
.view-tab.on { color: var(--accent-text); border-bottom-color: var(--accent); }
.view-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--bg); padding: 4px 10px; font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-soft); color: var(--accent-text); }
.chip-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.chip-btn:hover { border-color: var(--muted); }
.chip-btn.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.chip-btn input { margin: 0; }
.view-bar input.view-search { width: 200px; flex: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 2px 0 4px; }
.fchip { display: inline-flex; align-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 600; }
.fchip button { border: 0; background: none; color: inherit; padding: 3px 4px 3px 9px; font: inherit; }
.fchip .fchip-x { padding: 3px 7px 3px 2px; opacity: 0.7; }
.fchip .fchip-x:hover { opacity: 1; }
.link-btn { border: 0; background: none; color: var(--link); padding: 2px 4px; }
.view-pop { width: 280px; }
.view-pop select, .view-pop input[type=text], .view-pop input[type=number] { width: 100%; }
.view-pop .row select { width: auto; }
.view-pop button.pop-item { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: var(--text-2); }
.view-pop button.pop-item.on { color: var(--accent-text); font-weight: 600; }
.danger-text { color: var(--os-danger) !important; }

/* Agents */
.agents-area { flex: 1; overflow: auto; padding: 6px 24px 24px; }
.ag-team { margin-bottom: 8px; }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ag-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); text-decoration: none !important; transition: box-shadow 0.12s, transform 0.12s; }
.ag-card:hover { box-shadow: 0 8px 22px rgba(16, 24, 40, 0.08); transform: translateY(-1px); }
.ag-card.is-paused, .org-node.is-paused { opacity: 0.6; }
.ag-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ag-sum { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.ag-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; display: inline-grid; place-items: center; font-size: 18px; background: color-mix(in srgb, var(--c) 16%, var(--bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.ag-icon.big { width: 44px; height: 44px; font-size: 22px; }
.main-head h2 .ag-icon { width: 30px; height: 30px; font-size: 16px; }
.ag-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-2); }
.ag-badge.sched { color: var(--link); }
.ag-badge.ready { background: var(--os-live-bg); border-color: var(--os-line-strong); color: var(--os-live-ink); }
.ag-badge.paused { background: var(--os-partial-bg); border-color: var(--os-line-strong); color: var(--os-partial-ink); }
.ag-badge.skill { background: var(--os-info-bg); border-color: var(--os-line-strong); color: var(--os-info-ink); }
.ag-badge.role { background: var(--os-live-bg); border-color: var(--os-line-strong); color: var(--os-live-ink); }
.ag-badge.phone { background: var(--os-info-bg); border-color: var(--os-line-strong); color: var(--os-info-ink); }
.ag-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ag-stat { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.ag-stat strong { font-size: 20px; }
.ag-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ag-prompt { white-space: pre-wrap; max-height: 360px; overflow: auto; background: var(--bg-soft); border-radius: 8px; padding: 10px; font-size: 12.5px; }
.ag-calls tr[data-call] { cursor: pointer; }
.ag-calls tr[data-call]:hover { background: var(--bg-hover); }
.ag-badge.muted { color: var(--muted); }
.ag-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.ag-dot.ok { background: #12b76a; } .ag-dot.bad { background: #d92d20; }
.ag-page { flex: 1; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 18px 24px 32px; align-items: start; }
.ag-lede { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.ag-section p { margin: 4px 0; line-height: 1.55; }
.ag-caps { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ag-caps li { display: flex; gap: 8px; align-items: flex-start; }
.ag-caps .i { color: var(--os-success); margin-top: 3px; }
.ag-samples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ag-sample { border: 1px dashed var(--border); background: var(--bg-soft); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; text-align: left; color: var(--text-2); }
.ag-sample:hover { border-color: var(--accent); color: var(--accent-text); }
.ag-run { border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 16px; margin-top: 18px; background: var(--bg-soft); }
.ag-side { display: flex; flex-direction: column; gap: 12px; }
.ag-box { border: 1px solid var(--border); border-radius: 12px; padding: 2px 14px 12px; }
.ag-box .section-title { margin-top: 12px; }
.ag-box p { margin: 4px 0; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.ag-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 3px 9px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-2); text-decoration: none !important; }
.ag-chip:hover { border-color: var(--muted); }
.ag-feed-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; max-height: 160px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.share-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.share-row select { width: auto; }
/* org chart: nested lists with connector lines, plus an SVG layer for "feeds" arrows */
.org-legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 2px 0 8px; align-items: center; }
.org-line { display: inline-block; width: 26px; vertical-align: middle; border-top: 2px solid var(--muted); margin-right: 4px; }
.org-line.dashed { border-top-style: dashed; border-color: #5f55ee; }
.org-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); min-height: 300px; }
.org { position: relative; display: inline-block; min-width: 100%; padding: 24px 16px 32px; }
.org ul { display: flex; justify-content: center; padding: 22px 0 0; margin: 0; position: relative; list-style: none; }
.org > ul { padding-top: 0; }
.org li { display: flex; flex-direction: column; align-items: center; position: relative; padding: 22px 8px 0; }
.org > ul > li { padding-top: 0; }
.org li::before, .org li::after { content: ''; position: absolute; top: 0; width: 50%; height: 22px; border-top: 2px solid var(--border); }
.org li::before { right: 50%; }
.org li::after { left: 50%; border-left: 2px solid var(--border); }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: 22px; }
.org li:only-child > .org-node::before { content: ''; position: absolute; top: -22px; left: 50%; height: 22px; border-left: 2px solid var(--border); }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid var(--border); border-radius: 0 6px 0 0; }
.org li:first-child::after { border-radius: 6px 0 0 0; }
.org ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--border); }
.org > ul > li::before, .org > ul > li::after { display: none; }
.org-node { position: relative; }
.org-node.dim { opacity: 0.35; }
.org-card { display: flex; align-items: center; gap: 8px; width: 244px; padding: 8px 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--c, var(--accent)), 0 1px 2px rgba(16, 24, 40, 0.05); color: var(--text); text-decoration: none !important; position: relative; z-index: 1; }
a.org-card:hover { border-color: var(--muted); }
.org-card.root { --c: var(--accent); }
.org-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.25; }
.org-text strong { font-size: 13px; }
.org-text .small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.org-links { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; color: var(--os-info-ink); z-index: 2; }
.org-links path { fill: none; stroke-width: 1.8; stroke-dasharray: 5 4; opacity: 0.85; }
@media (max-width: 900px) {
  .ag-page { grid-template-columns: 1fr; padding: 12px; }
  .agents-area { padding: 6px 12px 16px; }
}
.view-bar select.chip-btn { width: auto; flex: none; }
.org-team { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: color-mix(in srgb, var(--c) 14%, var(--bg)); color: color-mix(in srgb, var(--c) 75%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); position: relative; z-index: 1; }
.org ul.stack { flex-direction: column; align-items: center; gap: 10px; }
.org ul.stack > li { padding: 0; }
.org ul.stack > li::before, .org ul.stack > li::after { display: none; }
.org ul.stack::after { content: ''; position: absolute; top: 22px; bottom: 24px; left: 50%; border-left: 2px solid var(--border); z-index: 0; }
.org ul.stack > li > .org-node::before { display: none; }

/* Org chart tidy-up: equal cards, a spine down stacked teams, focus mode for hand-offs */
.org-node { transition: opacity 0.15s; }
.org-node.faded { opacity: 0.25; }
.org-links-count { margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; flex: none; }
.org-text { flex: 1; }
.org-text .small { max-width: 160px; }
.org > ul > li > .org-node::before { display: none; }
.org ul.stack { padding-top: 22px; gap: 12px; }
.org ul.stack::before { height: 22px; }
.org ul.stack::after { top: 22px; bottom: 30px; z-index: 0; }
.org li { padding-left: 10px; padding-right: 10px; }
.org > ul > li:only-child { padding-top: 0; }
.cal-overdue { color: var(--os-danger); }
.cal-late { color: var(--os-danger); font-weight: 600; }
.side-space { display: flex; align-items: center; }
.side-space .icon-btn { margin-left: auto; padding: 2px; opacity: 0; }
.side-space:hover .icon-btn, .side-space .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .side-space .icon-btn { opacity: 1; } }
[hidden] { display: none !important; }

/* Session 2: status chips (Live / Partial / External / Gap), Move day counts, card GitHub and intake panels. */
.st-chip { display: inline-block; font: 600 12px/1 var(--os-mono); padding: 5px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.st-live { background: var(--os-live-bg); color: var(--os-live-ink); }
.st-partial { background: var(--os-partial-bg); color: var(--os-partial-ink); }
.st-external { background: var(--os-ext-bg); color: var(--os-ext-ink); }
.st-gap { background: var(--os-gap-bg); color: var(--os-gap-ink); }
.st-num { font: 600 20px/1.1 var(--os-mono); }
.table-scroll { overflow-x: auto; max-width: 100%; }
.grid .num { text-align: right; font-family: var(--os-mono); }
.gh-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.intake-panel { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--bg-soft); }
.intake-panel pre.spec { white-space: pre-wrap; font: 13px/1.5 inherit; max-height: 320px; overflow: auto; margin: 6px 0; }
.intake-panel textarea { width: 100%; min-height: 240px; }
/* Dialogs fit phone width: the grid track can shrink, so wide content scrolls inside instead of pushing the dialog off screen. */
.modal-back { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal-body { min-width: 0; overflow-x: auto; }

/* Collab design pass (docs/design-guide.md): Collab's admin window, Move day,
   client spaces and card extras. Help sits behind ⓘ, setup steps fold, and
   rows keep at most two visible buttons (the rest in a ⋯ menu). */
.adm-tabs { margin: 0 0 18px; }
.adm-tabs button { min-height: 36px; }
.adm-intro { margin: 0 0 12px; }
.adm-title { display: flex; align-items: center; gap: 4px; }
.adm-fold { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.adm-fold + .adm-fold { margin-top: 10px; }
.adm-fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px; cursor: pointer; border-radius: 12px; }
.adm-fold > summary::-webkit-details-marker { display: none; }
.adm-fold > summary:hover { background: var(--bg-hover); }
.adm-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.adm-fold[open] > summary { border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.adm-fold-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; font-weight: 700; font-size: 14.5px; }
.adm-count { font: 600 12px/1 ui-monospace, Menlo, monospace; padding: 4px 8px; border-radius: 999px; background: var(--bg-hover); color: var(--text-2); white-space: nowrap; }
.adm-fold-chev { color: var(--muted); transition: transform 0.15s; }
.adm-fold[open] .adm-fold-chev { transform: rotate(180deg); }
.adm-fold-body { padding: 12px 16px 16px; }
.adm-fold-body > .callout:first-child { margin-top: 0; }
.adm-add { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.adm-line { padding: 6px 0; border-bottom: 1px solid var(--border); }
.adm-how { margin: 6px 0 10px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; background: var(--bg-soft); }
.adm-how > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.adm-how[open] { padding-bottom: 10px; }
.adm-how ol { margin: 4px 0 6px; padding-left: 20px; }
.adm-how pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-card { margin: 10px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow); }
.adm-steps > li { padding-bottom: 22px; }
.adm-steps > li > strong { display: inline-flex; align-items: center; gap: 6px; }
.adm-steps > li > .row, .adm-steps > li > .btn { margin-top: 8px; }
.adm-row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.adm-form-title { margin: 0 0 8px; display: flex; align-items: center; gap: 2px; }
.md-safe .md-csv { margin-left: auto; }
/* Workflow bubbles and ⋯ menus inside Collab's dialogs (shared CSS in os.css). */
.modal .os-steps { margin: 0 0 16px; }
.modal .os-more > summary.btn { min-width: 36px; justify-content: center; }
.modal .os-more-pop { z-index: 60; }
.intake-panel .os-more { vertical-align: middle; }
@media (max-width: 700px) {
  .adm-fold > summary { padding: 8px 12px; }
  .adm-fold-body { padding: 12px; }
  .md-safe .md-csv { margin-left: 0; }
  .adm-row-actions { flex-wrap: wrap; justify-content: flex-start; }
}
.modal .setup-notice { padding: 0; }
.adm-add input[type=url], .adm-add input[type=text] { flex: 1 1 200px; width: auto; min-width: 0; }
.adm-add select { flex: 0 1 auto; max-width: 100%; }
.adm-fold .os-more-pop .danger { background: none; border: 0; }
/* ---------- Approvals inbox (Collab, Nov 3) ---------- */
.apv-bar { padding: 10px 24px 6px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.apv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.apv-tabs { margin: 0; }
.apv-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 360px; }
.apv-search .i { position: absolute; left: 9px; color: var(--muted); }
.apv-search input { padding-left: 30px; width: 100%; min-height: 36px; }
.apv-filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.apv-filters select { width: auto; min-height: 34px; }
.apv-filters .grow { flex: 1; }
.apv-strategy { margin: 0; color: var(--text-2); }
.apv-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; }
.apv-wrap.has-detail { grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.15fr); }
.apv-list { overflow: auto; padding: 12px 18px 24px; min-width: 0; }
.apv-detail { overflow: auto; border-left: 1px solid var(--border); background: var(--bg-soft); min-width: 0; }
.apv-bulk { position: sticky; top: -12px; z-index: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; margin: -4px 0 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.apv-bulk .grow { flex: 1; }
.apv-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.apv-card { display: grid; grid-template-columns: 32px 1fr; gap: 4px; padding: 10px 12px 10px 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.apv-card.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.apv-card.rec { border-left: 3px solid var(--os-live-ink); }
.apv-check { display: flex; justify-content: center; padding-top: 2px; }
.apv-check input { width: 20px; height: 20px; margin: 0; }
.apv-main { min-width: 0; display: grid; gap: 4px; }
.apv-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.apv-top .grow { flex: 1; }
.apv-agent { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-2); }
.apv-agent-icon { width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.apv-type { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--bg-hover); color: var(--text-2); }
.apv-status { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.apv-status.live { background: var(--os-live-bg); color: var(--os-live-ink); }
.apv-status.partial { background: var(--os-partial-bg); color: var(--os-partial-ink); }
.apv-status.ext { background: var(--os-ext-bg); color: var(--os-ext-ink); }
.apv-status.gap { background: var(--os-gap-bg); color: var(--os-gap-ink); }
.apv-rec { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--os-live-bg); color: var(--os-live-ink); }
.apv-title { font-weight: 650; font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.apv-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); }
.apv-k { font-family: var(--os-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.apv-preview { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.apv-blockers { margin: 4px 0 0; padding: 6px 10px 6px 26px; background: var(--os-gap-bg); color: var(--os-gap-ink); border-radius: 8px; }
.apv-warn { color: var(--os-gap-ink); }
.apv-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.apv-acts .btn { min-height: 36px; }
.apv-acts .grow { flex: 1; min-width: 200px; margin: 0; }
.apv-empty { padding: 40px 12px; text-align: center; color: var(--muted); }
.apv-d-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-soft); font-size: 12.5px; }
.apv-d-head .grow { flex: 1; }
.apv-back { display: none; }
.apv-close { min-width: 36px; min-height: 36px; }
.apv-d-body { padding: 14px 18px 28px; }
.apv-d-title { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.apv-decision { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); display: grid; gap: 3px; }
.apv-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.apv-fields .apv-field { margin: 8px 0; }
.apv-fields label.apv-field:has(textarea), .apv-fields .apv-field.ro:has(.apv-pre) { grid-column: 1 / -1; }
.apv-field.ro { display: grid; gap: 2px; font-size: 13.5px; overflow-wrap: anywhere; }
.apv-fields .apv-ro-wrap:has(.apv-pre) { grid-column: 1 / -1; }
.apv-ro-head { display: flex; align-items: center; gap: 6px; min-height: 28px; }
.apv-sentback { color: var(--os-info-ink); }
.apv-detail .apd-bar { margin: 12px -18px 0; padding: 12px 18px; }
.apv-field input, .apv-field textarea { width: 100%; }
.apv-pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; }
.apv-preview-box { margin: 12px 0; }
.apv-mail { margin-top: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); display: grid; gap: 4px; }
.apv-mail .apv-pre { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.apv-img { max-width: 100%; max-height: 320px; border-radius: var(--radius); object-fit: cover; }
.apv-art-title { margin: 8px 0 0; font-size: 17px; }
.apv-md { line-height: 1.55; } .apv-md h1, .apv-md h2 { font-size: 16px; margin: 14px 0 6px; } .apv-md h3 { font-size: 15px; margin: 12px 0 4px; } .apv-md p { margin: 0 0 10px; } .apv-md ul, .apv-md ol { margin: 0 0 10px; padding-left: 20px; }
.apv-faq dt { font-weight: 600; margin-top: 8px; } .apv-faq dd { margin: 2px 0 0; }
.apv-acts.sticky { position: sticky; bottom: -28px; padding: 10px 0; background: var(--bg-soft); }
@media (max-width: 900px) {
  .apv-bar { padding: 10px 12px 6px; }
  .apv-search { max-width: none; }
  .apv-list { padding: 10px 10px 20px; }
  .apv-wrap.has-detail { grid-template-columns: 1fr; }
  .apv-wrap.has-detail .apv-list { display: none; }
  .apv-detail { border-left: 0; }
  .apv-back { display: inline-flex; }
  .apv-close { display: none; }
  .apv-fields { grid-template-columns: 1fr; }
  .apv-d-body { padding: 12px 12px 24px; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .apv-blockers { background: #3a1410; color: #f8b4a8; }
  :root:not([data-theme=light]) .apv-warn { color: #f8b4a8; }
}
:root[data-theme=dark] .apv-blockers { background: #3a1410; color: #f8b4a8; }
:root[data-theme=dark] .apv-warn { color: #f8b4a8; }

/* Move day → What keeps syncing from Slack (moveday.js keepModal) */
.mk-tools { gap: 8px; margin: 8px 0; }
.mk-tools input[type=search] { flex: 1 1 200px; min-width: 0; }
.mk-bulk { gap: 6px; align-items: center; margin-bottom: 6px; }
.mk-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.mk-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); min-height: 44px; }
.mk-row:last-child { border-bottom: 0; }
.mk-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.mk-main > span { display: flex; flex-direction: column; min-width: 0; }
.mk-main input { width: 18px; height: 18px; flex: none; }
.mk-name { font-weight: 500; overflow-wrap: anywhere; }
.mk-del .mk-main { cursor: default; flex-direction: column; align-items: flex-start; gap: 0; padding-left: 28px; }
.mk-empty { padding: 12px; }
@media (max-width: 600px) { .mk-del { flex-wrap: wrap; } }

/* Workspace settings → Cleanup → Delete conversations (admin.js) */
.cc-tools { gap: 8px 14px; margin: 8px 0; align-items: center; }
.cc-tools input[type=search] { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.cc-chk { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; }
.cc-bar { gap: 8px; align-items: center; margin: 4px 0 8px; }
.cc-wrap { max-height: 52vh; overflow: auto; }
.cc-table td:first-child, .cc-table th:first-child { width: 36px; }
.cc-table input[type=checkbox] { width: 18px; height: 18px; }
.cc-off td:not(:first-child) { opacity: .75; }
.cc-table td:last-child { white-space: nowrap; }
.mk-bulk [data-count] { white-space: nowrap; }
@media (max-width: 600px) {
  .mk-bulk [data-count] { flex: 1 1 100%; }
  .cc-tools input[type=search] { flex-basis: 100%; max-width: none; }
  .cc-tools { gap: 0 14px; }
  .cc-table thead { display: none; }
  .cc-table, .cc-table tbody { display: block; }
  .cc-table tr { display: grid; grid-template-columns: 36px 1fr auto; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  table.cc-table.grid td { display: block; border: 0; padding: 0; background: none; }
  .cc-table td[data-label="Messages"] { font-family: inherit; }
  .cc-table td:first-child { grid-row: span 3; padding-top: 2px; }
  .cc-table td[data-label="Conversation"] { grid-column: 2 / 4; }
  .cc-table td[data-label="Kind"], .cc-table td[data-label="Last message"] { font-size: 13px; color: var(--muted); }
  .cc-table td[data-label="Messages"] { grid-column: 3; grid-row: 2; text-align: right; font-size: 13px; color: var(--muted); }
  .cc-table td[data-label="Messages"]::after { content: ' msgs'; }
  .cc-table td[data-label="Slack"] { grid-column: 3; grid-row: 3; text-align: right; }
}

/* Collab → Reorganize lists (reorganize.js) */
.ro-bar { gap: 8px; align-items: center; position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 4px 0 10px; border-bottom: 1px solid var(--border); }
.ro-bar select, .ro-bar input { width: auto; min-width: 0; flex: 0 1 200px; }
.ro-new { flex-basis: 100%; }
.ro-new input { width: 100%; max-width: 320px; }
.ro-spaces { display: grid; gap: 12px; margin-top: 12px; max-height: 58vh; overflow: auto; }
.ro-space { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; }
.ro-head { gap: 4px; align-items: center; min-height: 44px; }
.ro-lists { list-style: none; margin: 0; padding: 0; min-height: 36px; }
.ro-list { display: flex; align-items: center; gap: 6px; min-height: 44px; border-top: 1px solid var(--border); }
.ro-list[draggable=true] { cursor: grab; }
.ro-pick { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 44px; }
.ro-pick input { width: 18px; height: 18px; }
.ro-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ro-empty { padding: 10px 0; border-top: 1px solid var(--border); }
@media (max-width: 600px) { .ro-bar select, .ro-bar input { flex: 1 1 100%; } }

/* ---------- Meetings, calls and screen recordings (Session A2) ---------- */
.mtg-page { flex: 1; overflow: auto; padding: 14px 18px 24px; }
.mtg-page .os-steps { margin: 4px 0 14px; }
.mtg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.mtg-card { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.mtg-card > summary { cursor: pointer; min-height: 32px; }
.mtg-actions { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.mtg-actions li { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.mtg-actions li:last-child { border-bottom: 0; }
.mtg-actions input[type=date], .mtg-actions select { width: auto; }
.mtg-lines { max-height: 520px; overflow: auto; }
.mtg-lines p { margin: 0 0 10px; }
.mtg-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.clip-video { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.clip-rec { display: flex; align-items: center; gap: 10px; }
.clip-dot { width: 12px; height: 12px; border-radius: 50%; background: #C8381E; animation: clip-pulse 1.2s infinite; }
@keyframes clip-pulse { 50% { opacity: .35; } }
.linkish { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }
.error-note { color: var(--os-gap-ink); }
:root[data-theme=dark] .error-note { color: #F08A7A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .error-note { color: #F08A7A; } }
@media (max-width: 860px) { .mtg-grid { grid-template-columns: 1fr; } }

/* Wiki (ResQ Collab, Session 22; v2 from Joe's design review, Nov 9). Tokens only: every color,
   radius and space comes from tokens.css, the components from modern.css. */
.wk-area { flex: 1; overflow: auto; padding: var(--os-s4) var(--os-s6) var(--os-s7); container-type: inline-size; container-name: wk; }
:is(.wk-area, .modal) .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wk-area .wk-gap, .wk-area .os-stats.wk-gap { margin-top: var(--os-s4); }
.wk-area > .os-crumbs { margin-bottom: var(--os-s3); }
.wk-hero-icon { width: 44px; height: 44px; border-radius: var(--os-radius); }
.wk-empty { margin: 0; padding: var(--os-s3) var(--os-s-5); color: var(--os-muted); font-size: 13px; line-height: 18px; }
.wk-dim, .wk-row-sub { color: var(--os-subtle); font-size: 12px; line-height: 16px; }
.wk-row-sub { display: block; margin-top: 2px; }
.wk-note, .wk-sub-label { margin: var(--os-s2) 0 0; color: var(--os-muted); font-size: 13px; line-height: 18px; }
.wk-error { margin: var(--os-s2) 0 0; color: var(--os-danger); font-size: 13px; line-height: 18px; }
.wk-error:empty { display: none; }
.wk-warn { color: var(--os-partial-ink); font-weight: 600; }
.wk-notice-gap { background: var(--os-gap-bg); color: var(--os-gap-ink); }
.wk-area :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.modal :is(.wk-hist-list button, .wk-pick button):focus-visible { outline: 2px solid var(--os-focus); outline-offset: 2px; }

/* Home */
.wk-search { position: relative; display: flex; align-items: center; min-width: 0; }
.wk-search .i { position: absolute; left: 10px; color: var(--os-subtle); pointer-events: none; }
.wk-search input { width: 280px; max-width: 100%; height: var(--os-control-h); padding: 0 var(--os-s3) 0 32px; border: 1px solid var(--os-line-strong); border-radius: var(--os-radius-sm); background: var(--os-card); color: var(--os-ink); font: inherit; }

/* A page: tree · document · On this page */
.wk-cols3 { display: grid; gap: var(--os-s4); grid-template-columns: 240px minmax(0, 1fr) 200px; align-items: start; }
.wk-tree-card { position: sticky; top: 0; max-height: calc(100vh - 140px); overflow: auto; padding-bottom: var(--os-s2); }
.wk-tree-card .os-card-head h2 { font-size: 14px; line-height: 20px; }
.wk-tree-card .os-card-head a { color: var(--os-ink); text-decoration: none; }
.wk-tree-fold { display: none; }
.wk-tree-fold > summary, .wk-toc-fold > summary { cursor: pointer; list-style: none; min-height: var(--os-control-h); display: flex; align-items: center; gap: var(--os-s2); padding: 0 var(--os-s3); font-weight: 600; font-size: 13px; line-height: 18px; }
.wk-tree-fold > summary::-webkit-details-marker, .wk-toc-fold > summary::-webkit-details-marker { display: none; }
.wk-tree { list-style: none; margin: 0; padding: 0 var(--os-s2); }
.wk-tree .wk-tree { padding: 0 0 0 var(--os-s4); }
.wk-node { display: flex; align-items: center; gap: 2px; border-radius: var(--os-radius-sm); }
.wk-node:hover { background: var(--os-hover); }
.wk-node.on { background: var(--os-accent-soft); }
.wk-node.on a { color: var(--os-accent); font-weight: 600; }
.wk-node a { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--os-s2); padding: 6px var(--os-s2) 6px 0; color: var(--os-ink-2); text-decoration: none; font-size: 13px; line-height: 18px; }
.wk-node a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-twist { width: 24px; height: 24px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--os-subtle); border-radius: var(--os-radius-xs); cursor: pointer; padding: 0; }
.wk-twist:hover { background: var(--os-hover); color: var(--os-ink); }
.wk-twist-pad { width: 24px; flex: none; }
.wk-tree [draggable=true] .wk-node { cursor: grab; }
.wk-tree-box { padding: 0 0 var(--os-s2); }

.wk-doc { padding: var(--os-s6); min-width: 0; }
.wk-doc-head { display: flex; flex-direction: column; gap: var(--os-s2); padding-bottom: var(--os-s4); border-bottom: 1px solid var(--os-line); margin-bottom: var(--os-s5); }
.wk-doc-head > .os-notice { flex-wrap: wrap; }
.wk-title { margin: 0; font: 700 var(--os-text-2xl) var(--os-sans); letter-spacing: -0.015em; color: var(--os-ink); display: flex; flex-wrap: wrap; align-items: center; gap: var(--os-s2); }
.wk-chips { display: flex; flex-wrap: wrap; gap: var(--os-s2); }
.wk-chips:empty { display: none; }
.wk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--os-s1) var(--os-s3); color: var(--os-muted); font-size: 12px; line-height: 16px; }
.wk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--os-s2); margin-top: var(--os-s1); }
.wk-area .wk-actions .btn[aria-pressed=true] { color: var(--os-accent); background: var(--os-accent-soft); }
.wk-toc-fold { display: none; position: relative; }
.wk-toc-list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 240px; max-width: min(360px, 80vw); max-height: 50vh; overflow: auto; padding: var(--os-s2); background: var(--os-raised); border: 1px solid var(--os-line); border-radius: var(--os-radius); box-shadow: var(--os-shadow-md); display: flex; flex-direction: column; }
.wk-toc { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; padding: var(--os-s2) 0; max-height: calc(100vh - 140px); overflow: auto; }
.wk-toc .os-label { margin: 0 0 var(--os-s2); padding-left: var(--os-s3); }
.wk-toc a, .wk-toc-list a { display: block; padding: 4px var(--os-s3); border-left: 2px solid transparent; color: var(--os-muted); text-decoration: none; font-size: 13px; line-height: 18px; line-height: 1.35; }
.wk-toc a:hover, .wk-toc-list a:hover { color: var(--os-ink); }
.wk-toc a.on { color: var(--os-accent); border-left-color: var(--os-accent); font-weight: 600; }
:is(.wk-toc, .wk-toc-list) a.l3 { padding-left: calc(var(--os-s3) + var(--os-s3)); }
.wk-body { font-size: 15px; line-height: 1.65; color: var(--os-ink); max-width: 74ch; }
.wk-body :is(h1, h2, h3) { scroll-margin-top: var(--os-s4); color: var(--os-ink); }
.wk-body :is(table) { border-collapse: collapse; }
.wk-body :is(th, td) { border: 1px solid var(--os-line); padding: 6px var(--os-s2); }
.wk-img { max-width: 100%; height: auto; border-radius: var(--os-radius-sm); border: 1px solid var(--os-line); }
.wk-sub { margin-top: var(--os-s6); }
.wk-sub h2 { font: 600 var(--os-text-md) var(--os-sans); margin: 0 0 var(--os-s2); }
.wk-foot { margin-top: var(--os-s6); padding-top: var(--os-s3); border-top: 1px solid var(--os-line); color: var(--os-subtle); font-size: 12px; line-height: 16px; }

/* The editor */
.wk-editor { padding: var(--os-s5); display: flex; flex-direction: column; gap: var(--os-s3); }
.wk-ed-head { display: flex; flex-direction: column; gap: var(--os-s2); }
.wk-title-in { width: 100%; border: 0; border-bottom: 1px solid var(--os-line); background: transparent; color: var(--os-ink); font: 700 var(--os-text-2xl) var(--os-sans); padding: var(--os-s1) 0 var(--os-s2); }
.wk-title-in:focus { outline: none; border-bottom-color: var(--os-focus); }
.wk-ed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--os-s1); padding: var(--os-s1); border: 1px solid var(--os-line); border-radius: var(--os-radius-sm); background: var(--os-soft); }
.wk-ed-bar .wk-mode { margin-left: auto; }
.wk-split { display: grid; gap: var(--os-s3); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.wk-split[data-mode=write] { grid-template-columns: minmax(0, 1fr); }
.wk-split[data-mode=write] .wk-preview { display: none; }
.wk-split[data-mode=preview] { grid-template-columns: minmax(0, 1fr); }
.wk-split[data-mode=preview] label.wk-pane { display: none; }
.wk-pane { min-width: 0; }
.wk-text { width: 100%; min-height: 60vh; resize: vertical; padding: var(--os-s3); border: 1px solid var(--os-line-strong); border-radius: var(--os-radius-sm); background: var(--os-card); color: var(--os-ink); font: 14px/1.6 var(--os-code); }
.wk-preview { min-height: 60vh; max-height: 75vh; overflow: auto; padding: var(--os-s3) var(--os-s4); border: 1px solid var(--os-line); border-radius: var(--os-radius-sm); background: var(--os-ground); max-width: none; }
.wk-save-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--os-s2); padding: var(--os-s3) 0 0; border-top: 1px solid var(--os-line); background: var(--os-card); }
.wk-save-state { flex: 1 1 200px; color: var(--os-muted); font-size: 13px; line-height: 18px; }

/* Publish dialog */
.wk-reach { list-style: none; margin: var(--os-s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--os-s1); font-size: 13px; line-height: 18px; color: var(--os-ink-2); }
.wk-reach .i { color: var(--os-success); }

/* History */
.wk-hist-tabs { margin-bottom: var(--os-s3); }
.wk-hist { display: grid; gap: var(--os-s3); grid-template-columns: 240px minmax(0, 1fr); }
.wk-hist-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.wk-hist-list button { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: var(--os-s2) var(--os-s3); min-height: var(--os-control-h); border: 1px solid transparent; border-radius: var(--os-radius-sm); background: none; color: var(--os-ink); cursor: pointer; font: inherit; font-size: 13px; line-height: 18px; }
.wk-hist-list button:hover { background: var(--os-hover); }
.wk-hist-list button.on { background: var(--os-accent-soft); border-color: var(--os-accent); }
.wk-hist-sub { color: var(--os-subtle); font-size: 12px; line-height: 16px; }
.wk-hist-note { color: var(--os-ink-2); font-size: 12px; line-height: 16px; font-style: italic; }
.wk-compare { min-width: 0; max-height: 60vh; overflow: auto; }
.wk-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--os-s2); }
.wk-col-h { position: sticky; top: 0; padding: var(--os-s1) var(--os-s2); background: var(--os-soft); font-weight: 600; font-size: 12px; line-height: 16px; border-radius: var(--os-radius-xs); }
.wk-line { font: 12px/1.5 var(--os-code); white-space: pre-wrap; word-break: break-word; padding: 0 var(--os-s2); }
.wk-line.del { background: var(--os-gap-bg); color: var(--os-gap-ink); }
.wk-line.add { background: var(--os-live-bg); color: var(--os-live-ink); }
.wk-line.pad { background: var(--os-soft); }
.wk-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.wk-events li { display: flex; align-items: flex-start; gap: var(--os-s3); padding: var(--os-s2) 0; border-bottom: 1px solid var(--os-line); }
.wk-events .os-chip { flex: none; min-width: 120px; }
.wk-ev-main { font-size: 13px; line-height: 18px; color: var(--os-ink-2); }

/* Pickers */
.wk-list { list-style: none; margin: var(--os-s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--os-s1); max-height: 50vh; overflow: auto; }

/* Import from Drive */
.wk-protect { list-style: none; margin: 0; padding: var(--os-s4) var(--os-s-5); display: grid; gap: var(--os-s4); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wk-protect li { display: flex; gap: var(--os-s3); align-items: flex-start; }
.wk-protect b { display: block; font-size: 13px; line-height: 18px; color: var(--os-ink); }
.wk-protect span:not(.os-icon-box) { display: block; color: var(--os-muted); font-size: 12px; line-height: 16px; margin-top: 2px; }
.wk-import { display: grid; gap: var(--os-s4); grid-template-columns: minmax(0, 1fr); margin-top: var(--os-s4); align-items: start; }
.wk-import.has-insp { grid-template-columns: minmax(0, 1fr) 360px; }
.wk-import:not(.has-insp) .wk-insp { display: none; }
.wk-imp-main { min-width: 0; padding-top: var(--os-s3); }
.wk-views { margin: 0 var(--os-s-5) var(--os-s3); flex-wrap: wrap; }
.wk-table-wrap { overflow-x: auto; }
.wk-imp-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.wk-imp-table th { text-align: left; font: 600 var(--os-text-xs) var(--os-sans); color: var(--os-muted); padding: var(--os-s2) var(--os-s3); border-bottom: 1px solid var(--os-line); }
.wk-imp-table td { padding: var(--os-s2) var(--os-s3); border-bottom: 1px solid var(--os-line); vertical-align: top; }
.wk-imp-table tr.on td { background: var(--os-accent-soft); }
.wk-imp-table tbody tr:hover td { background: var(--os-hover); }
.wk-sel { width: 44px; }
.wk-check { display: inline-grid; place-items: center; width: 32px; height: 32px; cursor: pointer; }
.wk-check input { width: 18px; height: 18px; margin: 0; }
.wk-linkbtn { border: 0; background: none; padding: 0; color: var(--os-link); font: 600 var(--os-text-sm) var(--os-sans); text-align: left; cursor: pointer; }
.wk-linkbtn:hover { text-decoration: underline; }
.wk-insp { position: sticky; top: 0; padding: var(--os-s4) var(--os-s-5); max-height: calc(100vh - 260px); overflow: auto; display: flex; flex-direction: column; gap: var(--os-s3); }
.wk-insp-head { display: flex; align-items: flex-start; gap: var(--os-s2); }
.wk-insp-head h2 { flex: 1; margin: 0; font: 600 var(--os-text-lg) var(--os-sans); }
.wk-insp-chips { display: flex; flex-wrap: wrap; gap: var(--os-s2); }
.wk-insp-form { display: flex; flex-direction: column; gap: var(--os-s2); }
.wk-insp-form :is(input, select) { width: 100%; }
.wk-insp-sub { margin: var(--os-s2) 0 0; font: 600 var(--os-text-sm) var(--os-sans); display: flex; align-items: center; gap: var(--os-s2); }
.wk-excerpt { margin: 0; padding: var(--os-s3); max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--os-soft); border-radius: var(--os-radius-sm); font: 12px/1.5 var(--os-code); color: var(--os-ink-2); }
.wk-insp-acts { display: flex; flex-wrap: wrap; gap: var(--os-s2); padding-top: var(--os-s2); border-top: 1px solid var(--os-line); }
.wk-insp-empty { color: var(--os-muted); text-align: center; padding: var(--os-s6) var(--os-s3); font-size: 13px; line-height: 18px; }
.wk-imp-foot { position: sticky; bottom: var(--os-s3); z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: var(--os-s2); margin-top: var(--os-s4); padding: var(--os-s3) var(--os-s4); background: var(--os-raised); border: 1px solid var(--os-line); border-radius: var(--os-radius); box-shadow: var(--os-shadow-md); }
.wk-foot-sum { flex: 1 1 220px; font-size: 13px; line-height: 18px; color: var(--os-ink-2); }
.wk-prev-list { margin: var(--os-s1) 0 var(--os-s3); padding-left: var(--os-s5); font-size: 13px; line-height: 18px; display: flex; flex-direction: column; gap: var(--os-s1); }
.wk-prev-more summary { cursor: pointer; font-weight: 600; font-size: 13px; line-height: 18px; min-height: var(--os-control-h); display: flex; align-items: center; }

/* Narrower: two columns, the outline becomes a control by the heading */
@container wk (max-width: 1180px) {
  .wk-cols3 { grid-template-columns: 220px minmax(0, 1fr); }
  .wk-toc, .wk-toc-empty { display: none; }
  .wk-toc-fold { display: inline-block; }
}
@container wk (max-width: 1000px) {
  .wk-import.has-insp { grid-template-columns: minmax(0, 1fr) 300px; }
}
@container wk (max-width: 860px) {
  .wk-protect { grid-template-columns: minmax(0, 1fr); }
}
/* Phones: the document first, both navigations folded */
@container wk (max-width: 760px) {
  .wk-cols3 { grid-template-columns: minmax(0, 1fr); }
  .wk-tree-card { position: static; max-height: none; order: 2; }
  .wk-tree-card .os-card-head, .wk-tree-wide { display: none; }
  .wk-tree-fold { display: block; }
  .wk-doc { padding: var(--os-s4); }
  .wk-title { font-size: 20px; line-height: 28px; }
  .wk-split, .wk-split[data-mode=split] { grid-template-columns: minmax(0, 1fr); }
  .wk-text, .wk-preview { min-height: 40vh; }
  .wk-hist { grid-template-columns: minmax(0, 1fr); }
  .wk-hist-list { max-height: 30vh; }
  .wk-cols { grid-template-columns: minmax(0, 1fr); }
  .wk-search, .wk-search input { width: 100%; }
  .os-identity-acts:has(.wk-search) { flex-wrap: wrap; width: 100%; }
  .wk-imp-table thead { display: none; }
  .wk-imp-table tr { display: grid; grid-template-columns: 44px minmax(0, 1fr); padding: var(--os-s2) 0; border-bottom: 1px solid var(--os-line); }
  .wk-imp-table td { border: 0; padding: 2px var(--os-s2); }
  .wk-imp-table td:nth-child(n+3) { grid-column: 2; }
  .wk-imp-table td[data-label]:empty { display: none; }
  .wk-imp-table td[data-label]::before { content: attr(data-label) ': '; color: var(--os-subtle); font-size: 12px; line-height: 16px; }
  /* The inspector covers the screen on a phone. */
  .wk-import.has-insp { grid-template-columns: minmax(0, 1fr); }
  .wk-import.has-insp .wk-insp { position: fixed; inset: 0; z-index: 50; max-height: none; border-radius: 0; padding: var(--os-s4); }
  .wk-area { padding: var(--os-s3) var(--os-s4) var(--os-s6); }
}
/* Touch: 44px targets */
@media (pointer: coarse) {
  .wk-node a, .wk-twist, .wk-toc a, .wk-toc-list a, .wk-check { min-height: var(--os-touch); }
  .wk-twist { width: var(--os-touch); }
  .wk-check { width: var(--os-touch); }
  .wk-area .btn, .modal .wk-hist-list button { min-height: var(--os-touch); }
}
/* In the narrow inspector, label above value. */
.wk-insp .os-kv > div { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: var(--os-s2) 0; min-height: 0; }
.wk-insp .os-kv dd { font-size: 13px; line-height: 18px; }
.wk-insp .os-kv dt { font-size: 12px; line-height: 16px; }
.wk-card-body { padding: var(--os-s3) var(--os-s-5) var(--os-s4); display: flex; flex-direction: column; gap: var(--os-s2); }

/* ---------- Task description editor, ClickUp style (rich-desc.js; Joe, Nov 13) ---------- */
.desc-head { align-items: center; gap: 8px; }
.rd-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); min-height: 20px; }
.rd-status .i { width: 14px; height: 14px; }
.rd-status[data-state="saved"] { color: var(--os-live-ink); }
.rd-status[data-state="error"] { color: var(--os-danger); }
.rd-spin { width: 10px; height: 10px; border: 2px solid var(--os-line-strong); border-top-color: var(--os-accent); border-radius: 50%; animation: rd-spin .8s linear infinite; }
@keyframes rd-spin { to { transform: rotate(360deg); } }
.rd { position: relative; }
.rd-tools { display: flex; align-items: center; gap: 2px; padding: 4px; margin: 4px 0 6px; border: 1px solid var(--border); border-radius: var(--os-radius-sm); background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.rd-tools[hidden] { display: none; }
.rd-tools::-webkit-scrollbar { display: none; }
.rd-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: var(--os-radius-xs); background: transparent; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.rd-btn:hover, .rd-btn[aria-expanded="true"] { background: var(--bg-hover); color: var(--text); }
.rd-btn:focus-visible { outline: 3px solid var(--os-focus); outline-offset: 1px; }
.rd-btn .i { width: 16px; height: 16px; }
.rd-btn .rd-caret { width: 12px; height: 12px; opacity: .7; }
.rd-sep { flex: none; width: 1px; height: 20px; margin: 0 4px; background: var(--border); }
.rd-g { font-weight: 600; font-size: 14px; line-height: 1; }
.rd-g-i { font-style: italic; font-family: Georgia, serif; }
.rd-g-s { text-decoration: line-through; }
.rd-g-c { font-family: var(--os-mono); font-size: 12px; }
.rd-notice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 6px; border-radius: var(--os-radius-sm); background: var(--os-warn-bg); color: var(--os-warn); font-size: 13px; }
.rd-notice[hidden] { display: none; }
.rd-notice .i { width: 16px; height: 16px; }
.rd-doc { min-height: 64px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--os-radius-sm); outline: none; cursor: text; word-break: break-word; }
.rd-doc:hover { background: var(--bg-soft); }
.rd-focus .rd-doc, .rd-focus .rd-doc:hover { background: transparent; box-shadow: 0 0 0 3px var(--os-focus); }
.rd-doc { position: relative; }
.rd-doc.rd-empty::before { content: attr(data-placeholder); position: absolute; left: 8px; right: 8px; top: 6px; line-height: 1.6; color: var(--muted); pointer-events: none; }
.rd-b { display: flex; align-items: flex-start; gap: 8px; padding-left: calc(var(--d, 0) * 24px); min-height: 1.6em; line-height: 1.6; }
.rd-t { flex: 1; min-width: 0; white-space: pre-wrap; }
.rd-b[data-type="ul"]::before { content: '•'; flex: none; width: 18px; text-align: center; color: var(--text-2); font-weight: 700; }
.rd-b[data-type="ol"]::before { content: attr(data-n); flex: none; min-width: 18px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rd-b[data-type="h"] { font-weight: 600; margin-top: 10px; }
.rd-b[data-type="h"][data-level="1"] { font-size: 20px; }
.rd-b[data-type="h"][data-level="2"] { font-size: 17px; }
.rd-b[data-type="h"][data-level="3"] { font-size: 15px; }
.rd-b[data-type="quote"] { border-left: 3px solid var(--border); padding-left: 10px; color: var(--text-2); }
.rd-b[data-type="code"] .rd-t { margin: 4px 0; padding: 8px 10px; border-radius: var(--os-radius-sm); background: var(--bg-soft); font-family: var(--os-mono); font-size: 13px; }
.rd-box { flex: none; position: relative; width: 18px; height: 18px; margin-top: .2em; border: 1.5px solid var(--os-line-strong); border-radius: 50%; cursor: pointer; user-select: none; }
.rd-box::after { content: ''; position: absolute; inset: -13px; } /* 44px to tap */
.rd-box:hover { border-color: var(--os-accent); }
.rd-b[data-checked="1"] .rd-box { background: var(--os-accent-bg); border-color: var(--os-accent-bg); }
.rd-b[data-checked="1"] .rd-box::before { content: ''; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.rd-b[data-checked="1"] .rd-t { color: var(--muted); text-decoration: line-through; }
.rd-doc a { color: var(--link); }
.rd-doc code { font-family: var(--os-mono); font-size: .9em; padding: 1px 4px; border-radius: 4px; background: var(--bg-soft); }
.rd-tok { display: inline; }
.rd-tok a { pointer-events: auto; }
.rd-pop { position: fixed; z-index: 60; min-width: 240px; max-width: min(320px, calc(100vw - 16px)); max-height: 300px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: var(--os-radius); background: var(--bg); box-shadow: var(--shadow-lg); }
.rd-pop[hidden] { display: none; }
.rd-item { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 10px; border-radius: var(--os-radius-xs); cursor: pointer; font-size: 14px; }
.rd-item.sel, .rd-item:hover { background: var(--bg-hover); }
.rd-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 1px solid var(--border); border-radius: var(--os-radius-xs); font-size: 12px; font-weight: 600; color: var(--text-2); }
.rd-kbd { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rd-on { width: 16px; height: 16px; color: var(--os-accent); }
.rd-none { padding: 8px 10px; }
.rd-linkpop { padding: 12px; min-width: 280px; }
.rd-linkform .row { gap: 6px; margin-top: 8px; }
.nt-desc .rd-doc { border: 1px solid var(--border); margin: 0; min-height: 96px; }
@media (max-width: 640px) {
  .rd-btn { min-width: 40px; height: 40px; }
  .rd-item { min-height: 44px; }
  .rd-pop.rd-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; max-width: none; border-radius: 16px 16px 0 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
}

/* ---------- Copy a message (Joe, Nov 13) ---------- */
.msg.flash { animation: msg-flash 2.4s ease-out; }
@keyframes msg-flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.msg-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); }
.msg-sheet-back { position: fixed; inset: 0; z-index: 69; background: var(--os-overlay, rgba(15,23,42,.35)); }
.msg-sheet button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: var(--os-radius-sm); background: none; color: var(--text); font: inherit; font-size: 15px; text-align: left; }
.msg-sheet button:active { background: var(--bg-hover); }
.msg-sheet .i { width: 18px; height: 18px; color: var(--text-2); }
.msg-menu { position: fixed; z-index: 60; min-width: 220px; padding: 4px; border: 1px solid var(--border); border-radius: var(--os-radius); background: var(--bg); box-shadow: var(--shadow-lg); }
.msg-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--os-radius-xs); background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.msg-menu button:hover, .msg-menu button:focus-visible { background: var(--bg-hover); outline: none; }
.msg-menu .i { width: 16px; height: 16px; color: var(--text-2); }
.msg.pressed { background: var(--bg-hover); }
