/* Gudeli UI. Every colour is a token below: change the brand in one place. */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Yellow leaning green */
  --accent: #cfe23a;
  --accent-hover: #c3d82b;
  --accent-ink: #1d2108;      /* text on top of --accent */
  --accent-soft: #eff5c4;     /* tinted surfaces */
  --accent-text: #56640f;     /* accent used as text/icon on --bg */

  --bg: #fbfbf6;
  --surface: #ffffff;
  --sidebar: #f3f4ea;
  --hover: #e9ecd9;
  --border: #e3e6d3;
  --border-strong: #cdd2b6;
  --text: #1b1f10;
  --muted: #697058;
  --danger: #b3382c;
  --danger-soft: #fbe9e6;
  --warn: #9a6b00;
  --shadow: 0 1px 2px rgb(27 31 16 / 6%), 0 8px 28px rgb(27 31 16 / 7%);

  --radius: 14px;
  --sidebar-w: 272px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #d4e83c;
  --accent-hover: #dff04f;
  --accent-ink: #181c06;
  --accent-soft: #2b3212;
  --accent-text: #d4e83c;
  --bg: #12140c;
  --surface: #1b1e12;
  --sidebar: #0e100a;
  --hover: #222616;
  --border: #2a2f1a;
  --border-strong: #3a4126;
  --text: #eceee0;
  --muted: #9aa085;
  --danger: #ff8a7a;
  --danger-soft: #3a1d19;
  --warn: #e3b341;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 28px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #d4e83c;
    --accent-hover: #dff04f;
    --accent-ink: #181c06;
    --accent-soft: #2b3212;
    --accent-text: #d4e83c;
    --bg: #12140c;
    --surface: #1b1e12;
    --sidebar: #0e100a;
    --hover: #222616;
    --border: #2a2f1a;
    --border-strong: #3a4126;
    --text: #eceee0;
    --muted: #9aa085;
    --danger: #ff8a7a;
    --danger-soft: #3a1d19;
    --warn: #e3b341;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 28px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
#app { height: 100%; }

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon svg path[fill] { stroke: none; } /* brand-coloured icons (Google) are filled, not stroked */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--text); font-weight: 600; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline { border-color: var(--border-strong); background: var(--surface); }
.btn-outline:hover:not(:disabled) { background: var(--hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-text); font-weight: 600; }
.btn-link:hover:not(:disabled) { text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 8px; display: block; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.input:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.input.code { text-align: center; font: 600 26px/1 var(--font-mono); letter-spacing: .5em; padding-left: .5em; min-height: 56px; direction: ltr; }
.alert { padding: 10px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--accent-soft); color: var(--text); }
.hint { font-size: 13px; color: var(--muted); }

/* Auth modal */
dialog.auth-modal { position: relative; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 36px 32px 30px; border-radius: 26px; }
dialog.auth-modal::backdrop { background: rgb(0 0 0 / 62%); backdrop-filter: blur(4px); }
.modal-close { position: absolute; top: 14px; inset-inline-end: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text); display: grid; place-items: center; }
.modal-close:hover { background: var(--hover); }
.auth-body h1 { font: 500 28px/1.2 var(--font-serif); text-align: center; margin: 0 28px 10px; }
.auth-body .sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-body .alert, .auth-body .pending-request { margin-bottom: 16px; }
.auth-stack { display: grid; gap: 12px; }
.pill-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 52px;
  padding: 0 22px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); font-size: 16px; font-weight: 500; transition: background .12s, opacity .12s;
}
.pill-btn:hover:not(:disabled) { background: var(--hover); text-decoration: none; }
.pill-btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.pill-btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.pill-btn:disabled { opacity: .6; cursor: not-allowed; }
.auth-modal .input { border-radius: 999px; min-height: 52px; padding: 0 22px; font-size: 16px; background: var(--bg); }
.auth-modal .input.code { font-size: 26px; padding-left: .5em; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 13px; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 14px; }
.form-hint { margin: -2px 6px 2px; text-align: center; }
.verify-row { margin-top: 18px; }
.pending-request { padding: 10px 14px; border-inline-start: 3px solid var(--accent); background: var(--accent-soft); border-start-end-radius: 10px; border-end-end-radius: 10px; font-size: 14px; }
.pending-request b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.code-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 14px; color: var(--muted); }

