/* tidepage (hosted) — the SPA shell (auth + dashboard).
   Built on the shared design system: editor.css supplies tokens, fonts, base
   styles, `.btn`/`.btn--primary`/`.btn--secondary`, `.badge` and `.avatar`.
   This file layers the auth + dashboard screens on top, on-brand. The editor
   view is a separate page that reuses the desktop chrome wholesale. */

body { background: var(--surface-page); }
#root { min-height: 100vh; display: flex; flex-direction: column; }

/* Brand lockup: line-only horizon mark + serif wordmark (Newsreader 300,
   first e mirrored), per brand/BRAND_BRIEF.md. */
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: var(--wordmark-weight, 300); font-size: var(--text-xl); letter-spacing: var(--wordmark-tracking, -0.01em); color: var(--text-primary); cursor: pointer; line-height: 1; }
.brand .mark { width: 24px; height: 24px; flex: none; }
.brand .mark svg { width: 100%; height: 100%; display: block; }
.brand .flip-e { display: inline-block; transform: scaleX(-1); }
.brand--lg { font-size: var(--text-2xl, 28px); }
.brand--lg .mark { width: 34px; height: 34px; }

.btn--ghost { --_bg: transparent; --_fg: var(--text-secondary); --_bd: transparent; }
.btn--ghost:hover { --_bg: var(--surface-hover); --_fg: var(--text-primary); }

/* ── auth ─────────────────────────────────────────────────────────────── */
/* Two-pane sign-in: a brand/product panel beside the form. Collapses to the
   form alone on narrow screens. */
.authpage { flex: 1; min-height: 100vh; display: grid; place-items: center; padding: clamp(20px, 4vw, 48px); background: radial-gradient(115% 115% at 0% 0%, var(--accent-subtle), transparent 52%), var(--surface-inset); }
/* The bounded two-pane card keeps content centred instead of stranded on wide screens. */
.authshell { width: 100%; max-width: 940px; display: grid; grid-template-columns: 1.04fr 0.96fr; align-items: stretch; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); overflow: hidden; }
.authpage__main { display: grid; place-items: center; padding: clamp(28px, 4vw, 52px); }

.authbrand { display: flex; flex-direction: column; justify-content: center; gap: var(--space-5); padding: clamp(28px, 4vw, 52px); background: var(--accent-subtle); border-right: 1px solid var(--border-subtle); }
.authbrand > * { width: 100%; }
.authbrand__headline { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 2.3vw, 33px); line-height: 1.08; letter-spacing: -0.03em; margin: 0; max-width: 15ch; }
.authbrand__accent { color: var(--accent); }
.authbrand__sub { font-size: var(--text-md); line-height: 1.55; color: var(--text-secondary); margin: 0; max-width: 44ch; }
.authbrand__points { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.authbrand__points li { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }
.authbrand__pt-ic { display: inline-flex; color: var(--accent); }
.authbrand__pt-ic svg { width: 16px; height: 16px; display: block; }

/* Compact product preview inside the brand panel. */
.authmock { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; max-width: 100%; }
.authmock__bar { display: flex; align-items: center; gap: var(--space-2); padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); }
.authmock__mark { width: 16px; height: 16px; flex: none; }
.authmock__mark svg { width: 100%; height: 100%; display: block; }
.authmock__name { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.authmock__chip { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--accent-text); background: var(--accent-subtle); border: 1px solid var(--accent-border); border-radius: var(--radius-full); padding: 2px 7px; }
.authmock__chip svg { width: 12px; height: 12px; display: block; }
.authmock__body { padding: var(--space-4); background: var(--surface-inset); }
.authmock__sel { display: inline-block; margin-bottom: var(--space-4); }
.authmock__h { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.authmock__kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.authmock__kpi { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.authmock__kpi span { font-size: 10px; color: var(--text-muted); }
.authmock__kpi strong { font-family: var(--font-display); font-size: var(--text-md); font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.authmock__kpi--sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.authmock__pin { position: absolute; top: -7px; right: -7px; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; box-shadow: var(--shadow-sm); }

.auth { width: 100%; max-width: 340px; margin: auto; display: flex; flex-direction: column; gap: var(--space-5); }
.auth .brand--lg { margin-bottom: var(--space-1); }
.auth__brand { display: none; }  /* shown only when the brand panel is hidden (mobile) */

@media (max-width: 820px) {
  .authshell { grid-template-columns: 1fr; max-width: 400px; }
  .authbrand { display: none; }
  .auth__brand { display: inline-flex; }
}
/* The shell is the card, so the form itself stays flat (no double border/shadow). */
.auth__form { width: 100%; display: flex; flex-direction: column; gap: var(--space-3); }
.auth__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); letter-spacing: -0.02em; margin: 0 0 var(--space-1); }
.auth__err { color: var(--danger-fg); font-size: var(--text-sm); min-height: 0; }
.auth__err:not(:empty) { min-height: 18px; }
.auth__alt { font-size: var(--text-sm); color: var(--text-muted); margin: var(--space-1) 0 0; }
.auth__alt a { color: var(--text-link); font-weight: 500; text-decoration: none; }
.auth__alt a:hover { text-decoration: underline; }
.auth__form .btn--primary { margin-top: var(--space-1); height: var(--control-md); }

.field { display: flex; flex-direction: column; gap: 5px; font-size: var(--text-xs); color: var(--text-muted); }
.field input { font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-primary); padding: 9px 11px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-inset); transition: var(--transition-colors); }
.field input::placeholder { color: var(--text-faint); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-card); }
.auth__show { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); cursor: pointer; user-select: none; margin-top: -2px; }
.auth__show input { accent-color: var(--accent); cursor: pointer; }
/* "Continue with Google" — a neutral provider button above the email form. */
.btn--google { height: var(--control-md); background: var(--surface-card); color: var(--text-primary); border: 1px solid var(--border-default); text-decoration: none; font-weight: 500; }
.btn--google:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.auth__divider { display: flex; align-items: center; text-align: center; color: var(--text-faint); font-size: var(--text-xs); }
.auth__divider::before, .auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }
.auth__divider span { padding: 0 var(--space-2); }

