/* ───────────── Font (Inter, SIL OFL — fonts/LICENSE-Inter.txt; loaded per script on demand) ───────────── */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }

/* ───────────── Design tokens — Apple-style soft glass: one neutral wallpaper, frosted panels,
   soft (neumorphic) raised/pressed controls, almost no colour; one quiet green accent. ───────────── */
:root {
  --bg: #eef0f3; --surface: #ffffff; --surface-2: #f6f7f9; --surface-3: #e7e9ed; --raised: #ffffff;
  --ink: #1d1d1f; --ink-2: #3a3a3c; --muted: #6e6e73; --faint: #a1a1a6;
  --line: rgb(0 0 0 / .07); --line-strong: rgb(0 0 0 / .13);
  --fill: rgb(118 118 128 / .1); --fill-2: rgb(118 118 128 / .18); --tile: rgb(255 255 255 / .62);
  --accent: #248a3d; --accent-hover: #1c7031; --accent-soft: rgb(36 138 61 / .1); --accent-ink: #1e7a35; --on-accent: #ffffff;
  --primary: #1d1d1f; --primary-hover: #3a3a3c; --on-primary: #ffffff;
  --glass: rgb(255 255 255 / .55); --glass-strong: rgb(255 255 255 / .76); --glass-border: rgb(255 255 255 / .8);
  --blur: blur(28px) saturate(180%);
  --shadow-glass: inset 0 .5px 0 rgb(255 255 255 / .85), 0 0 0 .5px rgb(0 0 0 / .07), 0 8px 26px -14px rgb(30 35 50 / .2);
  --neu-out: 4px 4px 12px rgb(150 160 178 / .26), -4px -4px 12px rgb(255 255 255 / .7);
  --neu-sm: 2px 2px 7px rgb(150 160 178 / .24), -2px -2px 7px rgb(255 255 255 / .7);
  --neu-in: inset 1.5px 1.5px 4px rgb(150 160 178 / .3), inset -1.5px -1.5px 4px rgb(255 255 255 / .75);
  --ring: 0 0 0 4px rgb(0 0 0 / .05);
  --glow: 0 0 0 4px rgb(0 0 0 / .05);
  /* Soft desaturated light, like a calm macOS wallpaper; glass panels blur it. */
  --wallpaper: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/></svg>"),
    radial-gradient(60vmax 45vmax at 6% 8%, rgb(206 224 214 / .9), transparent 70%),
    radial-gradient(55vmax 50vmax at 96% 10%, rgb(212 221 236 / .95), transparent 70%),
    radial-gradient(60vmax 50vmax at 78% 100%, rgb(234 227 217 / .9), transparent 70%),
    radial-gradient(45vmax 40vmax at 18% 96%, rgb(221 225 233 / .9), transparent 70%),
    #eceef1;
  --user-bubble: #ffffff; --code-bg: rgb(255 255 255 / .66); --code-head: rgb(0 0 0 / .025); --code-line: rgb(0 0 0 / .07);
  --danger: #d70015; --danger-soft: rgb(255 59 48 / .1); --warn: #9a5800; --warn-soft: rgb(255 159 10 / .14);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .05);
  --shadow-md: 0 0 0 .5px rgb(0 0 0 / .04), 0 6px 18px -10px rgb(30 35 50 / .18);
  --shadow-lg: 0 0 0 .5px rgb(0 0 0 / .06), 0 24px 64px -20px rgb(30 35 50 / .32);
  --shadow-composer: var(--shadow-glass);
  --tok-k: #9b2393; --tok-s: #c41a16; --tok-c: #8a8a8e; --tok-n: #1c00cf; --tok-f: #326d74; --tok-t: #0b4f79; --tok-a: #815f03; --tok-y: #3900a0; --tok-p: #8a8a8e;
  --radius: 12px; --sidebar-width: 272px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace;
  color-scheme: light;
  font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg);
  font-feature-settings: "cv11"; font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:root[data-text-size="small"] { font-size: 13px; }
:root[data-text-size="large"] { font-size: 16px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161618; --surface: #1f1f22; --surface-2: #1b1b1e; --surface-3: #2b2b2f; --raised: #242427;
    --ink: #f5f5f7; --ink-2: #d1d1d6; --muted: #98989d; --faint: #636366;
    --line: rgb(255 255 255 / .08); --line-strong: rgb(255 255 255 / .15);
    --fill: rgb(118 118 128 / .22); --fill-2: rgb(118 118 128 / .32); --tile: rgb(255 255 255 / .05);
    --accent: #30d158; --accent-hover: #4be07a; --accent-soft: rgb(48 209 88 / .14); --accent-ink: #4fdc78; --on-accent: #062b12;
    --primary: #f5f5f7; --primary-hover: #ffffff; --on-primary: #1d1d1f;
    --glass: rgb(40 40 44 / .52); --glass-strong: rgb(44 44 48 / .74); --glass-border: rgb(255 255 255 / .09);
    --shadow-glass: inset 0 .5px 0 rgb(255 255 255 / .08), 0 0 0 .5px rgb(0 0 0 / .5), 0 10px 32px -16px rgb(0 0 0 / .7);
    --neu-out: 4px 4px 12px rgb(0 0 0 / .42), -4px -4px 12px rgb(255 255 255 / .025);
    --neu-sm: 2px 2px 7px rgb(0 0 0 / .4), -2px -2px 7px rgb(255 255 255 / .022);
    --neu-in: inset 1.5px 1.5px 4px rgb(0 0 0 / .45), inset -1.5px -1.5px 4px rgb(255 255 255 / .03);
    --ring: 0 0 0 4px rgb(255 255 255 / .06); --glow: 0 0 0 4px rgb(255 255 255 / .06);
    --wallpaper: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/></svg>"),
      radial-gradient(60vmax 45vmax at 6% 6%, rgb(46 66 56 / .55), transparent 70%),
      radial-gradient(55vmax 50vmax at 96% 12%, rgb(42 50 70 / .6), transparent 70%),
      radial-gradient(60vmax 50vmax at 78% 100%, rgb(60 52 44 / .45), transparent 70%),
      #141416;
    --user-bubble: #2c2c30; --code-bg: rgb(0 0 0 / .22); --code-head: rgb(255 255 255 / .03); --code-line: rgb(255 255 255 / .08);
    --danger: #ff6961; --danger-soft: rgb(255 69 58 / .15); --warn: #ffb340; --warn-soft: rgb(255 159 10 / .15);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .35); --shadow-md: 0 0 0 .5px rgb(0 0 0 / .4), 0 8px 22px -10px rgb(0 0 0 / .6); --shadow-lg: 0 0 0 .5px rgb(0 0 0 / .5), 0 24px 64px -20px rgb(0 0 0 / .75);
    --tok-k: #fc5fa3; --tok-s: #fc6a5d; --tok-c: #7f8c98; --tok-n: #d0bf69; --tok-f: #67b7a4; --tok-t: #5dd8ff; --tok-a: #fd8f3f; --tok-y: #a167e6; --tok-p: #7f8c98;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161618; --surface: #1f1f22; --surface-2: #1b1b1e; --surface-3: #2b2b2f; --raised: #242427;
  --ink: #f5f5f7; --ink-2: #d1d1d6; --muted: #98989d; --faint: #636366;
  --line: rgb(255 255 255 / .08); --line-strong: rgb(255 255 255 / .15);
  --fill: rgb(118 118 128 / .22); --fill-2: rgb(118 118 128 / .32); --tile: rgb(255 255 255 / .05);
  --accent: #30d158; --accent-hover: #4be07a; --accent-soft: rgb(48 209 88 / .14); --accent-ink: #4fdc78; --on-accent: #062b12;
  --primary: #f5f5f7; --primary-hover: #ffffff; --on-primary: #1d1d1f;
  --glass: rgb(40 40 44 / .52); --glass-strong: rgb(44 44 48 / .74); --glass-border: rgb(255 255 255 / .09);
  --shadow-glass: inset 0 .5px 0 rgb(255 255 255 / .08), 0 0 0 .5px rgb(0 0 0 / .5), 0 10px 32px -16px rgb(0 0 0 / .7);
  --neu-out: 4px 4px 12px rgb(0 0 0 / .42), -4px -4px 12px rgb(255 255 255 / .025);
  --neu-sm: 2px 2px 7px rgb(0 0 0 / .4), -2px -2px 7px rgb(255 255 255 / .022);
  --neu-in: inset 1.5px 1.5px 4px rgb(0 0 0 / .45), inset -1.5px -1.5px 4px rgb(255 255 255 / .03);
  --ring: 0 0 0 4px rgb(255 255 255 / .06); --glow: 0 0 0 4px rgb(255 255 255 / .06);
  --wallpaper: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/></svg>"),
    radial-gradient(60vmax 45vmax at 6% 6%, rgb(46 66 56 / .55), transparent 70%),
    radial-gradient(55vmax 50vmax at 96% 12%, rgb(42 50 70 / .6), transparent 70%),
    radial-gradient(60vmax 50vmax at 78% 100%, rgb(60 52 44 / .45), transparent 70%),
    #141416;
  --user-bubble: #2c2c30; --code-bg: rgb(0 0 0 / .22); --code-head: rgb(255 255 255 / .03); --code-line: rgb(255 255 255 / .08);
  --danger: #ff6961; --danger-soft: rgb(255 69 58 / .15); --warn: #ffb340; --warn-soft: rgb(255 159 10 / .15);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .35); --shadow-md: 0 0 0 .5px rgb(0 0 0 / .4), 0 8px 22px -10px rgb(0 0 0 / .6); --shadow-lg: 0 0 0 .5px rgb(0 0 0 / .5), 0 24px 64px -20px rgb(0 0 0 / .75);
  --tok-k: #fc5fa3; --tok-s: #fc6a5d; --tok-c: #7f8c98; --tok-n: #d0bf69; --tok-f: #67b7a4; --tok-t: #5dd8ff; --tok-a: #fd8f3f; --tok-y: #a167e6; --tok-p: #7f8c98;
  color-scheme: dark;
}
/* Two-tone headline: the second line in secondary grey. */
.grad-text { color: var(--muted); }

