:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --text: #111111;
  --muted: #5c5c5c;
  --line: #e4e4e7;
  --accent: #1d4ed8;
  --danger: #b42318;
  --ok: #157347;
  --warn: #a15c00;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  --font: "Segoe UI", system-ui, sans-serif;
  --wb: #ffffff;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #111214;
    --surface: #1a1b1e;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --line: #2a2b30;
  }
}
html[data-theme="dark"] {
  --bg: #111214;
  --surface: #1a1b1e;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2a2b30;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 10px;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:not(.linkish),
a.btn,
.btn,
.ctrl,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 45%, #1d4ed8 100%);
  color: #fff !important;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(56, 189, 248, .65), 0 6px 14px rgba(29, 78, 216, .45), inset 0 2px 0 rgba(255,255,255,.6);
  transition: 150ms ease;
  text-decoration: none;
}
.btn-primary,
.btn-ghost,
.btn-stop,
.btn-save {
  background: linear-gradient(180deg, #7dd3fc 0%, #3b82f6 42%, #1d4ed8 100%);
  color: #fff !important;
  border-color: #93c5fd;
  border-radius: 999px;
}
.btn:hover, .ctrl:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 16px rgba(59, 130, 246, .55), inset 0 1px 0 rgba(255,255,255,.55);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.tight { padding: 12px; }
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: inherit; text-decoration: none; }
.brand-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: inherit;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}
.sidebar nav a.active, .sidebar nav a:hover { background: var(--bg); }
.sidebar-logout { margin-top: auto; color: var(--muted); }
.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar-title { font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
}
.user-chip { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e8e8ed; display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.app-content { padding: 24px; flex: 1; }
.app-footer { padding: 12px 24px; color: var(--muted); font-size: 13px; display: flex; gap: 16px; border-top: 1px solid var(--line); }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-head h1, .page-head h2 { margin: 0; font-size: 1.4rem; }
.stat-grid, .card-grid, .feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-grid strong { font-size: 1.6rem; }
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.empty {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}
.form-error { color: var(--danger); }
.form-ok { color: var(--ok); }
.auth-body { min-height: 100vh; display: grid; place-items: center; }
.auth-card { width: min(420px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: transparent; padding: 0; border-radius: 0; margin: 0 0 18px; border: 0; }
.auth-tabs a { text-align: center; padding: 8px 10px; border-radius: 999px; color: #fff; font-weight: 700; text-decoration: none; }
.auth-tabs a.active {
  box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(56, 189, 248, .65), 0 6px 14px rgba(29, 78, 216, .45), inset 0 2px 0 rgba(255,255,255,.6);
}
.join-code-big { font-size: 2rem; letter-spacing: .18em; font-weight: 700; margin: 8px 0; }
button.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.landing { width: min(960px, 94vw); margin: 40px auto; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; }
.hero { padding: 48px 0; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 8px 0 12px; }
.lede { max-width: 620px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; }
.eyebrow { letter-spacing: .08em; text-transform: uppercase; font-size: 12px; color: var(--muted); }
.list { list-style: none; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.mobile-nav { display: none; }
.join-screen { display: grid; grid-template-columns: 1fr 360px; gap: 20px; width: min(960px, 94vw); }
.join-preview video { width: 100%; background: #111; border-radius: 12px; min-height: 280px; }
.control-row { display: flex; gap: 8px; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; z-index: 20; width: 240px; }
  .mobile-nav { display: inline-flex; }
  .join-screen { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
