:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #eef3f9;
  --text: #122033;
  --muted: #5f7186;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --border: #dbe4ef;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 0 0, #e0f2fe 0, transparent 45%),
    radial-gradient(circle at 100% 0, #dcfce7 0, transparent 40%),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.main-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.main-nav .brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.main-nav li a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  color: #193248;
  font-size: 14px;
}

.main-nav li.active a,
.main-nav li a:hover {
  background: #dcfce7;
  color: #14532d;
}

.main-nav .user-pill {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 13px;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 18px 50px;
}

.page h1 {
  margin: 0 0 14px;
  font-size: 28px;
}

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

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

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

.grid.cols-3 {
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h2,
.card h3 {
  margin: 0 0 10px;
  font-size: 19px;
}

.card p {
  margin: 8px 0;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-card p {
  margin: 10px 0 16px;
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 14px;
  color: #23384e;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c6d4e3;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

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

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button,
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: transform 0.15s ease, background 0.2s ease;
}

button:hover,
.btn:hover {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.secondary {
  background: #dce8f5;
  color: #1e3348;
}

.btn.secondary:hover {
  background: #d0dfef;
}

.btn.danger {
  background: var(--danger);
}

.btn.warn {
  background: var(--warning);
}

.feedback {
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 14px;
}

.feedback.info {
  background: #e0f2fe;
  color: #0c4a6e;
}

.feedback.error {
  background: #fee4e2;
  color: #7a271a;
}

.feedback.success {
  background: #dcfce7;
  color: #14532d;
}

.class-list,
.session-list,
.exercise-list,
.qa-list,
.transcript-list,
.suggestion-list {
  display: grid;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px;
  background: #fff;
}

.list-item h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.list-meta {
  font-size: 13px;
  color: var(--muted);
}

.split {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.status-pill {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-idle {
  background: #e2e8f0;
  color: #334155;
}

.status-running {
  background: #dcfce7;
  color: #166534;
}

.status-paused {
  background: #fef3c7;
  color: #92400e;
}

.status-stopped,
.status-finalized {
  background: #fee2e2;
  color: #991b1b;
}

.btn.is-active {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.25);
}

.api-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 6px;
}

.status-connected {
  background: #dcfce7;
  color: #166534;
}

.status-disconnected {
  background: #fee2e2;
  color: #991b1b;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  min-height: 180px;
}

.panel h3 {
  margin: 0 0 8px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 18, 0.78);
  display: none;
  z-index: 90;
}

.overlay.open {
  display: grid;
  place-items: center;
}

.overlay-box {
  width: min(1100px, 95vw);
  max-height: 92vh;
  overflow: auto;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  padding: 16px;
}

.teleprompter-box {
  min-height: 130px;
  font-size: 20px;
  line-height: 1.5;
  color: #111827;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
}

.teleprompter-manual {
  min-height: 90px;
}

.iframe-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  min-height: 360px;
}

iframe {
  width: 100%;
  border: 0;
  min-height: 620px;
  background: #fff;
}

.tiny {
  font-size: 12px;
  color: var(--muted);
}

.right {
  text-align: right;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.hidden {
  display: none !important;
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.page-toolbar h1 {
  margin-bottom: 6px;
}

.class-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.class-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.class-card h3 {
  margin: 0;
  font-size: 17px;
}

.class-card .outline-preview {
  margin: 0;
  padding-left: 18px;
}

.class-card .outline-preview li {
  font-size: 13px;
  color: var(--muted);
}

.class-modal-box {
  width: min(920px, 96vw);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-sm {
  padding: 7px 10px;
  font-size: 12px;
}

.outline-items {
  display: grid;
  gap: 8px;
}

.outline-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.outline-item input {
  margin: 0;
}

body.modal-open {
  overflow: hidden;
}

.live-page {
  display: grid;
  gap: 14px;
}

.live-hero {
  background: linear-gradient(130deg, #ffffff 0%, #eef6ff 58%, #ecfeff 100%);
}

.live-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.live-hero-right {
  text-align: right;
  min-width: 120px;
}

.live-hero-right .status-pill {
  margin-top: 4px;
}

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

.live-meta-card {
  border: 1px solid #d8e4f1;
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.84);
}

.live-meta-card p {
  margin: 4px 0;
}

.live-state-card {
  border-color: #cbd5e1;
}

.session-state-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.session-dot.status-running {
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.2);
}

.live-control-panel {
  border: 1px solid #d5e5f8;
  background: linear-gradient(160deg, #ffffff 0%, #f9fbff 100%);
}

.live-control-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.live-control-grid > div {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.live-control-grid h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.live-stream-grid {
  grid-template-columns: 1fr;
}

.live-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #d8e2ef;
}

.live-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.live-panel-head h3 {
  margin: 0;
}

.live-overlay-box {
  width: min(1260px, 97vw);
}

.live-monitor-page {
  max-width: 1400px;
}

@media (min-width: 860px) {
  .grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .split {
    grid-template-columns: 1.2fr 0.8fr;
  }
  .live-control-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .live-stream-grid {
    grid-template-columns: 1.25fr 0.75fr;
  }
}
