/* ═══════════════════════════════════════════════════════════════════════════
   洛奇 LUO7 — unified search + chat UI
   Light warm-paper theme · Syne / Noto Sans SC / JetBrains Mono
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --paper: #f7f5ef;
  --paper-2: #fffdf8;
  --paper-3: #f0ece2;
  --sidebar: #f2efe6;
  --ink: #0f1113;
  --ink-soft: #34393f;
  --ink-muted: #5f656c;
  --ink-faint: #6a6f76;
  --line: #e3ded3;
  --line-strong: #ccc6b8;
  --accent: #2f4bff;
  --accent-deep: #1c2ed0;
  --accent-soft: #e9edff;
  --accent-wash: #f2f4ff;
  --mark-bg: #ffec9f;
  --green: #0c7a4f;
  --green-soft: #e6f4ec;
  --amber: #8c5c00;
  --amber-soft: #fbf1da;
  --red: #b42318;
  --red-soft: #fdecea;
  --user-bubble: #e9edff;
  --code-bg: #14171c;
  --shadow-sm: 0 1px 2px rgba(15, 17, 19, .05);
  --shadow-md: 0 14px 40px -20px rgba(15, 17, 19, .28);
  --shadow-lg: 0 30px 90px -40px rgba(15, 17, 19, .45);
  --radius: 18px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Noto Sans SC", "PingFang SC", -apple-system, BlinkMacSystemFont, "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Syne", "Noto Sans SC", "PingFang SC", sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --topbar-h: 64px;
  --sidebar-w: 292px;
  --maxw: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .03;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p, dl, dd, dt, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; background-clip: content-box; border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-faint); }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 900; padding: 10px 16px; background: var(--ink); color: var(--paper); border-radius: 999px; font-size: 13px; transition: top .2s var(--ease); }
.skip-link:focus { top: 12px; }

/* ── boot ─────────────────────────────────────────────────────────────── */
.boot { position: fixed; inset: 0; z-index: 800; display: grid; place-content: center; gap: 14px; justify-items: center; background: var(--paper); transition: opacity .35s var(--ease), visibility .35s; }
.boot.is-done { opacity: 0; visibility: hidden; }
.boot__mark { width: 54px; height: 54px; border-radius: 16px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 20px; box-shadow: 0 14px 30px -14px rgba(47, 75, 255, .65); }
.boot__text { font-family: var(--mono); font-size: 10px; letter-spacing: .26em; color: var(--ink-faint); text-transform: uppercase; }

/* ── shell / topbar ───────────────────────────────────────────────────── */
.shell { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 400;
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: .02em; box-shadow: 0 4px 12px -5px rgba(47,75,255,.65); }
.brand__name { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.brand__latin { font-family: var(--mono); font-size: 9px; letter-spacing: .2em; color: var(--ink-faint); margin-left: 1px; }
.mainnav { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); }
.mainnav__item { border: 0; background: transparent; color: var(--ink-muted); font-size: 12.5px; padding: 6px 16px; border-radius: 999px; transition: background .18s var(--ease), color .18s var(--ease); }
.mainnav__item:hover { color: var(--ink); }
.mainnav__item.is-active { background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn-login { height: 34px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper-2); font-size: 12.5px; }
.btn-login:hover { border-color: var(--accent); color: var(--accent-deep); }
.user-area { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); font-size: 12px; }
.user-btn:hover { border-color: var(--line-strong); }
.user-btn__avatar { width: 27px; height: 27px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.user-btn__name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn svg { width: 13px; height: 13px; color: var(--ink-faint); }
.usermenu { position: absolute; right: 0; top: calc(100% + 8px); width: 208px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); box-shadow: var(--shadow-lg); z-index: 500; }
.usermenu__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 10px 10px; border-bottom: 1px dashed var(--line); margin-bottom: 5px; }
.usermenu__head strong { font-size: 13px; }
.usermenu__head span { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.usermenu button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 12.5px; color: var(--ink-soft); }
.usermenu button:hover { background: var(--paper-3); color: var(--ink); }
.usermenu__badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--paper-3); color: var(--ink-faint); font-family: var(--mono); font-size: 9px; display: grid; place-items: center; }

/* ── layout ───────────────────────────────────────────────────────────── */
.appmain { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1 1 auto; min-height: 0; }
.view--search { overflow-y: auto; }
.view--chat { display: flex; min-height: 0; height: calc(100dvh - var(--topbar-h)); }

/* ═══════════════════════════════════════════════════════════════════════
   SEARCH
   ═══════════════════════════════════════════════════════════════════════ */
