/* ═══════════════════════════════════════════════════════════
   Style.css — SmartClassroom  |  Complete shared stylesheet
   Link on ALL pages. Contains: variables, base, nav, cards,
   buttons, forms, modals, tables, toasts, responsive.
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ══════════════════════════════════════════════════════════
   TOKENS
══════════════════════════════════════════════════════════ */
:root {
  --bg:          #090c14;
  --bg-1:        #0f1422;
  --bg-2:        #141928;
  --bg-3:        #1a2035;
  --border:      rgba(99,120,200,0.13);
  --border-hi:   rgba(99,120,200,0.28);
  --text:        #e8eaf6;
  --text-1:      #e8eaf6;
  --text-2:      #8892b0;
  --text-3:      #4a5270;
  --accent:      #6c8dff;
  --accent-2:    #a78bfa;
  --accent-dim:  rgba(108,141,255,0.35);
  --accent-glow: rgba(108,141,255,0.06);
  --amber:       #f5a623;
  --amber-dim:   rgba(245,166,35,0.25);
  --amber-glow:  rgba(245,166,35,0.07);
  --green:       #34d399;
  --green-dim:   rgba(52,211,153,0.05);
  --red:         #f87171;
  --red-dim:     rgba(248,113,113,0.05);
  --blue:        #60a5fa;
  --gray:        #6b7280;
  --font-main:   'Syne', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --transition:  0.22s cubic-bezier(.4,0,.2,1);
  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   20px;
}

/* ══════════════════════════════════════════════════════════
   RESET
══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ── Background grid ──────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(108,141,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,141,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Ambient orb ──────────────────────────────── */
body::after {
  content: '';
  position: fixed; top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(108,141,255,0.07) 0%, transparent 70%);
  pointer-events: none;
  animation: driftOrb 18s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes driftOrb {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(300px,200px) scale(1.3); }
}

/* ══════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  height: 58px;
  backdrop-filter: blur(22px) saturate(1.5);
  background: rgba(9,12,20,0.88);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.nav-brand span { color: var(--amber); }

.brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--amber), #d4860a);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  box-shadow: 0 0 14px rgba(245,166,35,0.45);
  flex-shrink: 0;
}

/* ── Desktop nav links ── */
.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.25rem;
  margin: 0 auto;
}

.nav-links li a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.38rem 0.875rem;
  border-radius: 99px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-links li a:hover {
  color: var(--text-1);
  background: rgba(108,141,255,0.08);
  border-color: var(--border);
}

.nav-links li a.active {
  color: var(--text-1);
  background: rgba(245,166,35,0.12);
  border-color: rgba(245,166,35,0.28);
}

/* ── Status pill ── */
.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-2);
  font-family: var(--font-mono);
  background: rgba(52,211,153,0.07);
  border: 1px solid rgba(52,211,153,0.2);
  padding: 0.3rem 0.75rem;
  border-radius: 99px;
  flex-shrink: 0;
  white-space: nowrap;
}

.status-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: dotPulse 2.5s ease-in-out infinite;
}

@keyframes dotPulse {
  0%,100% { opacity:1; box-shadow: 0 0 6px var(--green); }
  50%      { opacity:.6; box-shadow: 0 0 14px var(--green); }
}

/* ── Hamburger (desktop: hidden) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px;
  margin-left: auto;
  transition: var(--transition);
  flex-shrink: 0;
  cursor: pointer;
}

.nav-hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text-1);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-hamburger:hover {
  border-color: var(--amber-dim);
  background: var(--amber-glow);
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════
   PAGE LAYOUTS
══════════════════════════════════════════════════════════ */
.page {
  position: relative;
  z-index: 1;
  max-width: 1340px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

.page-sm {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-header-left { flex: 1; }

.page-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-1);
  margin-bottom: 0.25rem;
}

.page-header h1 em {
  color: var(--amber);
  font-style: normal;
}

.page-header p {
  color: var(--text-2);
  font-size: 0.875rem;
}

/* ═══ Section label ════ */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1rem;
}

/* ══════════════════════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  cursor: default;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hi);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-1);
  margin-bottom: 0.375rem;
  letter-spacing: -0.025em;
}

.stat-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
}

/* ══════════════════════════════════════════════════════════
   CARD
══════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber), #d4860a);
  color: #0c0a04;
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(245,166,35,0.4);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 26px rgba(245,166,35,0.55);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text-1);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-hi);
  background: rgba(99,120,200,0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  color: var(--text-1);
  background: rgba(99,120,200,0.06);
  border-color: var(--border);
}

.btn-danger {
  background: rgba(248,113,113,0.1);
  color: var(--red);
  border-color: rgba(248,113,113,0.25);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.18);
  border-color: rgba(248,113,113,0.45);
}

.btn-sm {
  padding: 0.33rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ══════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.badge-green { background: rgba(52,211,153,0.12);  border-color: rgba(52,211,153,0.25);  color: var(--green); }
.badge-blue  { background: rgba(96,165,250,0.12);   border-color: rgba(96,165,250,0.25);   color: var(--blue); }
.badge-amber { background: rgba(245,166,35,0.12);   border-color: rgba(245,166,35,0.25);   color: var(--amber); }
.badge-gray  { background: rgba(107,114,128,0.12);  border-color: rgba(107,114,128,0.22);  color: #9ca3af; }

/* ══════════════════════════════════════════════════════════
   LECTURE CARDS
══════════════════════════════════════════════════════════ */
.lecture-card {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  position: relative;
}