/* Landing */
.landing { min-height: 100%; display: flex; flex-direction: column; }
.guest-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.guest-left { align-items: center; gap: 8px; }
.mobile-only { display: none; }
.landing-actions { display: flex; gap: 8px; align-items: center; margin-inline-start: auto; }
.landing-main { flex: 1; display: grid; place-items: center; padding: 24px 16px 80px; }
.landing-foot { text-align: center; padding: 20px; color: var(--muted); font-size: 13px; }

/* Home / prompt box */
.hero { width: 100%; max-width: 720px; text-align: center; }
.hero-title { font: 500 clamp(30px, 5vw, 42px)/1.15 var(--font-serif); letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.hero-title img { width: 40px; height: 40px; border-radius: 11px; }
.hero-sub { color: var(--muted); font-size: 17px; margin-bottom: 28px; }
.promptbox {
  text-align: start; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px;
  padding-block: 14px 10px; padding-inline: 18px 14px; box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s;
}
.promptbox:focus-within { border-color: var(--accent-text); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
.promptbox textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; min-height: 52px; max-height: 240px; padding: 4px 0; line-height: 1.5; }
.promptbox textarea::placeholder { color: var(--muted); }
.promptbox-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.send-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; flex: none; }
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 8px 16px; font-size: 14px; color: var(--text); }
.chip:hover { background: var(--accent-soft); border-color: var(--accent-text); }
.how { margin-top: 30px; color: var(--muted); font-size: 14px; }