.search-home { max-width: 880px; margin: 0 auto; padding: clamp(54px, 9vh, 112px) 24px 70px; }
.hero { text-align: center; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 9px; letter-spacing: .22em; color: var(--ink-faint); text-transform: uppercase; }
.hero__eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.hero__title { margin-top: 16px; font-family: var(--display); font-size: clamp(40px, 6vw, 68px); font-weight: 800; letter-spacing: -.045em; line-height: 1.04; }
.hero__title span { color: var(--accent); }
.hero__tagline { margin-top: 12px; font-size: clamp(16px, 2vw, 20px); font-weight: 600; letter-spacing: -.01em; }
.hero__sub { margin-top: 6px; color: var(--ink-faint); font-size: 13px; }
.omnibox { display: flex; align-items: center; gap: 8px; margin: 30px auto 0; padding: 9px 10px 9px 18px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper-2); box-shadow: var(--shadow-sm); transition: border-color .18s var(--ease), box-shadow .18s var(--ease); }
.omnibox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,75,255,.09), var(--shadow-md); }
.omnibox__icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--ink-faint); }
.omnibox__input { flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 6px; border: 0; outline: 0; background: transparent; font-size: 15px; }
.omnibox__input::placeholder { color: var(--ink-faint); }
.omnibox__submit { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; transition: background .18s var(--ease), transform .18s var(--ease); }
.omnibox__submit svg { width: 19px; height: 19px; }
.omnibox__submit:hover { background: var(--accent-deep); }
.omnibox__actions { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.ask-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px 0 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink-soft); font-size: 12px; }
.ask-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.ask-btn__mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-size: 9px; font-weight: 800; }
.ask-btn__arrow { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; }
.omnibox__hint { color: var(--ink-faint); font-size: 11px; }
.recent { display: flex; align-items: flex-start; justify-content: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.recent__label { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; color: var(--ink-faint); text-transform: uppercase; padding-top: 7px; }
.recent__list { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.recent-chip { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink-muted); font-size: 11.5px; }
.recent-chip:hover { border-color: var(--line-strong); color: var(--ink); }

.suggest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 52px; }
.suggest-card { text-align: left; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease); }
.suggest-card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.suggest-card__tag { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--accent-deep); text-transform: uppercase; margin-bottom: 5px; }
.suggest-card__text { display: block; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.guest-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 24px auto 0; padding: 12px 14px; border: 1px solid #ecd9ae; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 12px; }
.hero__foot { margin-top: 64px; text-align: center; font-family: var(--mono); font-size: 9px; letter-spacing: .18em; color: var(--ink-faint); text-transform: uppercase; }

/* results */
.results { min-height: 100%; }
.results__bar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 14px; padding: 12px max(22px, calc((100vw - var(--maxw)) / 2)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(12px); }
.results__brand { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.results__brand:hover { text-decoration: none; }
.results__brand .brand__mark { width: 26px; height: 26px; font-size: 10px; border-radius: 8px; }
.results__form { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; max-width: 660px; height: 42px; padding: 4px 4px 4px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper-2); }
.results__form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,75,255,.08); }
.results__form .omnibox__input { height: 32px; font-size: 13.5px; }
.results__form .omnibox__submit { width: 32px; height: 32px; }
.results__form .omnibox__submit svg { width: 16px; height: 16px; }
.ask-inline { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink-muted); font-size: 12px; flex: 0 0 auto; }
.ask-inline:hover { border-color: var(--accent); color: var(--accent-deep); }
.ask-inline .ask-btn__mark { width: 24px; height: 24px; font-size: 9px; }
.results__body { max-width: var(--maxw); margin: 0 auto; padding: 22px 24px 80px; display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 34px; }
.results__main { min-width: 0; }
.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.filter { height: 28px; padding: 0 11px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--ink-muted); font-size: 11.5px; }
.filter:hover { background: var(--paper-3); color: var(--ink); }
.filter.is-active { background: var(--accent-wash); color: var(--accent-deep); border-color: #d9e0ff; font-weight: 600; }
.filters__count { margin-left: auto; font-size: 9.5px; color: var(--ink-faint); }

.aio { margin-top: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, var(--paper-2), #fffef9); overflow: hidden; }
.aio__head { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px dashed var(--line); }
.aio__mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 9.5px; flex: 0 0 auto; }
.aio__titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.aio__title { font-size: 12.5px; font-weight: 600; }
.aio__sub { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; color: var(--ink-faint); }
.aio__status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.spin { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.aio__toggle { border: 0; background: transparent; color: var(--ink-faint); font-size: 13px; padding: 3px 5px; }
.aio__content { padding: 15px 17px 4px; }
.aio__content:empty { display: none; }
.aio__foot { padding: 0 17px 13px; }
.aio__notice { font-size: 10.5px; color: var(--ink-faint); }

.results__list { margin-top: 20px; display: flex; flex-direction: column; gap: 4px; }
.result { padding: 16px 14px 17px; border: 1px solid transparent; border-radius: 12px; transition: background .15s var(--ease), border-color .15s var(--ease); }
.result:hover { background: var(--paper-2); border-color: var(--line); }
.result__site { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--ink-muted); }
.result__favicon { width: 15px; height: 15px; border-radius: 50%; object-fit: cover; background: var(--paper-3); flex: 0 0 auto; }
.result__url { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result__title { display: block; margin-top: 5px; font-size: 17px; line-height: 1.42; font-weight: 500; color: var(--accent-deep); text-decoration: none; }
.result__title:hover { text-decoration: underline; }
.result__title mark, .snippet mark { background: var(--mark-bg); color: inherit; border-radius: 2px; padding: 0 1px; }
.result__snippet { margin-top: 5px; font-size: 12.5px; line-height: 1.7; color: var(--ink-muted); }
.result__meta { display: flex; align-items: center; gap: 10px; margin-top: 7px; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); flex-wrap: wrap; }
.result__preview { border: 0; background: transparent; color: var(--accent-deep); font-family: var(--mono); font-size: 9px; padding: 0; }
.result__preview:hover { text-decoration: underline; }
.results__empty { padding: 40px 0; text-align: center; color: var(--ink-muted); }
.results__empty .muted { font-size: 12px; margin: 4px 0 14px; }
.load-more-wrap { text-align: center; margin-top: 16px; }
.load-more { height: 38px; padding: 0 20px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper-2); font-size: 12px; }
.load-more:hover { border-color: var(--ink-faint); }