/* ── workspace shell: sidebar + main column ───────────────────────────── */
.shell { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; min-height: 0; overflow-y: auto; }

.sidebar { width: 248px; flex: none; display: flex; flex-direction: column; background: var(--surface-card); border-right: 1px solid var(--border-subtle); }
.sb-brand { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-4) var(--space-2); font-family: var(--font-display); font-weight: var(--wordmark-weight, 300); font-size: var(--text-lg); letter-spacing: var(--wordmark-tracking, -0.01em); color: var(--text-primary); cursor: pointer; line-height: 1; }
.sb-brand .mark { width: 24px; height: 24px; flex: none; }
.sb-brand .mark svg { width: 100%; height: 100%; display: block; }
.sb-brand .flip-e { display: inline-block; transform: scaleX(-1); }

.sb-ws { position: relative; display: flex; align-items: center; gap: var(--space-2); margin: var(--space-2) var(--space-3) var(--space-3); padding: 7px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.sb-ws__badge { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 5px; background: var(--slate-800); color: var(--white); font-size: 10px; font-weight: 700; }
[data-theme="dark"] .sb-ws__badge { background: var(--slate-200); color: var(--slate-900); }
.sb-ws__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Switcher variant: an invisible full-size select over the styled row. */
.sb-ws--switch:hover { background: var(--surface-hover); }
.sb-ws__select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font: inherit; }
.sb-ws__chev { margin-left: auto; color: var(--text-faint); display: inline-flex; pointer-events: none; }

.sb-nav { flex: 1; overflow-y: auto; padding: 0 var(--space-3) var(--space-3); display: flex; flex-direction: column; gap: 1px; }
.sb-item { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); text-decoration: none; cursor: pointer; transition: var(--transition-colors); }
.sb-item__ic { display: inline-flex; color: var(--text-muted); }
.sb-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.sb-item.is-active { background: var(--accent-subtle); color: var(--accent-text); font-weight: 600; }
.sb-item.is-active .sb-item__ic { color: var(--accent); }

.sb-foot { border-top: 1px solid var(--border-subtle); padding: var(--space-2) var(--space-3) var(--space-3); display: flex; flex-direction: column; gap: 2px; }
.sb-user { display: flex; align-items: center; gap: 9px; padding: 6px var(--space-2); border-radius: var(--radius-md); }
.sb-user__avatar { width: 26px; height: 26px; font-size: 10px; }
.sb-user__who { min-width: 0; flex: 1; line-height: 1.25; }
.sb-user__who b { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user__who span { display: block; font-size: var(--text-2xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user__out { flex: none; }

/* ── topbar: just search (and the theme toggle) ───────────────────────── */
.topbar { display: flex; align-items: center; gap: var(--space-3); height: var(--toolbar-height); flex: none; padding: 0 var(--space-4); background: var(--surface-card); border-bottom: 1px solid var(--border-subtle); }
.topbar__side { flex: 1; display: flex; align-items: center; }
.topbar__side--right { justify-content: flex-end; }
.searchbar { display: flex; align-items: center; gap: 9px; width: 100%; max-width: 520px; height: 34px; padding: 0 var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-full); background: var(--surface-inset); color: var(--text-muted); font: inherit; font-size: var(--text-sm); cursor: pointer; transition: var(--transition-colors); }
.searchbar:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.searchbar__hint { flex: 1; text-align: left; }
.searchbar kbd, .palette kbd { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 2px 5px; background: var(--surface-card); }

.wsel { font: inherit; font-size: var(--text-sm); padding: 5px 8px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text-primary); }

/* ── dashboard ────────────────────────────────────────────────────────── */
/* The content column: capped at 1440px (extra width buys more grid columns —
   the auto-fill grids below — never wider cards); beyond the cap, margins grow
   symmetrically. Gutters scale with the viewport. (#197 §5) */
.dash { width: 100%; max-width: 1440px; min-height: calc(100vh - var(--toolbar-height)); margin: 0 auto; padding: var(--space-6) clamp(var(--space-6), 4vw, 56px) calc(var(--space-6) * 3); border-radius: var(--radius-xl); transition: var(--transition-colors); }
/* The whole workspace is the drop zone — invite the drop while dragging over. */
.dash.is-drop { outline: 2px dashed var(--accent); outline-offset: -10px; background: var(--accent-subtle); }
.dash__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.dash__eyebrow { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); margin: 0 0 6px; }
.dash__head h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); letter-spacing: -0.02em; margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--space-4); }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: var(--transition-colors), transform var(--dur-fast) var(--ease-out); }
.card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); }
.card:active { transform: translateY(1px); }
.card__thumb { position: relative; height: 132px; overflow: hidden; background: var(--surface-inset); color: var(--text-faint); }

