/* Diva · custo.tech, chat UI.
   Layout and interaction follow Claude (sidebar, centered reading column, plain
   answers, rounded composer, files in a side panel) so the team needs no
   training. Look: warm neutrals, custo.tech purple as the one strong color,
   lime only as a small accent, Sinteca for everything. */

/* `hidden` always wins over component display rules. */
[hidden] { display: none !important; }

@font-face { font-family: 'Sinteca'; src: url('fonts/Sinteca-Regular.woff') format('woff');  font-weight: 400; font-display: swap; }
@font-face { font-family: 'Sinteca'; src: url('fonts/Sinteca-Medium.woff') format('woff');   font-weight: 500; font-display: swap; }
@font-face { font-family: 'Sinteca'; src: url('fonts/Sinteca-SemiBold.woff') format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Sinteca'; src: url('fonts/Sinteca-Bold.woff') format('woff');     font-weight: 700; font-display: swap; }

:root {
  /* Surfaces */
  --bg: #FAF9F7;
  --side: #F3F2EE;
  --surface: #FFFFFF;
  --raised: #FFFFFF;
  --hover: #EBE9E3;
  --active: #E4E1D9;
  --user-bubble: #EFEDE7;
  /* Text */
  --text: #24231F;
  --text-2: #4A4842;
  --muted: #5E5A52;
  --faint: #6B675F;
  /* Lines */
  --line: #E6E3DC;
  --line-strong: #D6D2C8;
  /* Brand */
  --accent: #4851C5;
  --accent-hover: #3C44AE;
  --accent-text: #FFFFFF;
  --accent-soft: #ECEBFB;
  --accent-ink: #3A41A8;
  --lime: #BFE806;
  /* States */
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --ok: #2F7D32;
  --warn-soft: #FFF4D6;
  --warn-ink: #7A5200;
  /* Code */
  --code-bg: #1E1F2B;
  --code-head: #2A2B3A;
  --code-text: #E8E8F2;
  --inline-code-bg: #EFEDE7;
  /* Code view in the files panel (highlight.js tokens), GitHub-like */
  --pc-bg: #FBFAF8; --pc-text: #24292F; --pc-gutter: #656D76; --pc-rule: #E6E3DC;
  --hl-keyword: #CF222E; --hl-title: #8250DF; --hl-attr: #0550AE; --hl-string: #0A3069; --hl-built: #953800;
  --hl-comment: #656D76; --hl-name: #116329; --hl-section: #0550AE; --hl-bullet: #953800; --hl-add: #116329; --hl-del: #82071E;
  /* Effects */
  --shadow-sm: 0 1px 2px rgba(36, 35, 31, .06);
  --shadow: 0 2px 6px rgba(36, 35, 31, .06), 0 8px 24px rgba(36, 35, 31, .06);
  --shadow-lg: 0 12px 40px rgba(36, 35, 31, .16);
  --focus: 0 0 0 3px rgba(72, 81, 197, .28);
  /* Type and shape */
  --font: 'Sinteca', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r-sm: 8px; --r: 12px; --r-lg: 20px;
  --side-w: 272px;
  --col: 760px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1E1D1B; --side: #191816; --surface: #262522; --raised: #2C2B28; --hover: #2E2D2A; --active: #383632; --user-bubble: #2F2D29;
    --text: #ECEAE4; --text-2: #CFCBC2; --muted: #A39F95; --faint: #8F8B82;
    --line: #34322E; --line-strong: #46433D;
    --accent: #8C93F5; --accent-hover: #A3A9F8; --accent-text: #15162B; --accent-soft: #2B2D4F; --accent-ink: #B9BEFA;
    --danger: #FF8A80; --danger-soft: #3A1E1C; --ok: #7FD483; --warn-soft: #3A2E14; --warn-ink: #FFD68A;
    --code-bg: #141416; --code-head: #1E1E22; --code-text: #E6E6EE; --inline-code-bg: #34322E;
    --pc-bg: #141416; --pc-text: #E6E6EE; --pc-gutter: #9A9CB3; --pc-rule: rgba(255, 255, 255, .07);
    --hl-keyword: #FF7B72; --hl-title: #D2A8FF; --hl-attr: #79C0FF; --hl-string: #A5D6FF; --hl-built: #FFA657;
    --hl-comment: #8B949E; --hl-name: #7EE787; --hl-section: #79C0FF; --hl-bullet: #F2CC60; --hl-add: #AFF5B4; --hl-del: #FFDCD7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 6px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.25); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    --focus: 0 0 0 3px rgba(140, 147, 245, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1E1D1B; --side: #191816; --surface: #262522; --raised: #2C2B28; --hover: #2E2D2A; --active: #383632; --user-bubble: #2F2D29;
  --text: #ECEAE4; --text-2: #CFCBC2; --muted: #A39F95; --faint: #8F8B82;
  --line: #34322E; --line-strong: #46433D;
  --accent: #8C93F5; --accent-hover: #A3A9F8; --accent-text: #15162B; --accent-soft: #2B2D4F; --accent-ink: #B9BEFA;
  --danger: #FF8A80; --danger-soft: #3A1E1C; --ok: #7FD483; --warn-soft: #3A2E14; --warn-ink: #FFD68A;
  --code-bg: #141416; --code-head: #1E1E22; --code-text: #E6E6EE; --inline-code-bg: #34322E;
  --pc-bg: #141416; --pc-text: #E6E6EE; --pc-gutter: #9A9CB3; --pc-rule: rgba(255, 255, 255, .07);
  --hl-keyword: #FF7B72; --hl-title: #D2A8FF; --hl-attr: #79C0FF; --hl-string: #A5D6FF; --hl-built: #FFA657;
  --hl-comment: #8B949E; --hl-name: #7EE787; --hl-section: #79C0FF; --hl-bullet: #F2CC60; --hl-add: #AFF5B4; --hl-del: #FFDCD7;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 2px 6px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.25); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  --focus: 0 0 0 3px rgba(140, 147, 245, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent-ink); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
/* Text fields that sit inside a framed box: the box shows focus, not the field. */
.composer textarea:focus-visible, .search-box input:focus-visible, .edit-box textarea:focus-visible { box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
kbd { font: 500 11px/1 var(--font); color: var(--faint); border: 1px solid var(--line-strong); border-radius: 5px; padding: 3px 5px; }
.ph, .ph-bold { font-size: 18px; line-height: 1; }

/* ─── Shell ─────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) auto; height: 100vh; height: 100dvh; overflow: hidden; }
.app.side-collapsed { grid-template-columns: 0 minmax(0, 1fr) auto; }
.app.side-collapsed .sidebar { visibility: hidden; }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 6px 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 17px; }
.brand img { width: 24px; height: 24px; }
.side-nav { display: grid; gap: 2px; padding: 6px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2); text-align: left; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); }
.nav-item > span:not(.nav-new-icon) { flex: 1; }
.nav-new { font-weight: 600; color: var(--text); }
.nav-new-icon { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; margin-left: -2px; }
.nav-new-icon .ph-bold { font-size: 13px; }
.nav-kbd { opacity: 0; transition: opacity .15s; }
.nav-item:hover .nav-kbd { opacity: 1; }
.side-scope { margin: 8px 12px 2px; display: grid; grid-template-columns: 1fr 1fr; background: var(--hover); border-radius: var(--r-sm); padding: 3px; gap: 3px; }
.scope-btn { padding: 5px 8px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.scope-btn[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 500; }
.side-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; }
.list-group { font-size: 12px; font-weight: 500; color: var(--faint); padding: 14px 10px 4px; }
.list-empty { color: var(--faint); font-size: 13px; padding: 14px 10px; }
.chat-item { position: relative; display: flex; align-items: center; border-radius: var(--r-sm); }
.chat-item:hover, .chat-item:focus-within { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-link { flex: 1; min-width: 0; display: grid; padding: 7px 10px; text-align: left; color: var(--text-2); }
.chat-item.active .chat-link { color: var(--text); }
.chat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.chat-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--faint); }
/* On a highlighted row the faintest gray drops below 4.5:1, so it steps up. */
.chat-item:hover .chat-sub, .chat-item.active .chat-sub, .search-hit:hover .s, .search-hit.sel .s { color: var(--muted); }
.chat-more { width: 28px; height: 28px; margin-right: 4px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); opacity: 0; }
.chat-item:hover .chat-more, .chat-item.active .chat-more, .chat-more:focus-visible, .chat-more[aria-expanded="true"] { opacity: 1; }
.chat-more:hover { background: var(--active); color: var(--text); }
.side-foot { border-top: 1px solid var(--line); padding: 8px; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: var(--r-sm); text-align: left; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-meta { flex: 1; min-width: 0; display: grid; }
.user-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--faint); }
.scrim { display: none; }

/* ─── Main ──────────────────────────────────────────────────────────────── */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px; }
#sidebar-open { visibility: hidden; }
.app.side-collapsed #sidebar-open { visibility: visible; }
.top-title { flex: 1; min-width: 0; display: flex; justify-content: center; }
.chat-title-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text); font-weight: 500; }
.chat-title-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title-btn:hover, .chat-title-btn[aria-expanded="true"] { background: var(--hover); }
.chat-title-btn .ph { font-size: 14px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 8px; min-width: 34px; justify-content: flex-end; }
.conn-pill { font-size: 12px; color: var(--warn-ink); background: var(--warn-soft); border-radius: 999px; padding: 4px 10px; }
.client-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); max-width: 320px; }
.client-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-pill:hover { background: var(--hover); }
.client-pill .ph { font-size: 15px; }
.banner { margin: 0 auto 8px; width: min(var(--col), calc(100% - 32px)); background: var(--warn-soft); color: var(--warn-ink); border-radius: var(--r); padding: 10px 14px; font-size: 14px; }

