/* ============================================================================
   XMPP Postman — 2026 UI system
   Glassmorphic dark theme · layered aurora backdrop · gradient accents
   ============================================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  /* surfaces */
  --bg-0: #07080d;
  --bg-1: #0c0e16;
  --glass: rgba(22, 26, 38, 0.62);
  --glass-2: rgba(30, 35, 50, 0.55);
  --glass-hi: rgba(45, 52, 72, 0.6);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);

  /* text */
  --fg: #e8ecf4;
  --fg-2: #aab4c5;
  --fg-3: #6f7b90;

  /* ── design tokens ───────────────────────────────────────────── */
  /* primary scale — Doot indigo (#7269ef) */
  --primary-50: #f1f0fe; --primary-100: #e4e2fc; --primary-200: #cbc7f9;
  --primary-300: #aaa4f5; --primary-400: #897ff1; --primary-500: #7269ef;
  --primary-600: #5b50e0; --primary-700: #4a40c0; --primary-800: #3d369c;

  /* brand gradient */
  --acc-1: #7269ef; /* Doot indigo */
  --acc-2: #8b5cf6; /* violet */
  --acc-3: #22d3ee; /* cyan   */
  --accent: #7269ef;
  --grad: linear-gradient(135deg, var(--acc-1), var(--acc-2) 55%, var(--acc-3));

  /* status */
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.14);
  --red: #fb7185;
  --red-bg: rgba(251, 113, 133, 0.14);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.14);
  --blue-bg: rgba(114, 105, 239, 0.16);

  /* typography scale */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 11px; --text-sm: 12.5px; --text-md: 14px; --text-lg: 16px; --text-xl: 20px; --text-2xl: 26px;

  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  /* radius scale */
  --radius-xs: 6px; --radius-sm: 10px; --radius: 14px; --radius-lg: 18px; --radius-full: 999px;

  /* elevation scale (theme-aware — dark values here, light overrides in body.light) */
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --elev-2: 0 4px 14px rgba(0, 0, 0, 0.42);
  --elev-3: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