/* Signature: card wave-top — the white body rises into the preview along a
   wavy waterline (BRAND_BRIEF signatures). A teal edge marks open review. */
.card__wave { display: block; width: 100%; height: 13px; margin-top: -13px; position: relative; z-index: 1; pointer-events: none; }
.card__wave > path:first-child { fill: var(--surface-card); }
.card__wave-edge { fill: none; stroke: var(--accent); stroke-width: 1.4; }
[data-theme="dark"] .card__wave-edge { stroke: var(--tide-bright); }
.card__thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.card__thumb svg { width: 34px; height: 34px; }
/* The thumbnail: a headless render of the artifact, painted over the fallback
   glyph once it loads. Top-anchored cover so the document's head reads. */
.card__preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: #fff; opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.card__thumb.is-loaded .card__preview { opacity: 1; }
.card__body { display: flex; flex-direction: column; gap: 5px; padding: var(--space-3) var(--space-4) var(--space-4); }
.card__title { font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__meta { color: var(--text-muted); font-size: var(--text-sm); }
/* "Shared with me" cards: no owned thumbnail — a dashed edge marks them as
   external, and a thin accent stripe stands in for the preview region. */
.card--shared { border-style: dashed; }
.card--shared .card__body { padding-top: var(--space-4); border-top: 3px solid var(--accent-subtle); }
/* Inline rename field — mirrors the title's footprint so the tile doesn't jump. */
.card__title-input { width: 100%; font-family: inherit; font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--text-primary); background: var(--surface-card); border: 1px solid var(--accent-border); border-radius: var(--radius-sm); padding: 1px var(--space-1); outline: none; box-shadow: var(--ring); }
.card__actions { position: absolute; top: var(--space-2); right: var(--space-2); display: flex; gap: var(--space-1); opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.card:hover .card__actions, .card:focus-within .card__actions { opacity: 1; }
.card__action { display: grid; place-items: center; width: 26px; height: 26px; border: none; background: color-mix(in srgb, var(--surface-card) 80%, transparent); color: var(--text-muted); cursor: pointer; border-radius: var(--radius-md); transition: var(--transition-colors); }
.card__action:hover { background: var(--surface-hover); color: var(--text-primary); }
.card__action--danger:hover { background: var(--danger-bg); color: var(--danger-fg); }

.empty { grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: var(--space-6) var(--space-4); }
.empty__sub { font-size: var(--text-sm); max-width: 44ch; margin: 6px auto 0; }

/* ── blog (public articles, reusing the workspace look) ──────────────────── */
.blog__sub { max-width: 62ch; margin: 10px 0 0; color: var(--text-secondary); font-size: var(--text-md); line-height: 1.55; }
.blog__filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); }
.bchip { font-family: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-full); padding: 6px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; width: auto; transition: var(--transition-colors); }
.bchip:hover { border-color: var(--accent-border); color: var(--text-primary); }
.bchip.is-on { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.bchip--saved { margin-left: auto; }
.bchip svg { width: 14px; height: 14px; }

.bcard__cover { position: relative; height: 134px; padding: var(--space-4); display: flex; flex-direction: column; justify-content: flex-end; color: #fff; overflow: hidden; }
.bcard__watermark { position: absolute; right: -16px; top: -16px; opacity: 0.16; filter: brightness(0) invert(1); }
.bcard__watermark svg { width: 96px; height: 96px; }
.bcard__cat { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: 700; }
.bcard__read { font-size: var(--text-xs); opacity: 0.88; margin-top: 2px; }
.bcard__star { position: absolute; top: var(--space-2); right: var(--space-2); display: grid; place-items: center; width: 30px; height: 30px; border: none; border-radius: var(--radius-full); background: color-mix(in srgb, #000 26%, transparent); color: #fff; cursor: pointer; transition: var(--transition-colors); }
.bcard__star:hover { background: color-mix(in srgb, #000 42%, transparent); }
.bcard__star svg { width: 16px; height: 16px; fill: none; }
.bcard__star.is-on svg { fill: #fff; }
.bcard__excerpt { color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.5; margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── dialog ───────────────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 80; }
.dialog { width: 560px; max-width: 92vw; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); padding: var(--space-6); box-shadow: var(--shadow-pop); }
.dialog h2 { font-family: var(--font-display); font-weight: 600; margin: 0 0 4px; font-size: var(--text-lg); }
.dialog__hint { color: var(--text-muted); font-size: var(--text-sm); margin: 0 0 var(--space-3); }
.dialog__ta { width: 100%; height: 200px; font-family: var(--font-mono); font-size: var(--text-xs); padding: var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-inset); color: var(--text-primary); resize: vertical; }
.dialog__ta:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.dialog__row { margin: var(--space-3) 0; font-size: var(--text-sm); color: var(--text-muted); }
.dialog__actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }

/* ── new-artifact flow ────────────────────────────────────────────────── */
.dialog--new { width: 600px; }
.newart__opts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-4); }
.newart__opt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface-card); cursor: pointer; font: inherit; transition: var(--transition-colors), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.newart__opt:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.newart__opt:active { transform: translateY(0); }
.newart__opt.is-drop { border-color: var(--accent); border-style: dashed; background: var(--accent-subtle); box-shadow: var(--ring); }
.newart__opt-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--surface-inset); color: var(--text-secondary); margin-bottom: var(--space-1); }
.newart__opt-ic--accent { background: var(--accent-subtle); color: var(--accent); }
.newart__opt-title { font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--text-primary); }
.newart__opt-sub { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.4; }
.newart__foot { display: flex; justify-content: center; margin-top: var(--space-4); }
.newart__link { font: inherit; font-size: var(--text-sm); color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: var(--transition-colors); }
.newart__link:hover { color: var(--text-primary); background: var(--surface-hover); }