.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-chat { position: relative; }

/* ─── Thread ────────────────────────────────────────────────────────────── */
.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.thread-col { width: min(var(--col), 100%); margin: 0 auto; padding: 12px 24px 40px; display: flex; flex-direction: column; gap: 28px; }
.view-chat.is-empty .thread { display: none; }
.notice { align-self: center; font-size: 13px; color: var(--muted); background: var(--hover); border-radius: 999px; padding: 6px 12px; text-align: center; }
.msg { position: relative; display: flex; flex-direction: column; min-width: 0; }
.msg-user { align-items: flex-end; }
.msg-user .bubble { background: var(--user-bubble); border-radius: var(--r-lg); padding: 10px 16px; max-width: min(85%, 620px); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; line-height: 1.55; }
.msg-user .msg-actions { opacity: 0; }
.msg-user:hover .msg-actions, .msg-user:focus-within .msg-actions { opacity: 1; }
.msg-assistant .bubble { font-size: 16px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.msg-actions { display: flex; gap: 2px; margin-top: 6px; transition: opacity .15s; }
.msg-assistant .msg-actions { opacity: 0; }
.msg-assistant:hover .msg-actions, .msg-assistant:focus-within .msg-actions, .msg-assistant.last .msg-actions { opacity: 1; }
.act { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--muted); }
.act:hover { background: var(--hover); color: var(--text); }
.act.on { color: var(--accent); }
.act .ph { font-size: 16px; }
.edit-box { width: min(100%, 620px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 10px 12px; box-shadow: var(--shadow-sm); }
.edit-box textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 15.5px; line-height: 1.55; max-height: 300px; }
.edit-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* What Diva did (tools, thinking): one line above the answer, a spinner and
   the current step while streaming, a summary after; it opens a timeline. */