/* ───────────── Base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.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; }
.eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .16em; }
kbd { font-family: var(--font); font-size: .68rem; color: var(--faint); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 1.5; background: var(--surface); white-space: nowrap; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.5rem; font-weight: 700; letter-spacing: -.045em; color: var(--ink); }
.brand img { border-radius: 10px; box-shadow: var(--neu-sm); }
.brand-ai { font-weight: 500; margin-left: 2px; color: var(--muted); }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); flex-shrink: 0; transition: background-color .12s, color .12s; }
.icon-button:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.icon-button svg { width: 18px; height: 18px; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 46px; border-radius: 10px; background: var(--primary); color: var(--on-primary); font-weight: 600; letter-spacing: -.01em; box-shadow: var(--shadow-sm); transition: background-color .15s, transform .1s, box-shadow .15s; }
.primary-button:hover:not(:disabled) { background: var(--primary-hover); box-shadow: var(--shadow-md); }
.primary-button:active:not(:disabled) { transform: scale(.99); }
.primary-button svg { width: 17px; height: 17px; transform: rotate(90deg); }
.secondary-button, .danger-button { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; font-weight: 550; border-radius: 8px; padding: 9px 15px; }
.secondary-button { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.secondary-button:hover:not(:disabled) { background: var(--surface-2); }
.secondary-button svg { width: 16px; height: 16px; }
.danger-button { background: var(--danger); color: #fff; }
.text-button { color: var(--accent-ink); font-weight: 600; padding: 2px; }
.text-button:hover { text-decoration: underline; }
label { display: grid; gap: 8px; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
input { width: 100%; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: color-mix(in srgb, var(--accent) 70%, var(--line-strong)); box-shadow: var(--glow); }
input::placeholder, textarea::placeholder { color: var(--faint); font-weight: 400; }
.notice-text { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); padding: 11px 12px; border-radius: 10px; font-size: .86rem; line-height: 1.55; color: var(--accent-ink); margin: 0; }
.error-text { background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); padding: 11px 12px; border-radius: 10px; font-size: .86rem; line-height: 1.55; color: var(--danger); margin: 0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 3px rgb(52 199 89 / .16); }

/* ───────────── Auth ───────────── */
.auth-view { display: grid; grid-template-columns: 46% 54%; min-height: 100dvh; }
.auth-story { background: transparent; padding: 42px 48px 25px; display: flex; flex-direction: column; min-height: 100dvh; overflow: hidden; position: relative; border-right: 1px solid var(--line); }
.story-content { margin: auto 0; padding: 55px 0 5px; }
.story-content > .eyebrow { color: var(--accent-ink); }
.story-content h1 { font-size: clamp(38px, 4.6vw, 64px); font-weight: 750; line-height: 1.04; letter-spacing: -.05em; margin: 22px 0 20px; }
.story-content > p { color: var(--muted); line-height: 1.75; font-size: 1.08rem; }
.story-orbit { height: 220px; position: relative; display: grid; place-items: center; margin-top: 20px; max-width: 400px; }
.orbit-ring { width: 200px; height: 200px; border: 1px solid color-mix(in srgb, var(--line-strong) 80%, transparent); border-radius: 50%; position: absolute; }
.orbit-ring::before { content: ""; position: absolute; inset: 22px; border: 1px dashed var(--line-strong); border-radius: 50%; }
.story-orbit > img { width: 88px; height: 88px; transform: rotate(-8deg); box-shadow: var(--neu-out); border-radius: 27px; position: relative; }
.orbit-pill { position: absolute; font-size: .8rem; font-weight: 550; padding: 9px 15px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(10px); color: var(--ink-2); box-shadow: var(--shadow-md); }
.pill-one { top: 38px; right: 4px; transform: rotate(6deg); }
.pill-two { bottom: 40px; left: 2px; transform: rotate(-6deg); }
.orbit-dot { position: absolute; width: 12px; height: 12px; background: var(--ink); border: 3px solid var(--surface-2); border-radius: 50%; left: 29%; top: 29px; }
.story-footer { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; margin-top: 20px; }
.story-year { margin-left: auto; font-size: .68rem; letter-spacing: .14em; }
.auth-main { display: grid; place-items: center; position: relative; padding: 60px 32px; background: var(--surface); }
.auth-settings { position: absolute; right: 18px; top: 18px; }
.auth-card { width: 100%; max-width: 350px; }
.auth-logo { margin-bottom: 22px; border-radius: 16px; display: none; box-shadow: var(--neu-sm); }
.auth-card > .eyebrow { color: var(--muted); }
.auth-card > h2 { font-size: 2.05rem; font-weight: 750; letter-spacing: -.045em; line-height: 1.15; margin: 14px 0 8px; }
.auth-card > p.muted { font-size: .95rem; margin: 0 0 28px; }
.auth-card form { display: grid; gap: 18px; }
.password-input { position: relative; display: block; }
.password-input input { padding-right: 46px; }
.password-input .icon-button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.auth-switch { font-size: .9rem; text-align: center; margin-top: 22px; color: var(--muted); }
.auth-bottom { font-size: .8rem; text-align: center; color: var(--faint); border-top: 1px solid var(--line); margin-top: 32px; padding-top: 20px; }
.small-leaf { margin-right: 6px; color: var(--faint); }
.legal-links { display: flex; justify-content: center; gap: 9px; margin-top: 10px; }
.legal-links a, .composer-caption a { color: inherit; text-underline-offset: 3px; }
.legal-links a:hover, .composer-caption a:hover { color: var(--accent-ink); }