.newart__preview-head { margin-bottom: var(--space-3); }
.newart__preview-head h2 { margin-bottom: 2px; }
.newart__preview-wrap { flex: 1; min-height: 0; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
/* Clips the scaled (oversized) frame box; the iframe scrolls its own content. */
.newart__preview-stage { width: 100%; height: 100%; overflow: hidden; }
/* width/height/transform are set inline as the frame is fitted to the stage;
   margin auto centers it when the screen is wider than the desktop canvas. */
.newart__preview { border: 0; display: block; background: #fff; transform-origin: top left; margin: 0 auto; }

/* Near-fullscreen preview: documents need room, so the modal takes the screen. */
.dialog--preview { width: 96vw; max-width: 1600px; height: 94vh; display: flex; flex-direction: column; padding: var(--space-5); }
.dialog__section { margin-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.dialog__label { font-size: var(--text-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-caps); margin: 0 0 4px; }
.code-box { width: 100%; font-family: var(--font-mono); font-size: var(--text-xs); background: var(--surface-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-3); white-space: pre-wrap; word-break: break-all; color: var(--text-secondary); }
.tok-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); }
.tok-row__meta { color: var(--text-muted); font-size: var(--text-2xs); margin-top: 2px; }

/* ── toast ────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: var(--space-5); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--slate-900); color: var(--white); padding: 10px var(--space-4); border-radius: var(--radius-lg); font-size: var(--text-sm); box-shadow: var(--shadow-pop); opacity: 0; transition: opacity var(--dur-base), transform var(--dur-base); pointer-events: none; max-width: 80vw; z-index: 90; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--err { background: var(--danger); }

/* ── "Pending review" section + tile review state ────────────────────────
   Review is normal work, not a warning: the brand reserves amber for
   warnings, so review state reads in the tide accent (teal waterline edge on
   tiles — see .card__wave-edge — and tide chips/CTAs here). */
.review-sec { margin-bottom: var(--space-6); }
.pill-count { font-size: var(--text-2xs); font-weight: 700; color: var(--accent-text); background: var(--accent-subtle); border: 1px solid var(--accent-border); border-radius: var(--radius-full); padding: 2px 9px; }
.sec-label { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); margin: 0; }
.sec-head { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.sec-head__more { margin-left: auto; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); text-decoration: none; }
.sec-head__more:hover { color: var(--text-primary); }
.home-sec { margin-bottom: var(--space-6); }