.related { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.related__title { font-size: 13px; margin-bottom: 10px; }
.related__list { display: flex; flex-wrap: wrap; gap: 7px; }
.related__chip { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); font-size: 11.5px; color: var(--ink-muted); }
.related__chip:hover { border-color: var(--accent); color: var(--accent-deep); }

.results__rail { display: flex; flex-direction: column; gap: 12px; }
.rail-card { padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); }
.rail-card__label { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--ink-faint); text-transform: uppercase; margin-bottom: 7px; }
.rail-card p { font-size: 11.5px; color: var(--ink-muted); line-height: 1.65; }
.rail-card .btn-primary { margin-top: 10px; }
.rail-card code { font-family: var(--mono); font-size: 10.5px; background: var(--paper-3); padding: 1px 4px; border-radius: 4px; color: var(--ink-soft); }

/* preview drawer */
.preview-backdrop { position: fixed; inset: 0; z-index: 600; background: rgba(15,17,19,.28); backdrop-filter: blur(2px); }
.preview { position: fixed; top: 0; right: 0; bottom: 0; z-index: 610; width: min(620px, 94vw); display: flex; flex-direction: column; background: var(--paper-2); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: drawerIn .28s var(--ease); }
@keyframes drawerIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.preview__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.preview__head > div { min-width: 0; flex: 1; }
.preview__site { font-size: 9px; letter-spacing: .1em; color: var(--ink-faint); text-transform: uppercase; }
.preview__title { font-size: 17px; line-height: 1.4; margin-top: 3px; }
.preview__body { flex: 1 1 auto; overflow-y: auto; padding: 18px 22px 40px; }
.preview__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 11px; }
.icon-btn { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); color: var(--ink-muted); padding: 0; flex: 0 0 auto; }
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }

