/* ==========================================================================
   Tshedimoso AI — interface
   Self-contained: no external fonts, images or scripts (works offline).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SF Mono", ui-monospace, Consolas, monospace;

  /* From the logo tile: sky highlight -> brand blue -> deep blue */
  --sky: #8cc2ee;
  --azure: #3d7cc9;
  --violet: #24539a;   /* deep brand blue (kept name for compatibility) */
  --navy: #0d1b33;
  --ai-blue: #2f6fb8;
  --grad: linear-gradient(135deg, #a9d3f5 0%, #4f8fd6 48%, #24539a 100%);
  --grad-soft: linear-gradient(135deg, rgba(140,194,238,.18), rgba(36,83,154,.16));

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 276px;
}

/* Dark (default) */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --bg-2: #0b1120;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --surface-solid: #0f1626;
  --elevated: rgba(17, 24, 39, .78);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --ink: #e9eef7;
  --ink-2: #c3cddb;
  --muted: #8c99ad;
  --brand: #8cc2ee;
  --brand-ink: #ffffff;
  --accent-soft: rgba(140, 194, 238, .12);
  --ok: #4ade80;
  --ok-bg: rgba(74, 222, 128, .12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, .11);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, .12);
  --code-bg: rgba(0, 0, 0, .35);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -12px rgba(0,0,0,.55);
  --shadow-lg: 0 1px 0 rgba(255,255,255,.05) inset, 0 30px 80px -20px rgba(0,0,0,.7);
  --glow: 0 0 0 1px rgba(140,194,238,.35), 0 8px 30px -6px rgba(61,124,201,.45);
  --aurora-1: rgba(61, 124, 201, .30);
  --aurora-2: rgba(36, 83, 154, .22);
  --aurora-3: rgba(140, 194, 238, .20);
}

/* Light */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-2: #eef2f9;
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(255, 255, 255, .92);
  --surface-solid: #ffffff;
  --elevated: rgba(255, 255, 255, .86);
  --line: rgba(15, 23, 42, .08);
  --line-strong: rgba(15, 23, 42, .14);
  --ink: #0d1b33;
  --ink-2: #334155;
  --muted: #64748b;
  --brand: #2f6fb8;
  --accent-soft: rgba(61, 124, 201, .10);
  --ok: #15803d;
  --ok-bg: rgba(21, 128, 61, .10);
  --warn: #b45309;
  --warn-bg: rgba(245, 158, 11, .13);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, .09);
  --code-bg: rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -12px rgba(15,23,42,.18);
  --shadow-lg: 0 2px 6px rgba(15,23,42,.06), 0 30px 70px -24px rgba(15,23,42,.28);
  --glow: 0 0 0 1px rgba(61,124,201,.35), 0 8px 26px -8px rgba(61,124,201,.45);
  --aurora-1: rgba(61, 124, 201, .18);
  --aurora-2: rgba(36, 83, 154, .14);
  --aurora-3: rgba(140, 194, 238, .20);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f7fb; --bg-2: #eef2f9; --surface: rgba(255,255,255,.72); --surface-2: rgba(255,255,255,.92);
    --surface-solid: #fff; --elevated: rgba(255,255,255,.86); --line: rgba(15,23,42,.08); --line-strong: rgba(15,23,42,.14);
    --ink: #0d1b33; --ink-2: #334155; --muted: #64748b; --brand: #2f6fb8; --accent-soft: rgba(61,124,201,.10);
    --ok: #15803d; --ok-bg: rgba(21,128,61,.10); --warn: #b45309; --warn-bg: rgba(245,158,11,.13);
    --danger: #dc2626; --danger-bg: rgba(220,38,38,.09); --code-bg: rgba(15,23,42,.05);
    --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -12px rgba(15,23,42,.18);
    --shadow-lg: 0 2px 6px rgba(15,23,42,.06), 0 30px 70px -24px rgba(15,23,42,.28);
    --glow: 0 0 0 1px rgba(61,124,201,.35), 0 8px 26px -8px rgba(61,124,201,.45);
    --aurora-1: rgba(61,124,201,.18); --aurora-2: rgba(36,83,154,.14); --aurora-3: rgba(140,194,238,.20);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.15rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; }