.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.rcard { position: relative; display: flex; flex-direction: column; background: var(--surface-card); border: 1px solid var(--accent-border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); transition: var(--transition-colors), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.rcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--accent); }
.rcard:active { transform: translateY(0); }
.rcard__row { display: flex; gap: var(--space-3); padding: var(--space-3); }
.rcard__thumb { position: relative; width: 104px; height: 78px; flex: none; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-subtle); background: var(--surface-inset); }
.rcard__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: #fff; opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.rcard__thumb.is-loaded .rcard__img { opacity: 1; }
.rcard__badge { position: absolute; top: 6px; right: 6px; z-index: 3; display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--text-on-accent); background: var(--accent); padding: 2px 7px; border-radius: var(--radius-full); box-shadow: var(--shadow-sm); }
.rcard__main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.rcard__title { font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard__sum { color: var(--text-secondary); font-size: var(--text-sm); margin-top: 4px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.src { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-2xs); font-weight: 600; padding: 2px 8px 2px 3px; border-radius: var(--radius-full); }
.src--human { background: var(--surface-inset); color: var(--text-secondary); }
.src--ai { background: var(--accent-subtle); color: var(--accent); padding-left: 8px; }
.src--ai svg { width: 13px; height: 13px; }
.avatar { width: 18px; height: 18px; border-radius: var(--radius-full); display: inline-grid; place-items: center; font-size: 9px; font-weight: 700; color: var(--white); }
.rcard__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3) var(--space-3); }
.rcard__when { color: var(--text-muted); font-size: var(--text-2xs); }
.rcard__cta { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: none; border-radius: var(--radius-md); background: var(--accent); color: var(--text-on-accent); font-weight: 600; font-size: var(--text-sm); transition: var(--transition-colors); }
.rcard__cta:hover { background: var(--accent-hover); }

/* pending-review marker on a tile title */
.card__title .dot { display: inline-block; width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--accent); margin-right: 6px; vertical-align: middle; }

/* ── sources / connectors (issue #113) ─────────────────────────────────── */
.src-sec { margin-top: var(--space-5); }
.src-sec__head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-3); }
.src-sec__head h2 { font-size: var(--text-lg); margin: 0; }
.src-conn { border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-4); background: var(--surface-card); }
.src-conn__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.src-conn__acct { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.src-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: var(--space-3); }
.src-files { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.src-file { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 10px; border: none; border-radius: var(--radius-md); background: transparent; color: var(--text-primary); font: inherit; font-size: var(--text-sm); cursor: pointer; transition: var(--transition-colors); }
.src-file:hover { background: var(--surface-inset); }
.src-file svg { flex: none; color: var(--text-muted); }
.src-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── favourites (the star) ────────────────────────────────────────────── */
.card__action--fav.is-fav, .lrow__star.is-fav { color: var(--accent); }
.card__action--fav.is-fav svg, .lrow__star.is-fav svg { fill: var(--accent); }
/* a starred tile keeps its star visible without hover */
.card .card__actions:has(.card__action--fav.is-fav) { opacity: 1; }

/* ── Home: compact recent cards ───────────────────────────────────────── */
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.mini-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); cursor: pointer; box-shadow: var(--shadow-xs); transition: var(--transition-colors), box-shadow var(--dur-fast) var(--ease-out); }
.mini-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); }
.mini-card__thumb { position: relative; width: 72px; height: 52px; flex: none; display: grid; place-items: center; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--surface-inset); color: var(--text-faint); overflow: hidden; }
.mini-card__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: #fff; }
.mini-card__main { min-width: 0; }
.mini-card__title { font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card__meta { color: var(--text-muted); font-size: var(--text-2xs); margin-top: 2px; }

/* ── filters row (view toggle; tags/sort arrive with folders) ─────────── */
.filters { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.filters__spacer { flex: 1; }
.view-seg .seg__btn { width: 32px; }
.seg__btn--label { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 12px; font-size: var(--text-sm); font-weight: 500; }

/* ── list view ────────────────────────────────────────────────────────── */
.list { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.lrow { display: grid; grid-template-columns: 26px 34px 24px minmax(0, 1fr) 190px 150px 96px 40px; align-items: center; gap: var(--space-2); height: 46px; padding: 0 var(--space-2); border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: var(--transition-colors); }
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: var(--surface-hover); }
.lrow--head { height: 34px; cursor: default; background: var(--surface-inset); font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); }
.lrow--head:hover { background: var(--surface-inset); }
.lrow__star { display: grid; place-items: center; width: 28px; height: 28px; margin-left: 4px; border: none; background: none; border-radius: var(--radius-sm); color: var(--text-faint); cursor: pointer; transition: var(--transition-colors); }
.lrow__star:hover { background: var(--surface-active); color: var(--text-secondary); }
.lrow__icon { display: inline-flex; color: var(--text-muted); }
.lrow__name { font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow__when { font-size: var(--text-sm); color: var(--text-muted); }
.lrow__status { display: flex; }
.lrow__actions { display: flex; justify-content: flex-end; gap: var(--space-1); opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.lrow:hover .lrow__actions, .lrow:focus-within .lrow__actions { opacity: 1; }
.chip-review { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); background: var(--accent-subtle); border: 1px solid var(--accent-border); color: var(--accent-text); font-size: var(--text-2xs); font-weight: 600; }
.chip-review__dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--accent); }
@media (max-width: 760px) { .lrow { grid-template-columns: 26px 34px 24px minmax(0, 1fr) 96px 40px; } .lrow__when, .lrow__tags { display: none; } }