/* prose / markdown */
.prose { font-size: 13.5px; line-height: 1.75; color: var(--ink-soft); overflow-wrap: anywhere; }
.prose > * + * { margin-top: 10px; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--ink); font-weight: 600; line-height: 1.35; margin-top: 20px; }
.prose h1 { font-size: 20px; } .prose h2 { font-size: 17px; } .prose h3 { font-size: 15px; } .prose h4 { font-size: 13.5px; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0; }
.prose ul, .prose ol { padding-left: 20px; list-style: revert; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--ink-faint); }
.prose blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--line-strong); background: var(--paper-3); border-radius: 0 8px 8px 0; color: var(--ink-muted); }
.prose code { font-family: var(--mono); font-size: 11.5px; background: var(--paper-3); padding: 1px 5px; border-radius: 4px; color: var(--ink-soft); }
.prose pre { margin: 12px 0; padding: 14px 15px; border-radius: 12px; background: var(--code-bg); overflow-x: auto; position: relative; }
.prose pre code { background: transparent; padding: 0; color: #e6e9ef; font-size: 11.5px; line-height: 1.7; }
.code-copy { position: absolute; top: 7px; right: 7px; height: 23px; padding: 0 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 6px; background: rgba(255,255,255,.07); color: #c9ced8; font-family: var(--mono); font-size: 9px; }
.code-copy:hover { background: rgba(255,255,255,.14); color: #fff; }
.prose table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--paper-3); font-weight: 600; }
.prose a { color: var(--accent-deep); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.prose .cite { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; margin: 0 1px; vertical-align: 1px; border-radius: 4px; background: var(--accent-wash); color: var(--accent-deep); font-family: var(--mono); font-size: 9.5px; font-weight: 600; text-decoration: none; }
.prose .cite:hover { background: var(--accent); color: #fff; }
.prose .math-inline { font-family: var(--mono); font-size: .9em; background: var(--paper-3); padding: 1px 4px; border-radius: 4px; }
.prose .math-block { font-family: var(--mono); font-size: 12px; text-align: center; background: var(--paper-3); padding: 9px; border-radius: 8px; }

/* ═══════════════════════════════════════════════════════════════════════
   CHAT
   ═══════════════════════════════════════════════════════════════════════ */
.chat-sidebar { width: var(--sidebar-w); flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0; background: var(--sidebar); border-right: 1px solid var(--line); }
.chat-sidebar__top { padding: 14px 13px 10px; display: flex; flex-direction: column; gap: 9px; }
.new-chat-btn { display: flex; align-items: center; gap: 7px; width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--paper-2); font-size: 12.5px; text-align: left; }
.new-chat-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.new-chat-btn__plus { font-size: 16px; line-height: 1; color: var(--accent); }
.new-chat-btn kbd { margin-left: auto; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.sidebar-close { display: none; border: 0; background: transparent; color: var(--ink-muted); font-size: 16px; }
.conv-search { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; color: var(--ink-faint); }
.conv-search:focus-within { border-color: var(--line-strong); background: var(--paper-2); }
.conv-search svg { width: 14px; height: 14px; flex: 0 0 auto; }
.conv-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.chat-sidebar__list { flex: 1 1 auto; overflow-y: auto; padding: 4px 9px 10px; }
.conv-group { margin-bottom: 14px; }
.conv-group__label { padding: 5px 8px; font-family: var(--mono); font-size: 8.5px; letter-spacing: .13em; color: var(--ink-faint); text-transform: uppercase; }
.conv-item { position: relative; display: flex; align-items: center; gap: 7px; padding: 9px 9px; border-radius: 9px; cursor: pointer; color: var(--ink-soft); }
.conv-item:hover { background: rgba(255,253,248,.7); }
.conv-item.is-active { background: var(--paper-2); box-shadow: var(--shadow-sm); color: var(--ink); }
.conv-item__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); opacity: .45; flex: 0 0 auto; }
.conv-item__dot.deep { background: var(--accent); opacity: .8; }
.conv-item__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.conv-item__actions { display: none; align-items: center; gap: 1px; flex: 0 0 auto; }
.conv-item:hover .conv-item__actions, .conv-item:focus-within .conv-item__actions { display: flex; }
.conv-item__actions button { width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-faint); font-size: 11px; padding: 0; }
.conv-item__actions button:hover { background: var(--paper-3); color: var(--ink); }
.conv-empty { padding: 28px 18px; text-align: center; color: var(--ink-faint); font-size: 11.5px; }
.chat-sidebar__foot { flex: 0 0 auto; padding: 8px 11px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.chat-sidebar__foot button { display: flex; align-items: center; gap: 9px; width: 100%; height: 34px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-muted); font-size: 11.5px; text-align: left; }
.chat-sidebar__foot button:hover { background: rgba(255,253,248,.8); color: var(--ink); }
.foot-ico { width: 16px; text-align: center; color: var(--ink-faint); }
.foot-count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--paper-3); color: var(--ink-faint); font-family: var(--mono); font-size: 9px; display: grid; place-items: center; }
.sidebar-scrim { position: fixed; inset: 0; z-index: 350; background: rgba(15,17,19,.28); }

