/* Black — RVLock brand theme: deep warm charcoal in place of black (owner choice; logo artwork stays black), charcoal rail, Light Gray sidebar, RVLock Rust (used sparingly as the pop), Warm Gray for secondary text. Montserrat, self-hosted (no outside requests). */
/* Montserrat: the brand guide's webfont substitute for Gotham. Self-hosted (SIL OFL, see fonts/Montserrat-OFL.txt). */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/montserrat-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/montserrat-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url(fonts/montserrat-latin-wght-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  /* RVLock brand palette */
  --brand-black: #000000;
  --charcoal: #2b2825;           /* deep warm charcoal: used everywhere the UI was black */
  --brand-rust: #d34227;        /* Pantone 7597 C, primary */
  --brand-light-rust: #e06036;  /* Pantone 166 U, secondary */
  --brand-warm-gray: #65665c;   /* Pantone 417 C, tertiary */
  --brand-light-gray: #e0dacd;  /* Pantone 7527 C, tertiary */

  --rail: var(--charcoal);
  --rail-text: #ffffff;
  --rail-muted: #a8a39b;
  --rail-hover: #3d3934;
  --side: var(--brand-light-gray);
  --side-deep: #ece8df;
  --side-hover: #d3ccbd;
  --side-active: var(--brand-rust);
  --side-active-text: #ffffff;
  --side-text: var(--charcoal);
  --side-muted: var(--brand-warm-gray);
  --side-line: #b9b1a1;
  --rust: var(--brand-rust);
  --rust-strong: #b3361f;
  --rust-light: var(--brand-light-rust);
  --rust-soft: #fbe9e4;
  --on-rust: #ffffff;
  --bg: #ffffff;
  --panel: #ffffff;
  --text: var(--charcoal);
  --muted: var(--brand-warm-gray);
  --line: var(--brand-light-gray);
  --hover: #f5f3ef;
  --mention-bg: #fbe9e4;
  --mention-text: #a3301b;
  --danger: #a3301b;
  --online: #5e9a5a;
  --badge: var(--charcoal);
  --badge-text: #ffffff;
  --code-bg: #eeeeeb;
  --shadow: 0 10px 30px rgba(43, 40, 37, .2);
  --radius: 10px;
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --panel: #1a1a1a; --text: #ededeb; --muted: #a9aa9f; --line: #333331;
    --hover: #242423; --mention-bg: #3b1f18; --mention-text: #f0896a; --code-bg: #252524;
    --rust-soft: #3b211a; --rust-strong: #ec7653; --danger: #ec7653;
    /* A bright sidebar glares in dark mode, so it goes dark neutral there. */
    --side: #1c1c1c; --side-deep: #141414; --side-hover: #2a2a2a; --side-text: #f2f2f2;
    --side-muted: #a0a0a0; --side-line: #2a2a2a; --badge: var(--brand-rust);
  }
  /* Black logo artwork becomes white on dark backgrounds (brand guide). */
  .brand-ink { filter: invert(1); }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; } /* panes scroll on their own; never let the page itself shift (e.g. when focusing a floating panel) */
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--rail); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--rust-strong); }
svg { flex-shrink: 0; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 72px 280px 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.shell.with-thread { grid-template-columns: 72px 280px 1fr 380px; }
.shell.with-todo { grid-template-columns: 72px 280px 1fr 330px; }
.shell.with-thread.with-todo { grid-template-columns: 72px 280px 1fr 360px 330px; }
.rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 14px 0 12px; gap: 6px; padding-top: max(14px, env(safe-area-inset-top)); min-height: 0; overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { flex-shrink: 0; }
@media (max-height: 700px) { .rail { gap: 2px; } .rail-btn { padding: 3px 0; } .rail-logo { margin-bottom: 4px; } }
.ws-logo { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 10px; }
.rail-btn { width: 60px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--rail-muted); font-size: 11px; padding: 6px 0; border-radius: 10px; position: relative; }
.rail-btn .ico { width: 40px; height: 34px; display: grid; place-items: center; border-radius: 9px; }
.rail-btn:hover .ico { background: var(--rail-hover); color: var(--rail-text); }
.rail-btn.active { color: var(--rail-text); }
.rail-btn.active .ico { background: var(--rail-hover); color: var(--rust); }
.rail-btn .dot { position: absolute; top: 6px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--rust); border: 2px solid var(--rail); }
.rail-spacer { flex: 1; }
.rail .me { margin-top: 6px; }