/* ── search palette (⌘K) ──────────────────────────────────────────────── */
.pal-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 95; }
.palette { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); width: 640px; max-width: calc(100vw - 32px); background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop); z-index: 96; overflow: hidden; }
.palette__input { display: flex; align-items: center; gap: 11px; padding: 14px var(--space-4); border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); }
.palette__field { flex: 1; border: 0; outline: 0; background: none; font: inherit; font-size: var(--text-md); color: var(--text-primary); }
.palette__field::placeholder { color: var(--text-faint); }
.palette__scopes { display: flex; gap: 6px; padding: var(--space-2) var(--space-4) 2px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: var(--radius-full); border: 1px solid var(--border-default); background: var(--surface-card); font: inherit; font-size: var(--text-xs); font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: var(--transition-colors); }
.fchip:hover { background: var(--surface-hover); }
.fchip.is-on { background: var(--accent-subtle); border-color: var(--accent-border); color: var(--accent-text); font-weight: 600; }
.palette__body { max-height: 420px; overflow-y: auto; padding: var(--space-1) var(--space-2) var(--space-2); }
.palette__note { padding: var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
.pgroup__label { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-faint); padding: var(--space-2) var(--space-2) 4px; }
.prow { display: flex; align-items: center; gap: 11px; padding: 8px var(--space-2); border-radius: var(--radius-md); cursor: pointer; }
.prow.is-active { background: var(--surface-hover); }
.prow__ic { display: inline-flex; color: var(--text-muted); flex: none; }
.prow__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.prow__title { font-size: var(--text-sm); font-weight: 550; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow__title mark { background: var(--highlight-bg); color: var(--highlight-fg); border-radius: 2px; padding: 0 1px; font-weight: 700; }
.prow__path { font-size: var(--text-2xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette__foot { display: flex; align-items: center; gap: var(--space-4); padding: 8px var(--space-4); border-top: 1px solid var(--border-subtle); background: var(--surface-inset); font-size: var(--text-2xs); color: var(--text-muted); }
.palette__foot kbd { margin-right: 3px; }

/* ── settings ─────────────────────────────────────────────────────────── */
.settings { display: flex; gap: var(--space-6); align-items: flex-start; }
.set-nav { width: 190px; flex: none; display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; }
.set-panel { flex: 1; min-width: 0; max-width: 640px; }
.set-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-4); box-shadow: var(--shadow-xs); }
.set-card h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 4px; font-size: var(--text-md); font-weight: 650; color: var(--text-primary); }
.set-card h3 svg { color: var(--text-secondary); }
.set-card > p { margin: 0 0 var(--space-3); font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
.set-row { display: flex; align-items: center; gap: var(--space-3); padding: 11px 0; border-top: 1px solid var(--border-subtle); }
.set-row__main { flex: 1; min-width: 0; }
.set-row__main b { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.set-row__main span { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; }
.set-row__avatar { width: 26px; height: 26px; font-size: 10px; flex: none; }
.role-chip { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); border: 1px solid var(--border-subtle); border-radius: var(--radius-full); padding: 2px 9px; }
.set-invite { display: flex; gap: var(--space-2); align-items: center; margin-bottom: var(--space-3); }
.set-input { flex: 1; font: inherit; font-size: var(--text-sm); color: var(--text-primary); padding: 7px 11px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-inset); }
.set-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-card); }
.note { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; margin: var(--space-2) 0 0; }
.src-cta { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
@media (max-width: 820px) { .settings { flex-direction: column; } .set-nav { width: 100%; flex-direction: row; flex-wrap: wrap; position: static; } }

/* ── folders + tags (phase 2) ─────────────────────────────────────────── */
/* sidebar sections */
.sb-organizer { margin-top: var(--space-2); }
.sb-sec { display: flex; align-items: center; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-faint); margin: var(--space-4) var(--space-2) 4px; }
.sb-sec__btn { display: grid; place-items: center; width: 20px; height: 20px; margin-left: auto; border: none; background: none; border-radius: var(--radius-sm); color: var(--text-faint); cursor: pointer; transition: var(--transition-colors); }
.sb-sec__btn:hover { background: var(--surface-hover); color: var(--text-secondary); }
.sb-item--tree { height: 30px; font-weight: 400; }
.sb-item__chev { display: grid; place-items: center; width: 16px; height: 16px; flex: none; border: none; background: none; border-radius: var(--radius-sm); color: var(--text-faint); cursor: pointer; padding: 0; }
.sb-item__chev:hover { background: var(--surface-active); color: var(--text-secondary); }
.sb-item__chev--none { pointer-events: none; }
.sb-item__label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item__count { margin-left: auto; font-size: var(--text-2xs); color: var(--text-faint); }
.sb-item--tag { height: 30px; font-weight: 400; }
.sb-tagdot { width: 8px; height: 8px; border-radius: var(--radius-full); flex: none; margin: 0 4px; }
.sb-item.is-drop { background: var(--accent-subtle); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* tag chips */
.tagchip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); border: 1px solid var(--border-subtle); background: var(--surface-card); font-size: var(--text-2xs); font-weight: 500; color: var(--text-secondary); max-width: 110px; }
.tagchip__dot { width: 7px; height: 7px; border-radius: var(--radius-full); flex: none; }
.tagchip__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tagchip--more { color: var(--text-muted); }
.card__tags { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.lrow__tags { display: flex; gap: 4px; overflow: hidden; }
.tagdot-lg { display: inline-block; width: 12px; height: 12px; border-radius: var(--radius-full); margin-right: 9px; }

/* ⋯ menu */
.pmenu { position: fixed; z-index: 98; min-width: 200px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 5px; }
.pmenu__item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); cursor: pointer; text-align: left; transition: var(--transition-colors); }
.pmenu__item svg { color: var(--text-muted); }
.pmenu__item:hover { background: var(--surface-hover); color: var(--text-primary); }
.pmenu__item--danger:hover { background: var(--danger-bg); color: var(--danger-fg); }
.pmenu__item--danger:hover svg { color: var(--danger-fg); }