/* ───────────── Workspace + sidebar ───────────── */
.workspace { height: 100dvh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border-right: 1px solid var(--line); padding: 14px 10px 10px; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 16px; }
.sidebar .brand { font-size: 1.45rem; }
.new-chat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-weight: 600; font-size: .93rem; text-align: left; transition: border-color .15s, box-shadow .15s, transform .1s; }
.new-chat:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.new-chat:active { transform: scale(.99); }
.new-chat svg { width: 17px; height: 17px; color: var(--accent-ink); }
.new-chat kbd { margin-left: auto; }
.history-search { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; padding: 0 10px; height: 36px; border-radius: 8px; font-weight: 400; color: var(--muted); transition: background-color .15s; }
.history-search:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.history-search svg { width: 15px; height: 15px; }
.history-search input { border: 0; background: none; padding: 0; height: 100%; font-size: .9rem; box-shadow: none; border-radius: 0; }
.history-search input::-webkit-search-cancel-button { display: none; }
.history-search:focus-within kbd { display: none; }
.history-heading { display: flex; align-items: center; justify-content: space-between; font-size: .72rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); padding: 8px 10px 4px; }
.chat-list { overflow-y: auto; flex: 1; min-height: 40px; margin: 0 -4px; padding: 0 4px 8px; }
.chat-group-title { font-size: .72rem; font-weight: 600; color: var(--muted); padding: 14px 10px 5px; letter-spacing: .02em; }
.chat-group-title:first-child { padding-top: 6px; }
.empty-history { font-size: .86rem; color: var(--muted); line-height: 1.6; padding: 10px; margin: 0; }
.chat-list-item { position: relative; display: flex; align-items: center; border-radius: 8px; margin-bottom: 1px; }
.chat-list-item:hover { background: var(--surface-3); }
.chat-list-item.active { background: var(--surface-3); }
.chat-select { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 8px 10px; font-size: .9rem; text-align: left; color: var(--ink-2); border-radius: 8px; }
.chat-list-item.active .chat-select { color: var(--ink); font-weight: 550; }
.chat-select svg { width: 14px; height: 14px; color: var(--faint); }
.chat-select .pin-mark { color: var(--accent-ink); }
.chat-select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 1px; padding-left: 22px; border-radius: 0 8px 8px 0; background: linear-gradient(to right, transparent, var(--surface-3) 20px); opacity: 0; transition: opacity .12s; }
.chat-list-item.active .chat-actions { background: linear-gradient(to right, transparent, var(--surface-3) 20px); }
.chat-list-item:hover .chat-actions, .chat-list-item:focus-within .chat-actions { opacity: 1; }
.chat-actions .icon-button { width: 26px; height: 26px; border-radius: 7px; }
.chat-actions .icon-button svg { width: 14px; height: 14px; }
.chat-actions .icon-button.danger:hover { color: var(--danger); background: var(--danger-soft); }
.chat-actions .icon-button.on { color: var(--accent-ink); }
.chat-rename { flex: 1; margin: 3px; padding: 6px 8px; font-size: .9rem; border-radius: 7px; }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.user-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px 2px 6px; }
.user-button.alert .avatar { position: relative; }
.user-button.alert .avatar::after { content: ''; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface-2); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(180deg, #a1a1a6, #7c7c80); color: #fff; font-size: .84rem; font-weight: 700; flex-shrink: 0; }
.user-details { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.user-details strong { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-details > span { font-size: .75rem; color: var(--muted); }
.user-row .icon-button { width: 30px; height: 30px; }
.user-row svg { width: 16px; height: 16px; }

/* ───────────── Main column ───────────── */
.chat-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-header { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 0 20px; flex-shrink: 0; border-bottom: 1px solid transparent; transition: border-color .2s; }
.chat-main.scrolled .chat-header { border-bottom-color: var(--line); }
.header-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.header-title { margin: 0; font-size: .95rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.header-actions { display: flex; gap: 2px; align-items: center; flex-shrink: 0; }
.provider-badge { display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 550; color: var(--ink-2); padding: 4px 10px; margin-right: 4px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.provider-badge.offline { color: var(--warn); background: var(--warn-soft); }
.provider-badge.offline .status-dot { background: var(--warn); box-shadow: none; }
.provider-notice, .model-notice { font-size: .82rem; line-height: 1.5; padding: 8px 20px; text-align: center; }
.provider-notice { background: var(--warn-soft); color: var(--warn); }
.model-notice { background: var(--surface-2); color: var(--muted); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }

/* Welcome */
.welcome { max-width: 640px; margin: 0 auto; padding: clamp(28px, 10vh, 110px) 24px 24px; text-align: center; animation: rise .35s ease-out; }
.welcome-mark { width: 56px; margin: 0 auto 22px; position: relative; }
.welcome-mark img { position: relative; border-radius: 17px; box-shadow: var(--neu-out); display: block; }
.greeting { font-size: clamp(1.8rem, 4.2vw, 2.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.15; margin: 0 0 6px; color: var(--ink); text-wrap: balance; }
.welcome-title { font-weight: 500; letter-spacing: -.03em; font-size: clamp(1.25rem, 3vw, 1.75rem); line-height: 1.25; margin: 0 0 34px; color: var(--muted); text-wrap: balance; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.suggestion { display: flex; align-items: center; gap: 12px; padding: 14px; min-width: 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: left; transition: border-color .15s, transform .15s, box-shadow .15s, background-color .15s; }
.suggestion:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.suggestion-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
.suggestion-icon svg { width: 17px; height: 17px; }
.suggestion-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.suggestion strong { font-size: .93rem; font-weight: 600; }
.suggestion-text > span { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Suggestion icons are monochrome (soft pressed wells); the colour classes stay for markup. */

/* ───────────── Messages ───────────── */
.messages { max-width: 780px; margin: 0 auto; padding: 20px 24px 24px; }
.message { margin: 0 0 24px; }
.messages > .message:not(:nth-last-child(-n+6)) { content-visibility: auto; contain-intrinsic-size: auto 160px; }
.message.entering { animation: rise .22s ease-out; }
.message.user { display: flex; flex-direction: column; align-items: flex-end; }
.message-heading { display: flex; align-items: center; gap: 9px; font-size: .88rem; font-weight: 650; letter-spacing: -.01em; margin-bottom: 8px; min-width: 0; }
.message-heading img { width: 26px; height: 26px; border-radius: 8px; box-shadow: var(--neu-sm); }
.message-meta { display: inline-flex; gap: 6px; font-size: .75rem; font-weight: 400; color: var(--faint); min-width: 0; }
.message-model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.message.user .message-heading { display: none; }
.message-content { font-size: 1.07rem; line-height: 1.7; overflow-wrap: anywhere; color: var(--ink); }
.message.user .message-content { max-width: min(86%, 620px); background: var(--user-bubble); padding: 10px 16px; border-radius: 16px; white-space: pre-wrap; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 .8em; }
.message-content h2, .message-content h3, .message-content h4 { line-height: 1.35; margin: 1.3em 0 .5em; font-weight: 700; letter-spacing: -.025em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.14em; }
.message-content h4 { font-size: 1.02em; }
.message-content ul, .message-content ol { padding-left: 1.5em; margin: 0 0 .8em; }
.message-content li { margin: .25em 0; }
.message-content li > ul, .message-content li > ol { margin: .2em 0 .3em; }
.message-content li::marker { color: var(--muted); }
.message-content ol > li::marker { font-weight: 600; }
.message-content .task-item { list-style: none; margin-left: -1.3em; }
.task-box { display: inline-block; width: 15px; height: 15px; border: 1.5px solid var(--line-strong); border-radius: 4px; margin-right: 8px; vertical-align: -2px; }
.task-box.done { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.message-content blockquote { margin: 0 0 .9em; padding: .1em 0 .1em 1em; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.message-content hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.message-content a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.message-content a:hover { text-decoration-color: currentColor; }
.message-content strong { font-weight: 650; }
.message-content del { color: var(--muted); }
.message-content code { font-family: var(--mono); font-size: .86em; background: var(--code-head); border: 1px solid var(--code-line); border-radius: 5px; padding: .1em .35em; }
.cite { display: inline-block; font-size: .72em; font-weight: 600; line-height: 1.5; padding: 0 .45em; margin: 0 .1em; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: .12em; }
.code-block { margin: .4em 0 1em; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 11px; overflow: hidden; }
.code-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 6px 4px 14px; background: var(--code-head); border-bottom: 1px solid var(--code-line); font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.code-copy { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font); font-size: .78rem; color: var(--muted); padding: 4px 9px; border-radius: 6px; }
.code-copy:hover { background: var(--surface-3); color: var(--ink); }
.code-copy.copied { color: var(--accent-ink); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; white-space: pre; line-height: 1.6; tab-size: 2; }
.code-block pre code { background: none; border: 0; padding: 0; font-size: .84rem; color: var(--ink); font-variant-ligatures: none; }
.tok-k { color: var(--tok-k); } .tok-s { color: var(--tok-s); } .tok-c { color: var(--tok-c); font-style: italic; } .tok-n { color: var(--tok-n); } .tok-f { color: var(--tok-f); } .tok-t { color: var(--tok-t); } .tok-a { color: var(--tok-a); } .tok-y { color: var(--tok-y); } .tok-p { color: var(--tok-p); }
.table-wrapper { overflow-x: auto; margin: .4em 0 1em; border: 1px solid var(--line); border-radius: 11px; }
.table-wrapper table { border-collapse: collapse; min-width: 100%; font-size: .92em; }
.table-wrapper th, .table-wrapper td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrapper th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.table-wrapper tr:last-child td { border-bottom: 0; }
.table-wrapper tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

.message-context { display: inline-flex; align-items: center; gap: 6px; max-width: min(86%, 620px); font-size: .8rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; margin-bottom: 6px; }
.message-context svg { width: 14px; height: 14px; color: var(--muted); }
.message-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-actions { display: flex; align-items: center; gap: 2px; margin-top: 6px; margin-left: -6px; opacity: 0; transition: opacity .15s; }
.message.user .message-actions { margin: 2px -4px 0 0; }
.message.user .message-actions .icon-button { width: 28px; height: 28px; }
.message:hover .message-actions, .message:focus-within .message-actions, .message.last .message-actions { opacity: 1; }
.message-actions .icon-button { width: 30px; height: 30px; border-radius: 8px; }
.message-actions .icon-button svg { width: 15px; height: 15px; }
.message-actions .icon-button.copied { color: var(--accent-ink); }
.message-actions time { font-size: .75rem; color: var(--faint); padding: 0 6px; }
.stopped-badge { font-size: .74rem; color: var(--warn); background: var(--warn-soft); border-radius: 99px; padding: 2px 9px; margin-left: 4px; }
.continue-button { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--accent-ink); border: 1px solid var(--line-strong); border-radius: 99px; padding: 4px 11px 4px 9px; margin-left: 6px; }
.continue-button:hover { background: var(--accent-soft); }
.continue-button svg { width: 13px; height: 13px; }
.browser-suggestion { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 2px; }
.browser-suggestion .primary-button { gap: 7px; }
.browser-suggestion .primary-button svg { width: 15px; height: 15px; transform: none; }
.browser-suggestion .field-help { margin: 0; flex: 1 1 200px; }
.browser-suggestion > svg { width: 16px; height: 16px; color: var(--muted); }
.browser-suggestion > span:not(.field-help) { font-size: .86rem; color: var(--muted); }
.browser-steps { margin: 10px 0 0; font-size: .86rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.browser-steps summary { cursor: pointer; padding: 8px 12px; color: var(--ink-2); font-weight: 550; list-style-position: inside; }
.browser-steps ol { margin: 0; padding: 4px 14px 10px 34px; color: var(--ink-2); max-height: 260px; overflow: auto; }
.browser-steps li { margin: 3px 0; line-height: 1.5; }
.browser-steps li.failed { color: var(--danger); }

/* Edit-in-place */
.message-editor { width: min(100%, 620px); background: var(--surface); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.message-editor textarea { width: 100%; border: 0; resize: none; background: none; font-size: 1.02rem; line-height: 1.6; min-height: 60px; max-height: 300px; outline: none; }
.message-editor div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.message-editor button { font-size: .86rem; font-weight: 600; padding: 7px 13px; border-radius: 99px; }
.message-editor .save { background: var(--primary); color: var(--on-primary); }
.message-editor .cancel { background: var(--surface-3); }

/* Streaming */
.streaming-content > :is(p, li, h2, h3, h4):last-child::after,
.streaming-content > :is(ul, ol):last-child > li:last-child::after { content: ""; display: inline-block; width: .5em; height: 1em; margin-left: 2px; vertical-align: -.12em; background: var(--accent); border-radius: 2px; animation: blink 1s steps(2, start) infinite; }
.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); opacity: .35; animation: bounce 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.agent-status { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: .95rem; }

/* ───────────── Scroll button ───────────── */
.scroll-down { position: absolute; left: 50%; bottom: var(--composer-height, 150px); transform: translate(-50%, -12px); z-index: 5; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--raised); color: var(--ink-2); border: 1px solid var(--line); box-shadow: var(--shadow-md); animation: rise .18s ease-out; }
.scroll-down:hover { color: var(--ink); }
.scroll-down svg { width: 17px; height: 17px; }

/* ───────────── Composer ───────────── */
.composer-area { width: 100%; max-width: 820px; margin: 0 auto; padding: 4px 20px 12px; flex-shrink: 0; }
.composer { position: relative; background: var(--surface); border: .5px solid var(--line-strong); border-radius: 18px; padding: 12px 10px 8px 18px; box-shadow: var(--shadow-composer); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); box-shadow: var(--shadow-composer), var(--glow); }
.composer.agent { border-color: color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: var(--shadow-composer), var(--glow); }
.composer textarea { display: block; width: 100%; resize: none; border: 0; background: transparent; color: var(--ink); font-size: 1.07rem; line-height: 1.55; padding: 4px 2px; min-height: 30px; max-height: 40vh; overflow-y: auto; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; }
.composer-tools { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; margin-left: -6px; }
.composer-tools .tool { width: 34px; height: 34px; border-radius: 99px; }
.composer-tools .tool svg { width: 18px; height: 18px; }
.browser-controls { display: inline-flex; }
.browser-mode[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.browser-mode[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent-hover); color: var(--on-accent); }
.tool-divider { width: 1px; height: 18px; background: var(--line-strong); margin: 0 5px; flex-shrink: 0; }
.pill-select { position: relative; display: inline-flex; align-items: center; min-width: 0; flex: 0 1 auto; gap: 0; font-weight: 500; }
.pill-select select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--ink-2); font-size: .84rem; font-weight: 550; height: 32px; padding: 0 26px 0 11px; border-radius: 99px; cursor: pointer; min-width: 0; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.pill-select select:hover:not(:disabled), .pill-select select:focus-visible { background: var(--surface-3); color: var(--ink); }
.pill-select select:disabled { opacity: .5; cursor: default; }
.pill-select select option { color: var(--ink); background: var(--surface); }
.pill-select svg { position: absolute; right: 6px; width: 14px; height: 14px; pointer-events: none; color: var(--muted); }
.model-pill { flex: 0 1 190px; }
.mode-pill { flex: 0 0 auto; }
.send-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.send-button { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); transition: background-color .15s, transform .1s; }
.send-button:hover:not(:disabled) { background: var(--primary-hover); }
.send-button:active:not(:disabled) { transform: scale(.94); }
.send-button:disabled { background: var(--surface-3); color: var(--faint); opacity: 1; box-shadow: none; }
.send-button svg { width: 18px; height: 18px; stroke-width: 2.1; }
.stop-button { background: var(--ink); color: var(--bg); }
.stop-button:hover:not(:disabled) { background: var(--ink-2); }
.stop-button svg { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.character-count { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.composer-caption { display: flex; justify-content: center; font-size: .74rem; color: var(--faint); margin: 8px 4px 0; text-align: center; }
.context-list { display: flex; gap: 6px; flex-wrap: wrap; max-height: 112px; overflow-y: auto; margin: 0 0 8px -4px; }
.context-chip { display: flex; align-items: center; gap: 7px; max-width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 4px 4px 9px; font-size: .82rem; color: var(--ink-2); animation: rise .18s ease-out; }
.context-chip > svg { width: 15px; height: 15px; color: var(--accent-ink); }
.context-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-chip small { color: var(--faint); font-size: .72rem; white-space: nowrap; }
.context-chip .icon-button { width: 22px; height: 22px; border-radius: 6px; }
.context-chip .icon-button svg { width: 12px; height: 12px; }
.attachment-help, .active-source-note { font-size: .8rem; line-height: 1.5; color: var(--muted); padding: 0 2px 8px; }
.attachment-help { color: var(--warn); }
.work-progress { display: flex; align-items: center; gap: 9px; font-size: .84rem; line-height: 1.5; color: var(--accent-ink); padding: 7px 12px; margin: 0 0 8px -6px; border-radius: 11px; background: var(--accent-soft); }
.work-progress::before { content: ""; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; border: 2px solid color-mix(in srgb, var(--accent-ink) 30%, transparent); border-top-color: var(--accent-ink); animation: spin .8s linear infinite; }
.browser-hint { display: flex; align-items: flex-start; gap: 8px; font-size: .8rem; line-height: 1.5; color: var(--accent-ink); padding: 0 2px 8px; }
.browser-hint svg { width: 15px; height: 15px; margin-top: 2px; }
.browser-decision { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); padding: 12px; border-radius: 10px; margin: 0 0 10px -4px; font-size: .9rem; line-height: 1.55; animation: rise .18s ease-out; }
.browser-decision strong { color: var(--accent-ink); }
.browser-decision p { margin: 4px 0 10px; overflow-wrap: anywhere; color: var(--ink-2); }
.browser-decision > div { display: flex; gap: 8px; }
.browser-decision button { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line-strong); font-size: .86rem; font-weight: 600; background: var(--surface); }
.browser-decision button:first-child { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.drop-overlay { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: inherit; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent-soft) 92%, transparent); color: var(--accent-ink); font-weight: 600; pointer-events: none; }

/* ───────────── Dialogs + toast ───────────── */
.settings-dialog { width: calc(100% - 32px); max-width: 440px; max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow-lg); background: var(--raised); color: var(--ink); }
.settings-dialog[open] { animation: pop .18s ease-out; }
.settings-dialog::backdrop { background: rgb(8 8 12 / .42); backdrop-filter: blur(6px); }
.settings-dialog.compact { max-width: 380px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-header h2 { font-size: 1.3rem; letter-spacing: -.035em; font-weight: 700; margin: 0; }
.settings-dialog p.muted { font-size: .92rem; line-height: 1.6; margin: 10px 0 0; }
.settings-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.settings-section:first-of-type { border-top: 0; margin-top: 8px; padding-top: 4px; }
.settings-section h3 { font-size: .8rem; letter-spacing: -.005em; color: var(--muted); margin: 0 0 10px; font-weight: 650; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: .93rem; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented label { display: block; font-weight: 500; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; padding: 5px 12px; font-size: .84rem; border-radius: 8px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.segmented input:checked + span { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.settings-dialog .primary-button { margin-top: 14px; }
.field-help { font-size: .8rem; line-height: 1.6; color: var(--muted); margin: 8px 0 0; }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; font-size: .88rem; align-items: center; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.toast { position: fixed; left: 50%; bottom: max(24px, calc(var(--composer-height, 0px) + 6px)); transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100vw - 32px); background: var(--primary); color: var(--on-primary); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 10px 16px; font-size: .9rem; line-height: 1.5; animation: rise .2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }

/* ───────────── Motion ───────────── */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes blink { to { visibility: hidden; } }
@keyframes bounce { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
.scroll-down { animation-name: rise-centered; }
@keyframes rise-centered { from { opacity: 0; transform: translate(-50%, -4px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ───────────── Responsive ───────────── */
.mobile-menu, .mobile-close, .sidebar-backdrop { display: none; }
@media (min-width: 761px) { #header-new-chat { display: none; } }
@media (min-width: 1500px) { .auth-story { padding-left: max(48px, calc((100vw - 1200px) / 2)); } }
@media (max-width: 900px) {
  .auth-story { padding: 30px; }
  .story-content h1 { font-size: 43px; }
}
@media (max-width: 760px) {
  .workspace { display: block; }
  .chat-main { height: 100dvh; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); z-index: 30; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; box-shadow: var(--shadow-lg); }
  .workspace.menu-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; background: rgb(10 20 15 / .38); animation: fade .2s; }
  .mobile-menu, .mobile-close { display: inline-grid; }
  .chat-header { padding: 0 6px 0 6px; height: 48px; }
  .header-title { font-size: .9rem; }
  .provider-label { display: none; }
  .provider-badge { padding: 5px 6px; margin-right: 0; }
  .messages { padding: 14px 14px 20px; }
  .composer-area { padding: 2px 10px 8px; }
  .composer { border-radius: 14px; padding: 8px 8px 6px 12px; }
  .welcome { padding: clamp(20px, 7vh, 60px) 16px 16px; }
  .history-search kbd, .new-chat kbd { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@media (max-width: 650px) {
  .auth-view { display: block; }
  .auth-story { display: none; }
  .auth-main { min-height: 100dvh; padding: 64px 24px 32px; }
  .auth-logo { display: block; }
}
@media (max-width: 460px) {
  .suggestions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .suggestion { flex-direction: column; align-items: flex-start; gap: 9px; padding: 12px; }
  .suggestion-text > span { white-space: normal; }
  .message.user .message-content { max-width: 92%; }
  .model-pill { flex-basis: 130px; }
  .composer-caption { font-size: .7rem; }
}
@media (max-width: 360px) {
  .tool-divider { display: none; }
  .model-pill { flex-basis: 100px; }
  .suggestion-text > span { display: none; }
}
@media (hover: none) { .message-actions { opacity: 1; } .chat-actions { opacity: 1; } }

/* ───────────── Page chip, site access, file cards ───────────── */
.page-chip { display: flex; align-items: center; gap: 7px; max-width: 100%; margin: 0 0 8px -4px; padding: 5px 10px 5px 8px; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: .82rem; color: var(--ink-2); text-align: left; transition: border-color .15s, background-color .15s; animation: rise .18s ease-out; }
.page-chip:hover { border-color: var(--accent); border-style: solid; background: var(--accent-soft); color: var(--ink); }
.page-chip img { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.page-chip .page-chip-plus { width: 14px; height: 14px; color: var(--accent-ink); }
.page-chip-label { color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.page-chip strong { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.site-access { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px -4px; padding: 9px 8px 9px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .86rem; line-height: 1.45; animation: rise .18s ease-out; }
.site-access > svg { width: 16px; height: 16px; }
.site-access > span { flex: 1 1 160px; }
.site-access > button:not(.icon-button) { padding: 6px 12px; border-radius: 99px; background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: .82rem; }
.site-access .icon-button { width: 26px; height: 26px; color: inherit; }
.file-card { display: flex; align-items: center; gap: 12px; margin: .4em 0 1em; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); }
.file-badge { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: #1d6f42; color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .04em; flex-shrink: 0; }
.file-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.file-title { font-size: .95rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.file-download { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding: 8px 15px; border-radius: 99px; background: var(--primary); color: var(--on-primary); font-size: .86rem; font-weight: 600; transition: background-color .15s; }
.file-download:hover:not(:disabled) { background: var(--primary-hover); }
.file-download svg { width: 16px; height: 16px; }
.file-card.pending .file-badge { background: var(--surface-3); color: var(--muted); animation: pulse 1.4s infinite; }
.file-card.failed { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.file-card.failed .file-badge { background: var(--danger); font-size: 1.1rem; }
.file-card.failed .file-meta { color: var(--ink-2); }
@media (max-width: 460px) {
  .file-card { flex-wrap: wrap; }
  .file-download { width: 100%; justify-content: center; }
  .page-chip-label { display: none; }
}
.switch-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; font-size: .9rem; color: var(--ink); margin-top: 14px; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; padding: 0; }
.switch-row.muted { opacity: .55; cursor: default; }
.web-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.web-toggle[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-ink); }
.web-flag { color: var(--accent-ink); }
.web-flag svg { color: var(--accent-ink); }
.web-sources { margin: 12px 0 2px; }
.web-sources-title { display: block; font-size: .78rem; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.web-sources-list { display: flex; flex-wrap: wrap; gap: 6px; }
.web-source { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 11px 5px 6px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); text-decoration: none; color: var(--ink-2); font-size: .82rem; transition: border-color .15s, background-color .15s; }
.web-source:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.web-source b { font-size: .7rem; padding: 1px 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); }
.web-source-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.web-source small { color: var(--faint); white-space: nowrap; }
a.cite { text-decoration: none; cursor: pointer; }
a.cite:hover { background: var(--accent); color: var(--on-accent); }

/* ───────────── Charts (validated categorical palette; the table view is the contrast relief) ───────────── */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767; }
.chart-card { margin: .5em 0 1em; padding: 14px 14px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.chart-title { font-size: .92rem; font-weight: 650; color: var(--ink); }
.chart-actions { display: flex; gap: 4px; flex-shrink: 0; }
.chart-button { font-size: .76rem; font-weight: 600; color: var(--muted); padding: 4px 9px; border-radius: 7px; border: 1px solid var(--line); }
.chart-button:hover, .chart-button[aria-pressed="true"] { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 6px; font-size: .8rem; color: var(--ink-2); }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-key i { width: 10px; height: 10px; border-radius: 3px; background: var(--key); }
.chart-key i.line { width: 14px; height: 2px; border-radius: 2px; }
.chart-plot { position: relative; }
.chart-plot svg { display: block; width: 100%; height: auto; max-height: 340px; overflow: visible; stroke: none; stroke-width: 0; fill: none; }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-grid line.chart-zero { stroke: var(--line-strong); }
.chart-axis { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-value, .chart-end { font-size: 11px; font-weight: 600; fill: var(--ink-2); }
.chart-total { font-size: 22px; font-weight: 650; fill: var(--ink); }
.chart-legend-text { font-size: 12px; fill: var(--ink-2); }
.chart-mark { cursor: pointer; transition: opacity .12s; outline: none; }
.chart-mark:hover, .chart-mark:focus-visible { opacity: .78; }
.chart-cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-hit { outline: none; cursor: crosshair; }
.chart-tooltip { position: absolute; z-index: 4; pointer-events: none; min-width: 120px; padding: 8px 10px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-md); font-size: .8rem; }
.chart-tip-head { color: var(--muted); margin-bottom: 4px; }
.chart-tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.chart-tip-row i { width: 12px; height: 2px; border-radius: 2px; background: var(--key); }
.chart-tip-row strong { font-variant-numeric: tabular-nums; color: var(--ink); }
.chart-tip-row span { color: var(--muted); }
.chart-table-wrap { overflow-x: auto; }
.chart-table { border-collapse: collapse; font-size: .82rem; width: 100%; }
.chart-table th, .chart-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.chart-table tr > th:first-child { text-align: left; font-weight: 500; color: var(--ink-2); }

/* ───────────── Account, templates, slash menu, admin ───────────── */
.user-button { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: left; padding: 4px; margin: -4px; border-radius: 8px; }
.user-button:hover { background: var(--surface-3); }
.settings-dialog.wide { max-width: 520px; }
.stack { display: grid; gap: 10px; }
.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.primary-button.compact { width: auto; min-height: 38px; padding: 0 18px; font-size: .9rem; }
.settings-dialog textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; background: var(--surface); color: var(--ink); resize: vertical; line-height: 1.5; }
.settings-dialog textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.danger-zone h3 { color: var(--danger); }
.secondary-button.small { padding: 5px 10px; font-size: .78rem; }
.secondary-button.warn { color: var(--danger); }
.slash-menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 8px); z-index: 6; max-height: 320px; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.slash-item { display: grid; grid-template-columns: 18px 1fr; column-gap: 9px; width: 100%; text-align: left; padding: 7px 9px; border-radius: 8px; }
.slash-item svg { width: 16px; height: 16px; grid-row: span 2; color: var(--accent-ink); margin-top: 2px; }
.slash-item strong { font-size: .88rem; font-weight: 600; }
.slash-item span { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-item.active, .slash-item:hover { background: var(--accent-soft); }
.slash-empty { margin: 6px 9px; font-size: .84rem; color: var(--muted); }
.slash-manage { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 4px; padding: 8px 9px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--accent-ink); font-weight: 600; }
.slash-manage svg { width: 15px; height: 15px; }
.templates-list { display: grid; gap: 6px; margin: 12px 0 16px; max-height: 260px; overflow-y: auto; }
.template-item { display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.template-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.template-body strong { font-size: .9rem; }
.template-body span { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-item .icon-button { width: 30px; height: 30px; }
.template-item .icon-button.danger:hover { color: var(--danger); background: var(--danger-soft); }
.template-form { border-top: 1px solid var(--line); padding-top: 14px; }
.admin-dialog { max-width: 980px; width: calc(100% - 24px); }
.dialog-tools { display: flex; gap: 2px; }
.admin-body { display: grid; gap: 12px; margin-top: 12px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-note { font-size: .76rem; color: var(--faint); }
.admin-facts { margin: 0; }
.admin-search { max-width: 320px; padding: 9px 12px; }
.admin-users td, .admin-users th { white-space: nowrap; }
.admin-users td small { color: var(--muted); }
.admin-users tr.disabled td { opacity: .55; }
.admin-actions { display: flex; gap: 6px; }
.admin-users td.shared-ip { color: var(--warn); }
.telegram-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-radius: 12px; background: var(--tile); border: .5px solid var(--line-strong); }
.telegram-text { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; font-size: .86rem; line-height: 1.45; }
.telegram-text span { color: var(--muted); }
.telegram-row .field-help { margin: 0; }
.admin-requests { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.admin-requests h3 { margin: 0; font-size: .95rem; color: var(--ink); }
.admin-requests .field-help { margin: 0; }
.request-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 9px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.request-text { display: grid; gap: 2px; flex: 1 1 260px; min-width: 0; font-size: .86rem; line-height: 1.45; }
.request-text span, .request-text small { color: var(--muted); overflow-wrap: anywhere; }
.primary-button.compact.small { padding: 6px 11px; font-size: .78rem; min-height: 0; }
.device-details td { background: var(--surface-2); white-space: normal !important; }
.device-list { display: grid; gap: 6px; margin-bottom: 8px; }
.device-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .84rem; }
.device-multi { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.feature-list { display: grid; gap: 6px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: .5px solid var(--line-strong); }
.feature-list > strong, .device-heading { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.admin-users td.feature-cell { color: var(--ink-2); }
.temp-password { display: grid; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.temp-password code { font-family: var(--mono); font-size: 1.1rem; letter-spacing: .04em; color: var(--ink); }
.temp-password .secondary-button { justify-self: start; }

.chat-select.with-snippet { display: grid; grid-template-columns: 14px 1fr; column-gap: 9px; row-gap: 2px; align-items: center; }
.chat-select.with-snippet .chat-snippet { grid-column: 2; font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.voice-toggle[aria-pressed="true"] { background: var(--danger-soft); color: var(--danger); animation: pulse 1.2s infinite; }
.plain-select { font: inherit; font-size: .88rem; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }

/* ───────────── Soft glass surfaces (Apple-style) ─────────────
   Frosted panels float over one neutral wallpaper; controls on the wallpaper are soft
   raised/pressed shapes (neumorphism) rather than borders; colour is reserved for state. */
body { background: var(--wallpaper); background-attachment: fixed; }
.glass, .sidebar, .composer, .settings-dialog, .slash-menu, .auth-card, .scroll-down { -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }

/* Buttons, fields and fills */
.icon-button:hover:not(:disabled) { background: var(--fill); color: var(--ink); }
.secondary-button { background: var(--fill); box-shadow: none; }
.secondary-button:hover:not(:disabled) { background: var(--fill-2); }
.primary-button { border-radius: 10px; box-shadow: 0 .5px 1px rgb(0 0 0 / .14), 0 2px 6px -2px rgb(0 0 0 / .18); }
input { background: var(--fill); border-color: transparent; }
input:focus { background: var(--surface); border-color: var(--line-strong); box-shadow: var(--ring); }
.settings-dialog textarea { background: var(--fill); border-color: transparent; }
.settings-dialog textarea:focus { background: var(--surface); border-color: var(--line-strong); box-shadow: var(--ring); }
.plain-select { background: var(--fill); border-color: transparent; }
:focus-visible { outline-color: color-mix(in srgb, var(--ink) 55%, transparent); }
.status-dot { background: #34c759; box-shadow: 0 0 0 3px rgb(52 199 89 / .16); }

/* Auth: headline on the wallpaper, the form on a frosted card */
.auth-story { background: transparent; border-right: 0; }
.auth-main { background: transparent; }
.auth-card { max-width: 400px; padding: 34px 32px 26px; border-radius: 16px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-glass); }
.auth-logo { box-shadow: var(--neu-sm); }
.story-content > .eyebrow { color: var(--muted); }
.story-content h1 { font-weight: 700; letter-spacing: -.045em; }
.orbit-ring { border-color: var(--line-strong); }
.orbit-ring::before { border-style: solid; border-color: var(--line); }
.story-orbit > img { box-shadow: var(--neu-out); }
.orbit-pill { background: var(--glass-strong); border-color: var(--glass-border); box-shadow: var(--shadow-glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.orbit-dot { background: var(--ink); border-color: var(--bg); }
.auth-bottom { border-top-color: var(--line); }

/* Workspace: floating frosted sidebar; the chat sits on the wallpaper */
@media (min-width: 761px) {
  .workspace { padding: 10px; gap: 10px; }
  .sidebar { border-radius: 14px; }
}
.sidebar { background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow-glass); }
.new-chat { background: var(--tile); border-color: var(--glass-border); box-shadow: var(--shadow-sm); }
.new-chat:hover { border-color: var(--glass-border); box-shadow: var(--shadow-md); }
.new-chat svg { color: var(--ink); }
.history-search { background: var(--fill); }
.history-search:focus-within { background: var(--surface); box-shadow: var(--ring); }
.chat-list-item:hover { background: var(--fill); }
.chat-list-item.active { background: var(--fill-2); }
.chat-actions, .chat-list-item.active .chat-actions { background: none; }
.chat-list-item:is(:hover, :focus-within) .chat-select { padding-right: 66px; }
.sidebar-footer { border-top-color: var(--line); }
.avatar { background: linear-gradient(180deg, #a1a1a6, #7c7c80); color: #fff; text-shadow: none; }

/* Chat column: header and composer are glass over the scrolling conversation */
.chat-main { background: transparent; }
.chat-header { position: absolute; top: 0; left: 0; right: 0; z-index: 4; height: 56px; transition: background-color .2s, border-color .2s; }
.chat-main.scrolled .chat-header { background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom-color: var(--line); }
.chat-scroll { padding-top: 56px; padding-bottom: calc(var(--composer-height, 140px) + 8px); }
.provider-notice, .model-notice { max-width: 760px; margin: 4px auto 0; border-radius: 11px; }
.provider-badge { border: 0; background: var(--fill); }
.composer-area { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; pointer-events: none; }
.composer-area > * { pointer-events: auto; }
/* Progressive blur across the whole column under the composer (no tint, so no visible box). */
.chat-main::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--composer-height, 140px) * .75); z-index: 3; pointer-events: none; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 60%); mask-image: linear-gradient(to bottom, transparent, #000 60%); }
.composer { background: var(--glass-strong); border-color: var(--glass-border); }
.composer:focus-within { border-color: var(--glass-border); box-shadow: var(--shadow-glass), var(--ring); }
.composer.agent { border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-border)); box-shadow: var(--shadow-glass), 0 0 0 4px var(--accent-soft); }
.composer-tools .tool:hover:not(:disabled) { background: var(--fill); }
.browser-mode[aria-pressed="true"], .browser-mode[aria-pressed="true"]:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.web-toggle[aria-pressed="true"], .web-toggle[aria-pressed="true"]:hover:not(:disabled) { background: var(--fill); color: var(--ink); box-shadow: var(--neu-in); }
.pill-select { background: var(--fill); border-radius: 99px; transition: background-color .15s; }
.pill-select:hover, .pill-select:focus-within { background: var(--fill-2); }
.pill-select select, .pill-select select:hover:not(:disabled), .pill-select select:focus-visible { background: transparent; width: 100%; }
.send-button { box-shadow: 0 .5px 1px rgb(0 0 0 / .14), 0 2px 6px -2px rgb(0 0 0 / .2); }
.send-button:disabled { background: var(--fill); box-shadow: none; }
.context-chip { background: var(--tile); border-color: var(--line); }
.page-chip { border-radius: 10px; }
.page-chips { display: flex; gap: 6px; margin: 0 0 8px -4px; min-width: 0; }
.page-chips .page-chip { margin: 0; min-width: 0; }
.page-chips .network-chip { flex: none; border-style: solid; border-color: var(--line); }
.network-chip svg { width: 14px; height: 14px; color: var(--ink-2); }
.page-chip:hover { border-color: var(--line-strong); background: var(--fill); }
.work-progress { background: var(--fill); color: var(--ink-2); }
.work-progress::before { border-color: color-mix(in srgb, var(--ink) 20%, transparent); border-top-color: var(--ink); }
.browser-hint { color: var(--ink-2); }
.browser-decision { background: var(--tile); border-color: var(--line); }
.browser-decision strong { color: var(--ink); }
.drop-overlay { border-color: var(--ink-2); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink); }
.scroll-down { background: var(--glass-strong); border-color: var(--glass-border); box-shadow: var(--shadow-glass); }

/* Welcome: soft raised tiles (neumorphism) on the wallpaper */
.welcome-mark img { box-shadow: var(--neu-out); }
.suggestion { background: color-mix(in srgb, var(--surface) 28%, transparent); border: 0; box-shadow: var(--neu-sm), inset 0 0 0 .5px var(--glass-border); border-radius: 12px; transition: box-shadow .2s, background-color .2s; }
.suggestion:hover { transform: none; box-shadow: var(--neu-out), inset 0 0 0 .5px var(--glass-border); background: color-mix(in srgb, var(--surface) 42%, transparent); border: 0; }
.suggestion:active { box-shadow: var(--neu-in); }
.suggestion-icon { background: transparent; color: var(--ink-2); box-shadow: var(--neu-in); border-radius: 8px; }

/* Messages */
.message-heading img { box-shadow: var(--neu-sm); }
.message.user .message-content { background: var(--user-bubble); box-shadow: 0 0 0 .5px var(--line-strong), 0 1px 3px -1px rgb(0 0 0 / .08); }
.message-context, .web-source, .browser-steps, .table-wrapper, .chart-card, .template-item, .stat-tile { background: var(--tile); border-color: var(--line); }
.message-context svg, .context-chip > svg, .page-chip .page-chip-plus { color: var(--ink-2); }
.message-content a { color: var(--ink); text-decoration-color: var(--line-strong); }
.message-content a:hover { text-decoration-color: currentColor; }
.cite { background: var(--fill); color: var(--ink-2); }
a.cite:hover { background: var(--primary); color: var(--on-primary); }
.web-source:hover { border-color: var(--line-strong); background: var(--fill); }
.web-source b { background: var(--fill); color: var(--ink-2); }
.web-flag, .web-flag svg { color: var(--ink-2); }
.code-copy.copied, .message-actions .icon-button.copied { color: var(--ink); }
.continue-button { color: var(--ink); }
.continue-button:hover { background: var(--fill); }
.task-box.done { background: var(--primary); border-color: var(--primary); }
.message-editor { border-color: var(--line-strong); box-shadow: var(--ring); }
.streaming-content > :is(p, li, h2, h3, h4):last-child::after,
.streaming-content > :is(ul, ol):last-child > li:last-child::after { background: var(--ink); }
.typing i { background: var(--ink-2); }
.file-card { background: var(--tile); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-color: var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.file-badge { background: #1d6f42; }
.chart-button:hover, .chart-button[aria-pressed="true"] { color: var(--ink); border-color: var(--line-strong); background: var(--fill); }
.site-access { background: var(--warn-soft); }

/* Sheets, menus, toast */
.settings-dialog { background: var(--glass-strong); border-color: var(--glass-border); border-radius: 14px; box-shadow: var(--shadow-lg), inset 0 .5px 0 rgb(255 255 255 / .6); }
.settings-dialog::backdrop { background: rgb(20 20 25 / .22); backdrop-filter: blur(4px); }
.segmented { background: var(--fill); }
.segmented input:checked + span { background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .1), 0 0 0 .5px rgb(0 0 0 / .05); }
.slash-menu { background: var(--glass-strong); border-color: var(--glass-border); }
.slash-item.active, .slash-item:hover { background: var(--fill); }
.slash-item svg, .slash-manage { color: var(--ink-2); }
.toast { background: rgb(28 28 30 / .84); color: #fff; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-radius: 10px; box-shadow: 0 0 0 .5px rgb(255 255 255 / .08), 0 12px 32px -12px rgb(0 0 0 / .45); }
.notice-text { background: var(--fill); border-color: transparent; color: var(--ink-2); }
.temp-password { background: var(--fill); border-color: var(--line); }
.text-button { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.text-button:hover { text-decoration-color: currentColor; }
.switch-row input { accent-color: var(--accent); }

/* Narrow side panel */
@media (max-width: 760px) {
  .sidebar { border-radius: 0 14px 14px 0; background: var(--glass-strong); }
  .chat-header { height: 50px; }
  .chat-scroll { padding-top: 50px; }
  .composer { border-radius: 16px; }
}
@media (max-width: 650px) {
  .auth-main { padding: 48px 16px 24px; }
  .auth-card { padding: 28px 22px 22px; }
}