/* App shell */
.shell { display: grid; grid-template-columns: auto 1fr; height: 100%; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; transition: width .18s ease; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding-block: 14px 6px; padding-inline: 18px 12px; min-height: 58px; }
.side-nav { display: grid; gap: 2px; padding: 4px 8px 6px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 15px; font-weight: 500; text-align: start; cursor: pointer; }
.nav-item:hover { background: var(--hover); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; flex: none; }
.nav-icon .icon { width: 22px; height: 22px; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-trailing { color: var(--muted); display: inline-flex; }
.nav-trailing .icon { width: 18px; height: 18px; }
.side-label { padding: 16px 20px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.side-section { padding: 0 8px; }
.side-toggle { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.side-toggle:hover { color: var(--text); }
.side-toggle .icon { width: 10px; height: 10px; transition: transform .12s ease; }
.side-section.open .side-toggle .icon { transform: rotate(90deg); }
.side-body { display: grid; gap: 2px; align-content: start; }
.side-body[hidden] { display: none; }
.side-empty { padding: 8px 12px; color: var(--muted); font-size: 14px; }
.a-item { display: flex; align-items: center; border-radius: 10px; min-width: 0; }
.a-item:hover { background: var(--hover); }
.a-item.active { background: var(--accent-soft); }
.a-link { flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-width: 0; color: var(--text); border-radius: 10px; }
.a-link:hover { text-decoration: none; }
.avatar { width: 28px; height: 28px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; position: relative; }
.avatar.xl { width: 56px; height: 56px; font-size: 22px; }
.avatar.lg { width: 36px; height: 36px; font-size: 15px; border-radius: 11px; }
.avatar.user { background: var(--hover); color: var(--text); border-radius: 50%; overflow: hidden; }
.avatar.brand { background: transparent; overflow: hidden; }
.msg.user .avatar { margin-top: 2px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.a-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.a-agents { list-style: none; margin: 2px 0 6px 22px; padding: 0 0 0 8px; display: grid; gap: 1px; border-inline-start: 1px solid var(--border); }
.agent { width: 100%; display: grid; gap: 1px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.agent:hover, .agent:focus-visible { background: var(--hover); outline: none; }
.agent-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.agent-about { font-size: 12px; line-height: 1.35; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.a-more { width: 30px; height: 30px; margin-inline-end: 4px; opacity: 0; }
.a-item:hover .a-more, .a-item:focus-within .a-more, .a-item.menu-open .a-more, .list-row:hover .a-more, .list-row:focus-within .a-more, .list-row.menu-open .a-more { opacity: 1; }
.a-item.menu-open { background: var(--hover); }
@media (hover: none) { .a-more { opacity: .7; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); flex: none; }
.dot.provisioning, .dot.working { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot.failed { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }
.suggest { padding: 0 8px 4px; }
.suggest .side-label { padding-inline-start: 12px; }
.s-list { display: grid; gap: 2px; }
.s-item { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.s-item:hover:not(:disabled) { background: var(--hover); text-decoration: none; }
.s-item:disabled { cursor: progress; opacity: .7; }
.s-item > .icon, .s-item > .spinner { color: var(--muted); flex: none; }
.s-item > .icon { width: 16px; height: 16px; }
.s-item:hover:not(:disabled) > .icon { color: var(--accent-text); }
.s-text { flex: 1; min-width: 0; display: grid; }
.s-reason { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot { position: relative; margin-top: auto; border-top: 1px solid var(--border); padding: 8px; }
.guest-promo { padding: 14px 8px 8px; }
.guest-promo h3 { font-size: 16px; margin-bottom: 6px; }
.guest-promo p { color: var(--muted); font-size: 14px; line-height: 1.45; margin-bottom: 14px; }
.guest-promo .promo-alt { font-size: 13px; text-align: center; margin: 12px 0 2px; }
.me-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; text-align: start; }
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--hover); }
.me-btn > .icon { color: var(--muted); width: 18px; height: 18px; }
.me-text { flex: 1; min-width: 0; display: grid; }
.me-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Profile menu */
.profile-menu { position: absolute; inset-inline: 8px; bottom: calc(100% + 6px); z-index: 40; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; max-height: calc(100dvh - 120px); overflow-y: auto; }
.menu-title { padding: 10px 12px 8px; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 15px; text-align: start; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item > .icon { color: var(--muted); }
.menu-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
.menu-trailing { color: var(--muted); display: inline-flex; }
.menu-trailing .icon { width: 18px; height: 18px; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 6px; }
.menu-item.danger, .menu-item.danger > .icon { color: var(--danger); }
.ctx-menu { position: fixed; z-index: 60; min-width: 190px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topbar-mobile { display: none; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.scrim { display: none; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.home { flex: 1; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px 64px; }

/* Collapsed sidebar: a narrow icon rail (desktop; on phones the sidebar is a drawer) */
@media (min-width: 821px) {
  .sidebar.collapsed { width: 64px; }
  .sidebar.collapsed .sidebar-head { flex-direction: column; justify-content: center; gap: 6px; padding: 12px 0 6px; }
  .sidebar.collapsed .brand-name, .sidebar.collapsed .nav-label, .sidebar.collapsed .side-label, .sidebar.collapsed .side-scroll,
  .sidebar.collapsed .me-text, .sidebar.collapsed .me-btn > .icon,
  .sidebar.collapsed .guest-promo, .sidebar.collapsed .a-agents, .sidebar.collapsed .nav-trailing { display: none; }
  .sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
  .sidebar.collapsed .me-btn { justify-content: center; padding: 8px 0; }
  .sidebar.collapsed .profile-menu { inset-inline-end: auto; width: 272px; }
}

/* Assistants page */
.page-scroll { flex: 1; overflow-y: auto; padding: 28px 20px 64px; }
.page { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font: 500 30px/1.2 var(--font-serif); }
.search { position: relative; margin-bottom: 14px; }
.search > .icon { position: absolute; inset-inline-start: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-inline-start: 46px; border-radius: 999px; min-height: 48px; }
.list-meta { color: var(--muted); font-size: 14px; margin: 0 4px 10px; }
.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row:hover, .list-row.menu-open { background: var(--hover); }
.list-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding-block: 14px; padding-inline: 18px 8px; color: var(--text); }
.list-link:hover { text-decoration: none; }
.list-text { min-width: 0; display: grid; }
.list-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-pick { width: 100%; text-align: start; border: 0; background: none; color: var(--text); cursor: pointer; }
.list-pick:disabled { cursor: default; }
.list-pick:hover:not(:disabled) { background: var(--hover); }
.list-end { padding-inline-end: 18px; color: var(--muted); display: inline-flex; }

/* New assistant: a card per category, closed until opened. The preview floats over it (it can't sit
   inside the card, which clips), so .pick-group is the positioning parent. */
.pick-group { position: relative; margin-top: 14px; }
.pick-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 18px; border: 0; background: none; color: var(--text); text-align: start; }
.pick-head:hover { background: var(--hover); }
.pick-head:focus-visible { outline-offset: -3px; }
.pick-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pick-name { font-size: 15px; }
.pick-blurb { color: var(--muted); font-size: 13px; line-height: 1.4; }
.pick-end { flex: none; display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.pick-end > .icon { transition: transform .2s ease; }
.pick-hint { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 600; }
.pick-hint .icon { width: 11px; height: 11px; }
@media (hover: none), (max-width: 560px) { .pick-hint { display: none; } } /* nothing to hover on a touch screen; no room on a narrow one */
.page .pick-group.open .pick-end > .icon[data-icon="chevronRight"] { transform: rotate(90deg); }
.pick-group.open .pick-head { border-bottom: 1px solid var(--border); }
.pick-body { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .24s ease, visibility 0s .24s; }
.pick-group.open .pick-body { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .24s ease; }
.pick-body > div { min-height: 0; overflow: hidden; }

.pick-demo {
  position: absolute; z-index: 6; inset-inline-end: 18px; width: min(420px, calc(100% - 36px)); padding: 10px 10px 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 22px; box-shadow: var(--shadow), 0 22px 56px rgb(0 0 0 / 18%);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.97); transform-origin: top; pointer-events: none;
  transition: opacity .16s ease, transform .16s ease, visibility 0s .16s;
}
.pick-demo.above { transform-origin: bottom; }
.pick-demo.show { opacity: 1; visibility: visible; transform: none; transition: opacity .18s ease, transform .18s ease; }
.demo-caption { text-align: center; color: var(--muted); font-size: 12px; padding: 6px 0 2px; }
.demo-screen { position: relative; display: flex; flex-direction: column; height: 300px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); border-radius: 15px; }
.demo-screen .chat-head { padding: 10px 14px; }
.demo-screen .chat-head h2 { font-size: 14px; }
.demo-screen .status { font-size: 12px; }
.demo-chat { flex: 1; min-height: 0; overflow: hidden; display: grid; align-content: start; gap: 12px; padding: 14px 14px 6px; font-size: 13.5px; line-height: 1.5; transition: opacity .5s ease; }
.demo-chat .msg { gap: 8px; }
.demo-chat .avatar { width: 24px; height: 24px; border-radius: 8px; font-size: 11px; }
.demo-chat .avatar.user { border-radius: 50%; }
.demo-chat .bubble { padding: 7px 13px; border-radius: 16px; border-end-end-radius: 5px; }
.demo-chat .body p { margin: 0; }
.demo-chat .thinking { padding: 3px 0; }
.demo-in { animation: demo-in .3s ease both; }
@keyframes demo-in { from { opacity: 0; transform: translateY(8px); } }
.demo-receipt { display: inline-flex; align-items: center; gap: 7px; margin-block-start: 8px; margin-inline-end: 6px; padding: 3px 11px 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 600; }
.demo-receipt .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.demo-box { display: flex; align-items: center; gap: 8px; margin: 0 12px 12px; padding: 5px 5px 5px 14px; border-radius: 16px; box-shadow: none; transition: opacity .5s ease; }
.demo-input { flex: 1; min-width: 0; position: relative; font-size: 13.5px; line-height: 24px; overflow-wrap: anywhere; }
.demo-input::after { content: ""; display: inline-block; width: 1.5px; height: 15px; margin-inline-start: 1px; vertical-align: -2px; background: var(--text); animation: demo-caret 1s steps(1) infinite; }
@keyframes demo-caret { 50% { opacity: 0; } }
.demo-placeholder { position: absolute; inset-inline-start: 0; color: var(--muted); white-space: nowrap; }
.demo-box .send-btn { width: 32px; height: 32px; border-radius: 10px; transition: opacity .2s; }
.demo-box .send-btn.off { opacity: .4; }
.demo-progress { position: absolute; inset-inline: 0; bottom: 0; height: 2px; background: var(--border); }
.demo-progress i { display: block; height: 100%; width: 100%; background: var(--accent-text); transform-origin: left; animation: demo-progress 10s linear forwards; }
:root[dir="rtl"] .demo-progress i { transform-origin: right; }
@keyframes demo-progress { from { transform: scaleX(0); } }
.demo-screen.fading .demo-chat, .demo-screen.fading .demo-box { opacity: 0; }
.list-empty { text-align: center; color: var(--muted); padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.list-empty p { margin-bottom: 8px; }

/* Chat */
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.chat-head .title { min-width: 0; flex: 1; }
.chat-head h2 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 16px 8px; }
.chat-col { max-width: 760px; margin: 0 auto; display: grid; gap: 22px; }
.messages { display: contents; }
.request-card { border-inline-start: 3px solid var(--accent); background: var(--accent-soft); border-start-end-radius: 12px; border-end-end-radius: 12px; padding: 12px 16px; }
.request-card b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.request-card p { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: 14px; }
.timeline li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.timeline li.running, .timeline li.done { color: var(--text); }
.timeline .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.timeline .done .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.timeline .done .mark .icon { width: 14px; height: 14px; stroke-width: 3; }
.timeline .running .mark { border-color: var(--accent-text); color: var(--accent-text); border-width: 0; }
.timeline .skipped { opacity: .55; text-decoration: line-through; }
.timeline .failed { color: var(--danger); }
.timeline .failed .mark { border-color: var(--danger); }
.timeline .detail { margin-inline-start: auto; font-size: 13px; color: var(--muted); }
.retry-row { display: flex; align-items: center; gap: 12px; }

.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 85%; background: var(--accent-soft); border-radius: 18px; border-end-end-radius: 6px; padding: 10px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant .body { min-width: 0; flex: 1; padding-top: 2px; overflow-wrap: anywhere; }
.msg-error { color: var(--danger); font-size: 14px; }
.msg-soft { color: var(--muted); font-size: 14px; }
.thinking { display: inline-flex; padding: 4px 0; color: var(--muted); }
.thinking .dots { display: inline-flex; }
.thinking .dots i { font-style: normal; opacity: 0; animation: 1.6s infinite; }
.thinking .dots i:nth-child(1) { animation-name: dot-1; }
.thinking .dots i:nth-child(2) { animation-name: dot-2; }
.thinking .dots i:nth-child(3) { animation-name: dot-3; }
/* One dot more every quarter, then all gone at once: ". .. ..." */
@keyframes dot-1 { 0%, 24% { opacity: 0; } 25%, 100% { opacity: 1; } }
@keyframes dot-2 { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes dot-3 { 0%, 74% { opacity: 0; } 75%, 100% { opacity: 1; } }

.composer-wrap { padding: 8px 16px 18px; }
.composer-wrap .promptbox { max-width: 760px; margin: 0 auto; border-radius: 20px; }
.composer-wrap .promptbox textarea { min-height: 26px; }
.composer-note { max-width: 760px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--muted); }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; }
.md h3, .md h4, .md h5 { margin: 1.1em 0 .4em; line-height: 1.3; }
.md h3 { font-size: 1.15em; } .md h4 { font-size: 1.05em; } .md h5 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .8em; padding-inline-start: 1.4em; }
.md li { margin: .15em 0; }
.md code { font: .9em var(--font-mono); background: var(--hover); padding: .1em .35em; border-radius: 6px; }
.md pre { background: var(--sidebar); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; overflow-x: auto; margin: 0 0 .8em; }
.md pre code { background: none; padding: 0; font-size: 13px; }
.md blockquote { margin: 0 0 .8em; padding: 2px 14px; border-inline-start: 3px solid var(--border-strong); color: var(--muted); }
.md em { font-style: italic; }

/* Settings */
.settings-scroll { flex: 1; overflow-y: auto; padding: 28px 20px 64px; }
.settings { max-width: 920px; margin: 0 auto; }
.settings h1 { font: 500 30px/1.2 var(--font-serif); margin-bottom: 24px; }
.settings-grid { display: grid; grid-template-columns: 180px 1fr; gap: 32px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 0; }
.settings-nav a { padding: 9px 14px; border-radius: 10px; color: var(--text); font-weight: 500; }
.settings-nav a:hover { background: var(--hover); text-decoration: none; }
.settings-nav a.active { background: var(--accent-soft); font-weight: 600; }
.settings-panel { min-width: 0; display: grid; gap: 28px; }
.s-section h2 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; margin-inline-start: 4px; }
.s-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.s-row, .s-profile, .s-block { padding: 16px 20px; }
.s-row + .s-row, .s-profile + .s-row, .s-block + .s-row { border-top: 1px solid var(--border); }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.s-text { min-width: 0; }
.s-text p { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.s-control { flex: none; display: flex; align-items: center; }
.s-profile { display: flex; align-items: center; gap: 16px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { width: 240px; }
.s-card .input { min-height: 40px; border-radius: 10px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--sidebar); border: 1px solid var(--border); border-radius: 12px; }
.segmented button { border: 0; background: transparent; min-height: 34px; padding: 0 16px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 14%); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--hover); color: var(--muted); }
.badge.good { background: var(--accent-soft); color: var(--accent-text); }
.badge.warn { background: var(--danger-soft); color: var(--warn); }
.meter-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.meter-head span { color: var(--muted); }
.meter { height: 10px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); min-width: 0; transition: width .4s ease; }
.stat { font-size: 20px; font-variant-numeric: tabular-nums; }
.panel-loading { display: grid; place-items: center; padding: 48px; color: var(--muted); }

/* Dialog + toast */
dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(10 12 4 / 45%); }
dialog h3 { font-size: 18px; margin-bottom: 8px; }
dialog p { color: var(--muted); margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; }

.center-msg { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.center-msg h1 { font: 500 28px var(--font-serif); color: var(--text); margin-bottom: 8px; }
.boot { min-height: 100%; display: grid; place-items: center; color: var(--muted); }

/* Mobile */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(86vw, 320px); z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  :root[dir="rtl"] .sidebar { transform: translateX(100%); }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(10 12 4 / 40%); z-index: 20; }
  .topbar-mobile { display: flex; }
  .collapse-btn { display: none; }
  .mobile-only { display: flex; }
  .guest-top { padding: 10px 12px; }
  .chat-head { padding: 10px 14px; }
  dialog.auth-modal { padding: 32px 20px 24px; }
  .bubble { max-width: 92%; }
  .settings-grid { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav { grid-auto-flow: column; justify-content: start; overflow-x: auto; position: static; }
  .s-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .s-control { justify-content: flex-start; }
  .inline-form { flex-wrap: wrap; }
  .inline-form .input { flex: 1; width: auto; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .thinking .dots i { animation: none; opacity: 1; }
}

/* Reception offers several assistants; the user picks one */
.choices { display: flex; flex-direction: column; margin-top: 14px; max-width: 560px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.choice {
  position: relative; display: grid; gap: 2px; width: 100%; padding-block: 12px; padding-inline: 16px 44px; border: 0; background: transparent;
  color: var(--text); text-align: start; cursor: pointer; transition: background .12s;
}
.choice + .choice { border-top: 1px solid var(--border); }
.choice::after {
  content: ""; position: absolute; inset-inline-end: 18px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: rotate(45deg); transition: transform .12s, border-color .12s;
}
.choice:hover:not(:disabled), .choice:focus-visible { background: var(--accent-soft); }
.choice:hover:not(:disabled)::after { border-color: var(--accent-text); transform: translateX(3px) rotate(45deg); }
.choice:disabled { opacity: .5; cursor: default; }
.choice-name { font-weight: 700; }
.choice-about { font-size: 13px; line-height: 1.4; color: var(--muted); }
.md .math { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-style: italic; }

/* A chat that found its assistant flies from Recents to Assistants (see flight.js, sidebar.js) */
.a-item.held { visibility: hidden; }
.a-item.flying { position: fixed; z-index: 70; margin: 0; background: var(--accent-soft); pointer-events: none; will-change: transform; }
.a-item.flying .a-link { display: grid; }
.a-item.flying .a-name { grid-area: 1 / 1; }
.a-item.flying .a-name.to { opacity: 0; font-weight: 600; }
.a-item.landed { animation: landed 1.2s ease-out; }
@keyframes landed { 0% { background: var(--accent); } 100% { background: transparent; } }

/* Learn more (/learn) */
.learn { max-width: 760px; }
.learn h1 { font: 500 clamp(30px, 5vw, 42px)/1.15 var(--font-serif); letter-spacing: -.01em; margin-bottom: 14px; }
.learn-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 8px; }
.learn-lead { font-size: 18px; line-height: 1.55; color: var(--muted); margin-bottom: 8px; }
.learn-section { margin-top: 44px; }
.learn-section h2, .learn-cta h2 { font: 500 26px/1.25 var(--font-serif); margin-bottom: 14px; }
.learn-section > p { margin-bottom: 14px; }
.learn-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.learn-steps li { display: flex; gap: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.learn-steps h3 { font-size: 17px; margin-bottom: 4px; }
.learn-steps p { color: var(--muted); }
.learn-num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.learn-card { padding: 16px 20px; margin-bottom: 18px; background: var(--accent-soft); border-inline-start: 3px solid var(--accent); border-start-end-radius: var(--radius); border-end-end-radius: var(--radius); }
.learn-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.learn-card p + p { margin-top: 4px; }
.learn-levels { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.learn-levels dt { font-weight: 700; }
.learn-levels dd { margin: 0; color: var(--muted); }
.learn-timeline { list-style: none; margin: 0; padding: 18px 20px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.learn-timeline li { display: flex; align-items: flex-start; gap: 12px; }
.learn-timeline li > div { display: grid; }
.learn-timeline span:not(.mark) { color: var(--muted); font-size: 14px; }
.learn-timeline .mark { width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--accent-ink); }
.learn-timeline .mark .icon { width: 14px; height: 14px; stroke-width: 3; }
.learn-rows { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.learn-row { display: grid; grid-template-columns: 200px 1fr; gap: 6px 24px; padding: 14px 20px; }
.learn-row + .learn-row { border-top: 1px solid var(--border); }
.learn-row p { color: var(--muted); }
.learn-faq { display: grid; gap: 8px; }
.learn-faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 18px; }
.learn-faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
.learn-faq details[open] summary { padding-bottom: 6px; }
.learn-faq details p { color: var(--muted); padding-bottom: 14px; }
.learn-cta { margin-top: 48px; padding: 28px 24px; text-align: center; background: var(--accent-soft); border-radius: var(--radius); }
.learn-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
@media (max-width: 820px) {
  .learn-row { grid-template-columns: 1fr; }
  .learn-levels { grid-template-columns: 1fr; gap: 2px; }
  .learn-levels dd { margin-bottom: 10px; }
}

/* Right to left (<html dir="rtl">). Flex and grid rows, margins and paddings above already mirror;
   what is left is arrows that point somewhere. */
:root[dir="rtl"] .icon[data-icon="chevronRight"],
:root[dir="rtl"] .icon[data-icon="panel"],
:root[dir="rtl"] .icon[data-icon="logout"] { transform: scaleX(-1); }
:root[dir="rtl"] .side-section:not(.open) .side-toggle .icon { transform: scaleX(-1); }
:root[dir="rtl"] .choice::after { transform: rotate(-135deg); }
:root[dir="rtl"] .choice:hover:not(:disabled)::after { transform: translateX(-3px) rotate(-135deg); }

/* The card a sidebar row shows after a moment of hovering: the chat, as the New assistant preview draws it,
   with the last few messages. It reuses .pick-demo / .demo-screen, so only its placement is set here. */
.chat-peek { position: fixed; inset-inline-end: auto; z-index: 80; width: 420px; max-width: calc(100vw - 16px); opacity: 1; visibility: visible; transform: none; animation: peek-in .15s ease-out; }
.chat-peek .demo-chat { align-content: end; }
@keyframes peek-in { from { opacity: 0; transform: translateY(2px); } }

.chat-agents { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 55%; }
.chat-agents[hidden] { display: none; }
.agent-chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.agent-chip:hover, .agent-chip:focus-visible { background: var(--hover); outline: none; }