/* move / tags dialogs */
.dialog--organize { width: 420px; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; margin-top: var(--space-2); }
.pick-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 12px; border: none; background: none; border-radius: var(--radius-md); font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); cursor: pointer; text-align: left; transition: var(--transition-colors); }
.pick-row svg { color: var(--text-muted); flex: none; }
.pick-row:hover { background: var(--surface-hover); }
.pick-row--check { cursor: pointer; }
.pick-row--check input { accent-color: var(--accent); }

/* tag editor */
.tag-editor { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-2); }
.swatches { display: flex; gap: 7px; flex: none; }
.swatch { width: 22px; height: 22px; border-radius: var(--radius-full); border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.is-on { border-color: var(--text-primary); box-shadow: inset 0 0 0 2px var(--surface-card); }
.btn--danger-ghost { color: var(--danger-fg); margin-right: auto; }
.btn--danger-ghost:hover { --_bg: var(--danger-bg); --_fg: var(--danger-fg); }

/* list extras: select checkbox, folder rows */
.lrow__checkwrap { display: grid; place-items: center; }
.lrow__check { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.lrow:hover .lrow__check, .lrow__check:checked, .lrow.is-selected .lrow__check { opacity: 1; }
.lrow.is-selected { background: var(--accent-subtle); }
.lrow--folder .lrow__icon--folder { color: var(--text-secondary); }
.lrow.is-drop { background: var(--accent-subtle); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* bulk bar */
.bulkbar { position: sticky; bottom: var(--space-4); display: flex; align-items: center; gap: var(--space-2); width: fit-content; margin: var(--space-4) auto 0; padding: 8px 14px; background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-full); box-shadow: var(--shadow-pop); z-index: 30; }
.bulkbar[hidden] { display: none; }
.bulkbar__count { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); padding-right: var(--space-2); }

/* folder tiles (tile view) + breadcrumbs + misc */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.folder-tile { display: flex; align-items: center; gap: 9px; padding: 11px 14px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); cursor: pointer; box-shadow: var(--shadow-xs); transition: var(--transition-colors), box-shadow var(--dur-fast) var(--ease-out); }
.folder-tile svg { color: var(--text-secondary); flex: none; }
.folder-tile:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); }
.folder-tile.is-drop { background: var(--accent-subtle); border-color: var(--accent); }
.folder-tile__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-tile__count { margin-left: auto; font-size: var(--text-2xs); color: var(--text-faint); }
.crumbs { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); margin: 0 0 6px; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text-primary); }
.crumbs .sep { color: var(--text-faint); }
.dash__head-actions { display: flex; align-items: center; gap: var(--space-2); }
.wsel--sm { font-size: var(--text-xs); padding: 4px 7px; }
.prow__dot { width: 10px; height: 10px; border-radius: var(--radius-full); }
.btn--sm { height: 28px; padding: 0 11px; font-size: var(--text-xs); }

/* ── phase 2.2 (issue #197) ─────────────────────────────────────────────── */

/* Dark mode: the page (#080D0C) and card (#0F1614) surfaces are nearly the
   same value, so anything that reads as a raised object on the page needs the
   raised surface + a stronger edge to separate (the same fix the editor's
   badges needed — see the #58 note in renderer/app.css). Frame chrome
   (sidebar, topbar, dialogs on the scrim) keeps --surface-card. */
[data-theme="dark"] .card,
[data-theme="dark"] .rcard,
[data-theme="dark"] .mini-card,
[data-theme="dark"] .list,
[data-theme="dark"] .folder-tile,
[data-theme="dark"] .set-card { background: var(--surface-raised); border-color: var(--border-default); }
[data-theme="dark"] .card__wave > path:first-child { fill: var(--surface-raised); }
/* --surface-hover equals the raised surface in dark, so hovers/inset chrome on
   raised objects step one further to stay visible. */