.lecture-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--amber), #d4860a);
  border-radius: 3px 0 0 3px;
  opacity: 0;
  transform: scaleY(0.4);
  transition: all var(--transition);
}

.lecture-card:hover {
  border-color: var(--border-hi);
  transform: translateX(4px);
  box-shadow: -4px 0 20px rgba(245,166,35,0.07), 0 4px 18px rgba(0,0,0,0.2);
}

.lecture-card:hover::after {
  opacity: 1;
  transform: scaleY(1);
}

.lecture-card-body {
  flex: 1;
  padding: 0.875rem 1.25rem;
  min-width: 0;
}

.lecture-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lecture-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 0.375rem;
}

.lecture-card-excerpt {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lecture-card-actions {
  padding: 0 0.875rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ══════════════════════════════════════════════════════════
   STAGE ITEMS
══════════════════════════════════════════════════════════ */
.stage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stage-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--border);
  transition: background var(--transition);
}

.stage-item.done {
  border-color: rgba(52,211,153,0.2);
  background: var(--green-dim);
}
.stage-item.done::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.stage-item.active {
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}
.stage-item.active::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: stagePulse 1.2s ease-in-out infinite;
}

.stage-item.error {
  border-color: rgba(248,113,113,0.25);
  background: var(--red-dim);
}
.stage-item.error::before { background: var(--red); }

@keyframes stagePulse {
  0%,100% { opacity:1; }
  50%      { opacity: 0.3; }
}

.stage-icon {
  width: 28px; height: 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-1);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(245,166,35,0.45);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.09);
}

.form-input::placeholder { color: var(--text-3); }

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a5270' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 2rem;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap .form-input { padding-left: 2.1rem; }

.search-icon {
  position: absolute;
  left: 0.65rem;
  color: var(--text-3);
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 1;
  line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4,6,14,0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity:0; transform: scale(0.95) translateY(8px); }
  to   { opacity:1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 28px; height: 28px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  transition: var(--transition);
}

.modal-close:hover {
  border-color: var(--border-hi);
  color: var(--text-1);
}

.modal-body { padding: 1.25rem; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(99,120,200,0.04); }

.td-title {
  color: var(--text-1);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 1.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
  max-width: 100%;
}

.tab-btn {
  padding: 0.42rem 1rem;
  border-radius: 5px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-1); }

.tab-btn.active {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--text-1);
}

/* ══════════════════════════════════════════════════════════
   TEXT BLOCK (LECTURE DETAIL)
══════════════════════════════════════════════════════════ */
.text-block-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.75rem;
}

.text-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.8;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Detail header ── */
.detail-header { margin-bottom: 1.5rem; }

.detail-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.2;
  margin: 0.5rem 0 1rem;
  letter-spacing: -0.025em;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  row-gap: 4px;
}

.breadcrumb a { color: var(--text-3); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--amber); }
.breadcrumb .sep { color: var(--text-3); }

/* ══════════════════════════════════════════════════════════
   LOADING / EMPTY / SPINNER
══════════════════════════════════════════════════════════ */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 0.875rem;
  padding: 2.5rem;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-lg { width: 28px; height: 28px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-2);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.875rem;
  display: block;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.4rem;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-2);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  color: var(--text-1);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  animation: toastIn 0.28s ease;
  pointer-events: all;
  max-width: 340px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--accent); }

.toast-out { animation: toastOut 0.28s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform: translateY(8px) scale(0.95); } to { opacity:1; transform:none; } }
@keyframes toastOut { to   { opacity:0; transform: translateX(12px) scale(0.95); } }

/* ══════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════ */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
}

.footer-text em {
  font-style: normal;
  color: var(--amber);
  opacity: 0.65;
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity:0; transform: translateY(14px); }
  to   { opacity:1; transform: none; }
}

.fade-in { animation: fadeUp 0.45s ease both; }

.stagger > * { animation: fadeUp 0.4s ease both; }
.stagger > *:nth-child(1) { animation-delay:.05s; }
.stagger > *:nth-child(2) { animation-delay:.10s; }
.stagger > *:nth-child(3) { animation-delay:.15s; }
.stagger > *:nth-child(4) { animation-delay:.20s; }
.stagger > *:nth-child(5) { animation-delay:.25s; }
.stagger > *:nth-child(6) { animation-delay:.30s; }

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

.flex         { display: flex; }
.items-center { align-items: center; }
.gap-1        { gap: 0.5rem; }
.gap-2        { gap: 1rem; }
.ml-auto      { margin-left: auto; }
.mt-1         { margin-top: 0.5rem; }
.mt-2         { margin-top: 1rem; }
.mb-2         { margin-bottom: 1rem; }
.mb-3         { margin-bottom: 1.5rem; }

