:root {
  color-scheme: dark;
  --bg: #08111d;
  --bg-soft: #0d1627;
  --panel: rgba(18, 29, 51, 0.96);
  --panel-soft: rgba(14, 24, 42, 0.94);
  --line: rgba(125, 156, 214, 0.18);
  --line-strong: rgba(125, 156, 214, 0.32);
  --text: #edf5ff;
  --muted: #9db2d1;
  --cyan: #57dcff;
  --purple: #7a42ff;
  --green: #4ade80;
  --yellow: #facc15;
  --red: #fb7185;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 26px;
  --radius-sm: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(87, 220, 255, 0.10), transparent 24%),
    radial-gradient(circle at 78% 14%, rgba(122, 66, 255, 0.12), transparent 20%),
    linear-gradient(180deg, #0b1424 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  line-height: 1.5;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  color: #a1edff;
}

button,
input,
textarea,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(7, 12, 22, 0.78);
  border-bottom: 1px solid rgba(125, 156, 214, 0.12);
}

.topbar-inner {
  width: min(100% - 2rem, 1280px);
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #08111d;
  background: linear-gradient(135deg, var(--cyan), #c4f4ff);
  box-shadow: 0 12px 30px rgba(87, 220, 255, 0.18);
}

.brand-copy {
  display: grid;
  gap: 0.1rem;
}

.brand-copy strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link,
.nav-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: 160ms ease;
}

.nav-link:hover,
.nav-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link-strong {
  background: linear-gradient(135deg, rgba(87, 220, 255, 0.18), rgba(122, 66, 255, 0.22));
}

.inline-form {
  margin: 0;
}

.stage {
  width: min(100% - 2rem, 1280px);
  margin: 0 auto;
}

.stage-page {
  padding: 1.6rem 0 3rem;
}

.card,
.auth-card,
.panel,
.hero-card,
.workspace-sidebar,
.room-sidebar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top right, rgba(87, 220, 255, 0.05), transparent 25%),
    linear-gradient(180deg, rgba(18, 29, 51, 0.97) 0%, rgba(9, 15, 27, 0.99) 100%);
  box-shadow: var(--shadow);
}

.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 140px);
}

.auth-card {
  width: min(100%, 580px);
  padding: 2rem;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.lead,
.muted-copy {
  color: var(--muted);
}

.lead {
  margin: 0;
  max-width: 64ch;
  font-size: 1.03rem;
  line-height: 1.75;
}

.muted-copy {
  margin: 0;
  line-height: 1.7;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.label {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0.95rem 1rem;
  outline: none;
  transition: 160ms ease;
}

.input:focus {
  border-color: rgba(87, 220, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(87, 220, 255, 0.08);
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.35rem;
}

.button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  transition: 160ms ease;
}

.button-primary {
  color: #06111d;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), #9be5ff);
}

.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(87, 220, 255, 0.18);
}

.button-ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.button-ghost:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.field-error {
  margin: 0;
  font-size: 0.92rem;
  color: var(--red);
}

.auth-alt {
  margin: 1.2rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 0.95rem 1rem;
  font-size: 0.96rem;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.03);
}

.flash-success {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.08);
}

.flash-error {
  border-color: rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.08);
}

.workspace-shell,
.room-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.workspace-main,
.room-main {
  display: grid;
  gap: 1rem;
}

.workspace-sidebar,
.room-sidebar,
.hero-card,
.panel {
  padding: 1.2rem;
}

.panel-head {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.hero-copy {
  display: grid;
  gap: 0.8rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 1rem;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.3rem;
}

.stat-label,
.section-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sidebar-section {
  margin-top: 1.1rem;
  display: grid;
  gap: 0.75rem;
}

.status-list,
.room-list,
.user-list,
.participant-list,
.activity-log {
  display: grid;
  gap: 0.7rem;
}

.status-row,
.user-row,
.participant-row,
.activity-entry {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.85rem 1rem;
}

.status-row,
.participant-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.user-meta,
.room-meta {
  display: grid;
  gap: 0.2rem;
}

.user-meta span,
.room-meta span {
  color: var(--muted);
  font-size: 0.92rem;
}

.room-list,
.workspace-grid,
.room-grid {
  display: grid;
  gap: 1rem;
}

.workspace-grid,
.room-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.room-row {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  transition: 160ms ease;
}

.room-row:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.room-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 900;
  color: #08111d;
  background: linear-gradient(135deg, var(--cyan), #c5f5ff);
}

.empty-card {
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 0.4rem;
}

.status-dot,
.participant-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.status-ok,
.badge-ok {
  background: rgba(74, 222, 128, 0.14);
  color: #b8ffd1;
}

.status-warn,
.badge-warn {
  background: rgba(250, 204, 21, 0.12);
  color: #fff1a8;
}

.status-info {
  background: rgba(87, 220, 255, 0.14);
  color: #c8f7ff;
}

.status-dot.status-ok,
.participant-indicator {
  background: var(--green);
}

.status-dot.status-warn {
  background: var(--yellow);
}

.status-dot.status-info {
  background: var(--cyan);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 700;
}

.badge-muted {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.control-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.code-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.code-list code,
.code-block {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  color: #dff8ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.session-list {
  margin-top: 1rem;
}

.session-row {
  align-items: flex-start;
}

.inline-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(87, 220, 255, 0.12);
  color: #c9f8ff;
  font-size: 0.78rem;
  font-weight: 700;
}

.incoming-call-box {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  width: min(360px, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(14, 18, 26, 0.96);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  padding: 1rem;
}

.incoming-call-inner {
  display: grid;
  gap: 0.8rem;
}

.incoming-call-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8fdcff;
}

.incoming-call-title {
  display: block;
  font-size: 1rem;
  line-height: 1.4;
}

.incoming-call-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 1080px) {
  .workspace-shell,
  .room-shell {
    grid-template-columns: 1fr;
  }

  .workspace-grid,
  .room-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    width: min(100% - 1rem, 1280px);
    min-height: 68px;
  }

  .stage {
    width: min(100% - 1rem, 1280px);
  }

  .nav {
    gap: 0.45rem;
  }

  .nav-link,
  .nav-button,
  .button {
    padding: 0.78rem 0.95rem;
  }

  .hero-card {
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .user-row {
    flex-direction: column;
    align-items: stretch;
  }
}