.chat-main { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.chat-top { height: 54px; flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 92%, transparent); }
.mobile-menu { display: none; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); font-size: 14px; }
.chat-top__title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 500; }
.chat-top__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.chat-top__dot.deep { background: var(--accent); }
#chatTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-top__right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mode-chip, .model-chip { height: 23px; padding: 0 8px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); background: var(--paper-2); }
.mode-chip.deep { border-color: #d5ddff; color: var(--accent-deep); background: var(--accent-wash); }

.chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; position: relative; }
.chat-welcome { max-width: 880px; margin: 0 auto; padding: clamp(34px, 6vh, 72px) 24px 40px; text-align: center; }
.chat-welcome__mark { width: 50px; height: 50px; margin: 0 auto; border-radius: 15px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 18px; box-shadow: 0 14px 30px -14px rgba(47,75,255,.6); }
.chat-welcome__title { margin-top: 18px; font-family: var(--display); font-size: clamp(34px, 4.5vw, 52px); line-height: 1.05; font-weight: 800; letter-spacing: -.045em; }
.chat-welcome__title span { color: var(--accent); }
.chat-welcome__tagline { margin-top: 9px; font-size: 15px; font-weight: 600; }
.chat-welcome__sub { margin-top: 4px; font-size: 12px; color: var(--ink-faint); }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 26px auto 0; max-width: 640px; }
.mode-card { text-align: left; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper-2); display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; }
.mode-card:hover { border-color: var(--line-strong); }
.mode-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,75,255,.07); }
.mode-card__icon { grid-row: span 2; font-size: 16px; }
.mode-card__name { font-size: 12.5px; font-weight: 600; }
.mode-card__desc { font-size: 10.5px; color: var(--ink-faint); }
.chat-suggests { max-width: 820px; margin: 28px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; text-align: left; }
.chat-suggests button { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); display: flex; flex-direction: column; gap: 4px; }
.chat-suggests button:hover { border-color: var(--line-strong); }
.chat-suggest__tag { font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em; color: var(--accent-deep); text-transform: uppercase; }
.chat-suggests button > span:last-child { font-size: 12px; color: var(--ink-muted); line-height: 1.55; }