.text-mono  { font-family: var(--font-mono); }
.text-xs    { font-size: 0.75rem; }
.text-sm    { font-size: 0.875rem; }
.text-muted { color: var(--text-3); }

.active-view {
  background: var(--bg-3) !important;
  border-color: var(--border-hi) !important;
  color: var(--text-1) !important;
}

/* ══════════════════════════════════════════════════════════
   ██████  RESPONSIVE  ██████
══════════════════════════════════════════════════════════ */

/* ── Tablet ≤ 1024px ──────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2,1fr);
  }
}

/* ── Tablet ≤ 900px ───────────────────────────── */
@media (max-width: 900px) {
  /* Nav: show hamburger */
  .nav-hamburger {
    display: flex;
  }

  /* Push status to the far right before hamburger hides it */
  .nav-status {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
  }

  /* Mobile nav drawer */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(9,12,20,0.98);
    backdrop-filter: blur(24px) saturate(1.5);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border-hi);
    padding: 0.25rem 0;
    z-index: 150;
    box-shadow: 0 16px 36px rgba(0,0,0,0.45);
    animation: slideDown 0.2s ease;
  }

  @keyframes slideDown {
    from { opacity:0; transform: translateY(-8px); }
    to   { opacity:1; transform: none; }
  }

  .nav-links.open { display: flex; }

  .nav-links li {
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child { border-bottom: none; }

  .nav-links li a {
    display: flex;
    padding: 0.875rem 1.5rem;
    border-radius: 0;
    border: none;
    font-size: 0.95rem;
    width: 100%;
  }

  .nav-links li a.active {
    background: var(--amber-glow);
    border-radius: 0;
    border: none;
    border-left: 3px solid var(--amber);
  }

  /* Page padding */
  .page, .page-sm {
    padding: 1.25rem 1.25rem 2rem;
  }

  /* Page header stack */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.875rem;
  }

  .page-header > a.btn,
  .page-header > .btn {
    width: 100%;
  }

  .page-header > .flex {
    flex-wrap: wrap;
    gap: 6px;
  }

  .page-header > .flex .btn {
    flex: 1;
    min-width: 80px;
  }

  /* Stats grid  */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  /* Tabs scrollable */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; }

  /* Table scroll */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 580px; }

  /* Modal bottom sheet */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100% !important;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92dvh;
    overflow-y: auto;
  }

  /* Footer */
  .footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.3rem;
    padding: 1rem 1.25rem;
  }

  /* Lecture card actions */
  .lecture-card-actions {
    display: none; /* show only the card body; tapping whole card navigates */
  }

  /* Detail actions wrap */
  .detail-actions {
    gap: 6px;
  }
  .detail-actions .btn {
    flex: 1 1 calc(50% - 3px);
    min-width: 110px;
  }
  .detail-actions .ml-auto {
    margin-left: 0;
    flex: 1 1 100%;
  }

  /* Raw info */
  #raw-info {
    grid-template-columns: 90px 1fr !important;
    font-size: 0.82rem !important;
  }

  /* Card padding */
  .card { padding: 1rem 1.1rem; }
}

/* ── Mobile ≤ 600px ───────────────────────────── */
@media (max-width: 600px) {
  .page, .page-sm {
    padding: 1rem 1rem 2rem;
  }

  /* Navbar */
  .navbar { padding: 0 1rem; }

  /* Hide status text, keep dot only */
  .nav-status span:not(.status-dot) { display: none; }
  .nav-status { background: none; border: none; padding: 0; }

  /* Stats single column */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }

  /* Smaller stat values */
  .stat-value { font-size: 2rem; }

  .page-header h1 { font-size: 1.65rem; }

  /* Detail title */
  .detail-title {
    font-size: 1.35rem !important;
    margin-bottom: 0.75rem;
  }

  /* Detail actions: full width */
  .detail-actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  /* Modal padding */
  .modal-body { padding: 1rem; }
  .modal-header, .modal-footer { padding: 0.875rem 1rem; }

  /* Lecture card title truncate less aggressively */
  .lecture-card-title { white-space: normal; -webkit-line-clamp: 2; }

  /* Toast full width */
  .toast-container {
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: 0.875rem !important;
  }
  .toast { max-width: 100%; }

  /* Hide table summary col */
  table th:nth-child(5),
  table td:nth-child(5) { display: none; }

  /* Card */
  .card { padding: 0.875rem 1rem; }
}

/* ── Tiny ≤ 400px ─────────────────────────────── */
@media (max-width: 400px) {
  .page, .page-sm {
    padding: 0.875rem 0.875rem 1.5rem;
  }

  .page-header h1 { font-size: 1.4rem; }

  .nav-brand { font-size: 0.95rem; }
  .brand-icon { width: 28px; height: 28px; font-size: 0.85rem; border-radius: 7px; }

  .stat-card { padding: 0.875rem 1rem; }
  .stat-value { font-size: 1.75rem; }

  .tabs { gap: 2px; }
  .tab-btn { padding: 0.38rem 0.75rem; font-size: 0.8rem; }

  /* Endpoint rows */
  .endpoint-row .text-mono { font-size: 0.68rem; }
}