:root {
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --ink: #17191d;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e2e5e9;
  --line-strong: #cfd4da;
  --red: #e6362a;
  --red-soft: #fff0ee;
  --amber: #d88a06;
  --amber-soft: #fff7e7;
  --green: #218a54;
  --green-soft: #eaf8f0;
  --blue: #276caa;
  --purple: #6d43c4;
  --purple-soft: #f2edff;
  --nav: #15181d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .04);
  --topbar-h: 58px;
  --signal-h: 36px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { background: var(--canvas); color: var(--ink); font-size: 13px; -webkit-font-smoothing: antialiased; }
button, input, textarea { color: inherit; font: inherit; letter-spacing: 0; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
svg { width: 17px; height: 17px; stroke-width: 1.8; }
h1, h2, p { margin: 0; }
h1 { font-size: 18px; line-height: 1.25; }
h2 { font-size: 15px; line-height: 1.3; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.2; margin-bottom: 3px; text-transform: uppercase; }
.eyebrow.purple { color: var(--purple); }

.auth-gate {
  align-items: center;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 5000;
}
.brand-mark { align-items: flex-end; display: flex; font-size: 22px; gap: 3px; margin-bottom: 24px; }
.brand-mark i { background: var(--red); display: block; height: 5px; width: 5px; }
.auth-spinner { animation: spin .8s linear infinite; border: 2px solid var(--line); border-radius: 50%; border-top-color: var(--red); height: 28px; margin-bottom: 12px; width: 28px; }
.auth-gate p { color: var(--muted); font-size: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning svg { animation: spin .8s linear infinite; }

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(285px, 1fr) auto minmax(285px, 1fr);
  height: var(--topbar-h);
  padding: 0 16px;
  position: relative;
  z-index: 1000;
}
.brand { align-items: center; color: var(--ink); display: flex; gap: 9px; min-width: 0; text-decoration: none; }
.brand-word { font-size: 18px; font-weight: 800; }
.brand-word span { color: var(--red); }
.brand-divider { background: var(--line-strong); height: 22px; width: 1px; }
.brand strong { font-size: 13px; }
.brand small { color: var(--muted); font-size: 11px; }
.workspace-tabs { align-self: stretch; display: flex; gap: 2px; }
.workspace-tab {
  align-items: center;
  background: transparent;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  display: flex;
  font-weight: 600;
  gap: 7px;
  padding: 0 15px;
}
.workspace-tab:hover { background: var(--surface-muted); color: var(--ink); }
.workspace-tab.active { border-bottom-color: var(--red); color: var(--ink); }
.top-actions { align-items: center; display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  width: 34px;
}
.icon-btn:hover { background: var(--surface-muted); border-color: var(--line-strong); }
.user-pill { align-items: center; background: transparent; display: flex; gap: 8px; min-width: 116px; padding: 4px; text-align: left; }
.user-pill > span:nth-child(2) { display: grid; min-width: 54px; }
.user-pill b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pill small { color: var(--muted); font-size: 9px; }
.user-pill > svg { color: var(--muted); height: 14px; margin-left: auto; width: 14px; }
.user-avatar { align-items: center; background: #282d36; border-radius: 50%; color: #fff; display: flex; font-size: 10px; font-weight: 700; height: 30px; justify-content: center; width: 30px; }

.signal-strip {
  align-items: center;
  background: var(--nav);
  color: #d5dae2;
  display: flex;
  font-size: 10px;
  gap: 22px;
  height: var(--signal-h);
  padding: 0 16px;
}
.signal-strip > span { align-items: center; display: flex; gap: 6px; white-space: nowrap; }
.signal-strip b { color: #fff; font-weight: 650; }
.state-dot { background: var(--amber); border-radius: 50%; display: inline-block; height: 7px; width: 7px; }
.state-dot.fresh { background: #46bf75; }
.state-dot.stale, .state-dot.partial { background: #f1a832; }
.state-dot.disconnected { background: #ee5c50; }
.state-dot.brain { background: #9d7ee8; }
.signal-focus { flex: 1; }
.signal-focus img { background: #fff; border-radius: 50%; height: 24px; object-fit: cover; width: 24px; }
.signal-focus em { color: #b7bfcc; font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.signal-strip time { color: #9ca6b5; font-variant-numeric: tabular-nums; margin-left: auto; white-space: nowrap; }

.toast { background: var(--nav); border-radius: 5px; bottom: 18px; color: #fff; left: 50%; opacity: 0; padding: 10px 14px; pointer-events: none; position: fixed; transform: translate(-50%, 10px); transition: .18s ease; z-index: 4000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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