[data-theme="dark"] .lrow:hover { background: var(--surface-active); }
[data-theme="dark"] .lrow--head, [data-theme="dark"] .lrow--head:hover { background: var(--surface-inset); }

/* Sidebar: the Inbox badge (actionable count) + the External subtree. */
.sb-item__count--attn { margin-left: auto; font-size: var(--text-2xs); font-weight: 600; color: var(--accent-text); background: var(--accent-subtle); border: 1px solid var(--accent-border); border-radius: var(--radius-full); padding: 0 7px; }
.sb-item--sub2 { padding-left: 44px; font-weight: 400; height: 30px; }
.sb-item--more { color: var(--text-faint); font-size: var(--text-xs); }
.sb-item__star { margin-left: auto; display: inline-flex; color: var(--accent); }
.sb-item__star svg { width: 11px; height: 11px; fill: var(--accent); }

/* Inbox rows: tasks + new-for-you (shared, with derived read state). */
.trow { display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-3) 10px var(--space-2); border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: var(--transition-colors); }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-hover); }
[data-theme="dark"] .trow:hover { background: var(--surface-active); }
.trow > .trow__ic { display: inline-flex; color: var(--text-muted); flex: none; margin-left: 4px; }
.trow__main { flex: 1; min-width: 0; }
.trow__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow__meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow__side { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.trow__when { font-size: var(--text-xs); color: var(--text-muted); }
.dot-new { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; margin-left: 6px; }
.dot-new--off { background: var(--border-strong); }

/* Status + assignee chips (Inbox tasks, External draft/PR state). */
.chip-st { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); background: var(--surface-inset); border: 1px solid var(--border-subtle); color: var(--text-secondary); font-size: var(--text-2xs); font-weight: 600; white-space: nowrap; }
.chip-st--open { background: var(--accent-subtle); border-color: var(--accent-border); color: var(--accent-text); }
.chip-assignee { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 3px; border-radius: var(--radius-full); border: 1px solid var(--border-subtle); background: var(--surface-card); font-size: var(--text-2xs); font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.chip-assignee .avatar { width: 16px; height: 16px; font-size: 7px; }
.chip-assignee--ai .avatar { background: var(--accent-text); }
[data-theme="dark"] .chip-assignee { background: var(--surface-raised); }

/* External: the repo view's mono source chip + branch picker. */
.chip-src { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); background: var(--surface-inset); border: 1px solid var(--border-subtle); color: var(--text-muted); font-family: var(--font-mono); font-size: 9.5px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.branch-pick { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text-secondary); }
.branch-pick svg { color: var(--text-muted); flex: none; }
.branch-pick select { border: none; background: none; color: var(--text-primary); font-family: var(--font-mono); font-size: var(--text-xs); outline: none; max-width: 180px; }

/* The task dialog's description field. */
.dialog__ta--task { width: 100%; min-height: 110px; resize: vertical; font: inherit; font-size: var(--text-sm); line-height: 1.5; color: var(--text-primary); background: var(--surface-inset); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.dialog__ta--task:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-card); }
.dialog--prompt { width: 440px; }
.dialog--prompt form { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2); }
.dialog--prompt .dialog__label { display: block; margin: 0; }
.dialog--prompt .set-input { width: 100%; }

/* Section caption under an Inbox lane / the External file list. */
.sec-note { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; margin: var(--space-2) 0 0; max-width: 72ch; }

/* ── search: in-document hits + the waiting wave (phase 3, issue #189) ──── */

/* An in-document row leads with the matched *text*, so it wraps to two lines
   and the page it lives in sits underneath. */
.prow__snippet { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prow__snippet mark { background: var(--highlight-bg); color: var(--highlight-fg); border-radius: 2px; padding: 0 1px; font-weight: 650; }

/* The brand's waiting signature: a standing wave whose crests swing through
   the line in place (never a travelling spinner). The path is drawn once; only
   its amplitude animates, via scaleY through zero. */
.wave-wait { display: flex; align-items: center; justify-content: center; padding: var(--space-5) var(--space-4); color: var(--accent); }
.wave-wait svg { width: 120px; height: 12px; overflow: visible; }
.wave-wait__path { transform-box: fill-box; transform-origin: 50% 50%; animation: wave-breathe 1.7s ease-in-out infinite; }
@keyframes wave-breathe {
  0%   { transform: scaleY(1); }
  50%  { transform: scaleY(-1); }
  100% { transform: scaleY(1); }
}
/* Reduced motion: hold the wave mid-swing rather than animating it (the
   reference impl renders a static 0.85 amplitude). */
@media (prefers-reduced-motion: reduce) {
  .wave-wait__path { animation: none; transform: scaleY(0.85); }
}
/* The wave sits between the scope chips and the results, so instant title
   matches stay readable while the full-text query is still running. */
.palette__wave:empty { display: none; }
.palette__wave .wave-wait { padding: 9px var(--space-4); }
.palette__wave svg { width: 100%; max-width: 220px; }
