:root {
  --bg: #eef2f7;
  --bg-strong: #dfe7f0;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-muted: #f5f8fc;
  --line: rgba(22, 35, 55, 0.12);
  --line-strong: rgba(22, 35, 55, 0.2);
  --text: #142033;
  --muted: #607188;
  --accent: #276ef1;
  --accent-soft: rgba(39, 110, 241, 0.12);
  --danger: #d24e4e;
  --success: #22a06b;
  --radius: 22px;
  --shadow: 0 18px 50px rgba(43, 71, 111, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(39, 110, 241, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f9fc, #edf2f7 50%, #e8eef6);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.landing {
  min-height: 100vh;
  padding: 3rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
}

.landing-copy,
.session-card,
.sidebar,
.meeting-panel,
.utility-panel,
.utility-card,
.meeting-header,
.stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.landing-copy,
.session-card {
  padding: 2.5rem;
}

.landing-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.landing-copy h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.95;
  max-width: 11ch;
}

.lede {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.session-card {
  display: flex;
  align-items: center;
}

.session-form,
.dialog-form {
  width: 100%;
  display: grid;
  gap: 1rem;
}

.session-form label,
.dialog-form label {
  display: grid;
  gap: 0.45rem;
}

.session-form span,
.dialog-form span {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.primary,
.ghost {
  padding: 0.82rem 1rem;
  border-radius: 16px;
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #5b8fff);
  color: white;
}

.ghost {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--text);
}

.ghost.critical {
  color: var(--danger);
}

.primary:disabled,
.ghost:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint,
.form-error {
  margin: 0;
  color: var(--muted);
}

.form-error {
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  padding: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 300px minmax(0, 1.2fr) 360px;
}

.sidebar,
.meeting-panel,
.utility-panel {
  padding: 1rem;
}

.sidebar,
.utility-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.meeting-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.sidebar-top,
.panel-header,
.meeting-header,
.dialog-header,
.dialog-actions,
.composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.session-badge,
.header-summary {
  display: grid;
  gap: 0.22rem;
}

.session-badge span,
.panel-header p,
.header-summary p,
.participant-row span,
.chat-meta time,
.video-meta span {
  color: var(--muted);
}

.panel-header {
  align-items: end;
}

.panel-header h2,
.meeting-header h1,
.dialog-header h3 {
  margin: 0;
}

.room-list,
.participant-list,
.chat-feed {
  display: grid;
  gap: 0.75rem;
}

.room-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  text-align: left;
}

.room-card span,
.room-card small {
  color: var(--muted);
}

.room-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.room-card.is-joined {
  box-shadow: inset 0 0 0 1px rgba(34, 160, 107, 0.45);
}

.create-room {
  width: 100%;
}

.meeting-header {
  position: sticky;
  top: 1rem;
  padding: 1rem 1.1rem;
  z-index: 2;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.call-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.stage {
  padding: 1rem;
}

.stage-heading h2 {
  margin: 0;
}

.stage-heading p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.video-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.video-tile {
  position: relative;
  min-height: 220px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #283347, #192230);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.video-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  background: linear-gradient(180deg, rgba(18, 28, 43, 0.2), rgba(18, 28, 43, 0.45));
}

.video-fallback.is-hidden {
  display: none;
}

.video-meta {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  color: white;
  background: rgba(15, 21, 32, 0.62);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 0.15rem;
}

.utility-panel {
  gap: 1rem;
}

.utility-card {
  padding: 1rem;
}

.participant-row,
.chat-message {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 0.95rem;
}

.participant-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.presence {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #9baabc;
}

.presence.is-live {
  background: var(--success);
}

.presence.is-idle {
  background: #9baabc;
}

.chat-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.chat-feed {
  min-height: 280px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 0.25rem;
}

.chat-meta,
.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.chat-message p {
  margin: 0.4rem 0 0.65rem;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.33rem 0.66rem;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.9rem;
}

.composer {
  display: grid;
  gap: 0.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.composer textarea {
  min-height: 96px;
}

.empty-inline {
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface-muted);
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 21, 32, 0.26);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 20;
}

.dialog {
  width: min(540px, 100%);
  padding: 1.1rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.dialog-header {
  align-items: start;
}

.dialog-header p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: 320px;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: #152339;
  color: white;
  box-shadow: var(--shadow);
  z-index: 30;
}

.toast.is-error {
  background: #b83d3d;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px 1fr;
  }

  .utility-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .chat-feed {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .landing,
  .app-shell,
  .utility-panel {
    grid-template-columns: 1fr;
  }

  .landing {
    padding: 1rem;
  }

  .landing-copy,
  .session-card {
    padding: 1.4rem;
  }

  .landing-copy h1 {
    max-width: none;
    font-size: 2.5rem;
  }

  .meeting-header,
  .sidebar,
  .meeting-panel,
  .utility-panel {
    position: static;
  }

  .call-controls,
  .sidebar-top,
  .panel-header,
  .meeting-header,
  .dialog-actions,
  .composer-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
