:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --line: #dfe4ea;
  --text: #1d2733;
  --muted: #667589;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #14866d;
  --red: #c84636;
  --amber: #946200;
  --ink: #111827;
  --soft: #eef2f6;
  --shadow: 0 12px 28px rgba(16, 24, 32, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  background: #111827;
}

.login-hero {
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(rgba(17, 24, 39, .35), rgba(17, 24, 39, .88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='800'%3E%3Crect width='1200' height='800' fill='%23111827'/%3E%3Cg fill='none' stroke='%233b82f6' stroke-opacity='.34' stroke-width='2'%3E%3Cpath d='M92 168h260v150H92zM410 120h320v210H410zM784 174h260v150H784zM188 420h360v210H188zM610 440h330v190H610z'/%3E%3Cpath d='M352 242h58M730 232h54M548 526h62'/%3E%3C/g%3E%3Cg fill='%23fff' fill-opacity='.18'%3E%3Ccircle cx='220' cy='242' r='46'/%3E%3Ccircle cx='570' cy='228' r='58'/%3E%3Ccircle cx='910' cy='246' r='44'/%3E%3C/g%3E%3C/svg%3E") center/cover;
}

.login-hero h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.login-hero p {
  max-width: 620px;
  color: #d7deea;
  font-size: 16px;
}

.login-panel {
  background: #fff;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel h2,
.page-head h1 {
  margin: 0;
  letter-spacing: 0;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: #394559;
  font-weight: 600;
  font-size: 13px;
}

.field input,
.field textarea,
.field select,
.field-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.hint {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #111827;
  color: #d7deea;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  color: #fff;
}

.brand-logo {
  display: block;
  width: 178px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  border: 0;
  color: #d7deea;
  background: transparent;
  text-align: left;
  padding: 10px 11px;
  border-radius: 8px;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: #253044;
}

.side-user {
  margin-top: auto;
  padding: 12px;
  background: #1b2435;
  border-radius: 8px;
}

.side-user strong {
  color: #fff;
  display: block;
}

.side-user span {
  color: #9aa7ba;
  font-size: 12px;
}

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.content {
  padding: 24px 28px 36px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.btn {
  min-height: 36px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  border-radius: 8px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.btn.primary {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.btn.primary:hover {
  background: var(--blue-dark);
}

.btn.danger {
  color: var(--red);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 16px;
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-2 {
  grid-template-columns: 1.2fr .8fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin: 10px 0 4px;
}

.muted {
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 12px;
  color: #184d3f;
  background: #ddf6ef;
}

.status.live {
  color: #7b2519;
  background: #ffe5df;
}

.status.scheduled {
  color: #59400c;
  background: #fff2cc;
}

.status.pending {
  color: #59400c;
  background: #fff2cc;
}

.status.ended {
  color: #4d5968;
  background: #eef2f6;
}

.course-list,
.chat-list,
.queue-list,
.member-list {
  display: grid;
  gap: 12px;
}

.course-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.thumb {
  height: 58px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .95), rgba(20, 134, 109, .92)),
    #d8e2f0;
}

.course-row h3,
.queue-card h3,
.member-card h3 {
  margin: 0;
  font-size: 15px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.admin-create-panel {
  margin-bottom: 16px;
}

.admin-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.admin-table-head h2 {
  margin-bottom: 4px;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .8fr) minmax(140px, .65fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.user-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fff;
}

.user-table th,
.user-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

.user-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
}

.user-table tr:last-child td {
  border-bottom: 0;
}

.user-table input,
.user-table select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
}

.table-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
  padding: 26px !important;
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 16px;
}

.room-head {
  margin-bottom: 12px;
}

.room-statusbar {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(110px, .5fr));
  gap: 10px;
  margin-bottom: 14px;
}

.room-status-item {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 18px rgba(16, 24, 32, .05);
  min-width: 0;
}

.room-status-item strong {
  color: var(--text);
  white-space: nowrap;
}

.room-status-item span:last-child {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d4a106;
  flex: 0 0 auto;
}

.signal-dot.online {
  background: var(--green);
}

.stage {
  background: #101820;
  border-radius: 8px;
  min-height: 590px;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto auto;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stage-label {
  min-height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid #263244;
  background: #151f2e;
  color: #d7deea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-main {
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 2.25fr) minmax(260px, .82fr);
  gap: 12px;
  min-height: 430px;
}

.tile {
  min-height: 360px;
  position: relative;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  background: #1f2937;
  color: #d7deea;
  display: grid;
  place-items: center;
}

.tile.primary,
.screen-focus {
  background:
    radial-gradient(circle at 34% 28%, rgba(64, 132, 255, .44), transparent 24%),
    linear-gradient(135deg, #111827, #243145);
}

.teacher-focus {
  min-height: 360px;
}

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

.speaker-strip {
  border-top: 1px solid #263244;
  background: #111a28;
  padding: 12px 16px 14px;
}

.speaker-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #d7deea;
  font-size: 13px;
  margin-bottom: 10px;
}

.speaker-strip-head span {
  color: #94a3b8;
}

.speaker-track {
  width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.speaker-tile {
  flex: 0 0 156px;
  width: 156px;
  height: 96px;
  position: relative;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1f2937;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.remote-track video,
.remote-track audio,
.speaker-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remote-audio-tracks {
  display: none;
}

.speaker-empty {
  width: 100%;
  min-height: 96px;
  border: 1px dashed #334155;
  border-radius: 8px;
  color: #94a3b8;
  display: grid;
  place-items: center;
}

.tile .placeholder {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #e8eef8;
  color: #1e3a8a;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 26px;
}

.tile .placeholder.small,
.speaker-tile .placeholder.small {
  width: 54px;
  height: 54px;
  font-size: 20px;
}

.tile-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  color: #fff;
  background: rgba(9, 14, 23, .72);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.fullscreen-btn {
  position: absolute;
  z-index: 2;
  right: 10px;
  top: 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(9, 14, 23, .72);
  color: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
}

.fullscreen-btn:hover {
  background: rgba(37, 99, 235, .92);
}

.tile:fullscreen {
  border-radius: 0;
}

.controls {
  min-height: 72px;
  border-top: 1px solid #263244;
  background: #151f2e;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-note {
  color: #cbd5e1;
  font-size: 13px;
}

.dark-btn {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid #3d4a60;
  color: #d7deea;
  background: #202b3c;
  padding: 0 12px;
}

.dark-btn.active {
  color: #fff;
  background: #1f4fc0;
  border-color: #1f4fc0;
}

.dark-btn.danger {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

.room-panel {
  padding: 0;
  overflow: hidden;
  align-self: start;
  min-height: 590px;
}

.room-tabs {
  height: 52px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.room-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.room-tabs button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: inset 0 -2px 0 var(--blue);
}

.room-tabs span {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  border-radius: 99px;
  background: #e8eef8;
  font-size: 12px;
}

.room-panel-body {
  padding: 16px;
}

.panel-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-section-head h2 {
  margin-bottom: 3px;
}

.chat-list {
  height: 386px;
  overflow: auto;
  padding-right: 4px;
}

.chat-message {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 9px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e8eef8;
  color: #1f4fc0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.chat-message p {
  margin: 2px 0 0;
  color: #394559;
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.message-head strong {
  color: var(--text);
}

.message-head span {
  font-size: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.empty-state {
  min-height: 150px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.empty-state strong {
  color: var(--text);
}

.approval-tips {
  margin-top: 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.approval-tips strong {
  color: var(--text);
}

.queue-card,
.member-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #b9d3ff;
  color: #1e4ec7;
  background: #edf4ff;
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: 380px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #1f2937;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

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

  .nav span,
  .side-user {
    display: none;
  }

  .sidebar .brand-logo {
    width: 50px;
  }

  .cols-3,
  .cols-2,
  .room-layout,
  .room-statusbar,
  .admin-filters {
    grid-template-columns: 1fr;
  }

  .stage-main {
    grid-template-columns: 1fr;
  }

  .tile.primary {
    grid-column: auto;
  }

  .room-panel {
    min-height: auto;
  }

  .chat-list {
    height: 300px;
  }
}

@media (max-width: 760px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 260px;
    padding: 28px;
  }

  .login-panel {
    padding: 28px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }

  .nav {
    display: flex;
  }

  .topbar,
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .page-head,
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .stage-label,
  .room-status-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .course-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stage-main {
    grid-template-columns: 1fr;
  }

  .speaker-tile {
    flex-basis: 132px;
    width: 132px;
    height: 86px;
  }
}