.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; min-width: 0; border-right: 2px solid var(--side-line); padding-top: env(safe-area-inset-top); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.side-head h1 { font-size: 21px; margin: 0; line-height: 1.1; }
/* RVLock word mark image (official artwork). */
.wm-img { display: block; height: 38px; width: auto; }
.ws-logo { object-fit: contain; }
/* Rail logo: black padlock on an RVLock Rust tile, so the lion shows Rust (owner-approved use of Rust with the logo). */
.rail-logo { width: 44px; height: 44px; border-radius: 11px; background: var(--brand-rust); display: grid; place-items: center; margin-bottom: 10px; flex-shrink: 0; }
.rail-logo .ws-logo { margin: 0; filter: none; }
.side-head .sub { font-size: 9.5px; color: var(--side-muted); text-transform: uppercase; letter-spacing: .14em; font-weight: 600; margin-top: 5px; white-space: nowrap; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: inherit; }
.sidebar .icon-btn:hover { background: var(--side-hover); }
.main .icon-btn:hover, .thread .icon-btn:hover, .modal .icon-btn:hover { background: var(--hover); }
.jump { margin: 0 12px 10px; display: flex; align-items: center; gap: 8px; background: var(--side-deep); border: 2px solid var(--side-line); border-radius: 8px; padding: 7px 10px; color: var(--side-muted); }
.jump input { background: none; border: 0; outline: none; color: var(--side-text); width: 100%; }
.gsearch:focus-within { border-color: var(--rust); }
.gs-kbd { font-size: 10.5px; font-weight: 700; color: var(--side-muted); border: 1px solid var(--side-line); border-radius: 5px; padding: 0 5px; white-space: nowrap; }
.gsearch:focus-within .gs-kbd { display: none; }
.gs-pop { position: fixed; z-index: 70; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; max-height: 70vh; overflow-y: auto; }
.gs-group { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 8px 10px 4px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.gs-item.sel, .gs-item:hover { background: var(--rust-soft); }
.gs-item.gs-all { border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 0 8px 8px; color: var(--rust-strong); font-weight: 700; }
.gs-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: auto; padding-left: 8px; }
.gs-empty { padding: 14px; color: var(--muted); text-align: center; }
.mobile-search { display: none !important; }
.side-scroll { overflow-y: auto; flex: 1; padding-bottom: 20px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 5px 12px; margin: 1px 8px; border-radius: 7px; color: var(--side-text); cursor: pointer; width: calc(100% - 16px); text-align: left; min-height: 32px; }
.side-item:hover { background: var(--side-hover); }
/* Active item: Rust tab with a slanted edge, echoing the brand's page-number tabs. */
.side-item.active { background: var(--side-active); color: var(--side-active-text); border-radius: 7px 0 0 7px; padding-right: 20px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.side-item.quick .muted-ico { color: var(--rust); }
.side-item.active .muted-ico { color: var(--side-active-text); }
.side-item.unread { font-weight: 800; color: var(--side-text); }
.side-item.active.unread { color: var(--side-active-text); }
/* Sidebar + rail run a heavier weight and thicker icon lines than the main pane. */
.sidebar .side-item, .side-head .sub, .rail-btn { font-weight: 600; }
.sidebar .ico-wrap svg, .rail .ico-wrap svg { stroke-width: 2.4; }
.sidebar .side-item.unread { font-weight: 800; }
.side-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-ico { color: var(--side-muted); width: 18px; display: grid; place-items: center; }
.badge { background: var(--badge); color: var(--badge-text); font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; min-width: 20px; text-align: center; }
.section { margin-top: 14px; }
.section-head { display: flex; align-items: center; gap: 6px; padding: 4px 16px; color: var(--side-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.section-head button.toggle { display: flex; gap: 6px; align-items: center; flex: 1; text-align: left; }
.section-head .icon-btn { width: 24px; height: 24px; }
.section-head .chev { transition: transform .15s; }
.section.collapsed .chev { transform: rotate(-90deg); }
.section.collapsed .section-body { display: none; }
.add-row { color: var(--side-muted); }

/* avatars */
.avatar { border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; position: relative; user-select: none; }
.avatar .pres { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--side); background: transparent; }
.avatar .pres.on { background: var(--online); }
.avatar .pres.away { border-color: var(--side); box-shadow: inset 0 0 0 2px var(--side-muted); background: var(--side); }
.avatar .pres.off { display: none; }
/* Dot after a person's name: green = active now, hollow = Away (open but idle), nothing = offline */
.ndot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px 0 6px; vertical-align: 1px; flex-shrink: 0; }
.ndot.on { background: var(--online); }
.ndot.away { box-shadow: inset 0 0 0 1.5px var(--muted); }
.ndot.off { display: none; }
.main .avatar .pres, .thread .avatar .pres, .modal .avatar .pres { border-color: var(--panel); }

/* ---------- main pane ---------- */
.main { background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.main-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 58px; background: var(--panel); padding-top: max(10px, env(safe-area-inset-top)); }
.main-head .title { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.main-head .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-head .topic { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.main-head .actions { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.member-pill { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px 3px 4px; font-size: 13px; color: var(--muted); }
.back-btn { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 8px 0 12px; overscroll-behavior: contain; }
.day { display: flex; align-items: center; gap: 12px; margin: 16px 20px 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 6px 20px; position: relative; }
.msg:hover, .msg.focus { background: var(--hover); }
.msg.cont { padding-top: 1px; padding-bottom: 1px; }
.msg.cont .gutter-time { visibility: hidden; font-size: 10px; color: var(--muted); text-align: right; padding-top: 4px; white-space: nowrap; height: 0; overflow: visible; }
.msg.cont:hover .gutter-time { visibility: visible; }
.msg.highlight { background: var(--mention-bg); transition: background 1.5s; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-name { font-weight: 700; cursor: pointer; }
.msg-name:hover { text-decoration: underline; }
.msg-time { color: var(--muted); font-size: 12px; }
.msg-body { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-body.deleted { color: var(--muted); font-style: italic; }
.msg-body code { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.msg-body pre { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 10px 12px; border-radius: 8px; margin: 4px 0; overflow-x: auto; white-space: pre; }
/* Rich text from the formatting bar */
.msg-body .md-quote { display: block; border-left: 3px solid var(--muted); padding-left: 10px; color: var(--muted); }
.msg-body .md-li { display: block; position: relative; padding-left: 22px; }
.msg-body .md-li::before { content: "•"; position: absolute; left: 7px; }
.msg-body .md-ol::before { content: attr(data-n); left: 0; min-width: 18px; text-align: right; }
.media-att { max-width: min(420px, 100%); }
.media-att video { width: 100%; max-height: 300px; border-radius: 8px; background: #000; display: block; }
.media-att.audio audio { width: min(340px, 100%); display: block; }
.media-att .fmeta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.msg-body .mention { background: var(--mention-bg); color: var(--mention-text); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.msg-body .chan-link { color: var(--rust-strong); font-weight: 600; cursor: pointer; }
.edited { color: var(--muted); font-size: 12px; }
.msg-tools { position: absolute; right: 16px; top: -14px; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 2px 8px rgba(0,0,0,.08); padding: 2px; z-index: 2; }
.msg:hover .msg-tools, .msg.tools-open .msg-tools { display: flex; }
.msg-tools button { width: 32px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); }
.msg-tools button:hover { background: var(--hover); color: var(--text); }
.msg-tools button.on { color: var(--rust-strong); }
.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.reaction { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 1px 8px; font-size: 13px; display: flex; gap: 5px; align-items: center; }
.reaction.mine { border-color: var(--rust); background: var(--rust-soft); }
.reaction .n { font-weight: 600; color: var(--muted); font-size: 12px; }
.thread-link { display: flex; align-items: center; gap: 8px; margin-top: 5px; padding: 4px 6px; border-radius: 7px; border: 1px solid transparent; font-size: 13px; color: var(--rust-strong); font-weight: 600; width: fit-content; }
.thread-link:hover { background: var(--panel); border-color: var(--line); }
.thread-link .when { color: var(--muted); font-weight: 400; }
.mini-avatars { display: flex; }
.mini-avatars .avatar { margin-right: -4px; border: 2px solid var(--bg); }

.files-in-msg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.img-att { max-width: min(360px, 100%); max-height: 280px; border-radius: 8px; border: 1px solid var(--line); display: block; cursor: zoom-in; object-fit: cover; background: var(--code-bg); }
.file-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 12px; text-decoration: none; color: var(--text); max-width: 340px; min-width: 220px; }
.file-card:hover { border-color: var(--rust); }
.file-card .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fmeta { font-size: 12px; color: var(--muted); }
.ftype { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; flex-shrink: 0; letter-spacing: .02em; }

.empty-channel { padding: 28px 20px 10px; }
/* Channel title in the brand guide's header style: extra bold, uppercase. */
.empty-channel h2 { margin: 0 0 6px; font-size: 30px; font-weight: 800; text-transform: uppercase; letter-spacing: -.005em; line-height: 1.1; }
.empty-channel p { color: var(--muted); margin: 0; }
.load-more { display: block; margin: 8px auto; color: var(--rust-strong); font-weight: 600; font-size: 13px; }

/* composer */
.composer-wrap { padding: 0 16px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.typing { height: 18px; font-size: 12px; color: var(--muted); padding: 0 6px 2px; }
.composer { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; overflow: hidden; }
.composer:focus-within { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(211,66,39,.18); }
/* Formatting bar (toggled with Aa) */
.fmt-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; background: var(--hover); border-bottom: 1px solid var(--line); overflow-x: auto; }
.fmt-btn { width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.fmt-btn:hover { background: var(--panel); color: var(--text); }
.composer .sep { width: 1px; height: 18px; background: var(--line); margin: 0 5px; flex-shrink: 0; }
.ta-wrap { padding: 8px 12px 2px; position: relative; }
.ce { width: 100%; outline: none; max-height: 220px; min-height: 24px; overflow-y: auto; line-height: 1.45; padding: 2px 0; word-wrap: break-word; overflow-wrap: anywhere; }
.ce.is-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; position: absolute; }
.ce ul, .ce ol { margin: 2px 0; padding-left: 22px; }
.ce blockquote { margin: 2px 0; border-left: 3px solid var(--muted); padding-left: 10px; color: var(--muted); }
.ce pre { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 8px 10px; border-radius: 8px; margin: 4px 0; white-space: pre-wrap; }
.ce code { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; color: var(--rust-strong); }
.ce a { color: var(--rust-strong); }
.fmt-btn.on { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.composer .pending-files { padding: 8px 12px 0; }
.composer-row { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px; }
.composer-row .grow { flex: 1; }
.composer-row .icon-btn { color: var(--muted); }
.composer-row .icon-btn:hover { color: var(--text); }
.plus-btn { border-radius: 50% !important; background: var(--hover); }
.aa-btn { font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.aa-btn.on { color: var(--text) !important; background: var(--hover); }
/* Send + schedule split button */
.send-group { display: flex; align-items: stretch; border-radius: 8px; overflow: hidden; }
.send-btn { background: var(--rust); color: var(--on-rust); width: 36px; height: 30px; display: grid; place-items: center; }
.send-more { background: var(--rust); color: var(--on-rust); width: 24px; display: grid; place-items: center; border-left: 1px solid rgba(255,255,255,.35); }
.send-btn:disabled, .send-more:disabled { background: var(--hover); color: var(--muted); cursor: default; border-left-color: var(--line); }
/* Popup menus (+ menu, schedule menu) */
.pop-menu { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; }
.pm-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; font-size: 14px; }
.pm-item:hover { background: var(--rust); color: var(--on-rust); }
.pm-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 6px 10px 4px; }
.pm-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.pop-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 8px 12px 4px; }
.cmd-row { gap: 14px; }
.cmd-name { font-weight: 700; white-space: nowrap; }
/* Scheduled messages list */
.sched-list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.sched-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sched-when { font-size: 12px; font-weight: 700; color: var(--rust-strong); display: flex; align-items: center; gap: 2px; }
.sched-body { white-space: pre-wrap; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* Clip recorder */
.rec-stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; min-height: 120px; display: grid; place-items: center; }
.rec-preview { width: 100%; display: block; max-height: 60vh; background: #000; }
.rec-audio { color: #fff; padding: 36px; }
.rec-time { position: absolute; left: 10px; top: 10px; background: var(--rust); color: #fff; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 8px; }
.rec-note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.field-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--bg); outline: none; }
.field-input:focus { border-color: var(--rust); }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.pending-file { display: flex; align-items: center; gap: 6px; background: var(--hover); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px 4px 8px; font-size: 13px; max-width: 240px; }
.pending-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-file img { width: 28px; height: 28px; object-fit: cover; border-radius: 5px; }
.hint { font-size: 11px; color: var(--muted); }
.drop-overlay { position: absolute; inset: 0; background: rgba(211,66,39,.16); border: 3px dashed var(--rust); display: grid; place-items: center; font-weight: 700; font-size: 18px; color: var(--rust-strong); z-index: 20; pointer-events: none; }
.join-bar { margin: 0 16px 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-align: center; background: var(--panel); }

/* thread pane */
.thread { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread .main-head { background: var(--panel); }
.thread .messages { background: var(--panel); }
.thread .msg:hover { background: var(--hover); }
.reply-count { display: flex; align-items: center; gap: 10px; margin: 6px 20px; color: var(--muted); font-size: 13px; }
.reply-count::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* lists (DMs, activity, files, search) */
.list-view { flex: 1; overflow-y: auto; }
.list-row { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; text-decoration: none; color: inherit; }
.list-row:hover { background: var(--hover); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .top { display: flex; justify-content: space-between; gap: 10px; }
.list-row .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.list-row .snippet { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; }
.list-row.unseen .name::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rust); margin-right: 7px; vertical-align: middle; }
.tabs { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--panel); }
.tab { border: 1px solid var(--line); border-radius: 18px; padding: 5px 14px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }
/* Profile photos */
.avatar { overflow: visible; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-photo { width: 96px; height: 96px; border-radius: 18px; object-fit: cover; flex-shrink: 0; }
.photo-pick { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.photo-btn { position: relative; width: 76px; height: 76px; border-radius: 16px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-btn .avatar { width: 76px !important; height: 76px !important; }
.photo-cam { position: absolute; right: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--rust); color: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.photo-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
/* Directory */
.dir-scroll { background: var(--bg); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding: 16px 20px 30px; }
.people-grid .empty { grid-column: 1 / -1; }
.person-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; padding-bottom: 12px; transition: box-shadow .15s, transform .15s; }
.person-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pc-photo { position: relative; aspect-ratio: 1; background: var(--hover); }
.pc-photo img, .pc-initials { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; color: #fff; font-size: 44px; font-weight: 800; }
.pc-photo .pres { position: absolute; right: 10px; bottom: 10px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--panel); }
.pc-photo .pres.on { background: var(--online); }
.pc-photo .pres.away { background: var(--panel); box-shadow: inset 0 0 0 2px var(--muted); }
.pc-photo .pres.off { display: none; }
.pc-name { font-weight: 800; padding: 10px 12px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-you { font-weight: 500; color: var(--muted); }
.pc-title { color: var(--muted); font-size: 13px; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-msg { margin: 10px 12px 0; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px; font-size: 13px; }
/* Pages: sidebar tree */
.pg-item { display: flex; align-items: center; gap: 4px; margin: 1px 8px; padding: 4px 8px 4px 10px; border-radius: 7px; cursor: pointer; min-height: 30px; color: var(--side-text); font-weight: 600; position: relative; }
.pg-item:hover { background: var(--side-hover); }
.pg-item.active { background: var(--side-active); color: var(--side-active-text); }
.pg-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-tog { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; color: var(--side-muted); transform: rotate(-90deg); flex-shrink: 0; }
.pg-item:has(+ .pg-item) .pg-tog, .pg-tog:not(.none):hover { background: var(--side-hover); }
.pg-tog.none { visibility: hidden; }
.pg-emoji { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px; }
.pg-acts { display: none; gap: 2px; }
.pg-item:hover .pg-acts { display: flex; }
.pg-act { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; color: inherit; opacity: .75; }
.pg-act:hover { background: rgba(0,0,0,.08); opacity: 1; }
.pg-empty { color: var(--side-muted); font-size: 12.5px; padding: 4px 18px 6px 40px; }
.pg-item[data-drop="inside"] { box-shadow: inset 0 0 0 2px var(--rust); }
.pg-item[data-drop="before"] { box-shadow: inset 0 2px 0 var(--rust); }
.pg-item[data-drop="after"] { box-shadow: inset 0 -2px 0 var(--rust); }
/* Pages: page view */
.wiki-head { gap: 10px; min-height: 48px; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; font-size: 13.5px; }
.crumb-root { color: var(--muted); font-weight: 600; }
.crumb { color: var(--muted); padding: 2px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.cur { color: var(--text); font-weight: 700; }
.crumb-sep { color: var(--line); }
.wiki-edited { font-size: 12px; color: var(--muted); white-space: nowrap; }
.presence { display: flex; }
.pres-av { margin-left: -6px; border: 2px solid var(--panel); border-radius: 9px; }
.wiki-bar { position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line); }
.wiki-bar.disabled { opacity: .45; pointer-events: none; }
.wiki-scroll { flex: 1; overflow-y: auto; background: var(--panel); }
.wiki-cover { height: 200px; position: relative; background: var(--hover); }
.wiki-cover.none { display: none; }
.wiki-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-acts { position: absolute; right: 16px; bottom: 12px; display: none; gap: 6px; }
.wiki-cover:hover .cover-acts { display: flex; }
.wiki-page { max-width: 860px; margin: 0 auto; padding: 36px 48px 140px; position: relative; }
.wiki-cover:not(.none) + .wiki-page { padding-top: 0; }
.wiki-icon { font-size: 64px; line-height: 1; margin: -10px 0 8px -4px; border-radius: 10px; padding: 4px; display: inline-block; }
.wiki-cover:not(.none) + .wiki-page .wiki-icon { margin-top: -40px; }
.wiki-icon.none { display: none; }
.wiki-icon:not(:disabled):hover { background: var(--hover); }
.wiki-add { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; margin-bottom: 4px; }
.wiki-page:hover .wiki-add { opacity: 1; }
.wiki-add button { font-size: 13px; color: var(--muted); padding: 4px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; }
.wiki-add button:hover { background: var(--hover); color: var(--text); }
.wiki-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.wiki-title-row .wiki-title { margin: 0; }
.wiki-inline-icon { flex-shrink: 0; font-size: 34px; line-height: 1; border-radius: 10px; padding: 2px; }
.wiki-inline-icon:hover:not(:disabled) { background: var(--hover); }
.mini-check { display: inline-grid; place-items: center; width: 1.15em; height: 1.15em; border-radius: 4px; background: var(--charcoal); color: #fff; vertical-align: -0.15em; }
.mini-check svg { stroke-width: 3.2; width: .8em; height: .8em; }
.side-item.active .mini-check, .pg-item.active .mini-check { background: #fff; color: var(--rust); }
@media (prefers-color-scheme: dark) { .mini-check { background: #f2efe8; color: var(--charcoal); } }
.black-check { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--charcoal); color: #fff; }
.black-check svg { stroke-width: 3; }
@media (prefers-color-scheme: dark) { .black-check { background: #f2efe8; color: var(--charcoal); } }
.wiki-title { width: 100%; border: 0; outline: none; resize: none; overflow: hidden; background: none; font: inherit; font-size: 38px; font-weight: 800; line-height: 1.15; color: var(--text); padding: 0; margin: 0 0 12px; }
.wiki-title::placeholder { color: var(--line); }
.wiki-ed .ProseMirror { outline: none; font-size: 16px; line-height: 1.65; min-height: 40vh; }
.wiki-ed .ProseMirror > * + * { margin-top: .35em; }
.wiki-ed h1 { font-size: 28px; font-weight: 800; margin: 1.1em 0 .2em; line-height: 1.25; }
.wiki-ed h2 { font-size: 22px; font-weight: 700; margin: 1em 0 .2em; }
.wiki-ed h3 { font-size: 18px; font-weight: 700; margin: .9em 0 .1em; }
.wiki-ed p { margin: 0; }
.wiki-ed ul, .wiki-ed ol { padding-left: 1.5em; margin: .2em 0; }
.wiki-ed ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
.wiki-ed ul[data-type="taskList"] li { display: flex; gap: 8px; align-items: flex-start; }
.wiki-ed ul[data-type="taskList"] li > label { margin-top: .3em; }
.wiki-ed ul[data-type="taskList"] li > label input { width: 16px; height: 16px; accent-color: var(--rust); cursor: pointer; }
.wiki-ed ul[data-type="taskList"] li[data-checked="true"] > div { color: var(--muted); text-decoration: line-through; }
.wiki-ed blockquote { border-left: 3px solid var(--text); margin: .4em 0; padding-left: 14px; }
.wiki-ed pre { font-family: var(--mono); font-size: 13.5px; background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.wiki-ed code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); color: var(--rust-strong); padding: 1px 5px; border-radius: 4px; }
.wiki-ed pre code { background: none; color: inherit; padding: 0; }
.wiki-ed hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.wiki-ed img { max-width: 100%; border-radius: 8px; display: block; margin: .6em 0; }
.wiki-ed img.ProseMirror-selectednode { outline: 3px solid var(--rust); }
.wiki-ed a { color: var(--rust-strong); }
.wiki-ed mark { background: #fbe08a; color: inherit; border-radius: 3px; padding: 0 2px; }
.wiki-ed .is-empty::before { content: attr(data-placeholder); color: var(--muted); opacity: .6; float: left; height: 0; pointer-events: none; }
.wiki-newchild { margin-top: 24px; color: var(--muted); font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 6px; }
.wiki-newchild:hover { background: var(--hover); color: var(--text); }
.wiki-children { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.wiki-children-h { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.wiki-child { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; border-radius: 6px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.wiki-child:hover { background: var(--hover); }
.emoji-remove { grid-column: 1 / -1; font-size: 13px !important; height: 30px !important; color: var(--muted); }
/* Pages: blocks */
.wiki-ed [data-callout] { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; margin: .5em 0; background: #f1efea; }
.wiki-ed [data-callout][data-color="rust"] { background: #fbe2dc; } .wiki-ed [data-callout][data-color="orange"] { background: #fce6d6; }
.wiki-ed [data-callout][data-color="yellow"] { background: #fbf0c7; } .wiki-ed [data-callout][data-color="green"] { background: #e1efdc; }
.wiki-ed [data-callout][data-color="blue"] { background: #dde8f3; } .wiki-ed [data-callout][data-color="purple"] { background: #ebe2f2; }
.wiki-ed [data-callout][data-color="pink"] { background: #f6e0ea; }
.callout-emoji { font-size: 20px; line-height: 1.4; flex-shrink: 0; border-radius: 6px; height: fit-content; padding: 0 2px; }
.callout-emoji:hover { background: rgba(0,0,0,.06); }
.callout-body { flex: 1; min-width: 0; }
.wiki-ed [data-columns] { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 24px; margin: .6em 0; }
.wiki-ed [data-column] { min-width: 0; padding: 2px 0; border-radius: 6px; }
.wiki-ed.ProseMirror-focused [data-column], .wiki-ed [data-column]:hover { box-shadow: inset 0 0 0 1px var(--line); }
.wiki-ed .toggle { display: flex; gap: 4px; margin: .3em 0; }
.wiki-ed .toggle > button { width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; border-radius: 5px; margin-top: .2em; }
.wiki-ed .toggle > button::before { content: '▸'; transition: transform .15s; }
.wiki-ed .toggle.is-open > button::before { transform: rotate(90deg); }
.wiki-ed .toggle > button:hover { background: var(--hover); }
.wiki-ed .toggle > div { flex: 1; min-width: 0; }
.wiki-ed .toggle summary { list-style: none; font-weight: 600; }
.wiki-ed .toggle summary::-webkit-details-marker { display: none; }
.wiki-ed [data-type="detailsContent"] { padding-left: 2px; }
.wiki-ed table { border-collapse: collapse; width: 100%; margin: .6em 0; table-layout: fixed; }
.wiki-ed td, .wiki-ed th { border: 1px solid var(--line); padding: 6px 9px; vertical-align: top; position: relative; }
.wiki-ed th { background: var(--hover); font-weight: 700; text-align: left; }
.wiki-ed .selectedCell { background: var(--rust-soft); }
.wiki-ed .column-resize-handle { position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; background: var(--rust); pointer-events: none; }
.wiki-ed .tableWrapper { overflow-x: auto; }
.wiki-ed .mention { background: var(--mention-bg); color: var(--mention-text); border-radius: 5px; padding: 0 4px; font-weight: 600; white-space: nowrap; }
.wiki-ed .mention[data-kind="page"] { cursor: pointer; background: var(--hover); color: var(--text); text-decoration: underline; text-decoration-color: var(--line); }
.wiki-ed .mention[data-kind="date"] { background: var(--hover); color: var(--text); }
.wiki-ed .page-link { font-weight: 600; color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; border-radius: 4px; padding: 0 2px; }
.wiki-ed .page-link:hover { background: var(--hover); }
.wiki-ed .page-link.missing { color: var(--muted); cursor: default; }
.wiki-ed .bookmark, .wiki-ed .file-block { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: .5em 0; color: var(--text); text-decoration: none; }
.wiki-ed .bookmark:hover, .wiki-ed .file-block:hover { background: var(--hover); }
.bm-ico, .fb-ico { font-size: 18px; }
.bm-text { display: flex; flex-direction: column; min-width: 0; }
.bm-host { font-weight: 700; } .bm-path { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fb-size { color: var(--muted); font-size: 12.5px; }
.wiki-ed .ProseMirror-selectednode { outline: 2px solid var(--rust); border-radius: 8px; }
.drag-handle { width: 20px; height: 24px; display: grid; place-items: center; color: var(--muted); cursor: grab; border-radius: 5px; font-size: 13px; letter-spacing: -2px; user-select: none; }
.drag-handle:hover { background: var(--hover); color: var(--text); }
.fmt-hint { margin-left: auto; font-size: 12px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
.color-a { font-weight: 800; font-size: 15px; text-decoration: underline; text-decoration-color: var(--rust); text-decoration-thickness: 3px; }
/* "/" menu and @ picker */
.ed-pop { position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; width: 290px; max-height: 340px; overflow-y: auto; }
.ed-pop-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; position: relative; }
.ed-pop-item[data-group]::before { content: attr(data-group); display: block; position: absolute; top: -2px; }
.ed-pop-item.first[data-group] { margin-top: 18px; }
.ed-pop-item.first[data-group]::before { top: -18px; left: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ed-pop-item.sel, .ed-pop-item:hover { background: var(--rust-soft); }
.ed-pop-ico { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; font-size: 14px; font-weight: 700; background: var(--panel); flex-shrink: 0; }
.ed-pop-text { display: flex; flex-direction: column; min-width: 0; }
.ed-pop-text b { font-size: 14px; } .ed-pop-text small { color: var(--muted); font-size: 12px; }
.ed-pop-empty { padding: 10px; color: var(--muted); }
/* Comments panel */
.wiki-cbtn { position: relative; }
.wiki-cbtn.on { color: var(--rust); }
.cnum { position: absolute; top: 0; right: -2px; background: var(--rust); color: #fff; font-size: 10px; font-weight: 800; border-radius: 8px; padding: 0 4px; line-height: 15px; }
.thread-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.thread-head .t { font-size: 12.5px; color: var(--muted); }
.cm-list { padding: 12px 14px 30px; overflow-y: auto; flex: 1; }
.cm-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; align-items: flex-end; }
.cm-input { resize: vertical; min-height: 54px; font: inherit; }
.cm-thread { border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 6px; margin-bottom: 10px; }
.cm { display: flex; gap: 8px; padding: 4px 0; }
.cm.resolved { opacity: .55; }
.cm-meta { display: flex; gap: 8px; align-items: baseline; font-size: 13px; } .cm-meta span { color: var(--muted); font-size: 11.5px; }
.cm .msg-body { font-size: 14px; }
.cm-del { width: 24px; height: 24px; opacity: 0; } .cm:hover .cm-del { opacity: 1; }
.cm-actions { display: flex; gap: 14px; padding: 4px 0 2px 36px; }
.cm-thread .cm-box { margin: 6px 0 4px 36px; }
.linkish { color: var(--rust-strong); font-weight: 700; font-size: 12.5px; }
.linkish:hover { text-decoration: underline; }
/* Version history */
.hist { display: grid; grid-template-columns: 200px 1fr; gap: 14px; height: 60vh; }
.hist-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 8px; }
.hist-item { text-align: left; padding: 8px 10px; border-radius: 8px; display: flex; flex-direction: column; font-size: 13px; }
.hist-item span { color: var(--muted); font-size: 12px; }
.hist-item:hover { background: var(--hover); } .hist-item.on { background: var(--rust-soft); }
.hist-preview { overflow-y: auto; padding-right: 6px; }
.hist-title { font-size: 26px; margin: 0 0 10px; }
/* Page link previews in chat */
.page-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.page-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-left: 3px solid var(--rust); border-radius: 8px; padding: 8px 12px; max-width: 420px; text-align: left; background: var(--panel); }
.page-card:hover { background: var(--hover); }
.pc-ico { font-size: 20px; } .pc-txt { display: flex; flex-direction: column; min-width: 0; }
.pc-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-tab.locked { opacity: .6; }
/* Pages: Library */
.lib-table { padding-bottom: 30px; }
.lib-row { display: grid; grid-template-columns: minmax(200px, 2fr) 170px minmax(140px, 1.4fr) 110px 110px; gap: 10px; align-items: center; padding: 9px 20px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.lib-row:hover { background: var(--hover); }
.lib-head { cursor: default; position: sticky; top: 0; background: var(--panel); z-index: 1; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lib-head:hover { background: var(--panel); }
.lib-th { text-align: left; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.lib-th.on { color: var(--text); }
.lib-name { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lib-by { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.lib-loc, .lib-when { color: var(--muted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* To-do panel */
.right-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--side); border-left: 2px solid var(--side-line); }
.todo-panel { background: var(--side); display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; min-height: 0; color: var(--side-text); }
/* Calendar corner panel: fills the column alone, or sits under the to-do list */
.cal-panel { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; background: var(--side); color: var(--side-text); }
.todo-panel:not(.hidden) + .cal-panel { flex: 0 0 46%; border-top: 2px solid var(--side-line); }
.calp-head { padding: 10px 10px 8px 14px; gap: 2px; }
.calp-title { text-align: left; border-radius: 6px; }
.calp-title:hover { color: var(--rust-strong); }
.calp-date { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--side-muted); font-size: 13px; }
.calp-body { flex: 1; min-height: 0; overflow-y: auto; margin: 0 8px 8px; background: var(--panel); border-radius: 12px; color: var(--text); }
.calp-empty { padding: 18px 14px; font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.cal-week.mini .cal-wall { position: sticky; top: 0; z-index: 3; background: var(--panel); }
.cal-week.mini .cal-wallday:empty { min-height: 0; padding: 0; }
.cal-week.mini .cal-wall:has(.cal-wallday:empty) { display: none; }
.cal-panel .cal-week.mini .cal-wall, .cal-panel .cal-week.mini .cal-wgrid { grid-template-columns: 40px minmax(0, 1fr); }
.cal-week.mini .cal-wcol.today { background-color: transparent; }
.todo-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.todo-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; flex: 1; }
.todo-h .ico-wrap { color: var(--rust); }
.todo-n { font-weight: 800; font-size: 13px; color: var(--side-muted); }
.todo-head .icon-btn:hover { background: var(--side-hover); }
.todo-add { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; background: var(--side-deep); border: 2px solid var(--side-line); border-radius: 10px; padding: 8px 10px; color: var(--side-muted); flex-wrap: wrap; }
.todo-add:focus-within { border-color: var(--rust); }
.todo-add input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--side-text); font: inherit; font-size: 14px; }
.todo-hint { width: 100%; font-size: 12px; font-weight: 700; color: var(--rust-strong); padding-left: 24px; }
.todo-hint:empty { display: none; }
.todo-list { flex: 1; overflow-y: auto; padding: 0 8px 30px; }
.todo-list > .todo-add { margin: 0 0 8px; }
.todo-card { background: var(--panel); border-radius: 12px; overflow: hidden; color: var(--text); margin-bottom: 8px; }
.todo-sec { color: var(--text); }
.todo-sec + .todo-sec .todo-sec-h { border-top: 1px solid var(--line); }
.todo-sec-h.drop-on, .todo-empty.drop-on { background: var(--rust-soft); box-shadow: inset 0 0 0 2px var(--rust); }
.todo-sec-h { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 10px 12px 4px; }
.todo-sec.red .todo-sec-h { color: var(--danger); }
.todo-row { display: flex; align-items: flex-start; gap: 6px; padding: 7px 10px 7px 4px; border-top: 1px solid var(--line); position: relative; }
.todo-row:hover { background: var(--hover); }
.todo-row.red .todo-title { color: var(--danger); font-weight: 700; }
.todo-row.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-row.dragging { opacity: .4; }
.todo-row[data-drop="before"] { box-shadow: inset 0 2px 0 var(--rust); }
.todo-row[data-drop="after"] { box-shadow: inset 0 -2px 0 var(--rust); }
.todo-grip { width: 16px; color: var(--line); cursor: grab; flex-shrink: 0; padding-top: 2px; }
.todo-row:hover .todo-grip { color: var(--muted); }
.todo-check { width: 19px; height: 19px; border: 2px solid var(--muted); border-radius: 5px; flex-shrink: 0; display: grid; place-items: center; color: #fff; margin-top: 1px; }
.todo-check:hover { border-color: var(--rust); }
.todo-check.on { background: var(--rust); border-color: var(--rust); }
.todo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.todo-title { font-size: 14px; line-height: 1.35; cursor: text; word-break: break-word; }
.todo-edit { font: inherit; font-size: 14px; border: 1px solid var(--rust); border-radius: 6px; padding: 2px 6px; outline: none; width: 100%; background: var(--panel); color: var(--text); }
.todo-from { font-size: 11.5px; color: var(--muted); text-align: left; display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; }
.todo-from:hover { color: var(--rust-strong); }
.todo-due { font-size: 11.5px; font-weight: 700; background: #fbf0c7; color: #8a6200; border-radius: 8px; padding: 2px 7px; white-space: nowrap; flex-shrink: 0; }
.todo-due.overdue { background: var(--rust-soft); color: var(--danger); }
.todo-card.mytasks { margin-bottom: 8px; }
.todo-row.mytask .todo-main { text-align: left; align-items: flex-start; }
.todo-row.mytask .todo-title { cursor: pointer; font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.todo-row.mytask { padding-top: 4px; padding-bottom: 4px; gap: 5px; }
.todo-row.mytask .todo-check { width: 15px; height: 15px; border-width: 1.5px; margin-top: 1px; }
.todo-row.mytask .todo-due { font-size: 10.5px; padding: 1px 6px; }
.mytasks .todo-sec-h { padding-top: 6px; padding-bottom: 4px; }
.todo-row.mytask.late .todo-title { color: var(--danger); }
.mytask-sub { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); margin-top: 2px; min-width: 0; overflow: hidden; white-space: nowrap; }
.mytask-sub .db-pill { font-size: 10px; padding: 0 5px; line-height: 15px; }
.todo-check.ro { opacity: .35; }
.todo-acts { display: none; gap: 2px; position: absolute; right: 6px; top: 4px; background: var(--hover); border-radius: 8px; padding: 2px; }
.todo-row:hover .todo-acts { display: flex; }
.todo-row:hover .todo-due { visibility: hidden; }
.todo-acts button { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.todo-acts button:hover { background: var(--panel); color: var(--text); }
.todo-acts button.on { color: var(--danger); }
.todo-empty { padding: 8px 12px 12px; color: var(--muted); font-size: 13px; border-top: 1px dashed var(--line); }
.todo-empty:empty { display: none; }
.todo-more { display: block; width: 100%; text-align: left; padding: 8px 12px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-top: 1px solid var(--line); }
.todo-more:hover { color: var(--text); }
.todo-sec.done { background: none; margin-top: 4px; }
.todo-sec.done .todo-more { border: 0; color: var(--side-muted); }
.todo-sec.done .todo-row { background: var(--panel); }
.rail-count { position: absolute; top: 2px; right: 8px; background: var(--rust); color: #fff; font-size: 10px; font-weight: 800; border-radius: 8px; padding: 0 5px; line-height: 16px; border: 2px solid var(--rail); }
/* Medium screens: the to-do panel floats over the page instead of squeezing it */
@media (max-width: 1180px) and (min-width: 761px) {
  .shell.with-todo, .shell.with-thread.with-todo { grid-template-columns: 72px 280px 1fr; }
  .shell.with-thread.with-todo { grid-template-columns: 72px 280px 1fr 380px; }
  .right-col { position: fixed; right: 0; top: 0; bottom: 0; width: 340px; z-index: 35; box-shadow: var(--shadow); }
}
/* Databases (Pages Stage 2) */
.wiki-page.is-db { max-width: none; }
.wiki-db, .db-mount { min-width: 0; }
.db-mount { margin: 10px 0 18px; }
.db-loading, .db-missing { color: var(--muted); font-size: 14px; padding: 14px 0; }
.db-tb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
.db-name { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 16px; padding: 3px 6px; border-radius: 6px; margin-right: 6px; }
.db-name:hover { background: var(--hover); }
.db-tabs { display: flex; gap: 2px; flex-wrap: wrap; min-width: 0; }
.db-tab { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.db-tab:hover { background: var(--hover); }
.db-tab.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); border-radius: 6px 6px 0 0; }
.db-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.db-tool { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.db-tool:hover { background: var(--hover); color: var(--text); }
.db-tool.on { color: var(--rust-strong); }
.db-search { width: 0; padding: 5px 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text); outline: none; transition: width .15s; }
.db-tools:hover .db-search, .db-search:focus, .db-search.on { width: 130px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.db-new { margin-left: 6px; }
.db-body { position: relative; }
.db-scroll { overflow-x: auto; }
.dbt { border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.dbt th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); position: relative; padding: 0; }
.dbt th:last-child { border-right: 0; }
.db-th { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 8px; font-size: 13px; text-align: left; min-width: 0; }
.db-th:hover { background: var(--hover); }
.db-th-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-ticon { font-size: 12px; width: 16px; white-space: nowrap; line-height: 1; text-align: center; flex-shrink: 0; opacity: .8; }
.db-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 1; }
.db-resize:hover { background: var(--rust); opacity: .5; }
.db-cell { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; vertical-align: top; overflow: hidden; cursor: pointer; min-height: 34px; height: 34px; }
.db-cell:last-child { border-right: 0; cursor: default; }
.db-cell.ro { cursor: default; }
.db-row:hover .db-cell { background: var(--hover); }
.db-cell.title { font-weight: 600; }
.db-cell.title .db-title-text { cursor: pointer; }
.db-cell.title:hover .db-title-text { text-decoration: underline; color: var(--rust-strong); }
.db-title-cell { display: flex; align-items: center; gap: 4px; min-width: 0; }
.db-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.db-ricon:empty { display: none; }
.db-caret { width: 20px; height: 20px; flex-shrink: 0; border-radius: 4px; color: var(--muted); font-size: 11px; display: inline-grid; place-items: center; transition: transform .12s; }
.db-caret:hover { background: var(--line); }
.db-caret.open { transform: rotate(90deg); }
.db-caret.none { opacity: 0; }
.db-row:hover .db-caret.none { opacity: .45; }
.db-open { margin-left: auto; flex-shrink: 0; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--muted); visibility: hidden; }
.db-row:hover .db-open { visibility: visible; }
.db-cc { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.db-ph { color: var(--muted); font-weight: 400; opacity: .8; }
.db-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-num { display: block; text-align: right; font-variant-numeric: tabular-nums; }
.db-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.db-pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.db-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.c-gray { background: #ebe8e1; color: #4e4f47; } .c-brown { background: #eedfd3; color: #6b4a33; } .c-orange { background: #fce2cf; color: #9a4a12; }
.c-yellow { background: #fbefc2; color: #7c5e04; } .c-green { background: #dcecd6; color: #2f6029; } .c-blue { background: #d9e6f2; color: #244a70; }
.c-purple { background: #e8def1; color: #573c70; } .c-pink { background: #f5dce8; color: #8e3460; } .c-red { background: #f9dad3; color: #a3301b; }
.db-people { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.db-people > span:not(:first-child) .avatar, .db-people > span + span { margin-left: -4px; }
.db-date { white-space: nowrap; }
.db-date.late { color: var(--danger); font-weight: 700; }
.db-check { display: inline-grid; place-items: center; width: 17px; height: 17px; border: 1.5px solid var(--muted); border-radius: 4px; font-size: 12px; font-weight: 800; }
.db-check.on { background: var(--rust); border-color: var(--rust); color: #fff; }
.db-url { color: var(--rust-strong); text-decoration: underline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.db-files { display: flex; gap: 4px; flex-wrap: wrap; }
.db-file { font-size: 12.5px; background: var(--hover); border-radius: 5px; padding: 1px 6px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.db-inline { width: 100%; font: inherit; border: 0; outline: 2px solid var(--rust); border-radius: 4px; padding: 2px 4px; background: var(--panel); color: var(--text); resize: none; }
.db-addrow td { border-bottom: 1px solid var(--line); padding: 0; }
.db-addrow button, .db-li-add { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px; color: var(--muted); font-size: 13.5px; }
.db-addrow button:hover, .db-li-add:hover { background: var(--hover); color: var(--text); }
.db-addrow.sub button { font-size: 12.5px; padding-top: 4px; padding-bottom: 4px; }
.db-ghead td { padding: 0; border-bottom: 1px solid var(--line); }
.db-ghead-in { display: flex; align-items: center; gap: 8px; padding: 10px 4px 6px; font-weight: 700; font-size: 13.5px; }
.db-count { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.db-gnew { width: 22px; height: 22px; border-radius: 5px; display: inline-grid; place-items: center; color: var(--muted); visibility: hidden; }
.db-ghead:hover .db-gnew { visibility: visible; }
.db-gnew:hover { background: var(--hover); }
.db-empty { color: var(--muted); font-size: 14px; padding: 18px 8px; }
/* list view */
.db-list { display: flex; flex-direction: column; }
.db-li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.db-li:hover { background: var(--hover); }
.db-li-check { width: 20px; height: 20px; flex-shrink: 0; border: 2px solid var(--muted); border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.db-li-check.on { background: var(--rust); border-color: var(--rust); }
.db-li-title { font-weight: 600; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; }
.db-li-title:hover { text-decoration: underline; }
.db-li.done .db-li-title { color: var(--muted); text-decoration: line-through; }
.db-li-props { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-shrink: 0; font-size: 13px; color: var(--muted); }
/* popovers */
.db-pop { position: fixed; z-index: 120; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; min-width: 240px; max-width: min(560px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; }
.db-pop-h { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 2px 4px 8px; }
.db-pop-input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; font: inherit; font-size: 14px; background: var(--bg); color: var(--text); outline: none; margin-bottom: 6px; }
.db-pop-input:focus { border-color: var(--rust); }
.db-pop-list { display: flex; flex-direction: column; gap: 1px; }
.db-pop-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; text-align: left; font-size: 14px; width: 100%; cursor: pointer; }
.db-pop-item:hover, .db-pop-item.on { background: var(--hover); }
.db-pop-empty { color: var(--muted); font-size: 13px; padding: 6px 4px; }
.db-pop-btns { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 8px; }
.db-date-row { display: flex; gap: 6px; }
.db-frow { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.db-sel { border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; font: inherit; font-size: 13px; background: var(--bg); color: var(--text); max-width: 190px; }
.db-fval { display: inline-flex; gap: 6px; }
.db-opts { display: flex; flex-direction: column; gap: 6px; }
.db-opt-row { display: flex; gap: 6px; align-items: center; }
.db-opt-row .field-input { flex: 1; min-width: 0; }
/* a row's page: properties and sub-tasks */
.db-rowpanel { margin: 4px 0 14px; }
.db-props { display: flex; flex-direction: column; gap: 1px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.db-prow { display: flex; align-items: flex-start; gap: 10px; min-height: 32px; }
.db-pn { width: 170px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; padding: 6px 0; }
.db-pv { flex: 1; min-width: 0; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; min-height: 30px; }
.db-pv:hover { background: var(--hover); }
.db-pv.ro { cursor: default; } .db-pv.ro:hover { background: none; }
.db-subs { padding: 10px 0 4px; display: flex; flex-direction: column; gap: 2px; }
.db-subs-h { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; padding-bottom: 4px; }
.db-sub { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; text-align: left; font-size: 14px; font-weight: 600; }
.db-sub:hover { background: var(--hover); }
.db-sub.done { color: var(--muted); text-decoration: line-through; }
.db-sub.add { color: var(--muted); font-weight: 500; }
@media (prefers-color-scheme: dark) {
  .c-gray { background: #3a3a37; color: #d6d6d0; } .c-brown { background: #45362b; color: #e2c9b4; } .c-orange { background: #4a3020; color: #f3b78b; }
  .c-yellow { background: #47401f; color: #ead48a; } .c-green { background: #263d24; color: #a9d5a0; } .c-blue { background: #213345; color: #a6c6e6; }
  .c-purple { background: #362b45; color: #cbb5e3; } .c-pink { background: #45263a; color: #eeb0cf; } .c-red { background: #4a2219; color: #f3a08b; }
}
@media (max-width: 760px) {
  .db-tools .db-tool span { display: none; }
  .db-pn { width: 110px; font-size: 13px; }
  .db-li-props { display: none; }
}
.db-block { margin: 12px 0; padding: 4px 0; user-select: text; }
.wiki-ed .db-block.ProseMirror-selectednode { outline: 2px solid var(--rust); outline-offset: 4px; border-radius: 4px; }
.wiki-ed .db-block table { width: auto; margin: 0; }
.wiki-ed .db-block td, .wiki-ed .db-block th { border: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0; background: none; font-weight: 600; }
.wiki-ed .db-block .db-cell { padding: 6px 8px; font-weight: 400; }
.wiki-ed .db-block .db-cell.title { font-weight: 600; }
.wiki-ed .db-block td:last-child, .wiki-ed .db-block th:last-child { border-right: 0; }
.wiki-ed .db-block a { color: inherit; }
.wiki-ed .db-block .db-url { color: var(--rust-strong); }
.db-board { display: flex; gap: 12px; overflow-x: auto; padding: 6px 2px 12px; align-items: flex-start; }
.db-col { flex: 0 0 260px; background: var(--hover); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; }
.db-col.drop-on { border-color: var(--rust); }
.db-col-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; padding: 2px 2px 4px; }
.db-col-h:hover .db-gnew { visibility: visible; }
.db-col-cards { display: flex; flex-direction: column; gap: 6px; min-height: 8px; }
.db-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.db-card:hover { border-color: var(--muted); }
.db-card.dragging { opacity: .4; }
.db-card.done .db-card-title { color: var(--muted); text-decoration: line-through; }
.db-card-title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.db-card-prop { font-size: 12.5px; min-width: 0; }
.db-col-add, .db-col-new { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.db-col-add:hover, .db-col-new:hover { background: var(--line); color: var(--text); }
.db-col-new { flex: 0 0 auto; white-space: nowrap; margin-top: 4px; }
.db-cal-head { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.db-cal-head b { font-size: 16px; margin-right: 6px; }
.db-cal-wrap { display: flex; gap: 10px; align-items: flex-start; }
.db-cal-grid { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.db-cal-dow { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.db-cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; }
.db-cal-cell:hover { background: var(--hover); }
.db-cal-cell.other { background: var(--bg); } .db-cal-cell.other .db-cal-num { opacity: .5; }
.db-cal-cell.drop-on, .db-cal-tray.drop-on { outline: 2px solid var(--rust); outline-offset: -2px; }
.db-cal-num { font-size: 12.5px; font-weight: 700; color: var(--muted); align-self: flex-end; padding: 1px 5px; border-radius: 10px; }
.db-cal-cell.today .db-cal-num { background: var(--rust); color: #fff; }
.db-cal-ev { font-size: 12.5px; font-weight: 600; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.db-cal-ev[class*=" c-"] { border-color: transparent; }
.db-cal-ev:not([class*=" c-"]) { background: var(--panel); }
.db-cal-ev.done { text-decoration: line-through; opacity: .65; }
.db-cal-ev.late { box-shadow: inset 3px 0 0 var(--danger); }
.db-cal-ev.hide { display: none; }
.db-cal-more { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: left; padding: 0 4px; }
.db-cal-tray { width: 220px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 4px; max-height: 640px; overflow-y: auto; }
.db-cal-tray-h { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-bottom: 4px; }
.act-sys { width: 36px; height: 36px; border-radius: 8px; background: var(--side-hover); color: var(--side-text); display: grid; place-items: center; flex-shrink: 0; }
.act-sys.late { background: var(--rust); color: #fff; }
@media (max-width: 760px) {
  .db-cal-cell { min-height: 64px; }
  .db-cal-ev { font-size: 11px; padding: 1px 3px; }
  .db-cal-wrap { flex-direction: column; }
  .db-cal-tray { width: 100%; }
  .db-col { flex-basis: 230px; }
}
.import-seg { margin: 0 0 10px; }
.import-help { font-size: 13.5px; color: var(--muted); background: var(--hover); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.5; }
.import-out { background: var(--code-bg); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; max-height: 300px; overflow: auto; white-space: pre-wrap; margin: 8px 0 0; }
.chat-msg { position: relative; }
.chat-tools { position: absolute; right: 6px; top: -10px; display: none; gap: 1px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 6px rgba(43,40,37,.12); padding: 1px; z-index: 2; }
.chat-msg:hover .chat-tools { display: flex; }
.chat-tools button { width: 26px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.chat-tools button:hover { background: var(--hover); color: var(--text); }
.chat-reactions { margin-top: 3px; }
.chat-reactions .reaction { padding: 0 6px; font-size: 12px; }
@media (hover: none) { .chat-msg:active .chat-tools { display: flex; } }
.group-av { position: relative; display: inline-block; flex-shrink: 0; }
.group-av .avatar { position: absolute; box-shadow: 0 0 0 1.5px var(--side); }
.group-av .avatar:first-child { left: 0; top: 0; }
.group-av .avatar:last-child { right: 0; bottom: 0; }
.main .group-av .avatar, .chat-head .group-av .avatar, .modal .group-av .avatar { box-shadow: 0 0 0 1.5px var(--panel); }
.db-done { width: 18px; height: 18px; flex-shrink: 0; border: 2px solid var(--muted); border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; margin-right: 2px; }
.db-done:hover:not(:disabled) { border-color: var(--rust); }
.db-done.on { background: var(--rust); border-color: var(--rust); }
.db-row.done .db-title-text { color: var(--muted); text-decoration: line-through; }
.push-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0 4px; }
.push-h { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.push-status { font-size: 13px; color: var(--muted); line-height: 1.45; }
.push-btns { display: flex; gap: 6px; margin-top: 8px; }
/* Calendar */
.cal-head .title { font-size: 19px; font-weight: 800; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: 6px; }
.seg button { padding: 5px 11px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--text); color: var(--bg); }
.cal-legend { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.cal-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); border-radius: 14px; padding: 3px 10px; }
.cal-chip.off { opacity: .45; text-decoration: line-through; }
.cal-chip.add { color: var(--rust-strong); border-style: dashed; }
.cal-warn { color: var(--danger); }
.ev-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cal-body { flex: 1; overflow: auto; background: var(--panel); display: flex; flex-direction: column; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(92px, 1fr)); flex: 1; min-height: 560px; }
.cal-dow { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cal-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; min-width: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cal-cell:hover { background: var(--hover); }
.cal-cell.other { background: var(--bg); } .cal-cell.other .cal-num { color: var(--muted); opacity: .6; }
.cal-num { font-size: 12.5px; font-weight: 700; padding: 2px 4px; align-self: flex-start; border-radius: 10px; }
.cal-cell.today .cal-num { background: var(--rust); color: #fff; }
.cal-ev { display: flex; align-items: center; gap: 4px; font-size: 12px; text-align: left; border-radius: 4px; padding: 1px 4px; min-width: 0; white-space: nowrap; overflow: hidden; }
.cal-ev:hover { background: var(--line); }
.cal-ev.allday { color: #fff; font-weight: 700; display: block; text-overflow: ellipsis; }
.cal-ev .ev-title { overflow: hidden; text-overflow: ellipsis; }
.ev-time { color: var(--muted); font-size: 11.5px; flex-shrink: 0; }
.cal-more { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.cal-week { display: flex; flex-direction: column; min-width: 640px; }
.cal-whead, .cal-wall { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-wday { text-align: center; padding: 6px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; }
.cal-wday b { font-size: 18px; color: var(--text); }
.cal-wday.today b { color: var(--rust); }
.cal-wlabel { font-size: 10.5px; color: var(--muted); padding: 4px; align-self: center; }
.cal-wallday { padding: 3px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-height: 28px; min-width: 0; }
.cal-wgrid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); position: relative; }
.cal-hours > div { font-size: 10.5px; color: var(--muted); text-align: right; padding-right: 6px; border-top: 1px solid var(--line); box-sizing: border-box; }
.cal-wcol { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 44px; }
.cal-wcol.today { background-color: rgba(211,66,39,.03); }
.cal-block { position: absolute; left: 3px; right: 3px; border-radius: 6px; background: color-mix(in srgb, var(--c) 16%, var(--panel)); border-left: 3px solid var(--c); padding: 3px 6px; text-align: left; overflow: hidden; display: flex; flex-direction: column; font-size: 12px; }
.cal-block b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-block span { color: var(--muted); font-size: 11px; }
.cal-block.short { flex-direction: row; align-items: center; gap: 4px; padding: 0 6px; white-space: nowrap; }
.cal-block.short span { flex-shrink: 0; }
.cal-week.dayview { min-width: 0; }
.cal-week.dayview .cal-whead, .cal-week.dayview .cal-wall, .cal-week.dayview .cal-wgrid { grid-template-columns: 52px minmax(0, 1fr); }
.cal-week.dayview .cal-wday { flex-direction: row; justify-content: center; align-items: baseline; gap: 6px; }
.cal-week.dayview .cal-block b { font-size: 13px; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--rust); z-index: 2; }
.cal-agenda { padding: 8px 0 30px; }
.cal-aday { display: flex; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.cal-adate { width: 54px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.cal-adate b { font-size: 22px; line-height: 1; } .cal-adate span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.cal-aday.today .cal-adate b { color: var(--rust); }
.cal-alist { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-arow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; text-align: left; min-width: 0; }
.cal-arow:hover { background: var(--hover); }
.cal-arow .ev-time { width: 110px; } .cal-arow .ev-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-loc { color: var(--muted); font-size: 12.5px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.cal-empty { margin: auto; max-width: 440px; text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.cal-empty h3 { color: var(--text); margin: 6px 0 0; }
.cal-steps { margin: 0 0 10px; padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.cal-steps b { color: var(--text); }
.cal-feed input[type=color] { width: 28px; height: 28px; border: 0; padding: 0; background: none; cursor: pointer; flex-shrink: 0; }
.err-text { color: var(--danger) !important; }
.ev-when { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 14.5px; }
.ev-desc { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); max-height: 40vh; overflow-y: auto; font-size: 14px; }
/* Pop-up chat windows */
.chat-dock { position: fixed; right: calc(16px + var(--right-w, 0px)); bottom: 0; z-index: 40; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 12px; pointer-events: none; }
.chat-win { pointer-events: auto; width: 330px; height: 460px; max-height: calc(100vh - 80px); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.16); display: flex; flex-direction: column; overflow: hidden; }
.chat-win.min { height: auto; width: 240px; }
.chat-win.min .chat-body { display: none; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; background: var(--charcoal); color: #fff; cursor: pointer; flex-shrink: 0; }
.chat-win.has-unread .chat-head, .chat-win.fresh .chat-head { background: var(--brand-rust); }
.chat-head .grow { flex: 1; }
.chat-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(255,255,255,.15); }
.chat-head .avatar .pres { border-color: var(--charcoal); }
.chat-head .badge { background: #fff; color: var(--brand-rust); }
.chat-btn { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; color: #fff; opacity: .8; flex-shrink: 0; }
.chat-btn:hover { background: rgba(255,255,255,.18); opacity: 1; }
.chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 10px 4px; background: var(--bg); }
.chat-msg { display: flex; gap: 8px; padding: 3px 0; font-size: 14px; }
.chat-msg.cont { padding-top: 0; }
.chat-gap { width: 26px; flex-shrink: 0; }
.chat-meta { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.chat-meta span { color: var(--muted); font-size: 11px; }
.chat-msg .msg-body { font-size: 14px; line-height: 1.4; }
.chat-files { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.chat-img { max-width: 100%; max-height: 160px; border-radius: 8px; cursor: zoom-in; border: 1px solid var(--line); }
.chat-file { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--rust-strong); text-decoration: none; }
.chat-thread { font-size: 12px; font-weight: 700; color: var(--rust-strong); margin-top: 2px; }
.chat-empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 13px; }
.chat-typing { font-size: 11.5px; color: var(--muted); padding: 0 12px; min-height: 16px; background: var(--bg); }
.chat-body .composer-outer { padding: 6px 8px 8px; }
.composer-outer.compact .fmt-bar, .composer-outer.compact .aa-btn, .composer-outer.compact .sep,
.composer-outer.compact [title="Record video clip"], .composer-outer.compact [title="Record audio clip"], .composer-outer.compact [title="Shortcuts"] { display: none !important; }
.composer-outer.compact .ta-wrap { padding: 6px 10px 0; }
.composer-outer.compact .ce { max-height: 120px; }
.composer-outer.compact .composer-row { padding: 2px 4px 4px; }
.composer-outer.compact .mention-pop { max-height: 200px; overflow-y: auto; }
body.has-dock .main .composer-wrap { padding-bottom: 56px; padding-right: max(16px, var(--dock-pad, 0px)); } /* keep chat windows off the Send button */
.side-pop { display: none; margin-left: auto; color: var(--side-muted); padding: 2px; border-radius: 5px; }
.side-item:hover .side-pop { display: grid; }
.side-pop:hover { color: var(--side-text); background: var(--side-hover); }
.pc-actions { display: flex; gap: 6px; margin: 10px 12px 0; }
.pc-actions .pc-msg { margin: 0; flex: 1; }
.pc-actions .pc-chat { flex: 0 0 38px; }
/* Compose */
.compose-to { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.compose-to .chips:empty { display: none; }
.compose-results { max-height: 360px; }
.compose-results .person-row.sel { background: var(--rust-soft); }
/* DM intro */
.dm-intro-top { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.dm-intro-top .avatar { font-size: 36px !important; border-radius: 18px !important; }
.dm-intro p { margin-bottom: 12px; }
.dm-intro .mention { background: var(--mention-bg); color: var(--mention-text); border-radius: 4px; padding: 0 3px; font-weight: 600; }
/* Conversation tabs (Messages / canvases / lists) */
.ch-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.ch-tab { display: flex; align-items: center; gap: 6px; padding: 8px 10px 9px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; max-width: 220px; }
.ch-tab:hover { color: var(--text); background: var(--hover); border-radius: 6px 6px 0 0; }
.ch-tab.on { color: var(--text); border-bottom-color: var(--rust); font-weight: 800; }
.ch-tab-label { overflow: hidden; text-overflow: ellipsis; }
.ch-tab-more { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; }
.ch-tab-more:hover { background: var(--line); }
.ch-tab.add { font-weight: 500; }
.ch-tab.icon-only { padding-left: 8px; padding-right: 8px; }
.doc-head-embedded { min-height: 48px; padding-top: 6px; padding-bottom: 6px; }
.doc-head-embedded .back-btn, .doc-head-embedded > .doc-tile { display: none; }
.doc-head-embedded .doc-title { font-size: 16px; }
.pick-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin: -8px -4px; }
.pick-row { text-align: left; border-radius: 8px; border-bottom: 0; padding: 10px; align-items: center; width: 100%; }
.pick-row:hover { background: var(--hover); }
.pick-row:disabled { opacity: .5; cursor: not-allowed; }
.tpl-grid { flex-wrap: wrap; }
/* Threads and Drafts & sent */
.side-count { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--side-muted); font-weight: 700; }
.threads-list { background: var(--bg); padding: 12px 0 30px; }
.thread-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 0 20px 12px; padding: 12px 14px; cursor: pointer; }
.thread-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.thread-card.unread { border-left: 4px solid var(--rust); }
.thread-where { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; margin-bottom: 8px; }
.thread-n { color: var(--muted); font-weight: 600; }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rust); }
.tmsg { display: flex; gap: 10px; padding: 4px 0; }
.tmsg .msg-body { font-size: 14px; }
.thread-more { font-size: 12px; color: var(--rust-strong); font-weight: 700; margin: 4px 0 2px 40px; }
.thread-replies { border-left: 2px solid var(--line); margin-left: 14px; padding-left: 12px; }
.thread-reply-btn { margin: 8px 0 0 40px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; }
.tab-n { font-size: 11px; font-weight: 800; background: var(--hover); color: var(--muted); border-radius: 9px; padding: 0 6px; margin-left: 2px; }
.tab.on .tab-n { background: rgba(255,255,255,.2); color: inherit; }
.draft-row { align-items: center; }
.draft-row .snippet { -webkit-line-clamp: 1; }
/* Files page (Slack-style) */
.files-scroll { flex: 1; overflow-y: auto; }
.files-scroll .files-list { overflow: visible; }
.doc-tile { display: grid; place-items: center; color: #fff; }
.doc-tile.canvas { background: var(--brand-rust); }
.doc-tile.list { background: #2b2b28; }
/* Templates strip */
.tpl-wrap { padding: 12px 20px 4px; border-bottom: 1px solid var(--line); }
.tpl-toggle { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; }
.tpl-wrap.closed .tpl-row { display: none; }
.tpl-wrap.closed .tpl-toggle .chev { transform: rotate(-90deg); }
.tpl-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.tpl-card { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; flex: 0 0 210px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-align: left; background: var(--panel); transition: box-shadow .15s, transform .15s; }
.tpl-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tpl-preview { height: 74px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.tpl-preview.canvas { background: var(--rust-soft); color: var(--rust-strong); }
.tpl-preview.list { background: var(--brand-light-gray); color: #2b2b28; }
.tpl-text { padding: 10px 12px 12px; flex: 1; }
.icon-spacer { width: 32px; flex-shrink: 0; }
.tpl-title { font-weight: 800; }
.tpl-blurb { color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
/* Doc page header */
.doc-head { gap: 10px; }
.doc-title { font: inherit; font-size: 18px; font-weight: 800; border: 0; outline: none; background: none; width: 100%; padding: 2px 4px; border-radius: 6px; color: var(--text); }
.doc-title:hover, .doc-title:focus { background: var(--hover); }
.doc-status { display: block; font-size: 12px; color: var(--muted); padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; }
.share-pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 14px; padding: 3px 10px; }
.doc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Canvas */
.lock-banner { display: flex; align-items: center; gap: 10px; padding: 9px 20px; background: var(--rust-soft); color: var(--mention-text); font-size: 13.5px; border-bottom: 1px solid var(--line); }
.lock-banner.mine { background: var(--hover); color: var(--muted); }
.canvas-bar.disabled { opacity: .45; pointer-events: none; }
.canvas-ed[contenteditable="false"] { cursor: default; }
.canvas-bar { position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); }
.canvas-scroll { flex: 1; overflow-y: auto; background: var(--bg); }
.canvas-page { max-width: 780px; margin: 0 auto; padding: 28px 32px 120px; }
.canvas-ed { max-height: none; min-height: 60vh; font-size: 15px; line-height: 1.6; }
.canvas-ed h1 { font-size: 26px; font-weight: 800; text-transform: uppercase; margin: 18px 0 8px; line-height: 1.2; }
.canvas-ed h2 { font-size: 18px; font-weight: 700; margin: 16px 0 6px; }
.canvas-ed [data-chk] { position: relative; padding-left: 28px; }
.canvas-ed [data-chk]::before { content: ""; position: absolute; left: 2px; top: .28em; width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 4px; cursor: pointer; box-sizing: border-box; }
.canvas-ed [data-chk="1"] { color: var(--muted); text-decoration: line-through; }
.canvas-ed [data-chk="1"]::before { background: var(--rust); border-color: var(--rust); }
.canvas-ed [data-chk="1"]::after { content: ""; position: absolute; left: 7px; top: calc(.28em + 3px); width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ce h1, .ce h2 { margin-top: 0; }
/* List */
.list-wrap { overflow-y: auto; }
.list-bar { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; position: sticky; top: 0; z-index: 1; }
.list-bar .grow { flex: 1; }
.list-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.list-progress .bar { width: 90px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.list-progress .bar span { display: block; height: 100%; background: var(--rust); }
.li-table { padding: 0 0 40px; overflow-x: auto; }
.li-table > .li-row { min-width: 860px; }
.li-row { display: grid; grid-template-columns: 34px minmax(180px, 2fr) 150px 140px 130px minmax(120px, 1.5fr) 36px; gap: 8px; align-items: center; padding: 6px 20px; border-bottom: 1px solid var(--line); }
.li-row:hover { background: var(--hover); }
.li-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding-top: 10px; padding-bottom: 8px; }
.li-head:hover { background: none; }
.li-check { width: 20px; height: 20px; border: 2px solid var(--muted); border-radius: 5px; display: grid; place-items: center; color: #fff; }
.li-check.on { background: var(--rust); border-color: var(--rust); }
.li-row input, .li-row select { font: inherit; border: 1px solid transparent; background: none; border-radius: 6px; padding: 5px 7px; width: 100%; outline: none; color: var(--text); min-width: 0; }
.li-row input:hover, .li-row select:hover { border-color: var(--line); }
.li-row input:focus, .li-row select:focus { border-color: var(--rust); background: var(--panel); }
.li-title { font-weight: 600; }
.li-row.done .li-title { text-decoration: line-through; color: var(--muted); }
.li-notes { color: var(--muted); font-size: 13px; }
.li-date.overdue { color: var(--danger); font-weight: 700; }
.li-status { font-weight: 700; font-size: 13px; }
.li-status.s-doing { color: var(--rust-strong); }
.li-status.s-done { color: var(--muted); }
.li-del { opacity: 0; color: var(--muted); }
.li-row:hover .li-del { opacity: 1; }
.add-item { padding: 8px 20px; }
.add-item input { width: 100%; border: 1px dashed var(--line); border-radius: 8px; padding: 9px 12px; background: none; outline: none; font: inherit; }
.add-item input:focus { border-color: var(--rust); border-style: solid; background: var(--panel); }
/* Deleted */
.trash-note { display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--panel); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 6px; }

.files-head .title { font-size: 19px; font-weight: 800; }
.new-btn { display: flex; align-items: center; gap: 6px; padding: 7px 14px; }
.files-top { padding: 14px 20px 10px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.big-search { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--muted); background: var(--panel); }
.big-search:focus-within { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(211,66,39,.15); }
.big-search input { border: 0; outline: none; background: none; width: 100%; font-size: 15px; color: var(--text); }
.files-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.files-filters .grow { flex: 1; }
.files-filters .tab { font-weight: 600; font-size: 13px; }
.tab.dd { gap: 5px; }
.tab.dd.on { background: var(--rust); border-color: var(--rust); color: var(--on-rust); }
.mobile-only { display: none !important; }
.file-row { align-items: center; padding: 10px 20px; }
.file-row:hover { background: var(--hover); }
.file-row .snippet { -webkit-line-clamp: 1; font-size: 13px; }
.file-row .icon-btn { color: var(--muted); flex-shrink: 0; }
.file-row .icon-btn:hover { color: var(--text); background: var(--panel); }
.star-btn.on { color: var(--rust) !important; }
.star-btn.on svg { fill: currentColor; }
.pm-item.danger { color: var(--danger); }
.pm-item.danger:hover { background: var(--danger); color: #fff; }
.side-divider { height: 1px; background: var(--side-line); margin: 10px 16px; }
.search-bar { padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.search-bar input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); outline: none; }
.search-bar input:focus { border-color: var(--rust); }
.group-label { padding: 14px 20px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty svg { color: var(--rust); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin: 0 0 6px; }
.dm-strip { display: flex; gap: 14px; padding: 6px 16px 12px; overflow-x: auto; }
.dm-strip button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--side-text); width: 58px; }
.dm-strip button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; text-align: center; }
.dm-strip button.unread > span:last-child { font-weight: 800; }
.dm-strip .strip-av { position: relative; display: inline-flex; }
.dm-strip .strip-av .badge { position: absolute; top: -4px; right: -6px; border: 2px solid var(--side); min-width: 20px; }

/* ---------- modals ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(43,40,37,.55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0 } }
.modal { background: var(--panel); color: var(--text); border-radius: 14px; width: min(520px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 8px 20px 12px; overflow-y: auto; }
.modal-foot { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--bg); outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--rust); }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.btn { border-radius: 8px; padding: 8px 16px; font-weight: 600; border: 1px solid var(--line); background: var(--panel); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--rust); border-color: var(--rust); color: var(--on-rust); }
.btn.primary:hover { background: var(--rust-strong); border-color: var(--rust-strong); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; }
.people-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.person-row:hover { background: var(--hover); }
.person-row .grow { flex: 1; min-width: 0; }
.person-row .t { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: var(--rust-soft); border-radius: 14px; padding: 3px 6px 3px 10px; font-size: 13px; display: flex; gap: 4px; align-items: center; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table td, .admin-table th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.admin-table tr.inactive td { opacity: .6; }
.admin-person { display: flex; gap: 10px; align-items: center; }
.ap-name { font-weight: 700; }
.ap-sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.role-pill { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; background: var(--rust-soft); color: var(--mention-text); border-radius: 6px; padding: 1px 6px; }
.role-pill.off { background: var(--hover); color: var(--muted); }
.ap-title { color: var(--text); }
.manage-btn { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.emoji-pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; }
.emoji-pop button { height: 34px; border-radius: 7px; font-size: 20px; }
.emoji-pop button:hover { background: var(--hover); }
.lightbox { position: fixed; inset: 0; background: rgba(43,40,37,.92); z-index: 70; display: grid; place-items: center; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.lightbox .bar { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
.lightbox .bar a, .lightbox .bar button { color: #fff; background: rgba(255,255,255,.14); border-radius: 8px; padding: 8px 12px; text-decoration: none; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 80; box-shadow: var(--shadow); font-size: 14px; }
.mention-pop { position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; z-index: 10; }
.mention-pop .person-row.sel { background: var(--rust-soft); }
.composer-outer { position: relative; }

/* auth screens */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--rail); padding: 20px; color: var(--side-text); }
.auth-card { width: min(400px, 100%); background: var(--side); border: 1px solid var(--side-line); border-radius: 16px; padding: 30px 28px; }
.auth-card .brand { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 12px; }
.auth-card .brand .ws-logo { margin-bottom: 0; }
.auth-card .wm-img { height: 44px; margin-bottom: 14px; }
.auth-card h1 { margin: 0; font-size: 30px; font-weight: 300; color: var(--rust); text-transform: uppercase; letter-spacing: .06em; line-height: 1.05; }
.auth-card p { color: var(--side-muted); margin: 4px 0 18px; }
.auth-card .field input { background: var(--side-deep); border-color: var(--side-line); color: var(--side-text); }
.auth-card .btn.primary { width: 100%; padding: 11px; margin-top: 6px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--side-muted); display: flex; gap: 6px; align-items: center; }

/* ---------- mobile / narrow ---------- */
@media (max-width: 1100px) {
  .shell.with-thread { grid-template-columns: 72px 280px 1fr; }
  .shell.with-thread .thread { position: fixed; inset: 0 0 0 auto; width: min(420px, 100%); z-index: 30; box-shadow: var(--shadow); }
}
@media (max-width: 760px) {
  .shell, .shell.with-thread, .shell.with-todo, .shell.with-thread.with-todo { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail { flex-direction: row; justify-content: space-around; order: 2; padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--rail-hover); grid-row: 2; }
  .rail .ws-logo, .rail-logo, .rail-spacer, .rail .me { display: none; }
  .rail-btn { width: auto; flex: 1; }
  .rail .desk-only { display: none; }
  .sidebar { grid-row: 1; border-right: 0; }
  .main { grid-row: 1; }
  .shell.view-side .main { display: none; }
  .shell.view-main .sidebar { display: none; }
  .shell.view-main .rail { display: none; }
  .back-btn { display: grid; }
  .shell.with-thread .thread { inset: 0; width: 100%; }
  .msg { padding-left: 14px; padding-right: 14px; }
  .msg-tools { right: 8px; }
  .composer-wrap { padding: 0 10px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .hint { display: none; }
  .mobile-only { display: flex !important; }
  .cal-month { grid-template-rows: auto repeat(6, minmax(64px, 1fr)); min-height: 0; }
  .cal-ev:not(.allday) .ev-time, .cal-ev:not(.allday) .ev-title { display: none; }
  .cal-ev:not(.allday) { padding: 0; }
  .cal-head .seg button { padding: 5px 6px; font-size: 12.5px; }
  .cal-head .actions { gap: 2px; }
  .cal-head { flex-wrap: wrap; row-gap: 6px; }
  .cal-head .title { flex: 1; font-size: 17px; white-space: nowrap; }
  .cal-head .actions { width: 100%; justify-content: space-between; }
  .cal-aday { gap: 8px; padding: 8px 10px; }
  .cal-adate { width: 40px; }
  .cal-arow { gap: 8px; padding: 6px 4px; }
  .cal-arow .ev-time { width: 72px; flex-shrink: 0; font-size: 12px; }
  .cal-arow .ev-loc { display: none; }
  .right-col { position: fixed; inset: 0; z-index: 45; border: 0; padding-top: env(safe-area-inset-top); }
  .todo-acts { display: flex; position: static; background: none; }
  .todo-row:hover .todo-due { visibility: visible; }
  .wiki-page { padding: 20px 16px 100px; }
  .wiki-ed [data-columns] { grid-auto-flow: row; gap: 4px; }
  .hist { grid-template-columns: 1fr; height: auto; }
  .hist-list { flex-direction: row; overflow-x: auto; border: 0; }
  .fmt-hint { display: none; }
  .wiki-title { font-size: 28px; }
  .wiki-icon { font-size: 48px; }
  .wiki-cover { height: 130px; }
  .wiki-edited, .crumb-root, .crumb-sep, .crumbs .crumb:not(.cur) { display: none; }
  .lib-row { grid-template-columns: 1fr 90px; }
  .lib-row > :nth-child(2), .lib-row > :nth-child(3), .lib-row > :nth-child(5) { display: none; }
  .desktop-only, .chat-dock { display: none !important; }
  .mobile-search { display: flex !important; }
  .li-head { display: none; }
  .li-table > .li-row { min-width: 0; }
  .li-row { grid-template-columns: 30px 1fr 1fr 36px; grid-template-areas: "c t t d" ". a a ." ". u s ." ". n n ."; padding: 10px 12px; row-gap: 2px; }
  .li-row .li-check { grid-area: c; } .li-row .li-title { grid-area: t; } .li-row .li-del { grid-area: d; opacity: 1; }
  .li-row select:not(.li-status) { grid-area: a; } .li-row .li-date { grid-area: u; } .li-row .li-status { grid-area: s; } .li-row .li-notes { grid-area: n; }
  .canvas-page { padding: 18px 16px 100px; }
  .doc-head .share-btn { padding: 6px 8px; font-size: 0; gap: 0; } /* icon only on phones, so the title has room */
  .doc-head .share-pill { display: none; }
  .tpl-wrap { padding: 10px 12px 2px; }
  .files-filters .grow { display: none; }
  .file-row .icon-btn:not(.star-btn):not([title='More actions']) { display: none; }
}
@media (max-width: 760px) {
  .shell.view-page .sidebar { display: none; }
}