.messages { max-width: 860px; margin: 0 auto; padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 26px; }
.msg { display: flex; gap: 11px; }
.msg--user { justify-content: flex-end; }
.msg__avatar { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-size: 9.5px; font-weight: 800; flex: 0 0 auto; margin-top: 2px; }
.msg--user .msg__avatar { order: 2; background: var(--paper-3); color: var(--ink-muted); font-family: var(--sans); font-size: 10px; border-radius: 50%; }
.msg__body { min-width: 0; max-width: calc(100% - 42px); flex: 1 1 auto; }
.msg--user .msg__body { flex: 0 1 auto; display: flex; justify-content: flex-end; }
.msg--user .msg__bubble { background: var(--user-bubble); border-radius: 16px 16px 4px 16px; padding: 10px 15px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 620px; }
.msg__head { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; flex-wrap: wrap; }
.msg__name { font-size: 12px; font-weight: 600; }
.msg__mode { height: 19px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; font-family: var(--mono); font-size: 8.5px; color: var(--ink-faint); display: inline-flex; align-items: center; background: var(--paper-2); }
.msg__mode.deep { border-color: #d5ddff; color: var(--accent-deep); background: var(--accent-wash); }
.msg__mode.search { border-color: #cfeadd; color: var(--green); background: var(--green-soft); }
.msg__content { font-size: 14px; line-height: 1.78; color: var(--ink-soft); }
.msg__content.is-streaming::after { content: ""; display: inline-block; width: 6px; height: 14px; margin-left: 3px; background: var(--accent); vertical-align: -2px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg__pending { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--ink-faint); font-size: 10.5px; }
.msg__pending .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faint); animation: dotPulse 1.2s infinite; }
.msg__pending .dot:nth-child(2) { animation-delay: .15s; } .msg__pending .dot:nth-child(3) { animation-delay: .3s; }
@keyframes dotPulse { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.msg__pending span:last-child { margin-left: 4px; }
.msg__actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; color: var(--ink-faint); font-size: 10px; }
.msg__action { display: inline-flex; align-items: center; gap: 3px; border: 0; background: transparent; color: var(--ink-faint); font-size: 10px; padding: 2px 0; }
.msg__action:hover { color: var(--ink); }
.msg__action svg { width: 12px; height: 12px; }
.msg__meta { margin-left: auto; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.msg__error { margin-top: 8px; padding: 8px 11px; border: 1px solid #f2c9c3; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg__error button { border: 0; background: transparent; color: var(--red); font-size: 11px; text-decoration: underline; padding: 0; }
.msg__stopped { color: var(--ink-faint); font-size: 12px; font-style: italic; }

.reasoning { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper-3); overflow: hidden; }
.reasoning__head { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 11px; border: 0; background: transparent; color: var(--ink-muted); font-size: 11px; text-align: left; }
.reasoning__head svg { width: 12px; height: 12px; color: var(--ink-faint); transition: transform .2s var(--ease); }
.reasoning.is-open .reasoning__head svg { transform: rotate(180deg); }
.reasoning__label { font-weight: 500; }
.reasoning__time { margin-left: auto; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.reasoning__body { display: none; max-height: 340px; overflow-y: auto; padding: 0 12px 10px; border-top: 1px dashed var(--line); }
.reasoning.is-open .reasoning__body { display: block; }
.reasoning__text { white-space: pre-wrap; word-break: break-word; padding-top: 9px; font-size: 11.5px; line-height: 1.75; color: var(--ink-muted); }
.reasoning__spinner { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: 0 0 auto; }

.search-status { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 11px; color: var(--ink-faint); }
.search-status.is-error { color: var(--amber); }
.search-status__spinner { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.search-status.is-error .search-status__spinner { display: none; }
.sources-card { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper-2); overflow: hidden; }
.sources-card__head { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 11px; border: 0; background: transparent; text-align: left; font-size: 11px; color: var(--ink-muted); }
.sources-card__head:hover { background: var(--paper-3); }
.sources-card__globe { width: 13px; height: 13px; color: var(--accent); flex: 0 0 auto; }
.sources-card__label { font-weight: 500; color: var(--ink-soft); }
.sources-card__count { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.sources-card__query { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.sources-card__chev { margin-left: auto; width: 12px; height: 12px; color: var(--ink-faint); transition: transform .2s var(--ease); }
.sources-card.is-open .sources-card__chev { transform: rotate(180deg); }
.sources-card__list { display: none; border-top: 1px dashed var(--line); }
.sources-card.is-open .sources-card__list { display: block; }
.source-item { display: flex; gap: 8px; padding: 8px 11px; border-top: 1px dashed var(--line); }
.source-item:first-child { border-top: 0; }
.source-item__index { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; border-radius: 4px; background: var(--accent-wash); color: var(--accent-deep); font-family: var(--mono); font-size: 9px; font-weight: 600; display: grid; place-items: center; }
.source-item__body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.source-item__title { font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.source-item__title:hover { color: var(--accent-deep); }
.source-item__meta { font-family: var(--mono); font-size: 8.5px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item.is-cited { animation: sourceFlash 1.8s var(--ease); }
@keyframes sourceFlash { 0% { background: var(--accent-wash); } 100% { background: transparent; } }
.scroll-bottom { position: sticky; bottom: 16px; left: 50%; transform: translateX(-50%); height: 30px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper-2); color: var(--ink-muted); font-size: 10.5px; box-shadow: var(--shadow-sm); }

/* composer */
.composer-wrap { flex: 0 0 auto; padding: 8px max(18px, calc((100% - 860px) / 2)) 12px; background: var(--paper); }
.memory-hint { display: flex; align-items: center; gap: 7px; margin: 0 auto 7px; max-width: 860px; font-size: 10.5px; color: var(--ink-faint); }
.memory-hint__ico { color: var(--accent); }
.memory-hint button { border: 0; background: transparent; color: var(--ink-faint); font-size: 10.5px; text-decoration: underline; padding: 0; }
.composer { border: 1px solid var(--line-strong); border-radius: 16px; background: var(--paper-2); box-shadow: var(--shadow-sm); padding: 10px 10px 7px 15px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,75,255,.07); }
.composer textarea { width: 100%; min-height: 26px; max-height: 200px; border: 0; outline: 0; resize: none; background: transparent; font-size: 14px; line-height: 1.6; color: var(--ink); }
.composer textarea::placeholder { color: var(--ink-faint); }
.composer__bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mode-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-3); flex: 0 0 auto; }
.mode-toggle__btn { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-muted); font-size: 10.5px; }
.mode-toggle__btn.is-active { background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-sm); }
.mode-toggle__btn:disabled { opacity: .55; cursor: not-allowed; }
.search-toggle { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink-muted); font-size: 10.5px; flex: 0 0 auto; }
.search-toggle svg { width: 14px; height: 14px; }
.search-toggle[aria-pressed="true"] { background: var(--accent-wash); border-color: #c9d2ff; color: var(--accent-deep); }
.search-toggle:disabled { opacity: .5; cursor: not-allowed; }
.composer__count { margin-left: auto; font-size: 9px; color: var(--ink-faint); }
.composer__hint { font-size: 10px; color: var(--ink-faint); }
.send-btn { width: 34px; height: 34px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.send-btn svg { width: 17px; height: 17px; }
.send-btn:hover { background: var(--accent-deep); }
.stop-btn { width: 34px; height: 34px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.stop-btn span { width: 9px; height: 9px; background: #fff; border-radius: 1px; }
.composer__foot { margin: 7px 0 0; text-align: center; font-size: 9.5px; color: var(--ink-faint); }

/* ═══════════════════════════════════════════════════════════════════════
   MODALS / FORMS / TOAST
   ═══════════════════════════════════════════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 700; display: grid; place-items: center; padding: 20px; background: rgba(15,17,19,.36); backdrop-filter: blur(3px); overflow-y: auto; }
.modal__dialog { position: relative; width: min(480px, 100%); max-height: min(86vh, 900px); overflow-y: auto; padding: 26px 26px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper-2); box-shadow: var(--shadow-lg); animation: modalIn .22s var(--ease); }
@keyframes modalIn { from { transform: translateY(8px) scale(.99); opacity: .7; } to { transform: none; opacity: 1; } }
.modal__dialog--wide { width: min(700px, 100%); }
.modal__dialog--sm { width: min(400px, 100%); }
.modal__dialog--admin { width: min(820px, 100%); }
.modal__close { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-faint); font-size: 13px; }
.modal__close:hover { border-color: var(--line); color: var(--ink); }
.modal__title { font-size: 21px; line-height: 1.3; letter-spacing: -.02em; }
.modal__sub { margin-top: 6px; color: var(--ink-faint); font-size: 12px; line-height: 1.6; }
.eyebrow { display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: .18em; color: var(--ink-faint); text-transform: uppercase; margin-bottom: 7px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.btn-primary, .btn-ghost, .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 15px; border-radius: 9px; font-size: 12px; border: 1px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { border-color: var(--line-strong); background: var(--paper-2); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink-faint); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #8f1d14; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 11px; border-radius: 7px; }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 11px; font-weight: 500; color: var(--ink-muted); }
.field__input { height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper-2); font-size: 12.5px; color: var(--ink); outline: 0; width: 100%; }
.field__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,75,255,.08); }
.field__input::placeholder { color: var(--ink-faint); }
.field__hint { font-size: 9.5px; color: var(--ink-faint); }
.form-error { margin-top: 9px; padding: 8px 10px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 11px; }
.form-ok { color: var(--green); font-size: 11px; }
.muted { font-size: 10.5px; color: var(--ink-faint); }

.auth__brand { display: flex; align-items: center; gap: 7px; margin-bottom: 17px; font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.auth__brand .brand__mark { width: 24px; height: 24px; border-radius: 7px; font-size: 9px; }
.auth-tabs { display: flex; gap: 4px; margin: 18px 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-3); }
.auth-tabs button { flex: 1; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); font-size: 11.5px; }
.auth-tabs button.is-active { background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth__foot { margin-top: 16px; font-size: 10.5px; line-height: 1.6; color: var(--ink-faint); }
.memory-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.memory-switch-row strong { display: block; font-size: 12px; font-weight: 500; }
.memory-switch-row span { display: block; font-size: 10px; color: var(--ink-faint); }
.switch { width: 38px; height: 22px; flex: 0 0 auto; border: 0; border-radius: 999px; background: var(--line-strong); padding: 2px; transition: background .18s var(--ease); }
.switch span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(16px); }

.memory-add { display: grid; grid-template-columns: 1fr 120px auto; gap: 7px; margin-top: 13px; }
.memory-cat { padding: 0 8px; }
.memory-list { margin-top: 10px; }
.memory-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.memory-item__main { flex: 1; min-width: 0; }
.memory-item__meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.memory-cat { height: 19px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper-3); color: var(--ink-muted); font-family: var(--mono); font-size: 8.5px; display: inline-flex; align-items: center; }
.memory-cat.preference { background: var(--amber-soft); color: var(--amber); border-color: #ecd9ae; }
.memory-cat.project { background: var(--green-soft); color: var(--green); border-color: #cfeadd; }
.memory-item__time { font-family: var(--mono); font-size: 8.5px; color: var(--ink-faint); }
.memory-item__text { margin-top: 4px; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
.memory-item__actions { display: flex; gap: 1px; flex: 0 0 auto; }
.memory-item__actions button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-faint); font-size: 11px; padding: 0; }
.memory-item__actions button:hover { background: var(--paper-3); color: var(--ink); }
.memory-item form { display: flex; gap: 5px; margin-top: 5px; }
.mini-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper-2); font-size: 11.5px; }
.memory-empty { padding: 24px 0; text-align: center; font-size: 11.5px; color: var(--ink-faint); }
.memory-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 10px; color: var(--ink-faint); }
.settings-account { display: flex; align-items: center; gap: 11px; margin-top: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.settings-account > div { min-width: 0; }
.avatar-lg { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; line-height: 1; padding: 0; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .01em; text-align: center; }
.settings-account > div strong { display: block; font-size: 13px; }
.settings-account > div span { display: block; font-size: 10px; color: var(--ink-faint); }
.settings-group { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.segmented { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-3); }
.segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); font-size: 11px; }
.segmented button.is-active { background: var(--paper-2); color: var(--ink); box-shadow: var(--shadow-sm); }
.settings-actions { display: flex; gap: 8px; margin-top: 18px; }

/* admin */
.admin-tabs { display: flex; gap: 3px; margin: 18px 0 16px; padding-bottom: 9px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tabs button { height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink-muted); font-size: 11.5px; white-space: nowrap; }
.admin-tabs button.is-active { background: var(--accent-wash); border-color: #d9e0ff; color: var(--accent-deep); font-weight: 500; }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.admin-stat { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); }
.admin-stat__label { display: block; font-size: 9.5px; color: var(--ink-faint); }
.admin-stat__value { display: block; margin-top: 2px; font-family: var(--mono); font-size: 18px; font-weight: 600; }
.admin-note { margin-top: 13px; font-size: 10.5px; color: var(--ink-faint); }
.admin-users { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.admin-user { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); }
.admin-user__avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--paper-3); color: var(--ink-muted); display: grid; place-items: center; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.admin-user__info { flex: 1; min-width: 0; }
.admin-user__name { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.admin-user__role { font-family: var(--mono); font-size: 8px; padding: 1px 4px; border-radius: 4px; background: var(--paper-3); color: var(--ink-faint); }
.admin-user__role.admin { background: var(--accent-wash); color: var(--accent-deep); }
.admin-user__meta { display: block; font-size: 9px; color: var(--ink-faint); }
.admin-user__actions { display: flex; gap: 2px; flex: 0 0 auto; }
.admin-user__actions button { height: 24px; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper-2); color: var(--ink-muted); font-size: 9.5px; }
.admin-user__actions button:hover { border-color: var(--ink-faint); color: var(--ink); }
.admin-create { display: grid; grid-template-columns: 1fr 1fr 110px auto; gap: 6px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-grid__full { grid-column: 1 / -1; }
.admin-actions { display: flex; align-items: center; gap: 9px; margin-top: 14px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 1000; transform: translateX(-50%); max-width: min(90vw, 480px); padding: 9px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 11.5px; box-shadow: var(--shadow-lg); animation: toastIn .2s var(--ease); }
@keyframes toastIn { from { transform: translate(-50%, 6px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* responsive */
@media (max-width: 1120px) {
  .results__body { grid-template-columns: minmax(0, 1fr) 250px; gap: 24px; }
}
@media (max-width: 900px) {
  .results__rail { display: none; }
  .results__body { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand__latin { display: none; }
  .chat-sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 360; transform: translateX(-100%); transition: transform .24s var(--ease); box-shadow: var(--shadow-lg); }
  .chat-sidebar.is-open { transform: none; }
  .sidebar-close { display: block; position: absolute; top: 12px; right: 10px; }
  .mobile-menu { display: grid; place-items: center; }
  .chat-top { padding: 0 14px; }
  .composer-wrap { padding-left: 14px; padding-right: 14px; }
  .composer__hint { display: none; }
}
@media (max-width: 680px) {
  .hero { padding-top: 14px; }
  .suggest-grid { grid-template-columns: 1fr; margin-top: 32px; }
  .search-home { padding-top: 42px; }
  .omnibox { padding-left: 13px; }
  .omnibox__actions { flex-direction: column; gap: 7px; }
  .results__bar { padding: 9px 12px; gap: 8px; }
  .results__brand span:last-child { display: none; }
  .ask-inline { display: none; }
  .results__body { padding: 14px 14px 60px; }
  .result { padding: 13px 6px; }
  .result__title { font-size: 15.5px; }
  .chat-welcome { padding-left: 16px; padding-right: 16px; }
  .chat-suggests { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  .messages { padding: 16px 14px 30px; gap: 20px; }
  .msg__avatar { width: 26px; height: 26px; font-size: 8.5px; }
  .msg__body { max-width: calc(100% - 36px); }
  .msg__content { font-size: 13px; }
  .msg--user .msg__bubble { font-size: 13px; padding: 9px 12px; }
  .composer__bar { flex-wrap: wrap; row-gap: 6px; }
  .composer__count { display: none; }
  .composer__hint { display: none; }
  .search-toggle span { display: none; }
  .composer__foot { font-size: 8.5px; }
  .admin-create { grid-template-columns: 1fr 1fr; }
  .admin-create .btn-primary { grid-column: 1 / -1; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .memory-add { grid-template-columns: 1fr; }
  .topbar { height: 56px; }
  :root { --topbar-h: 56px; }
  .mainnav__item { padding: 6px 11px; font-size: 11.5px; }
  .user-btn__name { display: none; }
  .user-btn { padding-right: 6px; }
  .brand__name { font-size: 15px; }
}
@media (max-width: 400px) {
  .brand__mark { width: 27px; height: 27px; font-size: 11px; }
  .brand__name { font-size: 14px; }
  .mainnav__item { padding: 5px 9px; }
  .modal { padding: 10px; }
  .modal__dialog { padding: 20px 16px; }
  .result__meta { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