p { margin: 0 0 .6em; }
small { font-size: .82em; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: .92rem; }
::selection { background: rgba(61, 124, 201, .35); }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Aurora background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(1200px 800px at 50% -10%, var(--bg-2), var(--bg) 60%); }
.aurora span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .9; animation: drift 28s var(--ease) infinite alternate; }
.aurora span:nth-child(1) { width: 52vw; height: 52vw; left: -12vw; top: -18vw; background: var(--aurora-1); }
.aurora span:nth-child(2) { width: 46vw; height: 46vw; right: -14vw; top: 8vh; background: var(--aurora-2); animation-duration: 34s; }
.aurora span:nth-child(3) { width: 40vw; height: 40vw; left: 30vw; bottom: -24vw; background: var(--aurora-3); animation-duration: 40s; }
.aurora::after { /* fine grid for depth */
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; opacity: .35;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 20%, transparent 75%);
}
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(4vw, 3vh, 0) scale(1.12); } }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: .6em; font: 600 1.06rem/1 var(--font-display); letter-spacing: -.01em; }
.wordmark { font: 800 1.12rem/1 var(--font-display); letter-spacing: -.045em; color: var(--ink); white-space: nowrap; }
.wordmark em { font-style: normal; color: var(--ai-blue); }
:root[data-theme="dark"] .wordmark em, :root:not([data-theme]) .wordmark em { color: #8cc2ee; text-shadow: 0 0 18px rgba(140,194,238,.55); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .wordmark em { color: var(--ai-blue); text-shadow: none; } }
.wordmark.xl { font-size: clamp(2.2rem, 4vw, 3.2rem); letter-spacing: -.05em; }
.brand-lg .wordmark { font-size: 1.45rem; }
.brand-lg { font-size: 1.3rem; }
.brand-xl { font-size: 1.5rem; }
.mark { display: inline-block; position: relative; width: 1.9em; height: 1.9em; border-radius: 24%; flex: none; background: url("brand/favicon-192.png") center / cover no-repeat; box-shadow: 0 6px 20px -6px rgba(61, 124, 201, .75), 0 0 0 1px rgba(255,255,255,.08); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Icons ---------- */
.ico { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -.2em; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Controls ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 12px; padding: .62em 1.05em; font: 500 .94rem/1.2 var(--font); cursor: pointer;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn:hover { border-color: rgba(140, 194, 238, .5); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 8px 22px -10px rgba(61, 124, 201, .9), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.primary:hover { filter: brightness(1.08) saturate(1.05); box-shadow: 0 12px 28px -10px rgba(61, 124, 201, 1), inset 0 1px 0 rgba(255,255,255,.3); }
.btn.ghost { background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.ghost:hover { background: var(--surface); border-color: var(--line); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: rgba(248, 113, 113, .5); background: var(--danger-bg); }
.btn.small, .btn.sm { padding: .42em .8em; font-size: .85rem; border-radius: 10px; }
.btn.lg { padding: .82em 1.2em; font-size: 1rem; border-radius: 14px; }
.btn.block { width: 100%; }
.icon-btn {
  appearance: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn.active { color: var(--brand); }

label { display: grid; gap: .38em; font-weight: 550; font-size: .88rem; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: .66em .85em; width: 100%; font-weight: 400;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(140, 194, 238, .7); box-shadow: 0 0 0 4px rgba(61, 124, 201, .16); background: var(--surface-2); }
select { cursor: pointer; }
select option { background: var(--surface-solid); color: var(--ink); }
textarea { resize: vertical; min-height: 5em; }
.check { display: flex; align-items: center; gap: .6em; font-weight: 450; color: var(--ink-2); }
.check input { width: 1.05em; height: 1.05em; accent-color: var(--azure); }

/* ---------- Layout primitives ---------- */
.glass { background: var(--elevated); border: 1px solid var(--line); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3); box-shadow: var(--shadow-lg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.only-mobile { display: none; }

/* ---------- Sign in ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { position: relative; padding: clamp(32px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 26px; overflow: hidden; }
.hero-brand { display: flex; align-items: center; gap: 22px; }
.hero-logo { width: 132px; height: 132px; margin: -14px; filter: drop-shadow(0 18px 40px rgba(61,124,201,.45)); animation: float 7s ease-in-out infinite; }
.hero-title { font-size: clamp(2.4rem, 4.6vw, 4rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.04; margin: 12px 0 0; }
.hero-sub { font-size: 1.12rem; color: var(--ink-2); max-width: 34em; margin: 0; }
.hero-points { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 640px; }
.hero-points li { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.hero-points b { display: block; font-weight: 600; font-size: .95rem; }
.hero-points small { color: var(--muted); font-size: .84rem; }
.pt-icon { width: 36px; height: 36px; border-radius: 11px; background: var(--grad-soft); border: 1px solid var(--line); color: var(--brand); flex: none; }
.pt-icon .ico { width: 18px; height: 18px; }
.hero-orb { display: none; position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%; opacity: .55; pointer-events: none;
  background: conic-gradient(from 0deg, var(--sky), var(--azure), var(--violet), var(--sky)); filter: blur(60px); animation: spin 30s linear infinite; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; gap: 16px; }
.login-card { width: min(420px, 100%); border-radius: 24px; padding: 32px; display: grid; gap: 16px; }
.login-card-brand { display: none; }
.login-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .2em; }
.login-public { display: grid; gap: 10px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; margin: 2px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.login-foot { color: var(--muted); font-size: .82rem; margin: 0; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px;
  border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01));
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); z-index: 20;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.new-chat { justify-content: flex-start; padding: .75em 1em; border-radius: 14px; }
.new-chat .ico { width: 18px; height: 18px; }
#nav { display: grid; gap: 2px; }
#nav button {
  display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid transparent; background: none;
  font: 500 .93rem/1 var(--font); color: var(--ink-2); padding: .72em .8em; border-radius: 12px; cursor: pointer; transition: background .2s, color .2s;
}
#nav button .ico { width: 18px; height: 18px; color: var(--muted); transition: color .2s; }
#nav button:hover { background: var(--surface); color: var(--ink); }
#nav button[aria-current="page"] { background: var(--grad-soft); color: var(--ink); border-color: var(--line); }
#nav button[aria-current="page"] .ico { color: var(--brand); }
.side-label { font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; }
.recent { min-height: 0; flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.recent-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; color: var(--ink-2);
  font: 400 .88rem/1.3 var(--font); padding: .55em .8em; border-radius: 10px; cursor: pointer;
}
.recent-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .ico { width: 15px; height: 15px; color: var(--muted); }
.recent-item:hover { background: var(--surface); color: var(--ink); }
.recent-item.active { background: var(--surface-2); color: var(--ink); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.account-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--grad); color: #fff; font: 650 .82rem/1 var(--font); letter-spacing: .02em; box-shadow: 0 4px 14px -4px rgba(61,124,201,.8); }
.avatar.guest { background: linear-gradient(135deg, #475569, #64748b); box-shadow: none; }
.account-text { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.account-text span { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-actions { display: grid; gap: 6px; }
.account-actions.inline { display: flex; gap: 0; }
.account-actions.inline .icon-btn { width: 32px; height: 32px; }
.sov-badge { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--muted); padding: 2px 8px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); } 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 28px; min-height: 60px;
  background: linear-gradient(180deg, var(--bg) 30%, transparent);
}
.topbar h1 { margin: 0; font-size: 1.02rem; font-weight: 600; color: var(--ink-2); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.lang { display: flex; align-items: center; gap: 0; padding-left: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-weight: 500; }
.lang .ico { width: 16px; height: 16px; }
.lang select { border: 0; background: transparent; padding: .45em .7em .45em .45em; width: auto; box-shadow: none; font-size: .88rem; color: var(--ink); }
.view { padding: 8px 28px 48px; width: 100%; max-width: 1240px; margin: 0 auto; flex: 1; animation: fade-in .35s var(--ease); }
.view.chat-view { max-width: none; padding: 0; display: flex; flex-direction: column; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Guest trial banner ---------- */
.guest-banner {
  margin: 0 28px 8px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-radius: 16px; border: 1px solid rgba(140, 194, 238, .28); background: var(--grad-soft); font-size: .9rem; color: var(--ink-2);
}
.guest-banner .gb-icon { color: var(--brand); }
.guest-banner .gb-text { flex: 1; min-width: 200px; }
.guest-banner .gb-text b { color: var(--ink); }
.meter { display: flex; gap: 5px; }
.meter i { width: 22px; height: 6px; border-radius: 6px; background: var(--line-strong); }
.meter i.on { background: var(--grad); box-shadow: 0 0 10px rgba(61,124,201,.6); }
.guest-banner.out { border-color: rgba(251, 191, 36, .35); background: var(--warn-bg); }
.guest-banner.out .gb-icon { color: var(--warn); }

/* ---------- Assistant ---------- */
.chat { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; min-height: 0; }
.chat.has-sources { grid-template-columns: minmax(0, 1fr) 360px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: calc(100vh - 60px); }
.chat-scroll { flex: 1; padding: 8px 28px 24px; }
.thread { width: min(820px, 100%); margin: 0 auto; display: grid; gap: 22px; }

/* Empty state */
.hero { width: min(860px, 100%); margin: 0 auto; padding: clamp(8px, 3.5vh, 44px) 0 12px; text-align: center; animation: fade-in .5s var(--ease); }
.orb { position: relative; width: 92px; height: 92px; margin: 0 auto 26px; }
.orb::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: conic-gradient(from 0deg, var(--sky), var(--azure), var(--violet), var(--sky)); filter: blur(22px); opacity: .55; animation: spin 9s linear infinite; }
.orb .mark { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 26px; animation: float 6s ease-in-out infinite; }
.orb img { position: absolute; inset: -14px; width: calc(100% + 28px); height: calc(100% + 28px); animation: float 6s ease-in-out infinite; filter: drop-shadow(0 14px 30px rgba(61,124,201,.5)); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.view .hero h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 700; letter-spacing: -.03em; margin-bottom: .25em; }
.hero .lead { font-size: 1.08rem; color: var(--ink-2); margin-bottom: .3em; }
.hero .task-desc { color: var(--muted); font-size: .93rem; max-width: 38em; margin: 0 auto; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; text-align: left; }
.suggestion {
  display: flex; gap: 12px; align-items: flex-start; padding: 15px 16px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: left;
  transition: transform .2s var(--ease), border-color .2s, background .2s, box-shadow .2s;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.suggestion:hover { transform: translateY(-2px); border-color: rgba(140, 194, 238, .45); background: var(--surface-2); box-shadow: var(--shadow); }
.suggestion .s-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--grad-soft); color: var(--brand); flex: none; border: 1px solid var(--line); }
.suggestion .s-icon .ico { width: 17px; height: 17px; }
.suggestion b { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 2px; }
.suggestion small { color: var(--muted); font-size: .85rem; line-height: 1.4; display: block; }

/* Messages */
.msg-row { display: flex; gap: 14px; animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg-row.user { justify-content: flex-end; }
.bubble-user {
  max-width: min(78%, 640px); padding: 12px 16px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap; word-wrap: break-word;
  background: linear-gradient(135deg, rgba(140,194,238,.24), rgba(36,83,154,.22)); border: 1px solid rgba(140,194,238,.25); color: var(--ink);
}
.ai-avatar { width: 32px; height: 32px; flex: none; margin-top: 2px; }
.ai-avatar .mark { width: 100%; height: 100%; border-radius: 9px; }
.msg-body { min-width: 0; flex: 1; }
.msg-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.msg-name .chip { font-weight: 500; }
.answer { color: var(--ink); font-size: .98rem; line-height: 1.7; }
.answer > :first-child { margin-top: 0; }
.answer p { margin: .5em 0; }
.answer h3 { font-size: 1rem; margin: 1em 0 .4em; }
.answer ul, .answer ol { margin: .5em 0; padding-left: 1.4em; }
.answer li { margin: .25em 0; }
.answer li::marker { color: var(--brand); }
.answer strong { color: var(--ink); font-weight: 650; }
.answer em { color: var(--ink-2); }
.answer pre { background: var(--code-bg); border: 1px solid var(--line); padding: 14px 16px; border-radius: 12px; overflow: auto; font: .84rem/1.6 var(--mono); }
.answer code { background: var(--code-bg); padding: .12em .4em; border-radius: 6px; font: .86em var(--mono); }
.answer pre code { background: none; padding: 0; }
.cite {
  display: inline-grid; place-items: center; min-width: 1.45em; height: 1.45em; padding: 0 .35em; margin: 0 2px; vertical-align: .12em;
  font: 700 .7rem/1 var(--font); color: var(--brand); background: var(--accent-soft); border: 1px solid rgba(140,194,238,.3);
  border-radius: 7px; cursor: pointer; transition: background .15s, transform .15s;
}
.cite:hover { background: rgba(140, 194, 238, .25); transform: translateY(-1px); }
.typing-dots { display: inline-flex; gap: 5px; padding: 10px 2px; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: .4; animation: blink 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.answer.streaming > :last-child::after { content: ""; display: inline-block; width: .5em; height: 1.05em; margin-left: 2px; vertical-align: -.15em; border-radius: 2px; background: var(--grad); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.msg-actions { display: flex; align-items: center; gap: 2px; margin-top: 10px; flex-wrap: wrap; }
.msg-actions .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
.msg-actions .icon-btn .ico { width: 16px; height: 16px; }
.msg-actions .icon-btn.done { color: var(--brand); }
.msg-meta { margin-left: 8px; color: var(--muted); font-size: .78rem; }

.chip { display: inline-flex; align-items: center; gap: .35em; font-size: .74rem; padding: .22em .6em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-weight: 500; }

/* Notices */
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: .7em .9em; font-size: .9rem; margin: 0 0 10px; border: 1px solid transparent; }
.notice .ico { margin-top: .1em; }
.notice.warning, .notice.approval { background: var(--warn-bg); color: var(--warn); border-color: rgba(251, 191, 36, .25); }
.notice.approval { font-weight: 550; }
.notice.info { background: var(--accent-soft); color: var(--ink-2); border-color: rgba(140, 194, 238, .25); }

/* Composer */
.composer-dock { position: sticky; bottom: 0; padding: 12px 28px 18px; background: linear-gradient(180deg, transparent, var(--bg) 38%); z-index: 5; }
.composer {
  width: min(840px, 100%); margin: 0 auto; border-radius: var(--radius-lg); padding: 10px; display: grid; gap: 8px;
  transition: box-shadow .25s, border-color .25s;
}
.composer:focus-within { border-color: rgba(140, 194, 238, .45); box-shadow: var(--shadow-lg), var(--glow); }
.modes { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 4px; }
.modes::-webkit-scrollbar { display: none; }
.mode {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font: 500 .84rem/1 var(--font); padding: .55em .85em; border-radius: 999px; cursor: pointer; transition: all .2s var(--ease);
}
.mode .ico { width: 15px; height: 15px; }
.mode:hover { color: var(--ink); background: var(--surface); }
.mode[aria-selected="true"] { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -8px rgba(61,124,201,.9); }
.composer-options { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 4px; }
.composer-options > label { flex: 1 1 200px; font-size: .8rem; }
.composer-options select, .composer-options input:not([type=checkbox]) { padding: .5em .7em; font-size: .9rem; border-radius: 10px; }
.composer-options .check { flex-basis: 100%; }
.composer-input { display: flex; align-items: flex-end; gap: 8px; padding: 0 2px 0 6px; }
.composer-input textarea {
  border: 0; background: transparent; box-shadow: none; resize: none; min-height: 52px; max-height: 260px; padding: 12px 6px;
  font-size: 1rem; line-height: 1.55;
}
.composer-input textarea:focus { box-shadow: none; background: transparent; }
.send {
  width: 44px; height: 44px; border-radius: 14px; border: 0; flex: none; margin-bottom: 4px; cursor: pointer; color: #fff;
  background: var(--grad); display: grid; place-items: center; box-shadow: 0 8px 20px -8px rgba(61,124,201,1);
  transition: transform .15s var(--ease), filter .2s, opacity .2s;
}
.send:hover { filter: brightness(1.1); transform: translateY(-1px); }
.send:disabled { opacity: .5; cursor: progress; transform: none; }
.send .ico { width: 20px; height: 20px; }
.send.busy .ico { animation: spin 1s linear infinite; }
.composer-foot { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .76rem; padding: 0 8px 2px; flex-wrap: wrap; }
.kbd { font: 500 .72rem var(--mono); padding: .1em .45em; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.disclaimer { text-align: center; color: var(--muted); font-size: .75rem; margin-top: 10px; }

/* Sources panel */
.sources-panel { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto; padding: 8px 20px 24px 0; animation: fade-in .3s var(--ease); }
.sources-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; }
.sources-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .9rem; color: var(--ink-2); }
.sources { display: grid; gap: 10px; }
.source { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px 12px; background: var(--surface); font-size: .86rem; transition: border-color .2s, box-shadow .25s, transform .2s; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.source:hover { border-color: var(--line-strong); }
.source.hit { border-color: rgba(140, 194, 238, .7); box-shadow: var(--glow); }
.source-top { display: flex; gap: 10px; align-items: flex-start; }
.source-n { display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 8px; font: 700 .72rem/1 var(--font); background: var(--grad); color: #fff; flex: none; }
.source-title { font-weight: 600; line-height: 1.35; }
.source-heading { color: var(--muted); font-size: .8rem; }
.source .excerpt { color: var(--ink-2); margin-top: 8px; max-height: 7.8em; overflow: hidden; line-height: 1.5; mask-image: linear-gradient(180deg, #000 70%, transparent); }
.source-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* Structured results */
.result-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.route { display: grid; gap: 14px; padding: 16px; }
.route-dept { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; font-weight: 650; }
.route-dept .s-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; }
.confidence { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.confidence i { display: block; height: 100%; background: var(--grad); border-radius: 8px; }

/* Tags */
.tag { display: inline-flex; align-items: center; font-size: .72rem; padding: .2em .62em; border-radius: 999px; background: var(--accent-soft); color: var(--brand); font-weight: 600; border: 1px solid rgba(140,194,238,.22); }
.tag.pending { background: var(--warn-bg); color: var(--warn); border-color: rgba(251,191,36,.25); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(74,222,128,.25); }
.tag.denied, .tag.error, .tag.blocked { background: var(--danger-bg); color: var(--danger); border-color: rgba(248,113,113,.25); }

/* ---------- Tables, data, admin views ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
th, td { text-align: left; padding: .75em .8em; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .55em 1.2em; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.design-frame { width: 100%; min-height: 460px; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-top: 8px; }
.design-image { max-width: 100%; border-radius: 14px; border: 1px solid var(--line); }
pre.json { background: var(--code-bg); border: 1px solid var(--line); padding: 14px; border-radius: 12px; overflow: auto; font: .82rem/1.6 var(--mono); }
details summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-top: 8px; }
.view h2 { font-size: 1.05rem; }
.view ul { padding-left: 1.2em; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.stat .stat-label { color: var(--muted); font-size: .8rem; display: flex; align-items: center; gap: 6px; }
.stat .stat-value { font: 700 1.8rem/1.1 var(--font-display); letter-spacing: -.02em; margin-top: 8px; }

/* History */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.history-card { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.history-card:hover { transform: translateY(-2px); border-color: rgba(140,194,238,.4); box-shadow: var(--shadow); }
.history-card .h-title { font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-card .h-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .s-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; background: var(--grad-soft); color: var(--brand); border: 1px solid var(--line); }

/* ---------- Dialog & toast ---------- */
dialog {
  border: 1px solid var(--line-strong); border-radius: 22px; padding: 0; color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: 88vh;
  background: var(--elevated); -webkit-backdrop-filter: blur(30px) saturate(1.4); backdrop-filter: blur(30px) saturate(1.4); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(3, 6, 12, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
#dialog-body { padding: 26px; display: grid; gap: 14px; }
#dialog-body h2 { font-size: 1.3rem; margin: 0; letter-spacing: -.02em; }
#dialog-body .doc-text { white-space: pre-wrap; max-height: 55vh; overflow: auto; background: var(--code-bg); border: 1px solid var(--line); padding: 14px; border-radius: 12px; font-size: .88rem; }
#dialog-body fieldset { border: 1px solid var(--line) !important; border-radius: 12px; padding: 10px 14px; display: grid; gap: 6px; }
#dialog-body legend { color: var(--muted); font-size: .82rem; padding: 0 6px; }
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px); padding: .75em 1.2em; border-radius: 14px; font-size: .92rem;
  background: var(--elevated); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease);
  max-width: calc(100vw - 32px); z-index: 100;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .chat.has-sources { grid-template-columns: minmax(0, 1fr); }
  .sources-panel { position: static; height: auto; padding: 0 28px 160px; }
  .sources-panel .sources { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card-brand { display: flex; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .only-mobile { display: inline-grid; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .3s var(--ease); background: var(--surface-solid); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(3, 6, 12, .5); z-index: 15; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .topbar, .view, .chat-scroll, .composer-dock { padding-left: 16px; padding-right: 16px; }
  .guest-banner { margin: 0 16px 8px; }
  .sources-panel { padding: 0 16px 170px; }
  .split, .grid-2, .suggestions, .hero-points { grid-template-columns: 1fr; }
  .bubble-user { max-width: 88%; }
  .modes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ai-avatar { display: none; }
  .composer-foot .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   Phones and tablets
   ========================================================================== */

/* Dynamic viewport units: the page fits between mobile browser toolbars. */
.login, .shell, .main { min-height: 100dvh; }
.sidebar { height: 100dvh; }
.chat-main { min-height: calc(100dvh - 60px); }

button, a, .suggestion, .src-chip, .mode { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Inline sources under each answer: used whenever the side panel is not shown. */
.msg-sources { display: none; margin-top: 12px; }
.msg-sources-label { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.msg-sources-label .ico { width: 14px; height: 14px; }
.msg-sources-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
.msg-sources-list::-webkit-scrollbar { display: none; }
.src-chip {
  flex: none; display: flex; align-items: center; gap: 10px; max-width: 260px; padding: 9px 12px 9px 9px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: left; scroll-snap-align: start;
}
.src-chip:active { background: var(--surface-2); }
.src-chip-text { display: grid; min-width: 0; line-height: 1.3; }
.src-chip-text b { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-chip-text small { font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar-brand { align-items: center; gap: 8px; flex: 1; min-width: 0; }
.topbar-brand .mark { width: 28px; height: 28px; border-radius: 8px; }
.topbar-brand .wordmark { font-size: 1.05rem; }
.mobile-note { display: none; }

@media (max-width: 1180px) {
  .sources-panel { display: none !important; }
  .chat.has-sources { grid-template-columns: minmax(0, 1fr); }
  .msg-sources { display: block; }
}

@media (max-width: 860px) {
  body { font-size: 16px; }

  /* Top bar: logo on the chat screen, page title elsewhere */
  .topbar { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; min-height: 56px; gap: 6px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .topbar-brand { display: flex; }
  body[data-view="assistant"] #view-title { display: none; }
  body:not([data-view="assistant"]) .topbar-brand { display: none; }
  .topbar h1 { font-size: 1rem; }
  .lang { padding-left: 8px; border-radius: 10px; }
  .lang select { padding: .4em .4em .4em .3em; font-size: .85rem; }
  .icon-btn { width: 40px; height: 40px; }

  /* Sidebar drawer respects the notch / home bar */
  .sidebar { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* Guest banner: one compact row */
  .guest-banner { margin: 8px 12px 0; padding: 8px 8px 8px 12px; gap: 10px; flex-wrap: nowrap; border-radius: 14px; font-size: .84rem; }
  .guest-banner .gb-more { display: none; }
  .guest-banner .gb-text { min-width: 0; }
  .guest-banner .meter i { width: 14px; }
  .guest-banner .btn { padding: .5em .8em; white-space: nowrap; }

  /* Welcome screen */
  .hero { padding: 18px 0 8px; }
  .orb { width: 64px; height: 64px; margin-bottom: 16px; }
  .view .hero h2 { font-size: 1.75rem; }
  .hero .lead { font-size: 1rem; }
  .hero .task-desc { font-size: .88rem; }
  .mobile-note { display: block; color: var(--muted); font-size: .78rem; margin: 6px 0 0; }
  .suggestions { gap: 8px; margin-top: 18px; }
  .suggestion { padding: 12px; gap: 10px; border-radius: 14px; }
  .suggestion .s-icon { width: 30px; height: 30px; border-radius: 9px; }
  .suggestion small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

  /* Conversation */
  .chat-scroll { padding: 12px 14px 16px; }
  .thread { gap: 18px; }
  .msg-row { gap: 0; }
  .bubble-user { max-width: 86%; padding: 10px 14px; border-radius: 18px 18px 6px 18px; }
  .answer { font-size: 1rem; line-height: 1.65; }
  .msg-actions .icon-btn { width: 40px; height: 40px; }
  .msg-meta { font-size: .74rem; }
  .design-frame { min-height: 380px; }

  /* Composer: compact, above the keyboard and the home bar */
  .composer-dock { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--bg) 22%); }
  .composer { padding: 8px; gap: 6px; border-radius: 20px; }
  .modes { mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
  .mode { padding: .5em .8em; font-size: .82rem; }
  .composer-input textarea { font-size: 16px; min-height: 46px; padding: 11px 4px; }
  .send { width: 44px; height: 44px; margin-bottom: 1px; }
  .composer-foot, .disclaimer { display: none; }
  .composer-options > label { flex-basis: 100%; }

  /* Every form field at 16px so iPhone Safari does not zoom in on focus */
  input, select, textarea { font-size: 16px; }

  /* Dialogs become bottom sheets */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 90dvh; border-bottom: 0; }
  dialog[open] { animation: sheet .28s var(--ease); }
  #dialog-body { padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); }
  #dialog-body .row.end .btn { flex: 1; }

  /* Admin views */
  .view { padding: 12px 12px 40px; }
  .card { padding: 16px; border-radius: 14px; }
  .history-grid { grid-template-columns: 1fr; }
  .login-panel { padding: calc(24px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom)); }
  .login-card { padding: 24px 20px; border-radius: 22px; }
  #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* Lighter effects for mid-range phones: blur and drifting glows are costly */
  .aurora span { animation: none; filter: blur(60px); }
  .aurora::after { display: none; }
  .card, .suggestion, .source, .hero-points li, .btn, .sidebar { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .orb::before { animation: none; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Installed as an app (home-screen): no browser bars, respect the status bar */
@media (display-mode: standalone) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
}
@media (max-width: 380px) {
  .topbar-brand { overflow: hidden; }
  .topbar-brand .wordmark { font-size: .95rem; }
  .lang { padding-left: 0; }
  .lang .ico { display: none; }
  .guest-banner .meter { display: none; }
}