/* ---- light theme (default) — Figma-style: airy, soft shadows, crisp borders ---- */
body.light {
  --bg-0: #f5f7fb; --bg-1: #ffffff;
  --glass: rgba(255, 255, 255, 0.86); --glass-2: rgba(248, 250, 253, 0.92); --glass-hi: rgba(20, 30, 70, 0.045);
  --line: rgba(20, 30, 70, 0.09); --line-2: rgba(20, 30, 70, 0.15);
  --fg: #161c2c; --fg-2: #434d63; --fg-3: #79839a;
  --shadow: 0 16px 44px rgba(40, 55, 95, 0.13); --shadow-sm: 0 4px 18px rgba(40, 55, 95, 0.08);
  /* Doot/Figma-grade soft elevation for light theme */
  --elev-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --elev-2: 0 4px 10px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --elev-3: 0 16px 24px -6px rgba(16, 24, 40, 0.12), 0 6px 8px -4px rgba(16, 24, 40, 0.05);
  --green-bg: rgba(16, 160, 100, 0.13); --red-bg: rgba(225, 55, 90, 0.11); --blue-bg: rgba(99, 102, 241, 0.1); --yellow-bg: rgba(190, 140, 20, 0.14);
}
body.light::before { opacity: 0.3; filter: blur(34px); }
body.light .topbar, body.light .sidebar, body.light .rail, body.light .builder, body.light .resp-head { background: rgba(255, 255, 255, 0.8); }
body.light .code, body.light .stanza, body.light .rpane, body.light .runner-log, body.light textarea, body.light input, body.light select, body.light .meet-grid { background: rgba(248, 250, 253, 0.9); }
body.light .profile-menu { background: rgba(255, 255, 255, 0.99); }
body.light .jkey { color: #0b66c2; } body.light .jstr { color: #157f3b; } body.light .jnum { color: #b25000; } body.light .jbool { color: #7a3cc0; } body.light .jnull { color: #8a93a6; }
body.light .call-overlay { background: #0c0e16; } /* keep call stage dark for video */
body.light .auth-screen { background: linear-gradient(135deg, #eef1f8, #f6f8fc); }

/* the hidden attribute must always win over component display rules
   (author display:flex on .modal/.toast would otherwise override [hidden]) */
[hidden] { display: none !important; }

body {
  background: var(--bg-0);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* aurora backdrop */
body::before {
  content: "";
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 18% 12%, rgba(99, 102, 241, 0.22), transparent 70%),
    radial-gradient(40% 50% at 82% 8%, rgba(34, 211, 238, 0.16), transparent 70%),
    radial-gradient(50% 60% at 55% 30%, rgba(139, 92, 246, 0.14), transparent 70%);
  filter: blur(20px);
  z-index: -1;
  pointer-events: none;
}

::selection { background: rgba(124, 132, 255, 0.32); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: content-box; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 18px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: -0.2px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.brand-sub {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 700; font-size: 11px; padding: 3px 8px;
  border: 1px solid var(--line-2); border-radius: 8px;
}
.conn { display: flex; align-items: center; gap: 9px; }
.conn label { color: var(--fg-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.divider { width: 1px; height: 24px; background: var(--line); margin: 0 5px; }

/* HTTP ⇄ XMPP mode switch */
.mode-switch { display: inline-flex; background: var(--glass-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.mode-btn { background: none; border: none; color: var(--fg-3); font-weight: 800; font-size: 11px; letter-spacing: 0.4px; padding: 6px 14px; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
.mode-btn:hover { color: var(--fg-2); }
.mode-btn.active { color: #fff; background: var(--grad); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35); }

/* console (Postman-style log) */
.console-panel { position: fixed; left: 0; right: 0; bottom: 0; height: 42vh; z-index: 58; background: var(--glass); backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); border-top: 1px solid var(--line-2); box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; animation: bubbleIn 0.2s; }
.console-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.console-body { flex: 1; overflow: auto; padding: 4px; font-family: var(--mono); font-size: 12px; }
.con-row { border-bottom: 1px solid var(--line); }
.con-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.con-line:hover { background: var(--glass-hi); }
.con-verb { font-weight: 800; font-size: 10px; padding: 2px 6px; border-radius: 5px; min-width: 48px; text-align: center; }
.con-verb.get { background: var(--blue-bg); color: var(--accent); }
.con-verb.post, .con-verb.put, .con-verb.patch { background: var(--green-bg); color: var(--green); }
.con-verb.delete { background: var(--red-bg); color: var(--red); }
.con-url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.con-meta { color: var(--fg-3); font-size: 11px; }
.con-row.err .con-meta { color: var(--red); } .con-row.ok .con-meta { color: var(--green); }
.con-detail { padding: 4px 14px 14px; background: rgba(0, 0, 0, 0.12); }
.con-sec { margin-top: 8px; } .con-sec-h { color: var(--accent); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.con-detail pre { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--fg-2); font-size: 11.5px; max-height: 240px; overflow: auto; }

/* inactivity lock */
.lock-screen { position: fixed; inset: 0; z-index: 95; background: rgba(6, 8, 14, 0.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: flex; align-items: center; justify-content: center; }
.lock-card { width: 360px; max-width: 92vw; background: var(--glass); backdrop-filter: blur(28px) saturate(150%); border: 1px solid var(--line-2); border-radius: 20px; padding: 28px; text-align: center; box-shadow: var(--shadow); animation: pop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.lock-emoji { font-size: 42px; }
.lock-title { font-weight: 800; font-size: 19px; margin: 8px 0 4px; }
.lock-name { color: var(--fg-3); font-size: 12px; font-family: var(--mono); margin-bottom: 16px; }
.lock-card input { width: 100%; margin-bottom: 12px; }
.env-vars { max-height: 300px; overflow: auto; }

/* variable hover preview (Postman-style) */
.var-tip { position: fixed; z-index: 120; min-width: 180px; max-width: 380px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; font-family: var(--mono); font-size: 11.5px; pointer-events: none; animation: bubbleIn 0.12s; }
.vt-row { display: flex; justify-content: space-between; gap: 16px; padding: 3px 6px; border-radius: 6px; }
.vt-row:hover { background: var(--glass-hi); }
.vt-row b { color: var(--accent); font-weight: 700; }
.vt-row span { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-row i { color: var(--fg-3); }

.pm-guest { font-size: 11px; color: var(--fg-3); line-height: 1.5; padding: 8px 10px; background: var(--glass-hi); border-radius: 9px; }

/* request context menu */
.ctx-menu { position: fixed; z-index: 130; min-width: 168px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; animation: bubbleIn 0.12s; }
.ctx-item { padding: 7px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--fg-2); cursor: pointer; white-space: nowrap; }
.ctx-item:hover { background: var(--glass-hi); color: var(--fg); }
.ctx-item.danger { color: var(--red); }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* deeper stylized polish */
.btn { transition: transform 0.12s cubic-bezier(0.2, 0.9, 0.3, 1.2), background 0.15s, box-shadow 0.15s, border-color 0.15s; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 6px 18px rgba(99, 102, 241, 0.32); }
.btn.primary:hover { box-shadow: 0 9px 26px rgba(99, 102, 241, 0.46); transform: translateY(-1px); }
.mode-btn.active { box-shadow: 0 2px 10px rgba(99, 102, 241, 0.28); }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--blue-bg); outline: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); background-clip: padding-box; }
/* assistant bot glow-up */
#assistantFab, .assistant-fab { transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.2s; }
#assistantFab:hover, .assistant-fab:hover { transform: scale(1.08) rotate(-4deg); }

/* HTTP request niceties */
.body-type { margin-bottom: 10px; }
.body-type select { font-size: 12px; font-weight: 600; padding: 6px 10px; }
.tab-pane[data-pane="auth"] .fld { margin-bottom: 10px; }

/* ---------------------------------------------------------------- inputs */
select, input, textarea {
  background: var(--glass-2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
select:hover, input:hover, textarea:hover { border-color: var(--line-2); }
select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 132, 255, 0.18);
  background: rgba(30, 35, 50, 0.8);
}
::placeholder { color: var(--fg-3); }

/* ---------------------------------------------------------------- buttons */
.btn {
  background: var(--glass-2);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.12s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--line-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}
.btn.primary:hover { box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 10px; font-size: 11px; }
.btn.danger { color: var(--red); border-color: rgba(251, 113, 133, 0.3); }
.btn.danger:hover { background: var(--red-bg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------------------------------------------------------------- status pill */
.pill {
  font-size: 11px; padding: 5px 12px; border-radius: 20px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; letter-spacing: 0.2px;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; }
.pill.offline { background: rgba(111, 123, 144, 0.14); color: var(--fg-3); }
.pill.connecting { background: var(--yellow-bg); color: var(--yellow); }
.pill.connecting::before { animation: pulse 1.2s infinite; }
.pill.online { background: var(--green-bg); color: var(--green); }
.pill.online::before { animation: pulse 2s infinite; }
.pill.error { background: var(--red-bg); color: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------------------------------------------------------------- layout */
.app { flex: 1; display: grid; grid-template-columns: 290px 1fr; min-height: 0; gap: 0; }
.sidebar {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.main { display: flex; flex-direction: column; min-height: 0; }

/* ---------------------------------------------------------------- sidebar */
.side-tabs { display: flex; padding: 8px 8px 0; gap: 4px; }
.side-tab {
  flex: 1; background: none; border: none; color: var(--fg-3);
  padding: 9px; cursor: pointer; font-size: 12px; font-weight: 600;
  border-radius: 9px 9px 0 0; position: relative; transition: color 0.15s;
}
.side-tab:hover { color: var(--fg-2); }
.side-tab.active { color: var(--fg); background: var(--glass-2); }
.side-tab.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--grad); border-radius: 2px; }
.side-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }
.tree { flex: 1; overflow: auto; padding: 8px; }

.coll { margin-bottom: 3px; }
.coll-head, .folder-head {
  display: flex; align-items: center; gap: 7px; padding: 7px 8px;
  border-radius: 9px; cursor: pointer; font-weight: 600; transition: background 0.12s;
}
.coll-head:hover, .folder-head:hover, .req:hover { background: var(--glass-hi); }
.caret { color: var(--fg-3); font-size: 10px; width: 10px; transition: transform 0.15s; }
.coll-actions { margin-left: auto; display: none; gap: 2px; }
.coll-head:hover .coll-actions { display: flex; }
.coll-actions button { background: none; border: none; color: var(--fg-3); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 6px; transition: color 0.12s, background 0.12s; }
.coll-actions button:hover { color: var(--accent); background: var(--blue-bg); }
.coll-body, .folder-body { margin-left: 13px; border-left: 1px solid var(--line); padding-left: 5px; margin-top: 2px; }
.req { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; cursor: pointer; transition: background 0.12s; }
.req.active { background: var(--blue-bg); box-shadow: inset 0 0 0 1px rgba(124, 132, 255, 0.25); }
.verb-tag { font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 5px; letter-spacing: 0.4px; flex-shrink: 0; }
.verb-tag.post { background: var(--green-bg); color: var(--green); }
.verb-tag.get { background: var(--blue-bg); color: var(--accent); }
.req-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.muted { color: var(--fg-3); font-size: 12px; padding: 14px; text-align: center; line-height: 1.6; }

/* ---------------------------------------------------------------- builder */
.builder {
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.req-line { display: flex; gap: 9px; }
.verb { width: 96px; font-weight: 800; font-size: 12px; }
.ev { flex: 1; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.send { white-space: nowrap; padding-inline: 22px; }
.req-meta { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--fg-3); }
.req-meta label { text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; font-size: 10px; }
.reqname { width: 210px; }
.tojid { flex: 1; font-family: var(--mono); }

.tabs, .resp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab, .rtab {
  background: none; border: none; color: var(--fg-3);
  padding: 8px 14px; cursor: pointer; font-size: 12px; font-weight: 600;
  position: relative; transition: color 0.15s; border-radius: 8px 8px 0 0;
}
.tab:hover, .rtab:hover { color: var(--fg-2); }
.tab.active, .rtab.active { color: var(--fg); }
.tab.active::after, .rtab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--grad); border-radius: 2px; }
.tab-body { min-height: 132px; padding-top: 12px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.kv { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.kv-row { display: flex; gap: 7px; align-items: center; }
.kv-row input { flex: 1; font-family: var(--mono); font-size: 12px; }
.kv-row input.k { max-width: 200px; }
.kv-row button { background: none; border: none; color: var(--fg-3); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; transition: color 0.12s, background 0.12s; }
.kv-row button:hover { color: var(--red); background: var(--red-bg); }

.code {
  width: 100%; min-height: 132px; resize: vertical;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: rgba(7, 8, 13, 0.6); tab-size: 2;
}
.code.tall { min-height: 380px; }
.hint { color: var(--fg-3); font-size: 11px; margin-top: 8px; line-height: 1.7; }
.hint code { background: var(--glass-hi); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); color: var(--fg-2); }
.stanza {
  background: rgba(7, 8, 13, 0.7); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; overflow: auto; font-family: var(--mono); font-size: 12px;
  color: var(--fg-2); white-space: pre-wrap; max-height: 240px; line-height: 1.6;
}

/* ---------------------------------------------------------------- response */
.response { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.resp-head {
  display: flex; align-items: center; gap: 12px; padding: 11px 18px;
  border-bottom: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.resp-tabs { margin-left: auto; border: none; }
.badge { font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 8px; letter-spacing: 0.4px; }
.badge.idle { background: rgba(111, 123, 144, 0.14); color: var(--fg-3); }
.badge.ok { background: var(--green-bg); color: var(--green); box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.25); }
.badge.err { background: var(--red-bg); color: var(--red); box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.25); }
.resp-meta { color: var(--fg-3); font-size: 11px; font-family: var(--mono); }
.resp-body { flex: 1; overflow: auto; min-height: 0; }
.rpane { display: none; margin: 0; padding: 16px 18px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.rpane.active { display: block; animation: fade 0.2s ease; }
.tline { padding: 4px 0; font-weight: 600; }
.tline.pass { color: var(--green); }
.tline.fail { color: var(--red); }

/* json syntax colors */
.jkey { color: #93c5fd; } .jstr { color: #86efac; } .jnum { color: #fdba74; } .jbool { color: #c4b5fd; } .jnull { color: var(--fg-3); }

/* ---------------------------------------------------------------- modals */
.modal {
  position: fixed; inset: 0; background: rgba(4, 5, 10, 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fade 0.18s ease;
}
.modal-card {
  background: var(--glass); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: var(--sp-5);
  width: 460px; max-width: 92vw; box-shadow: var(--elev-3);
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-card.wide { width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.modal-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; font-size: 12px; color: var(--fg-2); }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--fg-3); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.fld input, .fld select { font-size: 13px; color: var(--fg); text-transform: none; letter-spacing: normal; font-weight: 400; }
.runner-log { background: rgba(7, 8, 13, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 62vh; overflow: auto; font-family: var(--mono); font-size: 12px; }
.run-row { padding: 5px 4px; display: flex; gap: 9px; align-items: baseline; border-radius: 7px; }
.run-row.pass { color: var(--green); } .run-row.fail { color: var(--red); background: var(--red-bg); } .run-row.skip { color: var(--fg-3); }
.run-detail { color: var(--fg-3); font-size: 11px; padding: 0 0 8px 26px; white-space: pre-wrap; line-height: 1.6; }

/* ---------------------------------------------------------------- docs */
.docs-body { max-height: 66vh; overflow: auto; padding-right: 8px; line-height: 1.7; }
.docs-body h3 { margin: 18px 0 8px; font-size: 14px; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.docs-body h3:first-child { margin-top: 0; }
.docs-body p, .docs-body li { color: var(--fg-2); font-size: 12.5px; }
.docs-body code { background: var(--glass-hi); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); font-size: 11.5px; color: #93c5fd; }
.docs-body pre { background: rgba(7, 8, 13, 0.7); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); }
.docs-body ul { padding-left: 20px; margin: 6px 0; }
.docs-body .kbd { background: var(--glass-hi); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; font-family: var(--mono); font-size: 11px; }
.docs-grid { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 12px; margin: 6px 0; }
.docs-grid b { color: var(--accent); font-family: var(--mono); font-weight: 600; }

/* ---------------------------------------------------------------- auth screen */
.auth-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 80; }
.auth-card { width: 380px; max-width: 92vw; background: var(--glass); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%); border: 1px solid var(--line-2); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); animation: pop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.auth-brand { font-weight: 800; font-size: 18px; text-align: center; margin-bottom: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-sub { text-align: center; color: var(--fg-3); font-size: 12px; margin-bottom: 18px; }
.auth-tabs { display: flex; gap: 4px; background: var(--glass-2); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; background: none; border: none; color: var(--fg-3); padding: 9px; cursor: pointer; font-size: 13px; font-weight: 600; border-radius: 8px; transition: all 0.15s; }
.auth-tab.active { color: #fff; background: var(--grad); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35); }
.auth-msg { color: var(--red); font-size: 12px; min-height: 18px; margin-top: 10px; text-align: center; }
.auth-foot { color: var(--fg-3); font-size: 11px; line-height: 1.6; margin-top: 12px; text-align: center; }
.auth-card .fld { margin-bottom: 14px; }
.user-chip { font-size: 12px; color: var(--fg-2); font-weight: 600; }
.adv { margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; }
.adv summary { cursor: pointer; font-size: 11.5px; color: var(--fg-3); font-weight: 600; padding: 6px 0; user-select: none; }
.adv[open] summary { margin-bottom: 6px; }

/* ---------------------------------------------------------------- shell + rail */
.shell { flex: 1; display: grid; grid-template-columns: 76px 1fr; min-height: 0; }
.rail { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; padding: 12px 8px; }
.rail-btn { background: none; border: 1px solid transparent; color: var(--fg-3); cursor: pointer; padding: 10px 4px; border-radius: 12px; font-size: 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all 0.15s; }
.rail-btn span { font-size: 9.5px; font-weight: 700; letter-spacing: 0.3px; }
.rail-btn:hover { color: var(--fg-2); background: var(--glass-hi); }
.rail-btn.active { color: var(--fg); background: var(--blue-bg); border-color: rgba(124, 132, 255, 0.3); }
.views { min-height: 0; display: flex; }
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; }
#view-builder.view.active { display: block; }

/* the builder view keeps its internal 2-col grid */
#view-builder .app { height: 100%; }

/* ---------------------------------------------------------------- pages (dashboard/reports) */
.page { flex: 1; overflow: auto; padding: var(--sp-5) var(--sp-6); }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }

.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.kpi { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); box-shadow: var(--elev-1); }
.kpi-v { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi-k { color: var(--fg-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-5); box-shadow: var(--elev-2); margin-bottom: var(--sp-4); }
.card-h { font-size: 12px; font-weight: 700; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }

.chart { min-height: 150px; }
.svg-chart { width: 100%; height: 150px; display: block; }
.chart-meta { color: var(--fg-3); font-size: 11px; margin-top: 6px; font-family: var(--mono); }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.donut { width: 150px; height: 150px; }
.donut-num { fill: var(--fg); font-size: 26px; font-weight: 800; font-family: "Inter"; }
.donut-sub { fill: var(--fg-3); font-size: 11px; font-family: "Inter"; }
.donut-legend { display: flex; gap: 16px; font-size: 12px; font-weight: 600; }
.lg.ok { color: var(--green); } .lg.err { color: var(--red); }

.recent { display: flex; flex-direction: column; gap: 2px; }
.recent-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 8px; transition: background 0.12s; }
.recent-row:hover { background: var(--glass-hi); }
.recent-row .ok { color: var(--green); font-weight: 700; } .recent-row .err { color: var(--red); font-weight: 700; }
.rr-name { font-family: var(--mono); font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-wrap { overflow: auto; }
.rtbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rtbl th { text-align: left; color: var(--fg-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.rtbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.rtbl tr:hover td { background: var(--glass-hi); }
.rtbl .mono { font-family: var(--mono); color: var(--fg); }
.rate { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: 11px; }
.rate.ok { background: var(--green-bg); color: var(--green); } .rate.warn { background: var(--yellow-bg); color: var(--yellow); } .rate.err { background: var(--red-bg); color: var(--red); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 150px; font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 10px; background: var(--glass-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), #f59e0b); border-radius: 6px; }
.bar-n { width: 32px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--fg-2); }

@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: 1fr; } .grid-3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- rail badge */
.rail-btn { position: relative; }
.rail-badge { position: absolute; top: 4px; right: 10px; background: var(--red); color: #fff; font-size: 9px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---------------------------------------------------------------- ASSIST */
/* "Vee" — a friendly little human character */
.assist-fab {
  --vee-skin: #ffd2a8; --vee-skin2: #f3a87a; --vee-hair: #3a2a20; --vee-shirt: var(--grad);
  position: fixed; bottom: 22px; right: 22px; z-index: 55; width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 24px; color: #fff;
  background: radial-gradient(72% 62% at 50% 64%, var(--vee-skin), var(--vee-skin2));  /* face / skin */
  box-shadow: 0 10px 26px rgba(40, 30, 20, 0.32), inset 0 -5px 10px rgba(170, 90, 50, 0.25), inset 0 6px 10px rgba(255, 255, 255, 0.4);
  transition: box-shadow 0.18s; animation: humanIdle 3.8s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center; touch-action: none; overflow: visible;
}
.assist-fab:hover { box-shadow: 0 14px 38px rgba(40, 30, 20, 0.4), inset 0 -5px 10px rgba(170, 90, 50, 0.25), inset 0 6px 10px rgba(255, 255, 255, 0.45); }
.assist-fab.hidden-fab { display: none; }
.assist-fab.dragging { cursor: grabbing !important; animation: none !important; transition: none !important; }
@keyframes humanIdle { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-2.5deg); } }

/* ---- the assistant character (human) ---- */
.bot { position: relative; width: 30px; height: 30px; display: flex; flex-direction: column; align-items: center; }
/* hair — side-swept fringe */
.bot-antenna { position: absolute; top: -15px; left: 50%; transform: translateX(-52%); width: 37px; height: 19px; background: var(--vee-hair); border-radius: 20px 16px 10px 14px / 22px 20px 8px 12px; box-shadow: inset -3px -2px 5px rgba(0, 0, 0, 0.3), inset 3px 3px 5px rgba(255, 255, 255, 0.18); }
.bot-antenna::before { content: ""; position: absolute; top: 9px; left: 6px; width: 22px; height: 10px; background: var(--vee-hair); filter: brightness(1.18); border-radius: 0 0 60% 40%; transform: rotate(-6deg); }   /* fringe sweep */
.bot-antenna::after { content: ""; position: absolute; top: 9px; left: -3px; width: 9px; height: 17px; background: var(--vee-hair); border-radius: 60% 0 0 60%; }   /* side hair */
.bot-eyes { display: flex; gap: 7px; margin-top: 9px; transition: transform 0.12s ease; }
/* eyebrows */
.bot-eye::before { content: ""; position: absolute; top: -4px; left: -1px; width: 9px; height: 2px; border-radius: 2px; background: var(--vee-hair); }
/* dev glasses — overlay over the eyes (doesn't scale with blinks) */
.bot-glasses { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 22px; height: 10px; pointer-events: none; }
.bot-glasses::before, .bot-glasses::after { content: ""; position: absolute; top: 0; width: 10px; height: 10px; border: 1.6px solid #2a2150; border-radius: 50%; background: rgba(120, 170, 255, 0.16); box-shadow: 1px 1px 2px rgba(255, 255, 255, 0.35) inset; }
.bot-glasses::before { left: 0; } .bot-glasses::after { right: 0; }
.assist-fab.no-glasses .bot-glasses { display: none; }
/* Vee customizer */
.look-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.look-lbl { width: 56px; font-size: 12.5px; font-weight: 700; color: var(--fg-2); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); cursor: pointer; transition: transform 0.12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.look-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
.bot-glasses { background: linear-gradient(#2a2150, #2a2150) center 4px / 5px 1.6px no-repeat; }   /* bridge between lenses */
/* outfit — a little shirt collar peeking below the head */
.bot-shirt { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 22px; height: 11px; background: var(--vee-shirt); border-radius: 10px 10px 4px 4px; box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.3); }
.bot-shirt::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--vee-skin); }   /* collar V (neck) */
/* arms + legs (limbs) for walking */
.bot-arm { position: absolute; top: 14px; width: 3px; height: 9px; background: var(--vee-skin2); border-radius: 3px; transform-origin: top center; }
.bot-arm-l { left: -5px; } .bot-arm-r { right: -5px; }
.bot-leg { position: absolute; bottom: -10px; width: 4px; height: 8px; background: #5b50e0; border-radius: 0 0 3px 3px; transform-origin: top center; }
.bot-leg-l { left: 9px; } .bot-leg-r { right: 9px; }
/* walk cycle */
.assist-fab.bot-walking .bot { animation: botWalkBob 0.42s ease-in-out infinite; }
@keyframes botWalkBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.assist-fab.bot-walking .bot-leg-l { animation: botStep 0.42s ease-in-out infinite; }
.assist-fab.bot-walking .bot-leg-r { animation: botStep 0.42s ease-in-out infinite 0.21s; }
@keyframes botStep { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(30deg); } 70% { transform: rotate(-24deg); } }
.assist-fab.bot-walking .bot-arm-l { animation: botSwing 0.42s ease-in-out infinite 0.21s; }
.assist-fab.bot-walking .bot-arm-r { animation: botSwing 0.42s ease-in-out infinite; }
@keyframes botSwing { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-28deg); } 70% { transform: rotate(24deg); } }
/* landing squash when a walk finishes */
.assist-fab.bot-land { animation: botLandA 0.36s ease-out; }
@keyframes botLandA { 0% { transform: translateY(-6px) scale(0.94, 1.08); } 55% { transform: translateY(0) scale(1.12, 0.88); } 100% { transform: translateY(0) scale(1, 1); } }
.bot-eye { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0.5px rgba(80,50,30,.25); transform-origin: center; animation: botBlink 4.5s infinite; }
.bot-eye::after { content: ""; position: absolute; left: 50%; top: 54%; width: 4px; height: 4px; border-radius: 50%; background: #3a2a20; transform: translate(-50%, -50%); }
@keyframes botBlink { 0%, 91%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.12); } }
.bot-mouth { width: 11px; height: 6px; margin-top: 4px; border-radius: 0 0 11px 11px; background: #9c4438; transition: all 0.2s; }
.bot-cheeks { position: absolute; top: 17px; left: -1px; right: -1px; display: flex; justify-content: space-between; opacity: 0.55; transition: opacity 0.2s; }
.bot-cheeks span { width: 6px; height: 4px; border-radius: 50%; background: rgba(255, 120, 130, 0.7); }
.assist-fab:hover .bot-cheeks { opacity: 0.9; }
.assist-fab:hover .bot-mouth { height: 8px; width: 13px; }
.assist-fab:not(.dragging):hover { animation: botWiggle 0.5s ease; }
@keyframes botWiggle { 0%, 100% { transform: scale(1.1) rotate(0); } 25% { transform: scale(1.1) rotate(-9deg); } 75% { transform: scale(1.1) rotate(9deg); } }

/* call reactions — the buddy gets excited while ringing */
.assist-fab.bot-onstage { z-index: 96; }
.assist-fab.bot-ringing { animation: botRing 0.7s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(124, 132, 255, 0.5), 0 12px 34px rgba(124, 132, 255, 0.5); }
@keyframes botRing {
  0%, 100% { transform: rotate(0) scale(1.05); }
  15% { transform: rotate(-13deg) scale(1.1); }
  30% { transform: rotate(11deg) scale(1.1); }
  45% { transform: rotate(-9deg) scale(1.08); }
  60% { transform: rotate(7deg) scale(1.08); }
  75% { transform: rotate(-4deg) scale(1.06); }
}
.assist-fab.bot-ringing::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(124, 132, 255, 0.55); animation: botRingPulse 0.9s ease-out infinite; }
@keyframes botRingPulse { 0% { transform: scale(0.9); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }

/* funny reactions (JS adds a class for ~1s) */
.assist-fab.fun-spin { animation: botSpin 0.9s ease; }
@keyframes botSpin { to { transform: rotate(360deg); } }

/* ---- cartoon personality: talk · sleep · run · yawn · dance ---- */
.assist-fab.bot-talking .bot-mouth { animation: botTalkM 0.26s steps(2, end) infinite; }
@keyframes botTalkM { 0% { height: 4px; width: 10px; border-radius: 0 0 14px 14px; } 50% { height: 11px; width: 13px; border-radius: 50%; } 100% { height: 4px; width: 10px; border-radius: 0 0 14px 14px; } }
.assist-fab.bot-asleep { animation: botBreathe 3.2s ease-in-out infinite; }
.assist-fab.bot-asleep .bot-eye { animation: none; transform: scaleY(0.1); }
.assist-fab.bot-asleep .bot-mouth { height: 4px; width: 8px; border-radius: 4px; }
.assist-fab.bot-asleep .bot-antenna::after { animation: none; box-shadow: none; opacity: 0.45; }
@keyframes botBreathe { 0%, 100% { transform: scale(1) rotate(-5deg); } 50% { transform: scale(1.05) rotate(-5deg); } }
.assist-fab.bot-running { animation: botRunA 1.3s ease-in-out; }
@keyframes botRunA { 0% { transform: translateX(0); } 20% { transform: translate(-26px, -5px) rotate(-9deg); } 50% { transform: translate(24px, -7px) rotate(9deg); } 80% { transform: translate(-12px, -3px) rotate(-5deg); } 100% { transform: translateX(0); } }
.assist-fab.bot-yawn .bot-mouth { animation: botYawnM 1.3s ease; }
@keyframes botYawnM { 0% { height: 8px; } 35%, 70% { height: 16px; width: 16px; border-radius: 50%; } 100% { height: 8px; } }
.assist-fab.bot-dance { animation: botDanceA 1.4s ease-in-out; }
@keyframes botDanceA { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-15deg) translateY(-3px); } 40% { transform: rotate(13deg); } 60% { transform: rotate(-11deg) translateY(-3px); } 80% { transform: rotate(9deg); } }
/* throw-to-tumble */
.assist-fab.bot-tumble { animation: botTumbleA 0.8s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes botTumbleA { 0% { transform: rotate(0); } 60% { transform: rotate(620deg) scale(0.9); } 82% { transform: rotate(680deg) scale(1.08); } 100% { transform: rotate(720deg); } }
/* achievement party hat */
.assist-fab.bot-party::before { content: "🎉"; position: absolute; top: -16px; left: -6px; font-size: 16px; animation: botBounce 0.7s ease infinite; }
/* do-not-disturb posture — calm, dimmed, quiet */
.assist-fab.bot-dnd { filter: saturate(0.6) brightness(0.92); }
.assist-fab.bot-dnd::after { content: "🤫"; position: absolute; bottom: -4px; right: -4px; font-size: 13px; }
.assist-fab.fun-bounce { animation: botBounce 0.7s ease; }
@keyframes botBounce { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-14px); } 60% { transform: translateY(0) scaleY(0.92); } }
.assist-fab.fun-wink .bot-eye:first-child { transform: scaleY(0.12); }
.assist-fab.fun-wink .bot-mouth { width: 16px; height: 9px; }
.assist-fab.fun-dizzy .bot-eyes { animation: botDizzy 0.8s linear; }
@keyframes botDizzy { to { transform: rotate(360deg); } }
.assist-fab.fun-surprise .bot-eye { width: 9px; height: 9px; }
.assist-fab.fun-surprise .bot-mouth { width: 9px; height: 9px; border-radius: 50%; }
.assist-fab.fun-peek { animation: botPeek 1s ease; }
@keyframes botPeek { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px) scale(1.12) rotate(-6deg); } }
.assist-fab.fun-happy .bot-mouth { height: 12px; width: 18px; }
.assist-fab.fun-happy { animation: botBounce 0.7s ease; }
.assist-fab.fun-love .bot-eye { background: #ff7a96; transform: scale(1.25); }
.assist-fab.fun-love .bot-mouth { height: 12px; width: 18px; background: #ff7a96; }
.assist-fab.fun-cool .bot-eyes { gap: 2px; }
.assist-fab.fun-cool .bot-eye { width: 11px; height: 6px; border-radius: 2px; background: #1a1a1a; box-shadow: 0 0 0 1.5px #fff; }

/* idle speech bubble */
.bot-bubble {
  position: fixed; z-index: 57; max-width: 230px; background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 14px;
  font-size: 12.5px; font-weight: 600; color: var(--fg); cursor: pointer; box-shadow: var(--shadow);
  animation: bubbleIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.bot-bubble::after { content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 12px; height: 12px; background: var(--glass); border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.bot-bubble:hover { border-color: var(--accent); }
.bot-bubble { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.bubble-act { background: var(--grad); color: #fff; border: none; border-radius: 9px; padding: 5px 13px; font-size: 11.5px; font-weight: 700; cursor: pointer; align-self: stretch; text-align: center; transition: transform 0.12s; }
.bubble-act:hover { transform: translateY(-1px); }
@keyframes bubbleIn { 0% { opacity: 0; transform: translateY(8px) scale(0.85); } 100% { opacity: 1; transform: translateY(0) scale(1); } }

/* floating emoji pops above the buddy */
.bot-emoji { position: absolute; top: -4px; left: 50%; font-size: 17px; pointer-events: none; z-index: 2; animation: botEmojiPop 1.5s ease forwards; }
@keyframes botEmojiPop {
  0% { opacity: 0; transform: translate(-50%, 2px) scale(0.4); }
  25% { opacity: 1; transform: translate(-50%, -16px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(0.9); }
}

.assist-panel {
  position: fixed; bottom: 22px; right: 22px; z-index: 56; width: 380px; max-width: 92vw; height: 560px; max-height: 80vh;
  display: flex; flex-direction: column; background: var(--glass); backdrop-filter: blur(26px) saturate(150%); -webkit-backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
  animation: pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.assist-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.assist-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.assist-mode { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--fg-3); background: var(--glass-2); padding: 2px 7px; border-radius: 6px; }
.assist-mode.live { color: var(--green); background: var(--green-bg); }
.assist-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.amsg { display: flex; }
.amsg.user { justify-content: flex-end; }
.abubble { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: 12.5px; line-height: 1.6; }
.amsg.assistant .abubble { background: var(--glass-hi); border: 1px solid var(--line); border-top-left-radius: 4px; }
.amsg.user .abubble { background: var(--grad); color: #fff; border-top-right-radius: 4px; }
.abubble code { background: rgba(0, 0, 0, 0.28); padding: 1px 5px; border-radius: 5px; font-family: var(--mono); font-size: 11px; }
.abubble.typing { display: flex; gap: 4px; }
.abubble.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); animation: blink 1.2s infinite; }
.abubble.typing span:nth-child(2) { animation-delay: 0.2s; } .abubble.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }
.assist-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--glass-2); border: 1px solid var(--line); color: var(--fg-2); font-size: 11px; padding: 5px 10px; border-radius: 14px; cursor: pointer; transition: all 0.15s; }
.chip:hover { border-color: var(--accent); color: var(--fg); transform: translateY(-1px); }
.chip .chip-ico { flex: none; display: block; }
.chip .chip-arrow { opacity: 0.7; font-weight: 700; }
/* help & shortcuts */
.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.help-sec { display: flex; flex-direction: column; gap: 7px; }
.help-row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--fg-2); }
.help-row span { flex: 1; }
.help-row b { color: var(--fg); }
.help-row kbd { font-family: var(--mono); font-size: 10.5px; background: var(--glass-hi); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; color: var(--fg); }
@media (max-width: 720px) { .help-grid { grid-template-columns: 1fr; } }
.chip-go { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.chip-go:hover { background: var(--accent); color: #fff; }
.assist-compose { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.assist-compose input { flex: 1; }

/* ---------------------------------------------------------------- TOUR */
.tour-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(4, 5, 10, 0.55); animation: fade 0.2s; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 4px rgba(124, 132, 255, 0.7), 0 0 0 9999px rgba(4, 5, 10, 0.6); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; }
.tour-card { position: fixed; width: 332px; max-width: 90vw; background: var(--glass); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid var(--line-2); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); transition: top 0.3s, left 0.3s; }
.tour-step { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.tour-title { font-size: 16px; font-weight: 800; margin: 4px 0 6px; }
.tour-text { color: var(--fg-2); font-size: 12.5px; line-height: 1.6; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }

/* ---------------------------------------------------------------- TEAM */
.team { flex: 1; display: grid; grid-template-columns: 280px 1fr; min-height: 0; }
.team-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.team-new { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.team-new input { flex: 1; font-family: var(--mono); font-size: 11.5px; }
/* Doot-style conversation rows: avatar · name+preview · time+badge */
.peer-row { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; cursor: pointer; margin: 2px 8px; transition: background 0.14s; }
.peer-row:hover { background: var(--glass-hi); }
.cav { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; letter-spacing: 0.3px; }
.cav.big { width: 48px; height: 48px; font-size: 16px; }
.cav-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--bg-1); background: var(--fg-3); }
.cav-dot.on { background: var(--green); } .cav-dot.busy { background: var(--red); } .cav-dot.dnd { background: var(--red); } .cav-dot.away { background: var(--yellow); } .cav-dot.off { background: var(--fg-3); }
.peer-main { flex: 1; min-width: 0; }
.peer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.peer-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-time { color: var(--fg-3); font-size: 10px; flex: none; }
.peer-bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.peer-unread { background: var(--grad); color: #fff; font-size: 9px; font-weight: 800; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.peer-prev { color: var(--fg-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.contact-row .contact-presence { font-size: 11px; color: var(--fg-3); }

/* call history + file history rows */
.call-row.missed .peer-name { color: var(--red); }
.call-ar { font-weight: 800; opacity: 0.7; }
.call-row.missed .call-ar { color: var(--red); opacity: 1; }
.file-row .file-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-100); color: var(--primary-600); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
body:not(.light) .file-row .file-ic { background: rgba(114, 105, 239, 0.18); color: #b9b3fb; }
.file-row .file-dl { flex: none; }
.tt-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px; padding: 0 4px; margin-left: 5px; border-radius: 8px; background: var(--red); color: #fff; font-size: 9px; font-weight: 800; vertical-align: middle; }
/* in-thread call log chip */
.cmsg.call-log { align-items: center; }
.call-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: var(--radius-full); background: var(--glass-hi); border: 1px solid var(--line); font-size: 11.5px; color: var(--fg-2); }
.call-chip.missed { color: var(--red); border-color: rgba(251, 113, 133, 0.3); background: var(--red-bg); }
.call-chip .call-ic { font-size: 13px; }
.call-chip .call-redial { cursor: pointer; font-weight: 800; opacity: 0.6; margin-left: 2px; }
.call-chip .call-redial:hover { opacity: 1; color: var(--accent); }
.team-thread { display: flex; flex-direction: column; min-height: 0; position: relative; }
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--glass); }
.thread-peer { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.tiny-select { font-size: 11px; padding: 5px 8px; max-width: 180px; }
.thread-body { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 7px; background:
    radial-gradient(60% 60% at 100% 0%, rgba(124, 132, 255, 0.05), transparent 70%),
    radial-gradient(50% 50% at 0% 100%, rgba(34, 211, 238, 0.04), transparent 70%); }
.cmsg { display: flex; flex-direction: column; }
.cmsg.out { align-items: flex-end; }
.cmsg.in { align-items: flex-start; }
.cbubble { max-width: 68%; padding: 9px 13px 7px; border-radius: 16px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14); animation: bubblePop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2); word-break: break-word; }
@keyframes bubblePop { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
.cmsg.in .cbubble { background: var(--glass-hi); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.cmsg.out .cbubble { background: var(--grad); color: #fff; border-bottom-right-radius: 5px; }
.cbubble.share { display: flex; align-items: center; gap: 12px; }
.thread-compose { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.thread-compose input { flex: 1; }

/* ---------------------------------------------------------------- presence + assist action + workspaces */
.pdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); margin-right: 7px; vertical-align: middle; }
.pdot.on { background: var(--green); box-shadow: 0 0 7px var(--green); }
.pdot.busy { background: var(--red); box-shadow: 0 0 7px var(--red); }
.pdot.dnd { background: var(--red); box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 3px var(--red); }
.pdot.away { background: var(--yellow); box-shadow: 0 0 7px var(--yellow); }
.pdot.off { background: var(--fg-3); }

/* ---- Teams-style chat: roster, receipts, reactions ---- */
.roster-sec { margin-top: 10px; }
.roster-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--fg-3); padding: 4px 6px; }
.roster-h-act { display: flex; align-items: center; justify-content: space-between; }
.cav.grp { background: linear-gradient(135deg, #34d399, #22d3ee); font-size: 18px; }
.group-members { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.grp-cb { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.grp-cb:hover { background: var(--glass-hi); }
.gsender { display: block; font-size: 10.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.contact-row { position: relative; }
.contact-row .contact-presence { font-size: 10px; color: var(--fg-3); }
.contact-row .contact-del { position: absolute; right: 6px; top: 8px; background: none; border: none; color: var(--fg-3); cursor: pointer; opacity: 0; transition: opacity 0.15s; font-size: 11px; }
.contact-row:hover .contact-del { opacity: 1; }
.contact-row .contact-del:hover { color: var(--red); }
.thread-presence { font-size: 11px; color: var(--fg-3); font-weight: 500; margin-left: 8px; }
/* message time + read-receipt ticks (Teams/WhatsApp-style, tucked at the bubble's end) */
.cbubble:not(.share):not(.file) { display: flex; flex-direction: column; }
.cbubble .cbtext { display: block; white-space: pre-wrap; word-break: break-word; }
.cbubble .cbtext a { color: inherit; text-decoration: underline; }
.cbubble .cbtext code { font-family: var(--mono); font-size: 0.92em; background: rgba(127, 127, 127, 0.2); padding: 1px 5px; border-radius: 5px; }
.cbubble .cbtext pre.code-blk { font-family: var(--mono); font-size: 11.5px; background: rgba(0, 0, 0, 0.28); padding: 8px 10px; border-radius: 8px; margin: 4px 0; white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.cmsg.in .cbubble .cbtext pre.code-blk { background: rgba(127, 127, 127, 0.14); }
.cbubble.deleted .cbtext { font-style: italic; opacity: 0.6; }
/* link preview card */
.link-card { display: block; margin-top: 7px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--glass-2); cursor: pointer; max-width: 300px; transition: border-color 0.15s; }
.cmsg.out .link-card { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); }
.link-card:hover { border-color: var(--accent); }
.lc-img { width: 100%; height: 120px; background-size: cover; background-position: center; background-color: var(--glass-hi); }
.lc-body { padding: 8px 10px; }
.lc-site { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.7; }
.lc-title { font-size: 12.5px; font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lc-desc { font-size: 11px; opacity: 0.8; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.reply-quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin-bottom: 5px; font-size: 11px; opacity: 0.85; border-radius: 3px; background: rgba(127, 127, 127, 0.12); }
.reply-quote b { display: block; color: var(--accent); font-size: 10.5px; }
.reply-quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.edited-tag { font-size: 9px; opacity: 0.6; font-style: italic; }
.msg-act { background: none; border: none; color: var(--fg-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; opacity: 0; transition: opacity 0.15s; align-self: center; }
.cmsg:hover .msg-act { opacity: 0.7; }
.msg-act:hover { opacity: 1; color: var(--fg); }
.compose-ctx { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-top: 1px solid var(--line); background: var(--glass-hi); font-size: 12px; }
.compose-ctx .cc-tag { font-weight: 700; color: var(--accent); white-space: nowrap; }
.compose-ctx .cc-text { flex: 1; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* pinned messages bar */
.pinned-bar { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--glass-hi); font-size: 11.5px; overflow-x: auto; white-space: nowrap; }
.pinned-bar .pin-ic { flex: none; }
.pin-item { display: inline-flex; align-items: center; gap: 6px; background: var(--glass-2); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 3px 6px 3px 10px; cursor: pointer; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.pin-item b { color: var(--accent); }
.pin-x { background: none; border: none; color: var(--fg-3); cursor: pointer; font-size: 11px; padding: 0 2px; }
.pin-x:hover { color: var(--red); }
.mute-ic { font-size: 10px; margin-left: 5px; opacity: 0.7; }
.mention { color: var(--accent); font-weight: 700; }
.mention-me { background: var(--blue-bg); border-radius: 4px; padding: 0 3px; }
/* on the gradient (outgoing) bubble, accent-on-accent is unreadable — use a light, legible colour */
.cmsg.out .mention { color: #e9e6ff; text-decoration: underline; text-underline-offset: 2px; }
.cmsg.out .mention-me { background: rgba(255, 255, 255, 0.22); color: #fff; }
.mention-pop { position: absolute; bottom: 62px; left: 14px; right: 14px; max-width: 280px; z-index: 50; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--elev-3); padding: 4px; max-height: 200px; overflow: auto; }
.mention-opt { padding: 7px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
.mention-opt:hover { background: var(--glass-hi); color: var(--accent); }
/* avatars (photo) */
.cav.has-photo { background: none; }
.cav img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pm-av { position: relative; overflow: visible; cursor: pointer; }
.pm-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.pm-av-cam { position: absolute; right: -2px; bottom: -2px; font-size: 11px; background: var(--bg-1); border-radius: 50%; padding: 1px 2px; box-shadow: var(--elev-1); }
/* star */
.star-tag { font-size: 9px; }
/* e2ee */
.enc-badge { font-size: 9px; opacity: .85; }
#e2eeBtn.active { color: var(--green, #2ecc71); }
#e2eeBtn.pending { color: var(--warn, #e0a30a); }
.starred-list { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.starred-row { position: relative; padding: 10px 30px 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--glass-2); }
.starred-row:hover { border-color: var(--accent); }
.st-top { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 3px; }
.st-top b { color: var(--accent); } .st-where { color: var(--fg-3); } .st-time { margin-left: auto; color: var(--fg-3); }
.st-text { font-size: 12.5px; }
.st-x { position: absolute; right: 8px; top: 8px; background: none; border: none; color: var(--fg-3); cursor: pointer; }
.st-x:hover { color: var(--red); }
#muteBtn.active { color: var(--red); }
.thread-search { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--glass); }
.thread-search input { flex: 1; }
.cmsg.search-hide { display: none; }
.cmsg.search-hit .cbubble { box-shadow: 0 0 0 2px var(--yellow); }
.cbubble .cbmeta { align-self: flex-end; display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 10px; line-height: 1; white-space: nowrap; }
.cmsg.in .cbubble .cbmeta { color: var(--fg-3); }
.cmsg.out .cbubble .cbmeta { color: rgba(255, 255, 255, 0.82); }
.tick { font-size: 12px; font-weight: 800; letter-spacing: -1.5px; }
.cmsg.out .tick { color: rgba(255, 255, 255, 0.72); }
.cmsg.out .tick.read { color: #6ff0ff; text-shadow: 0 0 7px rgba(111, 240, 255, 0.6); }
.tick.pending { font-size: 10px; font-weight: 400; letter-spacing: 0; opacity: 0.85; }
.cmsg.out .tick.pending { color: rgba(255, 255, 255, 0.85); }
.react-wrap { display: flex; align-items: center; gap: 5px; margin-top: 3px; min-height: 18px; }
.cmsg.out .react-wrap { justify-content: flex-end; }
.rchip { font-size: 11px; padding: 1px 7px; border-radius: 11px; background: var(--glass-hi); border: 1px solid var(--line); cursor: pointer; user-select: none; }
.rchip.mine { background: var(--blue-bg); border-color: var(--accent); }
.react-btn { position: relative; font-size: 14px; opacity: 0; cursor: pointer; transition: opacity 0.15s, transform 0.12s; padding: 0 2px; }
.cmsg:hover .react-btn { opacity: 0.65; }
.react-btn:hover, .react-btn.open { opacity: 1; transform: scale(1.15); }
.react-pop { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 6px; display: none; gap: 2px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius-full); padding: 4px 6px; box-shadow: var(--elev-3); z-index: 40; }
.cmsg.out .react-pop { left: auto; right: 0; transform: none; }
.react-btn.open .react-pop { display: flex; animation: bubbleIn 0.12s; }
.react-pop span { font-size: 17px; cursor: pointer; padding: 2px; border-radius: 6px; transition: transform 0.1s; }
.react-pop span:hover { transform: scale(1.3); }

/* insecure-origin banner */
.secure-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 90; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; font-size: 12.5px; background: linear-gradient(90deg, var(--yellow-bg), var(--red-bg)); border-bottom: 1px solid var(--line-2); backdrop-filter: blur(10px); }
.secure-banner a { color: var(--accent); font-weight: 700; text-decoration: none; }
.secure-banner a:hover { text-decoration: underline; }
.secure-banner button { background: none; border: none; color: var(--fg-3); cursor: pointer; font-size: 13px; }
body.has-banner #appRoot { padding-top: 34px; }

.assist-action { align-self: flex-start; background: var(--blue-bg); border: 1px solid rgba(124, 132, 255, 0.4); color: var(--fg); font-size: 12px; font-weight: 600; padding: 8px 14px; border-radius: 12px; cursor: pointer; transition: all 0.15s; }
.assist-action:hover { background: var(--grad); color: #fff; transform: translateY(-1px); border-color: transparent; }

/* assistant-drafted collection card */
.draft-card { width: 100%; background: var(--glass-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px; }
.draft-h { font-weight: 700; font-size: 12.5px; margin-bottom: 10px; }
.draft-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow: auto; margin-bottom: 12px; }
.draft-req { display: flex; align-items: center; gap: 8px; font-size: 11.5px; padding: 3px 0; }
.draft-req .mono { font-family: var(--mono); color: var(--fg-2); }
.draft-cap { margin-left: auto; font-size: 10px; color: var(--green); font-family: var(--mono); }
.draft-actions { display: flex; gap: 8px; }

.team-tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.team-tab { flex: 1; background: none; border: none; color: var(--fg-3); padding: 9px; cursor: pointer; font-size: 12px; font-weight: 600; border-radius: 8px 8px 0 0; position: relative; }
.team-tab.active { color: var(--fg); }
.team-tab.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; background: var(--grad); border-radius: 2px; }

.ws-tag { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; color: var(--accent); background: var(--blue-bg); padding: 2px 7px; border-radius: 6px; }
.ws-tag.recv { color: var(--green); background: var(--green-bg); text-transform: none; }
.ws-detail { max-width: 560px; }
.ws-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-pill { background: var(--glass-hi); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-family: var(--mono); font-size: 11.5px; }
.ws-member { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.ws-member .mono { font-family: var(--mono); font-size: 12px; flex: 1; }
.ws-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--fg-3); background: var(--glass-2); padding: 2px 8px; border-radius: 6px; }
.ws-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.ws-check { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow: auto; }
.ws-cb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2); cursor: pointer; }
.ws-role-sel { max-width: 110px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 18px;
  font-size: 12.5px; font-weight: 500; z-index: 60; box-shadow: var(--shadow);
  max-width: 70vw; display: flex; align-items: center; gap: 9px;
  animation: toastIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.toast::before { content: "ℹ"; font-weight: 700; }
.toast.success { border-color: rgba(52, 211, 153, 0.4); }
.toast.success::before { content: "✓"; color: var(--green); }
.toast.error { border-color: rgba(251, 113, 133, 0.4); }
.toast.error::before { content: "⚠"; color: var(--red); }

/* ---------------------------------------------------------------- chat file + call */
/* voice / video message bubbles */
.cbubble.media { padding: 9px 11px; }
.cbubble.media .media-h { font-size: 11px; opacity: 0.85; margin-bottom: 6px; font-weight: 600; }
.cbubble.media audio { height: 36px; width: 230px; max-width: 60vw; display: block; }
.cbubble.media video { width: 260px; max-width: 64vw; border-radius: var(--radius-sm); display: block; background: #000; }

/* incoming group-call banner */
.group-ring { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 92; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--elev-3); animation: bubbleIn 0.18s; }
.group-ring .gr-emoji { font-size: 18px; animation: recPulse 1.2s ease-in-out infinite; }
.group-ring .gr-text { font-weight: 700; font-size: 13px; }

/* recording bar */
.rec-bar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 88; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--elev-3); animation: bubbleIn 0.16s; }
.rec-preview { width: 120px; height: 90px; border-radius: var(--radius-sm); object-fit: cover; background: #000; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: recPulse 1s ease-in-out infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
.rec-kind { font-weight: 700; font-size: 13px; }
.rec-time { font-family: var(--mono); font-size: 12px; color: var(--fg-3); }

.cbubble.loc { display: flex; align-items: center; gap: 12px; }
.loc-map { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg, #34d399, #22d3ee); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.loc-info { display: flex; flex-direction: column; gap: 1px; }
.loc-info .mono { font-size: 10.5px; opacity: 0.8; }
.loc-open { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 3px; text-decoration: none; }
.cmsg.out .loc-open { color: #d7f9ff; }
.cbubble.contact-card { display: flex; align-items: center; gap: 11px; }
.cc-av { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.cc-info { display: flex; flex-direction: column; gap: 1px; }
.cc-info .mono { font-size: 10.5px; opacity: 0.8; }
.cbubble.file { display: flex; align-items: center; gap: 12px; }
.cbubble.file .fmeta { font-size: 12px; }
.cbubble .fsize { color: var(--fg-3); font-size: 10.5px; }
.cmsg.out .cbubble .fsize { color: rgba(255, 255, 255, 0.7); }

.call-overlay { position: fixed; inset: 0; z-index: 75; background: #05060a; display: flex; align-items: center; justify-content: center; transition: all 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.call-stage { position: relative; width: 100%; height: 100%; }
#remoteVideo { width: 100%; height: 100%; object-fit: cover; background: #0c0e16; display: block; }
.call-overlay:not(.has-remote) #remoteVideo, .call-overlay.audio-only #remoteVideo { opacity: 0; }
.call-avatar { position: absolute; inset: 0; margin: auto; width: 124px; height: 124px; border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: 42px; font-weight: 800; color: #fff; background: var(--grad); box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5); }
.call-overlay:not(.has-remote) .call-avatar { display: flex; }
.call-overlay.audio-only .call-avatar { display: flex; }
#localVideo { position: absolute; right: 18px; bottom: 100px; width: 190px; max-width: 32vw; aspect-ratio: 4/3; object-fit: cover; border-radius: 14px; border: 1px solid var(--line-2); box-shadow: var(--shadow); background: #0c0e16; z-index: 2; }
.call-overlay.audio-only #localVideo { display: none; }
.call-top { position: absolute; top: 22px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 2; }
.call-peer { background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px); padding: 7px 16px; border-radius: 20px; font-weight: 700; font-size: 14px; }
.call-timer { color: var(--green); font-family: var(--mono); font-size: 12px; margin-left: 6px; }
.call-status { background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px); padding: 6px 14px; border-radius: 16px; font-weight: 600; font-size: 12px; color: var(--fg-2); }
.call-controls { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; z-index: 3; }
.call-btn { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(30, 35, 50, 0.85); backdrop-filter: blur(8px); color: #fff; font-size: 21px; cursor: pointer; transition: transform 0.12s, background 0.15s; display: inline-flex; align-items: center; justify-content: center; }
.call-btn svg { display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding-left: 9px; padding-right: 9px; }
.icon-btn svg { display: block; transition: transform 0.15s; }
.icon-btn:hover svg { transform: scale(1.08); }
/* assistant header: standardized line icons + voice on/off state */
.assist-spark { color: var(--accent); flex: none; }
#assistSpeak .ico-vol-on { display: none; }
#assistSpeak.on .ico-vol-on { display: block; }
#assistSpeak.on .ico-vol-off { display: none; }
#assistSpeak.on { color: var(--green); }
#assistSend svg { transform: translateX(-0.5px); }
.call-btn:hover { transform: translateY(-2px); }
.call-btn { position: relative; }
.call-btn.off { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.call-btn.off::after { content: ""; position: absolute; left: 13px; right: 13px; top: 50%; height: 2.5px; margin-top: -1px; background: var(--red); border-radius: 2px; transform: rotate(-45deg); box-shadow: 0 -2px 0 0 rgba(30, 35, 50, 0.85); }
.call-btn.active { background: var(--blue-bg); border-color: var(--accent); }
.call-btn.hang { background: var(--red); border-color: var(--red); }

/* minimized → floating PiP window (Teams-style) */
.call-overlay.minimized { inset: auto 18px 18px auto; width: 280px; height: 190px; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line-2); }
.call-overlay.minimized #localVideo { width: 84px; bottom: 8px; right: 8px; }
.call-overlay.minimized .call-controls { bottom: 8px; gap: 8px; transform: translateX(-50%) scale(0.78); }
.call-overlay.minimized .call-btn:not(.hang) { display: none; }
.call-overlay.minimized .call-top { top: 8px; }
.call-overlay.minimized .call-peer { font-size: 11px; padding: 4px 10px; }
.call-overlay.minimized #remoteVideo { cursor: zoom-in; }
.call-overlay.minimized .call-avatar { width: 64px; height: 64px; font-size: 24px; }

.ring-emoji { font-size: 44px; text-align: center; animation: floaty 1s ease-in-out infinite; margin-bottom: 8px; }
.ring-text { font-weight: 700; font-size: 15px; text-align: center; margin-bottom: 6px; }

/* draggable assistant */
.assist-head { cursor: grab; touch-action: none; }
.assist-head:active { cursor: grabbing; }
.typing-now { color: var(--green); font-size: 11px; font-style: italic; font-weight: 500; }

/* ---------------------------------------------------------------- meetings */
.meet-info { padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--glass); }
.meet-meta { display: flex; gap: 16px; font-size: 12px; color: var(--fg-2); font-weight: 600; margin-bottom: 6px; }
.meet-members { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--mono); font-size: 11px; color: var(--fg-3); }
.gsender { color: var(--accent); font-weight: 700; font-size: 10.5px; margin-right: 6px; }
/* advanced meeting grid — auto layout, active-speaker ring, avatar fallback */
.meet-grid { display: grid; gap: 10px; padding: 14px 18px; grid-template-columns: repeat(var(--cols, 2), 1fr); background: radial-gradient(80% 80% at 50% 0%, #11131d, #06070c); border-bottom: 1px solid var(--line); max-height: 56vh; overflow: auto; }
.meet-grid[data-n="1"] { grid-template-columns: 1fr; place-items: center; }
.meet-grid[data-n="1"] .meet-tile { max-width: 70%; }
.meet-tile { position: relative; aspect-ratio: 16/10; background: #0c0e16; border-radius: var(--radius); overflow: hidden; border: 1.5px solid var(--line-2); box-shadow: var(--elev-2); transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s; }
.meet-tile video { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.meet-tile .tile-av { position: absolute; inset: 0; margin: auto; width: 78px; height: 78px; border-radius: 50%; background: var(--grad); color: #fff; display: none; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; box-shadow: 0 8px 26px rgba(114, 105, 239, 0.5); }
.meet-tile.cam-off video { opacity: 0; }
.meet-tile.cam-off .tile-av { display: flex; }
.meet-tile.speaking { border-color: var(--green); box-shadow: 0 0 0 2px var(--green), 0 10px 30px rgba(52, 211, 153, 0.35); }
/* mesh-scaling: pin / active-speaker / paused-video */
.meet-tile:not(.is-me) { cursor: pointer; }
.meet-tile.pinned { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 10px 30px rgba(114, 105, 239, 0.4); order: -2; }
.meet-tile.active-speaker { order: -1; }
.meet-tile .tile-pin { position: absolute; top: 8px; right: 8px; font-size: 15px; display: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.meet-tile.pinned .tile-pin { display: block; }
.meet-tile .tile-paused { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); display: none; font-size: 10px; font-weight: 600; color: #cfd2e0; background: rgba(0, 0, 0, 0.55); padding: 2px 9px; border-radius: var(--radius-full); white-space: nowrap; }
.meet-tile.vpaused video { opacity: 0; }
.meet-tile.vpaused .tile-av { display: flex; }
.meet-tile.vpaused .tile-paused { display: block; }
.meet-scale-pill { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 8px; padding: 6px 12px; font-size: 11.5px; font-weight: 600; color: var(--fg-2); background: var(--glass-2); border: 1px solid var(--line); border-radius: var(--radius-full); }
.meet-scale-pill .btn { flex: none; }
.tile-name { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 3px 9px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; color: #fff; }
.meet-tile.muted .tile-name::before { content: "🔇"; font-size: 10px; }
.meet-tile.is-me .tile-name { background: rgba(114, 105, 239, 0.75); }
.meet-ctl.active { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); }
.btn.active { background: var(--blue-bg); border-color: var(--accent); color: var(--accent); }

/* shared whiteboard */
.meet-board { display: flex; flex-direction: column; background: #fff; border-bottom: 1px solid var(--line); height: 52vh; }
.wb-tools { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--glass); }
.wb-tools input[type="color"] { width: 30px; height: 26px; border: 1px solid var(--line-2); border-radius: 7px; background: none; cursor: pointer; padding: 0; }
.wb-w { width: 30px; height: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--glass-2); cursor: pointer; color: var(--fg-2); }
.wb-w.active { border-color: var(--accent); color: var(--accent); }
.wb-flex { flex: 1; }
.wb-canvas { flex: 1; width: 100%; background: #fff; cursor: crosshair; touch-action: none; }

/* watch-together */
.meet-watch { display: flex; flex-direction: column; background: #000; border-bottom: 1px solid var(--line); height: 54vh; }
.watch-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--glass); border-bottom: 1px solid var(--line); }
.watch-bar input { flex: 1; }
.watch-stage { flex: 1; position: relative; background: #000; }
.watch-stage iframe, .watch-stage video, .watch-video, #ytPlayer { width: 100%; height: 100%; border: 0; display: block; background: #000; }

/* live polls */
.meet-polls:empty { display: none; }
.meet-polls { padding: 10px 18px; border-bottom: 1px solid var(--line); }
.poll-card { background: var(--glass); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px; box-shadow: var(--elev-1); }
.poll-q { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.poll-opt { position: relative; display: flex; align-items: center; width: 100%; gap: 10px; padding: 9px 12px; margin-bottom: 7px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--glass-2); cursor: pointer; overflow: hidden; text-align: left; color: var(--fg); }
.poll-opt:hover { border-color: var(--accent); }
.poll-opt.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.poll-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue-bg); transition: width 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1); z-index: 0; }
.poll-text { position: relative; z-index: 1; flex: 1; font-size: 12.5px; font-weight: 600; }
.poll-pct { position: relative; z-index: 1; font-size: 11px; color: var(--fg-3); font-family: var(--mono); }
.poll-opt.mine .poll-pct { color: var(--accent); }
.poll-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.poll-total { font-size: 11px; color: var(--fg-3); }
.poll-opt-in { width: 100%; }
#pollOpts .kv-row { display: flex; gap: 6px; margin-bottom: 6px; }
#pollOpts .kv-row button { background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--fg-3); cursor: pointer; padding: 0 9px; }
.tile-hand { position: absolute; top: 8px; left: 8px; font-size: 20px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); animation: handWave 1.2s ease-in-out infinite; transform-origin: 70% 80%; }
@keyframes handWave { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(12deg); } }
.meet-tile.hand-up { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow), 0 10px 30px rgba(251, 191, 36, 0.3); }
.tile-mute { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(6px); color: #fff; cursor: pointer; font-size: 13px; opacity: 0; transition: opacity 0.15s; }
.meet-tile:hover .tile-mute { opacity: 1; }
.meet-tile.local-muted .tile-mute { opacity: 1; background: var(--red); }
.meet-ctl.off { background: var(--red-bg); border-color: var(--red); color: var(--red); position: relative; }
.meet-ctl.off::after { content: ""; position: absolute; left: 7px; right: 7px; top: 50%; height: 2px; margin-top: -1px; background: var(--red); border-radius: 2px; transform: rotate(-45deg); }

/* dashboard widgets + people grid */
.widget { display: flex; flex-direction: column; gap: 12px; }
.wstat { display: flex; gap: 24px; }
.wnum { font-size: 26px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wnum.hot { background: linear-gradient(135deg, var(--red), #ff9a6b); -webkit-background-clip: text; background-clip: text; }
.wlbl { font-size: 10.5px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.wlist.tall { max-height: 168px; overflow: auto; }
.week-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-3); }
.week-cell { text-align: center; padding: var(--sp-2) 0; border-radius: var(--radius-sm); background: var(--glass-2); border: 1px solid var(--line); }
@media (max-width: 720px) { .week-row { grid-template-columns: repeat(3, 1fr); } }
.dash-jump { cursor: pointer; }
.dash-jump:hover { border-color: var(--accent); }
.wrow .resp-meta.err { color: var(--red); }
.wlist { display: flex; flex-direction: column; gap: 4px; }
.wrow { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 5px 0; border-top: 1px solid var(--line); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 12px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.person-av { position: relative; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; background: var(--grad); }
.person-av .pdot { position: absolute; right: 0; bottom: 2px; width: 11px; height: 11px; border: 2px solid var(--bg-1); margin: 0; }
.person-jid { font-size: 10.5px; color: var(--fg-2); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- profile menu + crystal polish */
.user-area { position: relative; }
.user-chip { background: var(--glass-2); border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px; font-size: 12px; color: var(--fg-2); font-weight: 600; cursor: pointer; transition: all 0.15s; }
.user-chip:hover { border-color: var(--accent); color: var(--fg); transform: translateY(-1px); }
.profile-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 288px; background: rgba(13, 16, 24, 0.97); backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%); border: 1px solid var(--line-2); border-radius: 18px; padding: 18px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.08); z-index: 300; animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.topbar { position: relative; z-index: 90; }

/* resizable splitter between builder and response */
.splitter { height: 7px; cursor: row-resize; flex: 0 0 auto; position: relative; background: transparent; }
.splitter::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 3px; border-radius: 3px; background: var(--line-2); transition: background 0.15s; }
.splitter:hover::after { background: var(--accent); width: 56px; }

/* professional line icons (rail) */
.rail-ico { width: 22px; height: 22px; stroke-width: 1.9; }
.pm-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.pm-av { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: var(--grad); font-size: 17px; flex-shrink: 0; box-shadow: 0 6px 18px rgba(99,102,241,.4); }
.pm-name { font-weight: 700; font-size: 14.5px; }
.pm-email { color: var(--fg-3); font-size: 11.5px; }
.pm-status { font-size: 11px; font-weight: 600; padding: 7px 11px; border-radius: 9px; background: var(--glass-2); margin-bottom: 12px; }
.pm-status.on { color: var(--green); background: var(--green-bg); }
.pm-rows { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.pm-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; font-size: 11px; gap: 8px; }
.pm-row span { color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; font-size: 9.5px; }
.pm-row code { font-family: var(--mono); font-size: 10px; color: var(--fg-2); background: var(--glass-2); padding: 4px 7px; border-radius: 6px; word-break: break-all; white-space: normal; line-height: 1.4; }
.pm-copy { background: none; border: none; color: var(--fg-3); cursor: pointer; font-size: 12px; padding: 2px; border-radius: 5px; }
.pm-copy:hover { color: var(--accent); background: var(--blue-bg); }
.pm-prefs { display: flex; gap: 8px; margin-bottom: 12px; }
.pm-prefs .btn { flex: 1; justify-content: center; }
.assist-fab.hidden-fab { display: none; }
#assistSpeak.on { color: var(--green); }

.dash-profile { display: flex; align-items: center; gap: var(--sp-4); background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); box-shadow: var(--elev-2); }
.dp-av { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: #fff; background: var(--grad); box-shadow: 0 8px 24px rgba(99,102,241,.4); }
.dp-info { flex: 1; min-width: 0; }
.dp-name { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.dp-badge { font-size: 10px; font-weight: 700; padding: 2px 9px; border-radius: 10px; background: var(--glass-2); color: var(--fg-3); margin-left: 8px; }
.dp-badge.on { color: var(--green); background: var(--green-bg); }
.dp-sub { color: var(--fg-3); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-sub code { font-family: var(--mono); font-size: 11px; color: var(--fg-2); }

/* crystal edge highlights for a premium glass look */
.card { box-shadow: var(--elev-2); }
.auth-card, .modal-card { box-shadow: var(--elev-3); }
.card:hover { box-shadow: var(--elev-3); transition: box-shadow 0.2s; }
.auth-card { position: relative; }
.auth-card::before { content: ""; position: absolute; inset: 0; padding: 1px; border-radius: 20px; background: linear-gradient(135deg, rgba(124,132,255,.55), transparent 42%, rgba(34,211,238,.35)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }

/* ============================================================================
   RESPONSIVE — desktop · tablet · mobile  (mobile-app-ready)
   ============================================================================ */

/* robust full-height chain so flex:1 areas fill + scroll correctly everywhere */
#appRoot { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ---- TABLET (≤ 1024px) ---- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 240px 1fr; }
  .team { grid-template-columns: 240px 1fr; }
  .reqname { width: 150px; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .assist-panel { height: 60vh; }
}

/* ---- MOBILE (≤ 640px) ---- */
@media (max-width: 640px) {
  /* topbar wraps + condenses to two compact rows */
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .brand { font-size: 14px; gap: 6px; }
  .conn { flex-wrap: wrap; gap: 6px; width: 100%; }
  .conn label { display: none; }
  .divider { display: none; }
  #userChip { display: none; }
  #envSelect { flex: 1; min-width: 0; }
  .btn { padding: 6px 10px; }

  /* rail -> bottom tab bar (native-app feel) */
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    flex-direction: row; height: 60px; padding: 0; gap: 0;
    border-right: none; border-top: 1px solid var(--line);
    justify-content: space-around; z-index: 45;
    backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  }
  .rail-btn { flex: 1; border-radius: 0; border: none; padding: 8px 2px; font-size: 19px; }
  .rail-btn span { font-size: 9px; }
  .rail-btn.active { background: transparent; color: var(--accent); }
  .rail-badge { top: 5px; right: calc(50% - 18px); }
  .views { padding-bottom: 60px; }

  /* BUILDER: stack collections (capped) over a single-scroll builder+response */
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .main { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .response { flex: 0 0 auto; min-height: 0; }
  .resp-body { overflow: visible; }
  .builder { padding: 12px; }
  .req-line { flex-wrap: wrap; }
  .verb { width: 84px; }
  .send { flex: 1; }
  .req-meta { flex-wrap: wrap; }
  .reqname, .tojid { width: 100%; }
  .tabs, .resp-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab, .rtab { white-space: nowrap; }
  .resp-head { flex-wrap: wrap; }
  .resp-tabs { margin-left: 0; width: 100%; }

  /* DASHBOARD / REPORTS */
  .page { padding: 16px 14px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-v { font-size: 20px; }
  .bar-label { width: 100px; }

  /* TEAM: stack list (capped) over thread */
  .team { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .team-list { border-right: none; border-bottom: 1px solid var(--line); max-height: 38vh; }
  .thread-head { flex-wrap: wrap; gap: 6px; }
  .tiny-select { max-width: 130px; }

  /* ASSIST: full-width bottom sheet, FAB clears the nav */
  .assist-panel { left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; height: 80vh; max-height: 80vh; border-radius: 18px 18px 0 0; }
  .assist-fab { bottom: 74px; right: 16px; width: 50px; height: 50px; font-size: 22px; }

  /* profile menu fits small screens */
  .profile-menu { right: 8px; width: calc(100vw - 16px); max-width: 320px; }
  .dash-profile { flex-wrap: wrap; }

  /* MODALS + AUTH fit the viewport */
  .modal-card, .modal-card.wide { width: 100%; max-height: 88vh; overflow: auto; border-radius: 16px; }
  .auth-card { width: 100%; border-radius: 16px; }
  .tour-card { width: calc(100vw - 24px); }
}

/* coarse-pointer / touch tweaks (tablets + phones) */
@media (pointer: coarse) {
  .btn, .rail-btn, .tab, .rtab, .side-tab, .team-tab { min-height: 38px; }
  .req, .peer-row, .recent-row { min-height: 40px; }
  /* hover-only affordances must stay reachable without a hover state */
  .react-btn { opacity: 0.55; }
  .contact-row .contact-del { opacity: 0.7; }
  .react-pop { display: none; } /* tap the 🙂 toggles a tap-friendly sheet instead of hover */
  .react-btn:active .react-pop, .react-btn:focus-within .react-pop { display: flex; }
}

/* ---- modern-browser polish + new-UI responsiveness ---- */
html { color-scheme: dark light; }
body { accent-color: var(--accent); }
.thread-body { scroll-behavior: smooth; overscroll-behavior: contain; }
@media (max-width: 640px) {
  .secure-banner { flex-wrap: wrap; font-size: 11px; gap: 8px; padding: 7px 12px; text-align: center; }
  body.has-banner #appRoot { padding-top: 56px; }
  .call-btn { width: 48px; height: 48px; font-size: 18px; }
  .call-controls { gap: 8px; }
  #localVideo { width: 116px; bottom: 88px; right: 12px; }
  .console-panel { height: 56vh; }
  .cbubble { max-width: 82%; }
  .var-tip { max-width: 70vw; }
}
/* fall back gracefully where backdrop-filter is unsupported */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .console-panel, .lock-card, .assist-panel, .rail { background: var(--bg-1); }
}
/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
