/* FLUXBOT — themed like the logo: glassy electric blue on near-black, chrome highlights.
   Light + dark themes via [data-theme]. Token names are shared by every page (don't rename them). */
:root, [data-theme="dark"] {
  --bg: #03060f;
  --sidebar: #040914;
  --surface: #0a1428;
  --surface-2: #11213f;
  --hover: rgba(56, 152, 255, 0.09);
  --active: rgba(56, 152, 255, 0.17);
  --border: rgba(120, 180, 255, 0.12);
  --border-strong: rgba(120, 180, 255, 0.24);
  --text: #eaf2ff;
  --muted: #a3b4cc;
  --dim: #6d819d;
  --invert: #eaf2ff;
  --invert-text: #03060f;
  --accent: #2d9bff;
  --accent-soft: rgba(30, 144, 255, 0.16);
  --grad: linear-gradient(135deg, #36b3ff 0%, #1f7bff 42%, #0a3cff 100%);
  --glow: 0 6px 24px -6px rgba(30, 144, 255, 0.7);
  --page-glow: radial-gradient(1000px 520px at 50% -160px, rgba(30, 144, 255, 0.15), transparent 70%);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --ok: #4ade80;
  --code-bg: #050c1a;
  --code-head: #0b1730;
  --shadow: 0 12px 44px rgba(0, 3, 12, 0.6);
  --overlay: rgba(1, 3, 10, 0.72);
  --hl-kw: #ff7b9c; --hl-str: #a5d6ff; --hl-num: #7dd3fc; --hl-fn: #7fdcff;
  --hl-com: #6f86a8; --hl-attr: #5ec8ff; --hl-type: #fbbf24; --hl-var: #fbbf24;
  /* FLUXBOT brand */
  --flux-blue: #1e90ff;
  --flux-cyan: #4fd2ff;
  --flux-deep: #0a3cff;
  --flux-ice: #7fdcff;
  --chrome: linear-gradient(180deg, #ffffff 0%, #f1f5fb 28%, #b4c0d0 50%, #eef3f9 70%, #c2ccda 100%);
  --flux-bot: linear-gradient(180deg, #8fe3ff 0%, #2d9bff 48%, #1f6fff 100%);
  --font-display: 'Orbitron', 'Exo 2', ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f8fd;
  --sidebar: #edf2fa;
  --surface: #e8eef9;
  --surface-2: #d9e4f5;
  --hover: rgba(10, 100, 230, 0.07);
  --active: rgba(10, 100, 230, 0.13);
  --border: rgba(10, 40, 90, 0.12);
  --border-strong: rgba(10, 40, 90, 0.22);
  --text: #07101f;
  --muted: #43526a;
  --dim: #6f7d93;
  --invert: #07101f;
  --invert-text: #ffffff;
  --accent: #0b66f5;
  --accent-soft: rgba(11, 102, 245, 0.12);
  --grad: linear-gradient(135deg, #1a94ff 0%, #0b66f5 45%, #0a3cff 100%);
  --glow: 0 6px 20px -8px rgba(11, 102, 245, 0.6);
  --page-glow: radial-gradient(1000px 520px at 50% -160px, rgba(30, 144, 255, 0.1), transparent 70%);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --ok: #16a34a;
  --code-bg: #f2f6fd;
  --code-head: #e4ecf9;
  --shadow: 0 12px 40px rgba(8, 30, 80, 0.14);
  --overlay: rgba(6, 14, 40, 0.35);
  --hl-kw: #cf222e; --hl-str: #0a3069; --hl-num: #0550ae; --hl-fn: #0a58ca;
  --hl-com: #6e7781; --hl-attr: #0550ae; --hl-type: #953800; --hl-var: #953800;
  --flux-blue: #0b74f5;
  --flux-cyan: #0a9fe0;
  --flux-deep: #0a3cff;
  --flux-ice: #3aa8ff;
  --chrome: linear-gradient(180deg, #5d6c84 0%, #243048 40%, #0b1220 55%, #3c4a62 78%, #6b7a92 100%);
  --flux-bot: linear-gradient(180deg, #2aa5ff 0%, #0b6cf5 55%, #0a3cff 100%);
  color-scheme: light;
}

/* FLUXBOT touches: glassy electric-blue buttons, chrome brand, tinted bubbles, soft page glow */
.btn-primary, .send {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 52%), var(--grad) !important;
  color: #fff !important; text-shadow: 0 1px 1px rgba(0, 18, 70, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), inset 0 -1px 0 rgba(0, 20, 90, 0.35), var(--glow);
}
.btn-primary:hover, .send:hover:not(:disabled) { filter: brightness(1.1) saturate(1.05); opacity: 1; }
.send:disabled { box-shadow: none; }
.avatar { background: var(--grad) !important; }
.main, .auth { background: var(--page-glow), var(--bg); }
.sb-brand .grad, .brand-grad { background: var(--flux-bot); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sb-brand .logo, .auth-card .logo { filter: drop-shadow(0 0 10px rgba(30, 144, 255, 0.55)); }
.bubble {
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.2), rgba(10, 60, 255, 0.13)), var(--surface);
  border: 1px solid rgba(79, 210, 255, 0.2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .bubble { background: linear-gradient(135deg, rgba(30, 144, 255, 0.12), rgba(10, 60, 255, 0.07)), var(--surface); border-color: rgba(11, 102, 245, 0.18); }
.pending-dot { background: var(--grad) !important; box-shadow: 0 0 14px rgba(30, 144, 255, 0.6); }
.composer:focus-within { box-shadow: 0 0 0 1px rgba(79, 210, 255, 0.45), 0 0 28px -8px rgba(30, 144, 255, 0.6); }
.chat-item.active { background: linear-gradient(90deg, rgba(30, 144, 255, 0.22), rgba(10, 60, 255, 0.06)); box-shadow: inset 2px 0 0 var(--flux-cyan); }
.hero h1 { font-family: 'Exo 2', 'Inter', ui-sans-serif, system-ui, sans-serif; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero { width: 190px; height: 190px; border-radius: 28px; margin: 0 auto 18px; display: block; box-shadow: 0 20px 60px -20px rgba(30, 144, 255, 0.55), 0 0 0 1px rgba(79, 210, 255, 0.18); }
[data-theme="light"] .auth-hero { display: none; }
[data-theme="dark"] .auth-card .logo.small-logo { display: none; }
.swatch.none { background: var(--grad) !important; color: #fff !important; border-color: transparent !important; }

/* FLUXBOT wordmark: <span class="flux-wordmark"><span class="flux-w1">FLUX</span><span class="flux-w2">BOT</span></span>
   ("FLUX" in silver chrome, "BOT" in electric blue). Any other name inside .flux-wordmark is all chrome. */
.flux-wordmark {
  font-family: var(--font-display); font-weight: 800; letter-spacing: .08em; line-height: 1.1; white-space: nowrap;
  background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.flux-wordmark .flux-w1 { background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.flux-wordmark .flux-w2 {
  background: var(--flux-bot); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 .35em rgba(30, 144, 255, 0.45));
}
[data-theme="light"] .flux-wordmark .flux-w2 { filter: none; }
@media (forced-colors: active) {
  .flux-wordmark, .flux-wordmark .flux-w1, .flux-wordmark .flux-w2, .hero h1 { background: none; color: CanvasText; filter: none; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.booting { visibility: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }

/* ---------- shared bits ---------- */
.logo { width: 26px; height: 26px; flex: none; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); flex: none; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.btn {
  height: 38px; padding: 0 16px; border-radius: 999px; font-weight: 500; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .15s, opacity .15s, border-color .15s;
}
.btn-primary { background: var(--invert); color: var(--invert-text); }
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary { border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px;
  background: transparent; border: 1px solid var(--border-strong); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 6px; }
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; background: var(--surface-2); color: var(--muted);
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #ff6a3d, #c2410c);
}
.spinner {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--text);
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- auth page ---------- */
.auth {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; overflow-y: auto;
}
.auth-card { width: 100%; max-width: 380px; text-align: center; }
.auth-card .logo { width: 44px; height: 44px; margin-bottom: 22px; }
.auth-card h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 8px; }
.auth-card .sub { color: var(--muted); font-size: 14.5px; margin-bottom: 28px; }
.auth-form { display: grid; gap: 12px; text-align: left; }
.auth-form .input { height: 50px; font-size: 15px; }
.auth-form .btn { height: 50px; font-size: 15px; margin-top: 6px; border-radius: 12px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap .icon-btn { position: absolute; right: 7px; top: 7px; }
.auth-msg { min-height: 20px; font-size: 13.5px; color: var(--danger); text-align: center; }
.auth-note {
  font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; text-align: left; line-height: 1.5;
}
.auth-foot { margin-top: 36px; font-size: 12.5px; color: var(--dim); }
.shake { animation: shake .4s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- app shell ---------- */
.app { display: flex; height: 100%; }
.sidebar {
  width: 260px; flex: none; display: flex; flex-direction: column; background: var(--sidebar);
  transition: margin-left .25s ease, transform .25s ease;
}
.app.sb-closed .sidebar { margin-left: -260px; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 14px; height: 56px; }
.sb-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .12em; font-size: 13.5px; }
.sb-nav { padding: 4px 8px; display: grid; gap: 1px; }
.sb-item {
  width: 100%; height: 38px; padding: 0 10px; border-radius: 9px; display: flex; align-items: center; gap: 10px;
  font-size: 14px; text-align: left; transition: background .15s;
}
.sb-item:hover { background: var(--hover); }
.sb-item svg { width: 18px; height: 18px; flex: none; }
.sb-item .kbd { margin-left: auto; font-size: 11.5px; color: var(--dim); opacity: 0; transition: opacity .15s; }
.sb-item:hover .kbd { opacity: 1; }
.sb-search { position: relative; }
.sb-search input {
  width: 100%; height: 38px; padding: 0 10px 0 38px; border-radius: 9px; border: 0; outline: none;
  background: transparent; font-size: 14px;
}
.sb-search input:hover, .sb-search input:focus { background: var(--hover); }
.sb-search svg { position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; color: var(--text); pointer-events: none; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px 8px 12px; }
.group-label { font-size: 12px; font-weight: 600; color: var(--dim); padding: 14px 10px 6px; }
.chat-item {
  position: relative; display: flex; align-items: center; height: 36px; border-radius: 9px; padding: 0 6px 0 10px;
  font-size: 14px; cursor: pointer; transition: background .15s;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .acts { display: none; gap: 2px; }
.chat-item:hover .acts, .chat-item.active .acts { display: flex; }
.chat-item .acts button { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--dim); }
.chat-item .acts button:hover { color: var(--text); background: var(--hover); }
.chat-item .acts svg { width: 15px; height: 15px; }
.list-empty { padding: 12px 10px; font-size: 13px; color: var(--dim); }
.sb-foot { padding: 8px; border-top: 1px solid var(--border); position: relative; }
.profile {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left;
  transition: background .15s;
}
.profile:hover { background: var(--hover); }
.profile .pinfo { min-width: 0; flex: 1; }
.profile .pname { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile .prole { font-size: 12px; color: var(--dim); }

/* popover menus */
.menu {
  position: absolute; z-index: 60; min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 8px;
  font-size: 14px; text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { padding: 8px 10px 6px; font-size: 12.5px; color: var(--dim); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px; }
.topbar .spacer { flex: 1; }
.open-sb { display: none; }
.app.sb-closed .open-sb { display: grid; }
.model-btn {
  height: 40px; padding: 0 10px 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 6px;
  font-size: 17px; font-weight: 600; transition: background .15s; max-width: 70vw;
}
.model-btn:hover { background: var(--hover); }
.model-btn .mname { color: var(--muted); font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-btn svg { width: 16px; height: 16px; color: var(--dim); flex: none; }
.model-menu { width: 360px; max-width: calc(100vw - 24px); max-height: min(520px, 70vh); display: flex; flex-direction: column; padding: 0; }
.model-menu .msearch { padding: 10px; border-bottom: 1px solid var(--border); }
.model-menu .msearch input { width: 100%; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: transparent; padding: 0 10px; outline: none; font-size: 14px; }
.model-menu .msearch input:focus { border-color: var(--accent); }
.model-menu .mlist { overflow-y: auto; padding: 6px; }
.model-opt { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-align: left; }
.model-opt:hover, .model-opt.kb { background: var(--hover); }
.model-opt .mo-main { flex: 1; min-width: 0; }
.model-opt .mo-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-opt .mo-sub { font-size: 12px; color: var(--dim); display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.model-opt .check { width: 18px; height: 18px; color: var(--text); flex: none; visibility: hidden; }
.model-opt.sel .check { visibility: visible; }

/* ---------- thread ---------- */
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.thread { max-width: 768px; margin: 0 auto; padding: 16px 24px 32px; }
.turn { margin: 0 0 28px; }
.turn.user { display: flex; flex-direction: column; align-items: flex-end; }
.bubble {
  max-width: 78%; background: var(--surface); padding: 10px 18px; border-radius: 22px;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.6; font-size: 15.5px;
}
.u-attach { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: flex-end; margin-bottom: 8px; max-width: 78%; }
.u-attach img {
  width: 200px; height: 200px; max-width: 42vw; max-height: 42vw; object-fit: cover; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); cursor: zoom-in;
}
.u-attach.one img { width: auto; height: auto; max-width: 320px; max-height: 320px; object-fit: contain; }
.file-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg); max-width: 280px; text-align: left;
}
.file-chip .ficon {
  width: 36px; height: 36px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.file-chip .ficon svg { width: 18px; height: 18px; }
.file-chip .fmeta { min-width: 0; }
.file-chip .fname { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip .fsub { font-size: 12px; color: var(--dim); }
.turn-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.turn:hover .turn-actions, .turn.last .turn-actions { opacity: 1; }
.turn-actions button { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--dim); }
.turn-actions button:hover { background: var(--hover); color: var(--text); }
.turn-actions svg { width: 17px; height: 17px; }
.turn-actions .mlabel { font-size: 12px; color: var(--dim); align-self: center; margin-left: 8px; }
.edit-box { width: 100%; max-width: 100%; background: var(--surface); border-radius: 22px; padding: 12px 16px; }
.edit-box textarea { width: 100%; border: 0; outline: none; background: transparent; resize: none; font-size: 15.5px; line-height: 1.6; max-height: 50vh; }
.edit-box .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.turn.ai .md { font-size: 15.5px; line-height: 1.7; overflow-wrap: anywhere; }
.pending-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--text); animation: breathe 1.2s ease-in-out infinite; margin: 8px 0; }
@keyframes breathe { 50% { transform: scale(.65); opacity: .5; } }
.thinking { margin-bottom: 12px; }
.thinking summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--dim); user-select: none;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary:hover { color: var(--text); }
.thinking summary svg { width: 15px; height: 15px; transition: transform .2s; }
.thinking[open] summary svg { transform: rotate(90deg); }
.thinking.live summary .tlabel {
  background: linear-gradient(90deg, var(--dim) 30%, var(--text) 50%, var(--dim) 70%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.thinking .reason {
  margin-top: 8px; padding: 2px 0 2px 16px; border-left: 2px solid var(--border-strong);
  color: var(--muted); font-size: 14px; line-height: 1.6; white-space: pre-wrap; max-height: 360px; overflow-y: auto;
}
.error-box {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--danger); background: var(--danger-soft);
  color: var(--text); padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-top: 4px;
}
.error-box svg { width: 18px; height: 18px; color: var(--danger); flex: none; margin-top: 1px; }

/* markdown */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table, .md .code-wrap { margin: 0 0 16px; }
.md h1, .md h2, .md h3, .md h4 { font-weight: 600; line-height: 1.35; margin: 24px 0 10px; }
.md h1 { font-size: 1.55em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.6em; }
.md li { margin: 6px 0; }
.md li > p { margin: 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md strong { font-weight: 600; }
.md blockquote { border-left: 3px solid var(--border-strong); padding-left: 16px; color: var(--muted); }
.md hr { border: 0; height: 1px; background: var(--border); margin: 24px 0; }
.md img { max-width: 100%; border-radius: 10px; }
.md :not(pre) > code {
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: .86em;
  background: var(--surface); padding: 2px 6px; border-radius: 6px;
}
.md .table-wrap { overflow-x: auto; margin: 0 0 16px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 0; }
.md th, .md td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
.md th { font-weight: 600; border-bottom-color: var(--border-strong); }
.code-wrap { border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--border); }
.code-head {
  display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 8px 0 14px;
  background: var(--code-head); font-size: 12px; color: var(--muted);
}
.code-head button { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.code-head button:hover { color: var(--text); background: var(--hover); }
.code-head svg { width: 14px; height: 14px; }
.md pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.md pre code { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.65; font-variant-ligatures: none; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in, .hljs-doctag { color: var(--hl-kw); }
.hljs-string, .hljs-regexp, .hljs-meta .hljs-string, .hljs-template-string { color: var(--hl-str); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--hl-num); }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--hl-fn); }
.hljs-comment, .hljs-quote { color: var(--hl-com); font-style: italic; }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-name, .hljs-tag { color: var(--hl-attr); }
.hljs-type, .hljs-class .hljs-title, .hljs-title.class_ { color: var(--hl-type); }
.hljs-variable, .hljs-params, .hljs-template-variable { color: var(--hl-var); }
.hljs-addition { color: var(--ok); } .hljs-deletion { color: var(--danger); }

/* empty state */
.main.is-empty .scroll { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; }
.main.is-empty .dock { flex: 1 1 0; }
.hero { text-align: center; padding: 0 16px 28px; }
.hero h1 { font-size: 28px; font-weight: 500; letter-spacing: -.01em; }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 768px; margin: 16px auto 0; padding: 0 24px; }
.suggest button {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 14px; color: var(--muted); transition: background .15s, color .15s;
}
.suggest button:hover { background: var(--hover); color: var(--text); }
.suggest svg { width: 17px; height: 17px; }
.main:not(.is-empty) .suggest { display: none; }

/* composer */
.dock { flex: none; padding: 0 24px 12px; position: relative; }
.to-bottom {
  position: absolute; left: 50%; top: -52px; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
  box-shadow: var(--shadow); z-index: 5;
}
.to-bottom svg { width: 18px; height: 18px; }
.composer {
  max-width: 768px; margin: 0 auto; background: var(--surface); border-radius: 28px; padding: 10px 10px 10px 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 0 0 1px var(--border); transition: box-shadow .15s;
}
.composer.drag { box-shadow: 0 0 0 2px var(--accent); }
.attach-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 4px 10px; }
.att {
  position: relative; height: 56px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg);
  display: flex; align-items: center;
}
.att.img { width: 56px; overflow: hidden; }
.att.img img { width: 100%; height: 100%; object-fit: cover; }
.att.doc { padding: 0 30px 0 8px; gap: 10px; max-width: 240px; }
.att .x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--invert); color: var(--invert-text); border: 2px solid var(--surface);
}
.att .x svg { width: 11px; height: 11px; }
.att .veil { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); }
.att.error { border-color: var(--danger); }
.composer textarea {
  display: block; width: 100%; border: 0; outline: none; background: transparent; resize: none;
  font-size: 16px; line-height: 1.5; padding: 6px 8px; max-height: 40vh; min-height: 36px;
}
.composer textarea::placeholder { color: var(--dim); }
.composer-bar { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.composer-bar .spacer { flex: 1; }
.tool-btn {
  height: 36px; min-width: 36px; padding: 0 9px; border-radius: 999px; display: flex; align-items: center; gap: 6px;
  color: var(--text); border: 1px solid var(--border); font-size: 13.5px; transition: background .15s;
}
.tool-btn:hover { background: var(--hover); }
.tool-btn svg { width: 19px; height: 19px; }
.send {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--invert); color: var(--invert-text); transition: opacity .15s;
}
.send svg { width: 18px; height: 18px; }
.send:disabled { opacity: .3; cursor: not-allowed; }
.fineprint { text-align: center; font-size: 12px; color: var(--dim); padding: 8px 0 0; }
.main.is-empty #fineprint { display: none; } /* keep the daily quota visible on the new-chat screen */
.main.is-empty #quota::before { content: none; }

/* drop overlay */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80; display: none; place-items: center; background: var(--overlay);
  backdrop-filter: blur(2px); pointer-events: none;
}
.drop-overlay.show { display: grid; }
.drop-overlay .card { text-align: center; color: #fff; }
.drop-overlay svg { width: 56px; height: 56px; margin-bottom: 10px; }
.drop-overlay h2 { font-size: 20px; font-weight: 600; }
.drop-overlay p { opacity: .8; font-size: 14px; margin-top: 4px; }

/* modals */
.modal-bg {
  position: fixed; inset: 0; z-index: 70; background: var(--overlay); display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-bg.show { display: flex; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
  animation: pop .16s ease-out;
}
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 18px 22px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.section:first-child { padding-top: 0; }
.section:last-child { border-bottom: 0; padding-bottom: 0; }
.section h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.section .hint { font-size: 13px; color: var(--dim); margin-bottom: 12px; line-height: 1.5; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.range { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin-top: 2px; }
.stack { display: grid; gap: 10px; }
.form-msg { font-size: 13px; min-height: 18px; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-row .uinfo { flex: 1; min-width: 0; }
.user-row .uname { font-size: 14px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.user-row .usub { font-size: 12.5px; color: var(--dim); }
.user-row .uacts { display: flex; gap: 4px; }
.invite-box { display: flex; gap: 8px; margin-top: 10px; }
.invite-box .input { height: 38px; font-size: 13px; }
.copy-field { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }
.empty-note { font-size: 13px; color: var(--dim); padding: 6px 0; }

/* settings: tabbed layout */
.modal.wide { max-width: 800px; }
.settings-wrap { display: flex; flex: 1; min-height: 0; }
.tabs { width: 196px; flex: none; padding: 12px 10px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.tabs button {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 9px;
  font-size: 14px; color: var(--muted); text-align: left; white-space: nowrap; flex: none;
}
.tabs button:hover { background: var(--hover); color: var(--text); }
.tabs button.on { background: var(--active); color: var(--text); font-weight: 500; }
.tabs svg { width: 18px; height: 18px; flex: none; }
.tab-body { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 24px 22px; height: min(560px, calc(100vh - 170px)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select.input {
  appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e8e8e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select.input option { background: var(--bg); color: var(--text); }
.key-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.key-row:last-child { border-bottom: 0; }
.key-row .kname { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-row .ksub { font-size: 12.5px; color: var(--dim); margin: 3px 0 10px; }
.key-row .ksub a { color: var(--accent); }
.key-row .kform { display: flex; gap: 8px; }
.key-row .kform .input { height: 38px; font-size: 13px; }
.badge.ok { background: rgba(74, 222, 128, 0.14); color: var(--ok); }
.cred-box {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface); color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.8; white-space: pre-wrap; user-select: all; overflow-wrap: anywhere; word-break: break-all;
}

/* announcement banner */
.banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; font-size: 14px; flex: none;
  background: var(--accent-soft); color: var(--text); border-bottom: 1px solid var(--border);
}
.banner > svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.banner span { flex: 1; min-width: 0; }
.banner .icon-btn { width: 30px; height: 30px; }
.banner .icon-btn svg { width: 16px; height: 16px; }

/* usage quota in the fine print */
#quota:not(:empty)::before { content: ' · '; }
#quota.low { color: var(--danger); }

/* admin: model checklist, accent swatches, log, storage */
.checklist { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.check-row:hover { background: var(--hover); }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check-row .cr-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check-row .cr-sub { font-size: 12px; color: var(--dim); }
.check-group { font-size: 12px; font-weight: 600; color: var(--dim); padding: 8px 8px 4px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; outline: 2px solid transparent; outline-offset: 2px; }
.swatch.on { outline-color: var(--text); }
.swatch.none { background: var(--surface) !important; border-color: var(--border-strong); font-size: 11px; color: var(--muted); }
.log-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.log-row:last-child { border-bottom: 0; }
.log-row .ldot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--dim); }
.log-row .ldot.bad { background: var(--danger); }
.log-row .ldot.good { background: var(--ok); }
.log-row .ldot.admin { background: var(--accent); }
.log-row .lmain { flex: 1; min-width: 0; }
.log-row .lsub { font-size: 12px; color: var(--dim); }
.log-day { font-size: 12px; font-weight: 600; color: var(--dim); padding: 14px 0 2px; }
.bar { height: 6px; border-radius: 6px; background: var(--surface); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.badge.warn { background: var(--danger-soft); color: var(--danger); }

/* on/off switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--grad); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* lightbox + toast */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.85); display: none; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox.show { display: grid; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translate(-50%, 12px); z-index: 100; padding: 10px 16px; border-radius: 10px;
  background: var(--invert); color: var(--invert-text); font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.scrim { display: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  border-radius: 8px; border: 1px solid transparent; background-clip: padding-box;
  background-color: rgba(79, 170, 255, 0.28); background-image: linear-gradient(180deg, rgba(127, 220, 255, 0.22), rgba(10, 60, 255, 0.18));
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(79, 190, 255, 0.5); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background-color: rgba(11, 102, 245, 0.24); background-image: none; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background-color: rgba(11, 102, 245, 0.42); }
@supports (-moz-appearance: none) {
  html { scrollbar-color: rgba(79, 170, 255, 0.4) transparent; }
  [data-theme="light"] { scrollbar-color: rgba(11, 102, 245, 0.3) transparent; }
}

@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; transform: translateX(-100%); margin-left: 0 !important; box-shadow: var(--shadow); }
  .app.sb-mobile-open .sidebar { transform: none; }
  .app.sb-mobile-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: var(--overlay); }
  .open-sb { display: grid !important; }
  .close-sb { display: none; }
  .thread { padding: 12px 16px 24px; }
  .dock { padding: 0 12px 10px; }
  .bubble { max-width: 88%; }
  .hero h1 { font-size: 24px; }
  .suggest { padding: 0 12px; }
  .turn-actions { opacity: 1; }
  .model-menu { position: fixed !important; left: 12px !important; right: 12px; width: auto; }
  .settings-wrap { flex-direction: column; }
  .tabs { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; }
  .tab-body { height: calc(100vh - 240px); padding: 14px 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .key-row .kform { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   FLUXBOT layer: flux-stream space background, glass + neon, the 3D
   animated logo, intro, voice, modes (personas), folders, sharing.
   ===================================================================== */
:root, [data-theme="dark"] {
  --glass: rgba(6, 12, 26, 0.56);
  --glass-strong: rgba(4, 9, 20, 0.82);
  --neon: linear-gradient(135deg, rgba(127, 220, 255, 0.62), rgba(30, 144, 255, 0.4), rgba(10, 60, 255, 0.66));
  --neon-soft: linear-gradient(135deg, rgba(127, 220, 255, 0.22), rgba(30, 144, 255, 0.13), rgba(10, 60, 255, 0.28));
}
[data-theme="light"] {
  --glass: rgba(255, 255, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --neon: linear-gradient(135deg, rgba(0, 160, 255, 0.55), rgba(11, 102, 245, 0.36), rgba(10, 60, 255, 0.52));
  --neon-soft: linear-gradient(135deg, rgba(0, 160, 255, 0.22), rgba(11, 102, 245, 0.12), rgba(10, 60, 255, 0.22));
}

/* space background: canvas stars + flux streaks (fx.js), with faint blue light beams and glow drifting behind */
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
body::before {
  content: ""; position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    linear-gradient(118deg, transparent 36%, rgba(30, 144, 255, 0.055) 43%, rgba(79, 210, 255, 0.07) 45%, rgba(30, 144, 255, 0.04) 47%, transparent 54%),
    linear-gradient(118deg, transparent 57%, rgba(79, 210, 255, 0.045) 61%, transparent 65%),
    linear-gradient(118deg, transparent 18%, rgba(10, 60, 255, 0.05) 23%, transparent 29%),
    radial-gradient(40% 35% at 18% 12%, rgba(30, 144, 255, 0.12), transparent 70%),
    radial-gradient(38% 32% at 86% 22%, rgba(10, 60, 255, 0.14), transparent 70%),
    radial-gradient(45% 40% at 60% 96%, rgba(79, 210, 255, 0.07), transparent 70%);
  animation: nebula 60s ease-in-out infinite alternate;
}
[data-theme="light"] body::before { opacity: 0.5; }
@keyframes nebula { to { transform: translate3d(3%, -2%, 0) rotate(3deg) scale(1.06); } }
.app, .auth, #nv-defs { position: relative; z-index: 1; }
body:not(.fx-off) .main, body:not(.fx-off) .auth { background: transparent; }
body.fx-off::before { display: none; }

/* glass surfaces with neon edges and a chrome top highlight */
.sidebar {
  background: var(--glass); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid rgba(79, 170, 255, 0.14); box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .sidebar { border-right-color: rgba(11, 102, 245, 0.12); }
.topbar { background: transparent; }
.composer {
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon-soft) border-box;
  border: 1px solid transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 14px 44px -18px rgba(0, 3, 12, 0.75);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.composer:focus-within {
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box;
  box-shadow: 0 0 0 1px rgba(79, 210, 255, 0.16), 0 0 36px -10px rgba(30, 144, 255, 0.75), 0 14px 44px -18px rgba(0, 3, 12, 0.75);
}
[data-theme="light"] .composer { box-shadow: 0 10px 34px -18px rgba(8, 30, 80, 0.35); }
[data-theme="light"] .composer:focus-within { box-shadow: 0 0 0 1px rgba(11, 102, 245, 0.14), 0 0 30px -12px rgba(11, 102, 245, 0.55); }
.menu, .modal {
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon-soft) border-box;
  border: 1px solid transparent; backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
}
.modal { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow); }
.modal-bg { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.bubble { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.code-wrap { background: rgba(4, 10, 22, 0.78); }
[data-theme="light"] .code-wrap { background: rgba(242, 246, 253, 0.88); }
.suggest button, .persona-card { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.suggest button:hover, .persona-card:hover { border-color: rgba(79, 190, 255, 0.4); }
.badge.accent { box-shadow: inset 0 0 0 1px rgba(79, 190, 255, 0.22); }
:focus-visible { outline-color: var(--flux-cyan); }
[data-theme="light"] :focus-visible { outline-color: var(--accent); }
.input:focus { border-color: var(--flux-blue); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 18px -6px rgba(30, 144, 255, 0.55); }
[data-theme="light"] .input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

/* micro-animations */
.sb-item, .chat-item, .suggest button, .persona-card, .tool-btn, .icon-btn, .btn { transition: background .18s, color .18s, transform .18s, box-shadow .18s, border-color .18s; }
.suggest button:hover, .persona-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -12px rgba(30, 144, 255, 0.75); }
.chat-item:hover { transform: translateX(2px); }
.btn:active, .tool-btn:active, .send:active { transform: scale(0.96); }
.turn { animation: turnIn .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes turnIn { from { opacity: 0; transform: translateY(8px); } }
.send:not(:disabled):not(.busy) { animation: sendGlow 2.8s ease-in-out infinite; }
@keyframes sendGlow { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 0 22px -2px rgba(30, 144, 255, 0.9); } }
.send.busy { position: relative; }
.send.busy::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, #7fdcff, #1e90ff, #0a3cff, #4fd2ff, #7fdcff); animation: spin 1.1s linear infinite;
}

/* ---------- the 3D FLUXBOT "F" (built by fx.js mountLogos into any [data-nova-logo]) ----------
   host [data-nova-logo] (sized by the page; --u = 1% of its width)
   └ .fx3d (perspective, glow)  └ .fx3d-tilt (pointer tilt, hero)  └ .fx3d-float (bob)  └ .fx3d-swing (idle turn)
     └ .fx3d-turn (thinking spin)  └ extrusion planes (.fx3d-l, back → front), .fx3d-face, .fx3d-glint */
[data-nova-logo] { display: inline-block; flex: none; aspect-ratio: 1 / 1; }
.sb-brand [data-nova-logo] { width: 28px; height: 28px; }
.hero-logo { width: 88px; height: 88px; margin: 0 auto 14px; display: block; }
.fx3d {
  position: relative; display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; -webkit-user-select: none;
  perspective: calc(var(--u, 1px) * 440); filter: drop-shadow(0 0 calc(var(--u, 1px) * 3) rgba(30, 144, 255, 0.4));
  opacity: 0; transition: opacity .3s ease-out;
}
.fx3d.fx3d-ready { opacity: 1; }
.fx3d-hero { perspective: calc(var(--u, 1px) * 330); filter: drop-shadow(0 0 calc(var(--u, 1px) * 4) rgba(30, 144, 255, 0.5)); }
.fx3d-sm { perspective: calc(var(--u, 1px) * 520); filter: drop-shadow(0 0 calc(var(--u, 1px) * 5) rgba(30, 144, 255, 0.45)); }
[data-theme="light"] .fx3d { filter: drop-shadow(0 calc(var(--u, 1px) * 2) calc(var(--u, 1px) * 4) rgba(10, 60, 180, 0.28)); }
.fx3d-glow {
  position: absolute; inset: 6%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(30, 144, 255, 0.4), rgba(10, 60, 255, 0.16) 55%, transparent 76%);
  animation: fxGlow 5.5s ease-in-out infinite;
}
.fx3d-hero .fx3d-glow { inset: -14%; background: radial-gradient(closest-side, rgba(79, 190, 255, 0.36), rgba(30, 144, 255, 0.16) 48%, rgba(10, 60, 255, 0.06) 66%, transparent 78%); }
[data-theme="light"] .fx3d-glow { opacity: .55; }
@keyframes fxGlow { 50% { transform: scale(1.08); opacity: .7; } }
.fx3d-tilt, .fx3d-float, .fx3d-swing, .fx3d-turn { position: absolute; inset: 0; transform-style: preserve-3d; }
.fx3d-tilt { transform: rotateY(calc(var(--px, 0) * 26deg)) rotateX(calc(var(--py, 0) * -20deg)); }
.fx3d-float { animation: fxFloat 3.4s ease-in-out infinite alternate; }
.fx3d-swing { animation: fxSwing 4.8s ease-in-out infinite alternate; }
.fx3d-hero .fx3d-swing { animation: fxSwingHero 5.6s ease-in-out infinite alternate; }
@keyframes fxFloat { from { transform: translate3d(0, 2.2%, 0); } to { transform: translate3d(0, -2.2%, 0); } }
@keyframes fxSwing { from { transform: rotateY(-25deg) rotateX(7deg); } to { transform: rotateY(25deg) rotateX(-4deg); } }
@keyframes fxSwingHero { from { transform: rotateY(-34deg) rotateX(10deg) rotateZ(-2deg); } to { transform: rotateY(34deg) rotateX(-6deg) rotateZ(2deg); } }
.fx3d-l, .fx3d-face, .fx3d-back, .fx3d-glint {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none;
  transform: translateZ(calc(var(--z, 0) * var(--u, 1px)));
}
.fx3d-l { overflow: visible; }
.fx3d-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; -webkit-user-drag: none; }
.fx3d-back { filter: brightness(.5) saturate(1.35); -webkit-user-drag: none; }
/* the specular glint that sweeps across the glass (masked to the F) */
.fx3d-glint {
  --z: .45; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  -webkit-mask: url(fluxbot-face.webp?v=6928353e8d) center / 100% 100% no-repeat; mask: url(fluxbot-face.webp?v=6928353e8d) center / 100% 100% no-repeat;
}
.fx3d-glint > i {
  position: absolute; top: -10%; bottom: -10%; left: 0; width: 34%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(220, 245, 255, 0.18) 30%, rgba(255, 255, 255, 0.72) 50%, rgba(220, 245, 255, 0.18) 70%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-130%) skewX(-20deg); animation: fxGlint 6.5s cubic-bezier(.45, .05, .25, 1) 1.2s infinite;
}
@keyframes fxGlint { 0% { transform: translateX(-130%) skewX(-20deg); } 20%, 100% { transform: translateX(330%) skewX(-20deg); } }
.fx3d-sm .fx3d-glint > i { animation-duration: 8s; }
/* hero: energy rings with comet heads + light sparks orbiting in 3D (they pass behind the F) */
.fx3d-ring { position: absolute; inset: -16%; border-radius: 50%; transform-style: preserve-3d; border: 1px solid rgba(79, 190, 255, 0.1); }
.fx3d-ring.r1 { transform: rotateX(76deg) rotateY(-10deg); }
.fx3d-ring.r2 { inset: -6%; transform: rotateX(68deg) rotateY(26deg); border-color: rgba(127, 220, 255, 0.07); }
.fx3d-ring::before {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 58%, rgba(30, 144, 255, 0.05) 62%, rgba(79, 210, 255, 0.75) 95%, #f2fbff 99.3%, transparent 99.6%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: spin 3.8s linear infinite;
}
.fx3d-ring.r2::before { animation-duration: 5.6s; animation-direction: reverse; opacity: .8; }
.fx3d-spark {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d;
  animation: fxOrbit var(--t, 7s) linear var(--d, 0s) infinite;
}
.fx3d-spark > i {
  position: absolute; display: block; border-radius: 50%;
  width: calc(var(--s, 4) * var(--u, 1px)); height: calc(var(--s, 4) * var(--u, 1px));
  margin: calc(var(--s, 4) * var(--u, 1px) / -2);
  background: radial-gradient(circle, #ffffff 0 18%, rgba(160, 230, 255, 0.9) 34%, rgba(30, 144, 255, 0.35) 58%, transparent 72%);
  animation: fxFace var(--t, 7s) linear var(--d, 0s) infinite;
}
@keyframes fxOrbit { from { transform: rotateX(var(--a, 0deg)) rotateY(0deg); } to { transform: rotateX(var(--a, 0deg)) rotateY(360deg); } }
@keyframes fxFace {
  from { transform: translateZ(calc(var(--r, 60) * var(--u, 1px))) rotateY(0deg); }
  to { transform: translateZ(calc(var(--r, 60) * var(--u, 1px))) rotateY(-360deg); }
}
[data-theme="light"] .fx3d-ring, [data-theme="light"] .fx3d-spark { opacity: .7; }
/* AI thinking: the F spins and its glow pulses (fx.js lets the last turn finish so it lands face-on) */
body.nova-thinking .fx3d-turn { animation: fxTurn 1.2s cubic-bezier(.45, .05, .55, .95) infinite; }
@keyframes fxTurn { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
body.nova-thinking:not(.nova-thinking-end) .fx3d-glow { animation: fxPulse .6s ease-in-out infinite alternate; }
@keyframes fxPulse { from { transform: scale(.92); opacity: .75; } to { transform: scale(1.22); opacity: 1; } }
/* effects off / reduced motion: a still, good-looking 3D pose */
body.fx-off .fx3d, body.fx-off .fx3d *, body.fx-off .fx3d *::before { animation: none !important; }
body.fx-off .fx3d-swing { transform: rotateY(-22deg) rotateX(9deg); }
body.fx-off .fx3d-hero .fx3d-swing { transform: rotateY(-26deg) rotateX(10deg); }
body.fx-off .fx3d-tilt { transform: none; }
body.fx-off .fx3d-spark { transform: rotateX(var(--a, 0deg)) rotateY(calc(var(--r, 60) * 5deg)); }
body.fx-off .fx3d-spark > i { transform: translateZ(calc(var(--r, 60) * var(--u, 1px))) rotateY(calc(var(--r, 60) * -5deg)); }
@media (prefers-reduced-motion: reduce) {
  .fx3d, .fx3d *, .fx3d *::before { animation: none !important; }
  .fx3d-swing { transform: rotateY(-22deg) rotateX(9deg); }
  .fx3d-hero .fx3d-swing { transform: rotateY(-26deg) rotateX(10deg); }
  .fx3d-tilt { transform: none; }
  .fx3d-spark { transform: rotateX(var(--a, 0deg)) rotateY(calc(var(--r, 60) * 5deg)); }
  .fx3d-spark > i { transform: translateZ(calc(var(--r, 60) * var(--u, 1px))) rotateY(calc(var(--r, 60) * -5deg)); }
}

/* boot-up intro: the F flies in out of the depth, spins into place with a flash, the wordmark wipes in */
.nova-intro {
  position: fixed; inset: 0; z-index: 300; display: grid; place-content: center; justify-items: center; gap: 22px; cursor: pointer; overflow: hidden;
  background: radial-gradient(ellipse 70% 60% at 50% 44%, #0b1d3f 0%, #050d1f 42%, #03060f 76%);
}
.ni-beams {
  position: absolute; inset: -30%; pointer-events: none; opacity: 0;
  background:
    linear-gradient(118deg, transparent 40%, rgba(30, 144, 255, 0.12) 47%, rgba(127, 220, 255, 0.16) 49.5%, rgba(30, 144, 255, 0.1) 52%, transparent 58%),
    linear-gradient(118deg, transparent 62%, rgba(79, 210, 255, 0.08) 65%, transparent 68%),
    linear-gradient(118deg, transparent 24%, rgba(10, 60, 255, 0.1) 29%, transparent 34%);
  animation: niBeams 1.8s cubic-bezier(.2, .7, .2, 1) forwards;
}
@keyframes niBeams { from { opacity: 0; transform: translate3d(-14%, 8%, 0); } 40% { opacity: 1; } to { opacity: .75; transform: translate3d(4%, -2%, 0); } }
.ni-stage { position: relative; width: clamp(130px, 36vw, 176px); aspect-ratio: 1; display: grid; place-items: center; }
.ni-logo { width: 100%; height: 100%; animation: niFade .35s ease-out both; }
.ni-logo .fx3d-tilt { animation: niFly .9s cubic-bezier(.16, .84, .3, 1) both; }
@keyframes niFade { from { opacity: 0; } }
@keyframes niFly {
  from { transform: translateZ(calc(var(--u, 1px) * -950)) rotateY(-540deg) rotateX(24deg); }
  to { transform: translateZ(0px) rotateY(0deg) rotateX(0deg); }
}
.ni-flash, .ni-shock { position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none; opacity: 0; }
.ni-flash {
  width: 260px; height: 260px; margin: -130px 0 0 -130px;
  background: radial-gradient(closest-side, #ffffff 0%, rgba(190, 240, 255, 0.9) 18%, rgba(79, 210, 255, 0.5) 40%, rgba(30, 144, 255, 0.18) 62%, transparent 76%);
  animation: niFlash .6s .74s ease-out forwards;
}
.ni-shock { width: 180px; height: 180px; margin: -90px 0 0 -90px; border: 2px solid rgba(127, 220, 255, 0.9); box-shadow: 0 0 18px rgba(30, 144, 255, 0.7), inset 0 0 18px rgba(30, 144, 255, 0.5); animation: niShock .75s .78s ease-out forwards; }
@keyframes niFlash { from { opacity: 0; transform: scale(.25); } 22% { opacity: 1; } to { opacity: 0; transform: scale(2.1); } }
@keyframes niShock { from { opacity: .95; transform: scale(.35); } to { opacity: 0; transform: scale(2.6); } }
.ni-word {
  position: relative; font-size: clamp(26px, 7.4vw, 40px); letter-spacing: .16em; margin-right: -.16em; text-transform: uppercase;
  clip-path: inset(-20% 100% -20% 0); animation: niWipe .5s .84s cubic-bezier(.2, .8, .2, 1) forwards;
}
.ni-word .flux-w1 {
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.95) 50%, transparent 65%) no-repeat, var(--chrome);
  background-size: 260% 100%, 100% 100%; background-position: 120% 0, 0 0; -webkit-background-clip: text; background-clip: text;
  animation: niShine 1s 1.05s ease-out forwards;
}
@keyframes niWipe { to { clip-path: inset(-20% -2% -20% 0); } }
@keyframes niShine { to { background-position: -30% 0, 0 0; } }
.nova-intro.out { animation: niOut .38s ease-in forwards; }
@keyframes niOut { to { opacity: 0; transform: scale(1.04); } }
[data-theme="light"] .nova-intro { --chrome: linear-gradient(180deg, #ffffff 0%, #f1f5fb 28%, #b4c0d0 50%, #eef3f9 70%, #c2ccda 100%); --flux-bot: linear-gradient(180deg, #8fe3ff 0%, #2d9bff 48%, #1f6fff 100%); }

/* voice */
.tool-btn.rec { color: #fff; background: #ef4444; border-color: transparent; animation: recPulse 1.3s ease-in-out infinite; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25); } }
.tool-btn.on { color: #fff; background: var(--grad); border-color: transparent; box-shadow: var(--glow); }
.tool-btn .rec-time { font-variant-numeric: tabular-nums; font-size: 12.5px; }
.voice-status { max-width: 768px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.voice-bars { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.voice-bars i { width: 3px; height: 6px; border-radius: 3px; background: var(--grad); animation: bars 1s ease-in-out infinite; }
.voice-bars i:nth-child(2) { animation-delay: .15s; }
.voice-bars i:nth-child(3) { animation-delay: .3s; }
.voice-bars i:nth-child(4) { animation-delay: .45s; }
@keyframes bars { 50% { height: 18px; } }
.turn-actions button.speaking { color: var(--accent); }

/* modes (personas) */
.persona-btn {
  height: 34px; padding: 0 12px 0 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--muted); border: 1px solid var(--border); margin-left: 4px; max-width: 42vw;
}
.persona-btn:hover { color: var(--text); background: var(--hover); }
.persona-btn.set { color: var(--text); background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box; border-color: transparent; }
.persona-btn span.pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.personas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 768px; margin: 14px auto 0; padding: 0 24px; }
.persona-card { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); font-size: 14px; color: var(--muted); }
.persona-card.on { color: var(--text); background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box; border-color: transparent; }
.persona-card .pe, .persona-btn .pe { font-size: 16px; line-height: 1; }
.main:not(.is-empty) .personas { display: none; }
.persona-opt { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; text-align: left; }
.persona-opt:hover { background: var(--hover); }
.persona-opt .pe { font-size: 20px; width: 26px; text-align: center; }
.persona-opt .po-name { font-size: 14px; font-weight: 500; }
.persona-opt .po-desc { font-size: 12.5px; color: var(--dim); }
.persona-opt.sel { background: var(--active); }

/* folders + pins */
.group-label.folder { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; border-radius: 8px; padding-right: 8px; }
.group-label.folder:hover { color: var(--text); }
.group-label.folder svg { width: 14px; height: 14px; flex: none; transition: transform .2s; }
.group-label.folder.collapsed svg.fchev { transform: rotate(-90deg); }
.group-label.folder .fcount { margin-left: auto; font-weight: 500; }
.chat-item .ci-icon { width: 14px; height: 14px; color: var(--accent); flex: none; margin-right: 6px; }
.chat-item .more { opacity: 0; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: var(--dim); flex: none; }
.chat-item:hover .more, .chat-item.active .more { opacity: 1; }
.chat-item .more:hover { color: var(--text); background: var(--hover); }
.chat-item .more svg { width: 16px; height: 16px; }

/* shared chat view + memory list */
.share-banner {
  max-width: 768px; margin: 12px auto 0; padding: 10px 14px; border-radius: 12px; display: flex; align-items: center; gap: 12px; font-size: 14px;
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon-soft) border-box; border: 1px solid transparent;
}
.share-banner span { flex: 1; }
.main.readonly .dock .composer, .main.readonly .suggest, .main.readonly .personas { display: none; }
.memory-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.memory-row:last-child { border-bottom: 0; }
.memory-row span { flex: 1; }

@media (max-width: 768px) {
  .persona-btn span.pn { display: none; }
  .personas { padding: 0 12px; }
  .chat-item .more { opacity: 1; }
}
/* "Starfield & animations" off / reduced motion: the background and the busy glows stop too */
body.fx-off .send, body.fx-off .send.busy::before { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  body::before, .send, .send.busy::before, .turn { animation: none !important; }
}

/* iOS home-screen app: the status bar is translucent and the page runs edge to edge (viewport-fit=cover),
   so keep the bars clear of the notch, the rounded corners and the home indicator. All 0 elsewhere. */
.app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.app.sb-closed .sidebar { margin-left: calc(-260px - env(safe-area-inset-left)); }
.sb-top { height: calc(56px + env(safe-area-inset-top)); padding-top: calc(10px + env(safe-area-inset-top)); }
.topbar { height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
.banner:not([hidden]) { padding-top: calc(8px + env(safe-area-inset-top)); }
.banner:not([hidden]) + .topbar { height: 56px; padding-top: 0; }
.sb-foot { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.dock { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
@media (max-width: 768px) {
  .dock { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* =====================================================================
   FLUXBOT Control in the chat app: console links, model lock, switched-model
   note, reply feedback, notifications, lockdown, kill switches, invites,
   devices.
   ===================================================================== */

/* admin console link (Settings tab list + profile menu) */
.tabs .tab-link {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 9px; flex: none; margin-top: auto;
  font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--text);
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box; border: 1px solid transparent;
  transition: box-shadow .18s, transform .18s;
}
.tabs .tab-link:hover { box-shadow: var(--glow); transform: translateY(-1px); }
.tabs .tab-link svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.tabs .tab-link .ext { margin-left: auto; padding-left: 6px; color: var(--dim); font-size: 13px; }
.menu-item.menu-control { font-weight: 600; margin-bottom: 4px; background: var(--neon-soft); }
.menu-item.menu-control:hover { background: var(--neon); }
.menu-item.menu-control svg { color: var(--accent); }
.menu-item.menu-control span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* model lock */
.model-btn .mlock { width: 14px; height: 14px; color: var(--accent); display: none; }
.model-btn.locked .mlock { display: block; }
.model-btn.locked .mchev { display: none; }
.lock-pop { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-width: 0; width: max-content; max-width: min(320px, calc(100vw - 24px)); }
.lock-pop .lp-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.lock-pop .lp-icon svg { width: 18px; height: 18px; }
.lock-pop .lp-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.lock-pop .lp-sub { font-size: 12.5px; color: var(--muted); }

/* "switched to a backup model" note under a reply */
.switch-note {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted); background: var(--neon-soft); border: 1px solid var(--border); max-width: 100%;
}

/* thumbs up / down */
.turn-actions .vote-btn.on { color: var(--accent); }
.turn-actions .vote-btn.on svg path:last-child { fill: currentColor; fill-opacity: .22; }
.turn-actions .vote-btn.pop svg { animation: votePop .38s cubic-bezier(.2, .8, .2, 1); }
@keyframes votePop { 40% { transform: scale(1.32) rotate(-10deg); } }

/* notifications bell + panel */
.bell-btn { position: relative; }
.bell-badge {
  position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; pointer-events: none;
  background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg);
  animation: pop .2s ease-out;
}
.bell-btn.has-unread svg { color: var(--text); transform-origin: 50% 10%; animation: bellRing 1.1s ease-in-out 1; }
@keyframes bellRing { 20% { transform: rotate(14deg); } 40% { transform: rotate(-10deg); } 60% { transform: rotate(6deg); } 80% { transform: rotate(-3deg); } }
.inbox-panel { width: 380px; max-width: calc(100vw - 16px); padding: 0; }
.ib-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--border); background: var(--glass-strong);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ib-head b { font-size: 14.5px; font-weight: 600; }
.ib-clear { font-size: 12.5px; font-weight: 500; color: var(--accent); padding: 5px 8px; border-radius: 7px; }
.ib-clear:hover { background: var(--hover); }
.ib-list { padding: 6px; }
.ib-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; transition: background .2s; }
.ib-item + .ib-item { margin-top: 2px; }
.ib-item.unread { background: var(--accent-soft); }
.ib-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.ib-item.unread .ib-dot { background: var(--grad); box-shadow: 0 0 8px rgba(30, 144, 255, .75); }
.ib-item.urgent.unread .ib-dot { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, .7); }
.ib-main { flex: 1; min-width: 0; }
.ib-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.ib-urgent { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: #ef4444; padding: 1px 6px; border-radius: 5px; }
.ib-text { font-size: 13.5px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.ib-meta { font-size: 12px; color: var(--dim); margin-top: 4px; }
.ib-empty { display: grid; justify-items: center; gap: 4px; padding: 30px 16px; text-align: center; font-size: 14px; color: var(--muted); }
.ib-empty svg { width: 28px; height: 28px; color: var(--dim); margin-bottom: 4px; }
.ib-empty small { font-size: 12.5px; color: var(--dim); }

/* urgent notification pop-up */
#urgentModal { z-index: 95; }
.modal.urgent-card {
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, linear-gradient(135deg, #f97316, #ef4444 45%, #1e90ff) border-box;
  box-shadow: 0 0 44px -12px rgba(239, 68, 68, .6), var(--shadow);
}
.urg-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.urg-text { font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.urg-time { font-size: 12.5px; color: var(--dim); margin-top: 12px; }

/* kill switches */
.paused-note {
  max-width: 768px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 12px;
  border-radius: 12px; font-size: 13px; color: var(--text); background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .32);
}
.paused-note svg { width: 16px; height: 16px; flex: none; color: #f59e0b; }
body.no-voice .turn-actions .act-speak { display: none; }
body.no-uploads .suggest [data-upload] { display: none; }

/* lockdown: slim banner for admins */
.lock-banner {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; flex: none; font-size: 13px; font-weight: 500; color: #fff;
  background: linear-gradient(90deg, #b91c1c, #ef4444 50%, #b91c1c); background-size: 200% 100%; animation: lockSlide 8s linear infinite;
}
.lock-banner svg { width: 15px; height: 15px; flex: none; }
.lock-banner span { flex: 1; min-width: 0; }
.lock-banner a { color: #fff; font-weight: 600; white-space: nowrap; text-underline-offset: 2px; }
@keyframes lockSlide { to { background-position: -200% 0; } }
.lock-banner:not([hidden]) { padding-top: calc(6px + env(safe-area-inset-top)); }
.lock-banner:not([hidden]) ~ .banner:not([hidden]) { padding-top: 8px; }
.lock-banner:not([hidden]) ~ .topbar { height: 56px; padding-top: 0; }

/* lockdown: full-screen for members */
.lockdown {
  position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto; animation: fade .3s ease-out;
  background:
    radial-gradient(60% 45% at 50% 22%, rgba(30, 144, 255, .2), transparent 70%),
    radial-gradient(50% 40% at 50% 100%, rgba(10, 60, 255, .18), transparent 70%),
    var(--glass-strong);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.ld-card { width: 100%; max-width: 440px; text-align: center; animation: pop .35s cubic-bezier(.2, .8, .2, 1); }
.ld-logo-wrap { position: relative; width: 132px; height: 132px; margin: 0 auto 18px; display: grid; place-items: center; }
.ld-logo { width: 92px; height: 92px; }
.ld-logo img { width: 100%; height: 100%; }
.ld-ring {
  position: absolute; inset: 0; border-radius: 50%; opacity: .9;
  background: conic-gradient(from 0deg, #7fdcff, #1e90ff, #0a3cff, #ef4444, #7fdcff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
  animation: spin 7s linear infinite; filter: drop-shadow(0 0 10px rgba(30, 144, 255, .6));
}
.ld-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #fecaca; background: rgba(239, 68, 68, .16); border: 1px solid rgba(239, 68, 68, .4);
}
[data-theme="light"] .ld-chip { color: #b91c1c; }
.ld-chip svg { width: 13px; height: 13px; }
.lockdown h1 { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin: 14px 0 8px; }
.ld-sub { max-width: 360px; margin: 0 auto 22px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.ld-msg {
  margin: 0 0 22px; padding: 14px 16px; border-radius: 14px; text-align: left;
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box; border: 1px solid transparent;
}
.ld-msg-label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.ld-msg-text { font-size: 15.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ld-out svg { width: 16px; height: 16px; }
.ld-status { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--dim); }
.ld-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: breathe 1.6s ease-in-out infinite; }

/* invite friends */
.inv-intro { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.inv-closed { margin-bottom: 14px; }
.inv-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inv-field { display: block; }
.inv-field .field-label { margin-bottom: 4px; }
.inv-field .input { height: 40px; font-size: 14px; }
.inv-note { grid-column: 1 / -1; }
.inv-create { display: flex; justify-content: flex-end; margin-top: 12px; }
.inv-result {
  margin-top: 14px; padding: 12px; border-radius: 12px; animation: pop .2s ease-out;
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box; border: 1px solid transparent;
}
.inv-result .field-label { margin: 0; }
.inv-result .invite-box { margin-top: 6px; }
.inv-list-head { font-size: 14px; font-weight: 600; margin: 22px 0 2px; }
.inv-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.inv-row:last-child { border-bottom: 0; }
.inv-row.spent { opacity: .65; }
.inv-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--accent); }
.inv-icon svg { width: 17px; height: 17px; }
.inv-info { flex: 1; min-width: 0; }
.inv-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-sub { font-size: 12.5px; color: var(--dim); }
.inv-acts { display: flex; gap: 6px; flex: none; }

/* your devices */
.device-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.device-row:last-child { border-bottom: 0; }
.device-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--muted); }
.device-row.current .device-icon { background: var(--accent-soft); color: var(--accent); }
.device-icon svg { width: 18px; height: 18px; }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.device-sub { font-size: 12.5px; color: var(--dim); overflow-wrap: anywhere; }
.device-foot { display: flex; justify-content: flex-end; margin-top: 10px; }

@media (max-width: 768px) {
  .inbox-panel { position: fixed !important; left: 8px !important; right: 8px; width: auto; max-width: none; }
  .model-btn { min-width: 0; }
  .model-btn #modelBrand { white-space: nowrap; flex: none; }
  .model-btn .mname { min-width: 0; }
  .tabs .tab-link { margin-top: 0; }
}
@media (max-width: 480px) {
  .inv-form { grid-template-columns: 1fr; }
  .inv-row { flex-wrap: wrap; }
  .inv-acts { width: 100%; justify-content: flex-end; }
  .inv-result .invite-box { flex-wrap: wrap; }
  .inv-result .invite-box .input { flex: 1 1 100%; }
  .lockdown h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .lock-banner, .ld-ring, .ld-dot, .bell-btn.has-unread svg, .vote-btn.pop svg { animation: none !important; }
}

/* terms & privacy (blocking) */
#termsModal { z-index: 96; }
.modal.terms-card { max-width: 440px; }
.terms-card .modal-body { padding-top: 26px; text-align: center; }
.terms-logo { width: 64px; height: 64px; margin: 0 auto 10px; display: block; }
.terms-title { font-size: 21px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 8px; }
.terms-summary { font-size: 14.5px; line-height: 1.55; color: var(--muted); margin: 0 auto 16px; max-width: 360px; }
.terms-links { display: grid; gap: 8px; text-align: left; margin-bottom: 14px; }
.terms-links a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; text-decoration: none; font-size: 14.5px; font-weight: 500;
  background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon-soft) border-box; border: 1px solid transparent;
  transition: background .18s, box-shadow .18s, transform .18s;
}
.terms-links a:hover { background: linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box, var(--neon) border-box; box-shadow: var(--glow); transform: translateY(-1px); }
.terms-links svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.terms-links .ext { margin-left: auto; color: var(--dim); }
.terms-note { text-align: left; margin-bottom: 12px; }
.terms-check {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; cursor: pointer; text-align: left;
  font-size: 14.5px; font-weight: 500; background: var(--surface); border: 1px solid var(--border-strong); transition: border-color .18s, background .18s;
}
.terms-check:hover { border-color: var(--accent); }
.terms-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.terms-check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--accent); cursor: pointer; }
.terms-meta { font-size: 12px; color: var(--dim); margin-top: 10px; }
.terms-card .form-msg { margin-top: 6px; }
.terms-card .modal-foot { justify-content: space-between; }

/* legal links: profile menu + Settings → Account */
.menu-legal { display: flex; justify-content: center; gap: 8px; padding: 6px 10px 4px; font-size: 12px; color: var(--dim); }
.menu-legal a { color: var(--dim); text-decoration: none; }
.menu-legal a:hover { color: var(--text); text-decoration: underline; }
.legal-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--accent); text-decoration: underline; }