.steps { margin: -2px 0 10px; min-width: 0; }
.steps-head { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 30px; margin-left: -8px; padding: 4px 8px; border-radius: var(--r-sm); color: var(--muted); font-size: 14px; line-height: 1.35; text-align: left; transition: background .15s, color .15s; }
.steps-head:hover { color: var(--text); }
@media (hover: hover) { .steps-head:hover { background: var(--hover); } }
.steps-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps-spin { display: none; flex: none; }
.steps.live .steps-spin { display: inline-grid; place-items: center; color: var(--accent-ink); }
.steps.live .steps-title { color: var(--text-2); }
.steps-spin .ph, .step-item.pending .step-dot .ph { animation: steps-spin 1s linear infinite; }
@keyframes steps-spin { to { transform: rotate(360deg); } }
.steps-caret { flex: none; font-size: 13px; transition: transform .2s ease; }
.steps.open .steps-caret { transform: rotate(180deg); }
.steps-body { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .22s ease, visibility 0s linear .22s; }
.steps.open .steps-body { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .22s ease, visibility 0s; }
.steps-clip { min-height: 0; overflow: hidden; }
.steps-list { list-style: none; margin: 6px 0 4px; padding: 14px 16px 12px; display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.step-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding-bottom: 10px; }
.step-item:last-child { padding-bottom: 2px; }
.step-item:not(:last-child)::before { content: ''; position: absolute; left: 11.5px; top: 28px; bottom: 4px; width: 1px; background: var(--line); }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--muted); }
.step-dot .ph { font-size: 14px; }
.step-item.pending .step-dot { color: var(--accent-ink); }
.step-text { min-width: 0; padding-top: 2px; }
.step-label { font-size: 13.5px; line-height: 1.45; color: var(--text-2); overflow-wrap: anywhere; }
.step-detail { margin-top: 3px; font-size: 12.5px; line-height: 1.5; color: var(--faint); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .steps-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
}
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; height: 28px; }
.pulse-mark { width: 22px; height: 22px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .95; } 50% { transform: scale(.86); opacity: .6; } }
.msg.streaming .msg-actions { visibility: hidden; }

/* Markdown inside answers */
.bubble > :first-child { margin-top: 0; }
.bubble > :last-child { margin-bottom: 0; }
.bubble p { margin: 0 0 14px; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { line-height: 1.3; margin: 24px 0 10px; font-weight: 600; }
.bubble h1 { font-size: 1.45em; } .bubble h2 { font-size: 1.25em; } .bubble h3 { font-size: 1.1em; } .bubble h4 { font-size: 1em; }
.bubble ul, .bubble ol { margin: 0 0 14px; padding-left: 1.5em; }
.bubble li { margin: 4px 0; }
.bubble li > p { margin: 0; }
.bubble strong { font-weight: 600; }
.bubble a { color: var(--accent-ink); text-underline-offset: 2px; }
.bubble hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.bubble blockquote { margin: 0 0 14px; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--text-2); }
.bubble code { font-family: var(--mono); font-size: .88em; background: var(--inline-code-bg); padding: 2px 5px; border-radius: 5px; }
.bubble img { max-width: 100%; border-radius: var(--r); }
.table-wrapper { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--r); }
.bubble table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.bubble th, .bubble td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.bubble th { font-weight: 600; background: var(--hover); }
.bubble tr:last-child td { border-bottom: 0; }
.code-wrapper { margin: 0 0 16px; border-radius: var(--r); overflow: hidden; background: var(--code-bg); }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: var(--code-head); color: #A9AABB; font-size: 12px; }
.copy-btn { display: inline-flex; align-items: center; gap: 5px; color: #C9CADA; font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.copy-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.copy-btn .ph { font-size: 14px; }
.code-wrapper pre { margin: 0; padding: 14px; overflow-x: auto; }
.code-wrapper code { background: none; padding: 0; font-size: 13.5px; line-height: 1.6; color: var(--code-text); }

/* File cards: uploads on the user's message, files Diva made on hers. */
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.msg-user .files { justify-content: flex-end; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: 220px; max-width: 320px; text-align: left; color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); }
button.file-card:hover, a.file-card:hover { border-color: var(--line-strong); background: var(--raised); }
.file-icon { width: 36px; height: 40px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.file-icon .ph { font-size: 20px; }
.file-meta { min-width: 0; display: grid; }
.file-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 12px; color: var(--muted); }

/* ─── Empty state ───────────────────────────────────────────────────────── */
.empty { display: none; }
.view-chat.is-empty .empty { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; flex: 1 1 0; padding: 0 24px 26px; min-height: 120px; }
.greet { display: flex; align-items: center; gap: 14px; }
.greet-mark { width: 40px; height: 40px; }
.greet-text { margin: 0; font-weight: 500; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.01em; text-align: center; text-wrap: balance; }
.greet-sub { margin: 0; color: var(--muted); text-align: center; }
.view-chat.is-empty .composer-dock { flex: 1 1 0; justify-content: flex-start; padding-top: 0; }

/* ─── Composer ──────────────────────────────────────────────────────────── */
.composer-dock { flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px 12px; }
.composer { position: relative; width: min(var(--col), 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 12px 12px 10px 16px; display: grid; gap: 8px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 16px; line-height: 1.5; max-height: 40vh; min-height: 26px; padding: 2px 0; }
.composer textarea::placeholder { color: var(--faint); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.tool-btn { width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.tool-btn:hover { background: var(--hover); color: var(--text); }
.tool-btn.recording { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.tool-btn.busy { opacity: .6; pointer-events: none; }
.tool-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; max-width: 220px; }
.tool-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-chip .ph { font-size: 15px; }
.send-btn { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent); color: var(--accent-text); flex: none; }
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { background: var(--hover); color: var(--faint); cursor: default; }
.send-btn.stop { background: var(--text); color: var(--bg); }
.send-btn .ph-bold { font-size: 16px; }
.att-row { display: flex; flex-wrap: wrap; gap: 8px; }
.att { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 30px 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 13px; max-width: 240px; }
.att span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att.uploading { opacity: .6; }
.att-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.att-x:hover { background: var(--hover); color: var(--text); }
.drop-hint { display: none; }
.composer.dragging { border-color: var(--accent); border-style: dashed; }
.composer.dragging .drop-hint { display: grid; place-items: center; position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); color: var(--accent-ink); font-weight: 500; z-index: 2; }
.composer-note { margin: 0; font-size: 12px; color: var(--faint); text-align: center; }
.view-chat.is-empty .composer-note { display: none; }
.suggestions { width: min(var(--col), 100%); display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sugg { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 14px; }
.sugg:hover { background: var(--hover); color: var(--text); }
.sugg .ph { font-size: 16px; color: var(--muted); }

/* ─── Clients (Claude's Projects) ───────────────────────────────────────── */
.view-clients, .view-client { overflow-y: auto; }
.page-col { width: min(960px, 100%); margin: 0 auto; padding: 8px 24px 48px; display: grid; gap: 22px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-sm); font-weight: 500; font-size: 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn .ph { font-size: 16px; }
.field { width: 100%; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); outline: 0; }
.field:focus { border-color: var(--accent); box-shadow: var(--focus); }
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.client-card { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; min-height: 104px; align-content: start; }
.client-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.client-card h3 { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.client-card p { margin: 0; font-size: 13px; color: var(--muted); }
.client-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.client-main { display: grid; gap: 22px; min-width: 0; }
.knowledge-body { font-size: 13.5px; color: var(--text-2); max-height: 380px; overflow-y: auto; line-height: 1.55; }
.knowledge-body.bubble { font-size: 13.5px; line-height: 1.55; }
.knowledge-body.bubble h1, .knowledge-body.bubble h2, .knowledge-body.bubble h3 { font-size: 14px; margin: 12px 0 6px; }
.knowledge-note { font-size: 12px; color: var(--faint); margin: 0; overflow-wrap: anywhere; }
.client-chats { display: grid; gap: 2px; }
.client-chats .chat-item { border-bottom: 1px solid var(--line); border-radius: 0; }
.client-chats .chat-link { padding: 12px 6px; }
.client-chats .chat-name { font-size: 15px; color: var(--text); }
.client-chats .list-empty { padding: 12px 6px; }

/* Client page, laid out like a Claude Project: composer and chats on the left,
   instructions, files and what Diva knows as cards on the right. */
.client-page { gap: 18px; padding-top: 4px; }
/* Stack the cards by the room the page has, not the window: the preview panel
   takes half the width on a laptop. */
.view-client { container-type: inline-size; }
@container (max-width: 780px) { .client-layout { grid-template-columns: minmax(0, 1fr); } }
.back-link { justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin: 0 0 -8px -6px; padding: 4px 8px 4px 6px; border-radius: var(--r-sm); color: var(--muted); font-size: 14px; text-decoration: none; }
.back-link:hover { background: var(--hover); color: var(--text); }
.back-link .ph { font-size: 15px; }
.client-head { flex-wrap: nowrap; align-items: flex-start; }
.client-head h1 { min-width: 0; overflow-wrap: anywhere; }
.head-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.client-composer { width: 100%; }
.client-composer textarea { min-height: 52px; }
.client-compose-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.client-compose-hint span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-compose-hint .ph { font-size: 15px; color: var(--accent-ink); flex: none; }
.client-chats-sec { display: grid; gap: 4px; min-width: 0; }
.sec-h { margin: 0; padding: 0 6px 6px; font-size: 14px; font-weight: 600; color: var(--text-2); display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); }
.sec-count { font-size: 12px; font-weight: 500; color: var(--muted); }
.client-side { display: grid; gap: 14px; min-width: 0; }
.pcard { position: relative; display: grid; gap: 10px; min-width: 0; padding: 12px 14px 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; overflow-wrap: anywhere; }
.pcard-head h2 { min-width: 0; }
.pcard-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.pcard-head h2 > .ph { font-size: 17px; color: var(--accent-ink); }
.icon-btn.sm { width: 30px; height: 30px; }
.instr-preview { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--text-2); font-size: 13.5px; line-height: 1.55; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Clamped inside the padding, so a cut line never peeks out under it. */
.instr-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 8; overflow: hidden; max-height: calc(1.55em * 8); }
.instr-preview:hover { border-color: var(--line-strong); color: var(--text); }
.instr-preview.empty { border-style: dashed; color: var(--muted); }
.pfiles { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; margin: 0 -8px; padding: 0 2px; }
.pfile { display: flex; align-items: center; gap: 2px; border-radius: var(--r-sm); }
.pfile:hover, .pfile:focus-within { background: var(--hover); }
.pfile-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; text-align: left; color: var(--text); border-radius: var(--r-sm); }
.pfile .file-name { font-size: 13.5px; }
.pfile:hover .file-sub, .pfile:focus-within .file-sub { color: var(--text-2); }
.file-icon.sm { width: 30px; height: 34px; border-radius: 6px; }
.file-icon.sm .ph { font-size: 17px; }
.pfile.uploading { opacity: .65; }
.pfile.uploading .ph { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pfile-del { margin-right: 4px; opacity: 0; flex: none; }
.pfile:hover .pfile-del, .pfile:focus-within .pfile-del { opacity: 1; }
.pfile-del:hover { color: var(--danger); }
.pfile-empty { width: calc(100% - 16px); margin: 0 8px; display: grid; justify-items: center; gap: 6px; padding: 18px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--text-2); font-size: 13px; line-height: 1.45; text-align: center; }
.pfile-empty .ph { font-size: 22px; color: var(--accent-ink); }
.pfile-empty:hover { background: var(--hover); color: var(--text); }
.pfile-limit { font-size: 12px; color: var(--muted); }
.files-card.dragging { border-color: var(--accent); border-style: dashed; }
.files-card.dragging .drop-hint { display: grid; place-items: center; position: absolute; inset: 0; z-index: 2; border-radius: inherit; background: color-mix(in srgb, var(--accent-soft) 92%, transparent); color: var(--accent-ink); font-weight: 500; }
.dialog.wide { width: min(640px, calc(100vw - 32px)); }
.dlg textarea.field.instr-field { min-height: 280px; resize: vertical; font-size: 14.5px; line-height: 1.55; }
.dlg-count { margin-right: auto; align-self: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill-extra { flex: none; font-size: 12px; color: var(--muted); }
.pill-extra::before { content: '·'; margin-right: 6px; }

/* ─── Files panel (live documents, like Claude's artifacts) ──────────────── */
/* min-height: 0, or a long document stretches the app's row and pushes the composer off screen. */
.panel { position: relative; width: var(--panel-w, min(46vw, 720px)); border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.panel-resize { position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 5; touch-action: none; }
.panel-resize::after { content: ''; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .15s; }
.panel-resize:hover::after, .panel-resize:focus-visible::after, .app.resizing .panel-resize::after { background: var(--accent); }
.panel-resize:focus-visible { box-shadow: none; }
.app.resizing { cursor: col-resize; user-select: none; }
.app.resizing iframe { pointer-events: none; }
.panel-head { min-height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px 7px 14px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.panel-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.panel-icon .ph { font-size: 18px; }
.panel-titles { display: grid; min-width: 0; gap: 1px; }
.panel-name { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); line-height: 20px; }
.panel-ver { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; margin-left: -4px; }
.ver-btn { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.ver-btn .ph { font-size: 13px; }
.ver-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.ver-btn:disabled { opacity: .4; cursor: default; }
.panel-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-live { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-weight: 500; white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.panel-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.panel-mode { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; margin-right: 6px; border-radius: var(--r-sm); background: var(--hover); }
.panel-mode button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.panel-mode button .ph { font-size: 15px; }
.panel-mode button:hover { color: var(--text); }
.panel-mode button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: var(--shadow-sm); }
.panel-body { flex: 1; min-height: 0; overflow: auto; background: var(--surface); }
.panel-body[data-kind="pdf"], .panel-body[data-kind="html"][data-mode="preview"], .panel-body[data-kind="svg"][data-mode="preview"] { overflow: hidden; }
.panel-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.panel-media { min-height: 100%; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.panel-media img { display: block; max-width: 100%; height: auto; border-radius: var(--r-sm); box-shadow: var(--shadow); }
.panel-doc { max-width: 740px; margin: 0 auto; padding: 32px 40px 64px; font-size: 15.5px; line-height: 1.7; }
.panel-doc h1 { font-size: 1.7em; letter-spacing: -.01em; margin-top: 0; }
.panel-text { margin: 0; padding: 20px 24px; font: 13.5px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.panel-code { display: flex; min-height: 100%; min-width: max-content; background: var(--pc-bg); color: var(--pc-text); font: 13px/1.65 var(--mono); }
.panel-code pre { margin: 0; font: inherit; }
.panel-gutter { flex: none; padding: 16px 12px 16px 16px; min-width: 48px; text-align: right; color: var(--pc-gutter); user-select: none; border-right: 1px solid var(--pc-rule); position: sticky; left: 0; background: var(--pc-bg); }
.panel-src { flex: 1; padding: 16px 20px 16px 16px; }
/* The vendored theme pads pre code.hljs by 1em and paints its own background;
   here the pre carries the padding, so the code lines up with the line numbers. */
.panel-src code.hljs { display: inline; padding: 0; background: none; color: var(--pc-text); font: inherit; overflow: visible; }
/* Token colors come from the theme tokens: light in light mode, dark in dark. */
.panel-src .hljs-keyword, .panel-src .hljs-doctag, .panel-src .hljs-template-tag, .panel-src .hljs-template-variable, .panel-src .hljs-type, .panel-src .hljs-variable.language_ { color: var(--hl-keyword); }
.panel-src .hljs-title, .panel-src .hljs-title.class_, .panel-src .hljs-title.function_ { color: var(--hl-title); }
.panel-src .hljs-attr, .panel-src .hljs-attribute, .panel-src .hljs-literal, .panel-src .hljs-meta, .panel-src .hljs-number, .panel-src .hljs-operator, .panel-src .hljs-variable, .panel-src .hljs-selector-attr, .panel-src .hljs-selector-class, .panel-src .hljs-selector-id { color: var(--hl-attr); }
.panel-src .hljs-regexp, .panel-src .hljs-string, .panel-src .hljs-meta .hljs-string { color: var(--hl-string); }
.panel-src .hljs-built_in, .panel-src .hljs-symbol { color: var(--hl-built); }
.panel-src .hljs-comment, .panel-src .hljs-code, .panel-src .hljs-formula { color: var(--hl-comment); }
.panel-src .hljs-name, .panel-src .hljs-quote, .panel-src .hljs-selector-tag, .panel-src .hljs-selector-pseudo { color: var(--hl-name); }
.panel-src .hljs-subst { color: var(--pc-text); }
.panel-src .hljs-section { color: var(--hl-section); font-weight: 700; }
.panel-src .hljs-bullet { color: var(--hl-bullet); }
.panel-src .hljs-addition { color: var(--hl-add); background: none; }
.panel-src .hljs-deletion { color: var(--hl-del); background: none; }
.panel-table { padding: 0; }
.panel-table table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.panel-table th, .panel-table td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; white-space: nowrap; }
.panel-table th { position: sticky; top: 0; background: var(--side); font-weight: 600; box-shadow: inset 0 -1px 0 var(--line); }
.panel-msg { padding: 40px 24px; text-align: center; color: var(--muted); display: grid; gap: 14px; justify-items: center; }
.panel-spin .ph, .file-card.live .file-sub .ph { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
/* A file Diva is still writing: its card says so. */
.file-card.live { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.file-card.live .file-sub { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-ink); }
.file-card.live .file-sub .ph { font-size: 13px; }

/* ─── Menus, dialogs, toasts ───────────────────────────────────────────── */
.menu { position: fixed; z-index: 50; min-width: 200px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 5px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; text-align: left; font-size: 14px; color: var(--text); text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); box-shadow: none; }
.menu-item.danger { color: var(--danger); }
.menu-item .ph { font-size: 17px; color: var(--muted); }
.menu-item.danger .ph { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-label { font-size: 12px; color: var(--faint); padding: 6px 10px 4px; }
.dialog { border: 0; padding: 0; border-radius: 16px; background: var(--raised); color: var(--text); box-shadow: var(--shadow-lg); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
.dialog::backdrop { background: rgba(20, 19, 17, .45); }
.dlg { display: grid; gap: 14px; padding: 22px; }
.dlg h2 { margin: 0; font-size: 18px; font-weight: 600; }
.dlg p { margin: 0; color: var(--text-2); }
.dlg-row { display: flex; justify-content: flex-end; gap: 8px; }
.dlg textarea.field { min-height: 90px; resize: vertical; }
.dialog.search { width: min(620px, calc(100vw - 32px)); align-self: start; margin-top: 12vh; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search-results { max-height: 55vh; overflow-y: auto; padding: 6px; }
.search-hit { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--r-sm); }
.search-hit:hover, .search-hit.sel { background: var(--hover); }
.search-hit .t { font-size: 14px; font-weight: 500; }
.search-hit .s { font-size: 12px; color: var(--faint); }
.search-empty { padding: 18px 14px; color: var(--faint); font-size: 14px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button { padding: 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); display: grid; gap: 4px; justify-items: center; font-size: 13px; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14px; color: var(--text-2); }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg); pointer-events: auto; max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); color: #fff; }

/* ─── Phone ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app, .app.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 40; transform: translateX(-102%); transition: transform .2s ease; visibility: visible !important; box-shadow: var(--shadow-lg); }
  .app.side-open .sidebar { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(20, 19, 17, .4); }
  #sidebar-open { visibility: visible; }
  .panel { position: fixed; inset: 0; width: auto; z-index: 45; border-left: 0; padding-top: env(safe-area-inset-top); animation: sheet-up .22s ease-out; }
  .panel-resize { display: none; }
  /* Sheet header: close, name and file actions on one row; Preview/Code below. */
  .panel-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "close title copy dl" "mode mode mode mode"; align-items: center; column-gap: 4px; row-gap: 0; padding: 6px 6px 8px; }
  .panel-actions { display: contents; }
  .panel-title { grid-area: title; padding-left: 2px; }
  #panel-close { grid-area: close; width: 40px; height: 40px; color: var(--text); }
  #panel-close .ph { font-size: 22px; }
  #panel-copy { grid-area: copy; width: 40px; height: 40px; }
  #panel-download { grid-area: dl; width: 40px; height: 40px; }
  .panel-mode { grid-area: mode; margin: 8px 4px 0; grid-template-columns: 1fr 1fr; }
  .panel-mode button { justify-content: center; height: 32px; }
  .panel-doc { padding: 22px 18px 48px; }
  .client-layout { grid-template-columns: 1fr; }
  .pfiles { max-height: none; overflow-y: visible; }
  .thread-col { padding: 8px 16px 32px; }
  .nav-kbd { display: none; }
}
@media (max-width: 600px) {
  .composer-note { display: none; }
  .greet-mark { width: 32px; height: 32px; }
  .msg-user .bubble { max-width: 90%; }
  .msg-actions { opacity: 1 !important; }
  .chat-more { opacity: 1; }
  .file-card { min-width: 0; max-width: 100%; }
  .head-actions .btn span, .pill-extra { display: none; }
  .head-actions .btn { padding: 8px 10px; }
  .pfile-del { opacity: 1; }
}
@media (hover: none) { .msg-actions, .chat-more, .pfile-del { opacity: 1 !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ─── Starred, archived, share, scroll to bottom ───────────────────────── */
/* An archived chat says so in a bar above the thread (it never covers text). */
.archived-bar { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; width: min(var(--col), calc(100% - 32px)); margin: 0 auto 6px; padding: 4px 6px 4px 14px; background: var(--hover); color: var(--text-2); border-radius: var(--r); font-size: 13.5px; }
.archived-bar .ph { font-size: 15px; color: var(--muted); }
.view-chat.is-empty .archived-bar { display: none; }
.notice-btn { padding: 4px 10px; border-radius: 999px; font-weight: 500; font-size: 13px; color: var(--accent-ink); }
.notice-btn:hover { background: var(--accent-soft); }

.view-archived { overflow-y: auto; }
.archived-list { display: grid; }
.archived-item { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.archived-link { flex: 1; min-width: 0; display: grid; padding: 10px 6px; color: var(--text); text-decoration: none; border-radius: var(--r-sm); }
.archived-link:hover .chat-name { text-decoration: underline; text-underline-offset: 3px; }
.archived-link .chat-name { font-size: 15px; }
.archived-link .chat-sub { color: var(--muted); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.top-right .share-btn { height: 34px; padding: 0 12px; font-size: 13.5px; gap: 6px; }
.share-dlg-body { display: grid; gap: 12px; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row .field { flex: 1; min-width: 0; font: 13px/1.4 var(--mono); color: var(--text-2); background: var(--bg); }
.dlg p.share-private { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.share-private .ph { font-size: 16px; margin-top: 2px; flex: none; }
.dlg p.share-status { font-size: 13.5px; color: var(--text); font-weight: 500; }
.share-status:empty { display: none; }
.share-actions { align-items: center; flex-wrap: wrap; }
.share-actions .grow { flex: 1; }
.btn.danger-text { color: var(--danger); }
.btn.danger-text:hover { background: var(--danger-soft); }
.btn:disabled { opacity: .6; cursor: default; }
/* The shortcut hint shows on a hovered row, where the faintest gray falls
   under 4.5:1 in dark mode. */
.nav-item .nav-kbd { color: var(--muted); }
a.btn { text-decoration: none; }

/* The shared copy (/share/<token>): the app's reading column, no composer. */
.share-body { height: auto; min-height: 100%; }
.share-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.share-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.share-main { flex: 1; min-width: 0; }
.share-col { padding-top: 28px; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.share-head h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); font-weight: 500; letter-spacing: -.01em; line-height: 1.2; overflow-wrap: anywhere; }
.share-meta { margin: 8px 0 0; color: var(--muted); font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.share-notice { margin: -8px 0 0; align-self: flex-start; }
.share-foot { border-top: 1px solid var(--line); padding-top: 20px; display: flex; gap: 6px 12px; flex-wrap: wrap; justify-content: center; color: var(--muted); font-size: 14px; }
.share-missing { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 14vh 8px; }
.share-missing .ph { font-size: 44px; color: var(--muted); }
.share-missing h1 { margin: 0; font-size: 24px; font-weight: 500; }
.share-missing p { margin: 0; color: var(--muted); max-width: 420px; }
.share-loading { color: var(--muted); text-align: center; padding: 20vh 0; }
.file-dl { margin-left: auto; padding-left: 6px; color: var(--muted); font-size: 18px; }

/* Round button above the composer while the thread is scrolled up. */
.composer-dock { position: relative; }
.to-bottom { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); color: var(--text-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow); z-index: 3; animation: to-bottom-in .16s ease-out; }
.to-bottom:hover { background: var(--hover); color: var(--text); }
.to-bottom .ph-bold { font-size: 16px; }
@keyframes to-bottom-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ─── Phone polish ──────────────────────────────────────────────────────── */
.menu-scrim { display: none; }
@keyframes sheet-in { from { transform: translateY(18px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 900px) {
  html { overscroll-behavior: none; }
  /* Sized to the visual viewport (app.js), so the composer sits right above
     the keyboard on iOS too. */
  .app { position: fixed; top: var(--vv-top, 0px); left: 0; right: 0; height: var(--vv-h, 100dvh); }
  /* 16px or more, or iOS zooms the page when a field gets focus. */
  input, textarea, select, .field, .edit-box textarea, .search-box input { font-size: 16px; }
  /* Notch, rounded corners, home bar. */
  .main { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .topbar { height: calc(52px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); }
  .composer-dock { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .kb-open .composer-dock { padding-bottom: 8px; }
  .panel { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .toasts { bottom: calc(18px + env(safe-area-inset-bottom)); }
  /* Scrolling stops at the edge of what is scrolled, never moves the page. */
  .thread, .side-list, .search-results, .panel-body, .view-clients, .view-client, .view-archived, .menu, .dialog, .knowledge-body { overscroll-behavior: contain; }
  .scrim, .menu-scrim { touch-action: none; }
  /* The shadow only while the sidebar is out, or it shows along the left edge. */
  .sidebar { box-shadow: none; }
  .app.side-open .sidebar, .app.side-dragging .sidebar { box-shadow: var(--shadow-lg); }
  .app.side-dragging .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(20, 19, 17, .4); }
  /* Menus as bottom sheets. */
  .menu-scrim { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(20, 19, 17, .4); animation: fade-in .15s ease-out; }
  .menu { left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important; margin: 0 auto; max-width: 560px; min-width: 0; border-radius: 18px; padding: 8px; max-height: min(72dvh, 600px); overflow-y: auto; animation: sheet-in .2s cubic-bezier(.2, .8, .2, 1); }
  .menu::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 2px auto 6px; }
  .menu-item { min-height: 48px; font-size: 16px; padding: 10px 12px; border-radius: 10px; }
  .menu-item .ph { font-size: 20px; }
  .menu-label { padding: 8px 12px 6px; font-size: 13px; }
  /* Tap targets of 44px or more. */
  .icon-btn, .chat-more, .act, .tool-btn, .send-btn, .to-bottom { width: 44px; height: 44px; }
  .chat-more { margin-right: 0; border-radius: var(--r-sm); }
  .chat-link { min-height: 44px; align-content: center; }
  .nav-item, .scope-btn, .chat-title-btn, .client-pill, .btn, .user-btn, .sugg, .notice-btn, .tool-chip { min-height: 44px; }
  .copy-btn { min-height: 36px; }
  .att { padding-right: 40px; }
  .att-x { width: 32px; height: 32px; }
  .top-right .share-btn { width: 44px; height: 44px; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--muted); }
  .top-right .share-btn .ph { font-size: 20px; }
  .top-right .share-btn span { display: none; }
  .share-link-row { flex-direction: column; }
  .share-actions .grow { display: none; }
  .share-actions { flex-direction: column; align-items: stretch; }
  .share-actions .btn { justify-content: center; }
  .share-actions [data-update] { order: 1; }
  .share-actions [data-x] { order: 2; }
  .share-actions [data-stop] { order: 3; }
  button, a { -webkit-tap-highlight-color: transparent; }
}

/* ─── Admin dashboard (/admin) ──────────────────────────────────────────── */
.admin-body { overflow-y: auto; height: auto; min-height: 100%; }
.admin-wrap { width: min(1180px, 100%); margin: 0 auto; padding: 20px 24px 56px; display: grid; gap: 16px; }
.admin-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 4px 0 8px; }
.admin-back { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; padding: 6px 10px 6px 6px; border-radius: var(--r-sm); }
.admin-back:hover { background: var(--hover); }
.admin-back .logo-sm { width: 24px; height: 24px; }
.admin-header h1 { margin: 0; font-size: 22px; font-weight: 500; flex: 1; }
.admin-actions { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; font-size: 14px; }
.btn-secondary:hover { background: var(--hover); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.status-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.status-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; border-left-width: 3px; display: grid; gap: 4px; }
.status-item.good { border-left-color: var(--ok); }
.status-item.warn { border-left-color: #C98A00; }
.status-item.bad { border-left-color: var(--danger); background: var(--danger-soft); }
.status-item.neutral { border-left-color: var(--line-strong); }
.status-label { font-size: 12px; color: var(--muted); }
.status-value { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.status-problems { margin: 12px 0 0; padding-left: 18px; color: var(--danger); font-size: 14px; display: grid; gap: 4px; }
.status-problems:empty { display: none; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 6px; align-content: start; }
.kpi-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.admin-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.chart-legend { display: flex; align-items: center; gap: 8px; margin: -6px 0 12px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.swatch.failed { background: var(--danger); margin-left: 10px; }
.bar-chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; align-items: end; height: 160px; overflow-x: auto; }
.bar-item { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 14px; }
.bar-stack { width: 100%; display: flex; flex-direction: column; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; }
.bar-v { background: var(--accent); }
.bar-v.failed { background: var(--danger); }
.bar-label { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.users-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.users-table tr:last-child td { border-bottom: 0; }
.users-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-cell { width: 34%; }
.bar { height: 6px; border-radius: 3px; background: var(--accent); min-width: 2px; }
#recent-feedback { display: grid; gap: 10px; }
.fb-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; display: grid; gap: 6px; }
.fb-item.down { border-left: 3px solid var(--danger); }
.fb-item.up { border-left: 3px solid var(--ok); }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.fb-user { font-weight: 600; }
.fb-time { color: var(--muted); }
.fb-note { font-size: 14px; }
.fb-msg summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.fb-msg pre { white-space: pre-wrap; font: 13px/1.5 var(--mono); background: var(--hover); padding: 10px; border-radius: var(--r-sm); max-height: 260px; overflow: auto; }
@media (max-width: 600px) { .admin-wrap { padding: 12px 16px 40px; } .admin-row { grid-template-columns: 1fr; } }

/* ─── What's new ────────────────────────────────────────────────────────── */
.dialog.whats-new { width: min(680px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 48px)); }
.dialog.whats-new[open] { display: flex; flex-direction: column; }
.dlg.wn { padding: 0; gap: 0; min-height: 0; display: flex; flex-direction: column; flex: 1; }
.wn-head { display: flex; align-items: center; gap: 12px; padding: 22px 22px 6px; }
.wn-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.wn-mark img { width: 20px; height: 20px; }
.wn-body { overflow-y: auto; padding: 8px 22px 6px; display: grid; gap: 22px; min-height: 0; align-content: start; }
.wn-body { border-top: 1px solid transparent; transition: border-color .15s; }
.wn-body.scrolled { border-top-color: var(--line); }
.wn-body.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent); }
.wn-body:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.wn-entry { display: grid; gap: 10px; }
.wn-entry + .wn-entry { border-top: 1px solid var(--line); padding-top: 18px; }
.wn-entry-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wn-entry h3 { margin: 0; font-size: 15px; font-weight: 600; }
.wn-date { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dlg p.wn-intro { font-size: 14px; color: var(--text-2); }
.wn-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.wn-items li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; }
.wn-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 17px; }
.wn-txt { display: grid; gap: 2px; min-width: 0; font-size: 14px; line-height: 1.45; }
.wn-txt strong { font-weight: 600; color: var(--text); }
.wn-txt span { color: var(--text-2); }
.dlg.wn .dlg-row { padding: 14px 22px 20px; border-top: 1px solid var(--line); margin-top: 10px; }
.dlg.wn .dlg-row .btn { min-width: 96px; justify-content: center; }
@media (max-width: 600px) {
  /* A sheet from the bottom, like the menus. Tablets keep the centered dialog. */
  .dialog.whats-new { width: 100%; max-width: 100%; max-height: 85dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; animation: sheet-in .2s ease-out; }
  .dlg.wn .dlg-row { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .dlg.wn .dlg-row .btn { flex: 1; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .dialog.whats-new { animation: none; } }

/* Memory in Settings (v2.7) */
.dlg-settings { width: min(560px, calc(100vw - 32px)); }
.mem { display: grid; gap: 8px; }
.mem-title { margin: 0; color: var(--text); }
.dlg .mem-note { font-size: 13px; color: var(--muted); }
.mem-body { display: grid; gap: 6px; max-height: 46vh; overflow: auto; padding-right: 2px; }
.mem-sub { margin: 8px 0 2px; font-size: 13px; font-weight: 600; color: var(--text); }
.mem-admin { font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mem-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.mem-text { flex: 1; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.mem-text small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.mem-del { flex: none; }
.dlg .mem-empty { font-size: 13px; color: var(--muted); }
.mem-actions { display: flex; justify-content: flex-start; }
.btn-link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; color: var(--accent-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-link.danger { color: var(--danger); }

/* Questions for you (v2.9) */
.q-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 8px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; font-weight: 500; }
.q-pill:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent)); }
.q-pill .ph { font-size: 17px; }
.dlg p.q-intro { font-size: 13.5px; color: var(--muted); }
.q-body { display: grid; gap: 8px; max-height: 62vh; overflow: auto; padding-right: 2px; }
.q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.q-card { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.q-card.done { background: none; }
.q-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q-topic { font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--accent-ink); }
.q-status { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 7px; background: var(--hover); color: var(--text-2); }
.q-status.answered { background: var(--accent-soft); color: var(--accent-ink); }
.dlg p.q-text { margin: 0; color: var(--text); font-size: 14.5px; line-height: 1.45; font-weight: 500; overflow-wrap: anywhere; }
.dlg p.q-context, .dlg p.q-waiting { font-size: 13px; line-height: 1.45; color: var(--muted); overflow-wrap: anywhere; }
.q-answer { font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--hover); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.q-answer small { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted); white-space: normal; }
.q-form { display: grid; gap: 6px; }
.dlg .q-form textarea.field { min-height: 72px; }
.q-actions { display: flex; gap: 14px; justify-content: flex-start; align-items: center; }

/* ─── Projects (v2.10) ─────────────────────────────────────────────────── */
.proj-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.proj-tools > .field { flex: 1 1 220px; min-width: 0; }
.proj-tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--hover); flex-wrap: wrap; }
.proj-sort .field { width: auto; padding: 7px 10px; }
.proj-card { position: relative; padding: 0; min-height: 0; }
.proj-open { display: grid; gap: 6px; padding: 16px 44px 16px 16px; text-align: left; align-content: start; min-height: 104px; border-radius: var(--r); color: var(--text); }
.proj-open h3 { display: flex; align-items: center; gap: 8px; }
.proj-open h3 .ph { font-size: 17px; color: var(--accent-ink); flex: none; }
.proj-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--text-2) !important; }
.proj-star { position: absolute; top: 10px; right: 8px; }
.proj-star.on, #project-star[aria-pressed="true"] { color: #C58A00; }
.proj-title { display: grid; gap: 4px; min-width: 0; }
.proj-title h1 { display: flex; align-items: center; gap: 10px; }
.proj-title h1 .ph { font-size: 24px; color: var(--accent-ink); flex: none; }
.proj-byline { margin: 0; font-size: 13px; color: var(--muted); }
.proj-desc-box { margin-top: -8px; }
.proj-desc-text { margin: 0; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: 14px; padding: 2px 0; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.archived-note { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 14px; border-radius: var(--r); background: var(--hover); color: var(--text-2); font-size: 14px; }
.archived-note > span { flex: 1 1 240px; }
.sec-note { margin: 0; padding: 6px 6px 0; font-size: 12.5px; color: var(--faint); }
.cap { display: grid; gap: 4px; }
.cap:empty { display: none; }
.cap-bar { height: 6px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.cap-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.cap-text { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dlg-label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: -8px; }
.dlg-opt { font-weight: 400; color: var(--faint); }
.dlg-choice { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.dlg-choice legend { padding: 0; margin-bottom: 8px; }
.dlg-choice label, .dlg-check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.dlg-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dlg-choice input, .dlg-check input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.dlg-choice span, .dlg-check span { display: grid; gap: 2px; font-size: 14px; }
.dlg-choice small, .dlg-check small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.dlg-note { font-size: 13px; color: var(--muted) !important; }
.dlg-grow { flex: 1; }
.btn.danger-text { color: var(--danger); }
.share-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-add > input.field, .share-add > select.field:first-child { flex: 1 1 200px; min-width: 0; width: auto; }
.field.sm { width: auto; padding: 6px 8px; font-size: 13px; }
.mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 40vh; overflow-y: auto; }
.mem-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--r-sm); min-width: 0; }
.mem-who { flex: 1; min-width: 0; display: grid; }
.mem-name { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-access { font-size: 13px; color: var(--muted); }
.share-groups { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.sm .ph { font-size: 15px; }
@media (max-width: 600px) {
  .proj-tools { align-items: stretch; }
  .proj-tabs { order: 3; width: 100%; }
  .proj-sort { order: 2; }
  .client-head { flex-wrap: wrap; }
  .head-actions .btn span { display: none; }
  .mem-row { flex-wrap: wrap; }
}
