/* ============================================================================
   LMS Advanced — design system (bold/energetic, refined dark + red)
   ========================================================================= */
:root {
  --bg: #0b0c0f;
  --bg-soft: #101216;
  --surface: #16181e;
  --surface-2: #1c1f26;
  --surface-3: #22252d;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  --accent: #ff3b4e;
  --accent-2: #ff6a3d;
  --accent-dark: #c81e3a;
  --accent-gradient: linear-gradient(135deg, #ff4d5e 0%, #c81e3a 100%);
  --accent-soft: rgba(255, 59, 78, 0.14);

  --blue: #3b82f6;
  --gold: #eab308;
  --green: #22c55e;
  --amber: #f59e0b;

  --text: #f4f5f7;
  --text-dim: #aeb4c0;
  --text-muted: #72798a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 0 1px rgba(255,59,78,0.25), 0 8px 24px rgba(255,59,78,0.18);

  --sidebar-w: 272px;
  --journey-w: 300px;
  --topbar-h: 68px;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Lexend', 'Inter', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--accent-2); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent); }
h1, h2, h3 { margin: 0 0 12px; font-family: var(--font-display); letter-spacing: -0.01em; }
::selection { background: var(--accent); color: #fff; }
code { background: var(--surface-3); color: #ffd479; padding: 2px 7px; border-radius: 6px; font-size: 0.92em; }

/* scrollbars (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid var(--bg); }

/* ─── Global mobile menu button (fixed, shown < 900px) ──────────────────── */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 220;
  width: 42px; height: 42px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  align-items: center; justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.hamburger-btn span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 150;
}
.sidebar-overlay.open { display: block; }
body.sidebar-open-lock { overflow: hidden; }

.sidebar-close-btn { display: none; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(180deg, #121317 0%, #0d0e11 100%);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.topbar-logo:hover { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar-links { display: flex; align-items: center; gap: 18px; }
.topbar-links a { color: var(--text-dim); font-size: 13.5px; font-weight: 500; }
.topbar-links a:hover { color: var(--text); }

.membership-pill {
  background: var(--accent-gradient);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 14px rgba(255,59,78,0.3);
}
.avatar-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: var(--text);
}

/* ─── App / Admin layout ─────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--journey-w);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h));
}
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar-app, .sidebar-admin {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  padding: 22px 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.admin-layout .sidebar-admin { top: 0; height: 100vh; }

.sidebar-admin-brand {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  padding: 0 22px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-admin-brand span { color: var(--accent-2); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.sidebar-link .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-link.active {
  background: var(--accent-soft);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-link.active .nav-icon { color: var(--accent-2); opacity: 1; }
.logout-link { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.sidebar-role-badge { margin: 20px 20px 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.sidebar-role-badge strong { color: var(--text-dim); }

.tier-tabs { display: flex; margin: 20px 20px 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); padding: 3px; gap: 3px; }
.tier-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  border-radius: 7px;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.tier-tab.active { color: #fff; background: var(--tab-color, var(--accent-gradient)); box-shadow: var(--shadow-sm); }
.tier-tab:hover { text-decoration: none; color: #fff; }

.category-tree { padding: 16px 12px 0; }
.category-node { margin-bottom: 4px; }
.category-node summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 10px;
  list-style: none;
}
.category-node summary::-webkit-details-marker { display: none; }
.category-node ul { list-style: none; margin: 0; padding: 0 0 8px 10px; }
.category-node li a {
  display: block;
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 8px 10px;
  border-radius: 8px;
}
.category-node li a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.category-node li a.locked { color: var(--text-muted); }

/* ─── Content ────────────────────────────────────────────────────────────── */
.app-content { padding: 32px; max-width: 980px; }
.admin-layout .app-content { padding: 32px; max-width: none; width: 100%; }
.page-heading { font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; color: var(--text); }
.page-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

.watch-first-banner {
  background: var(--accent-gradient);
  color: #fff;
  padding: 16px 22px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 20px rgba(255,59,78,0.25);
}
.video-wrap {
  position: relative; padding-bottom: 56.25%; height: 0;
  background: #000;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.video-wrap iframe, .video-wrap video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.journey-widget {
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-lg);
  margin: 32px 32px 32px 0;
  height: fit-content;
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
}
.journey-header { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.25; margin-bottom: 18px; }
.journey-header strong { color: var(--accent-2); }
.journey-steps { list-style: none; margin: 0; padding: 0; }
.journey-step { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-dim); }
.journey-step:first-child { border-top: none; }
.journey-step .journey-check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}
.journey-step.done { color: var(--text); }
.journey-step.done .journey-check { background: var(--green); border-color: var(--green); color: #fff; }
.journey-mark-link { color: inherit; }
.journey-mark-link:hover { color: var(--accent-2); }

/* ─── Cards / grids ──────────────────────────────────────────────────────── */
.course-category-section { margin-bottom: 32px; }
.course-category-section h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 700; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.course-card, .plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.course-card:hover, .plan-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.course-card h3 { font-size: 15.5px; }
.course-card p, .plan-card p { color: var(--text-dim); font-size: 13.5px; }
.course-card.locked { opacity: 0.55; }
.course-card.locked:hover { transform: none; }
.plan-card.current { border-color: var(--green); box-shadow: 0 0 0 1px rgba(34,197,94,0.25); }

.bonus-stats-row { display: flex; gap: 28px; margin-bottom: 24px; flex-wrap: wrap; }
.bonus-stat { display: flex; flex-direction: column; }
.bonus-stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--text); }
.bonus-stat-label { font-size: 12px; color: var(--text-muted); }

.bonus-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
}
.bonus-hero-media {
  position: relative;
  min-height: 180px;
  background-size: cover; background-position: center;
  background-color: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.bonus-hero-media svg { width: 56px; height: 56px; opacity: 0.5; }
.bonus-hero-body { padding: 26px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.bonus-hero-body h2 { font-size: 22px; margin: 0; }
.bonus-hero-body p { color: var(--text-dim); margin: 0; }
.bonus-hero-body .btn { align-self: flex-start; margin-top: 4px; }
.bonus-hero.locked .bonus-hero-media { filter: blur(3px) brightness(0.6); }

.bonus-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.bonus-toolbar input { max-width: 240px; margin: 0; }
.bonus-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.bonus-filter-tab {
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-dim);
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.bonus-filter-tab:hover { color: var(--text); }
.bonus-filter-tab.active { background: var(--accent-gradient); border-color: transparent; color: #fff; }

.bonus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.bonus-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.bonus-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.bonus-card.locked { opacity: 0.7; }
.bonus-card.locked .bonus-thumb { filter: blur(2px) brightness(0.6); }
.bonus-card.locked:hover { transform: none; }
.bonus-thumb {
  position: relative;
  height: 130px;
  background-size: cover; background-position: center;
  background-color: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.bonus-thumb svg { width: 32px; height: 32px; opacity: 0.5; }
.bonus-new-badge { position: absolute; top: 10px; left: 10px; background: var(--green); color: #06280f; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; letter-spacing: 0.04em; }
.bonus-claimed-badge { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #06280f; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.bonus-lock-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; background: rgba(0,0,0,0.25); }
.bonus-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.bonus-card-body h3 { font-size: 15px; margin: 0; }
.bonus-card-body p { color: var(--text-dim); font-size: 13px; margin: 0; flex: 1; }
.bonus-card-body .btn { align-self: flex-start; }
.bonus-empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

.field-hint { font-size: 12px; color: var(--text-muted); margin: -10px 0 14px; word-break: break-all; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.plan-price { font-size: 28px; font-weight: 800; font-family: var(--font-display); color: var(--text); }

.locked-card {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  color: var(--text-dim);
}

.module-section { margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; }
.module-section h2 { font-size: 15.5px; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { padding: 12px 4px; border-bottom: 1px solid var(--border); }
.lesson-list li:last-child { border-bottom: none; }
.lesson-list li a { color: var(--text); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.lesson-list li a:hover { color: var(--accent-2); }

.lesson-notes { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; margin-bottom: 18px; color: var(--text-dim); }
.lesson-actions { margin-bottom: 18px; }
.lesson-nav { display: flex; justify-content: space-between; margin-top: 20px; font-size: 14px; gap: 12px; }

.progress-bar-wrap { background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 8px; border: 1px solid var(--border); }
.progress-bar { background: var(--accent-gradient); height: 100%; border-radius: 999px; }

.resource-list { list-style: none; margin: 0; padding: 0; }
.resource-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; margin-bottom: 12px; }
.resource-item.locked { opacity: 0.55; }
.resource-item p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }

/* ─── Community ──────────────────────────────────────────────────────────── */
.community-category-card { display: flex; flex-direction: column; gap: 10px; }
.community-category-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }

.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-item { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 10px; }
.thread-item-body { flex: 1; min-width: 0; }
.thread-title { color: var(--text); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread-title:hover { color: var(--accent-2); }
.thread-meta { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }
.badge-pinned { background: rgba(234,179,8,0.15); color: var(--gold); }

.thread-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; margin-bottom: 8px; }
.thread-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.thread-detail-head .page-heading { margin: 0; }
.thread-detail .thread-meta { margin: 12px 0 18px; }

.post-body { color: var(--text); font-size: 14.5px; line-height: 1.7; white-space: pre-line; }
.post-image { max-width: 100%; border-radius: var(--radius-md); margin-top: 14px; border: 1px solid var(--border); }
.mention { color: var(--accent-2); font-weight: 600; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }

.post-actions { display: flex; align-items: center; gap: 18px; margin-top: 16px; }
.like-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text-dim); font-weight: 700; font-size: 13px;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: all .15s ease;
}
.like-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.like-btn.liked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.btn-link { background: none; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; font-family: inherit; padding: 0; }
.btn-link:hover { color: var(--text); text-decoration: underline; }
.btn-link-danger:hover { color: #fca5a5; }

.reply-list { list-style: none; margin: 0 0 24px; padding: 0; }
.reply-item { display: flex; gap: 14px; align-items: flex-start; padding: 18px 0; border-top: 1px solid var(--border); }
.reply-item:first-child { border-top: none; }
.reply-body-wrap { flex: 1; min-width: 0; }
.reply-form textarea { min-height: 80px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 20px 0; font-size: 13.5px; color: var(--text-dim); }
.mod-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; text-align: center; }
.kpi-value { display: block; font-size: 28px; font-weight: 800; font-family: var(--font-display); color: var(--text); }
.kpi-label { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; display: block; }

/* ─── Forms / tables / badges ────────────────────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; margin-bottom: 20px; max-width: 480px; }
label { display: block; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 16px; padding: 12px 14px; }
legend { padding: 0 6px; font-size: 12px; color: var(--text-dim); }
.checkbox-label { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.checkbox-label input { width: auto; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent-gradient); color: #fff; box-shadow: 0 6px 16px rgba(255,59,78,0.28); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(255,59,78,0.4); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); color: #fca5a5; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-dim); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge-locked { background: rgba(239,68,68,0.15); color: #fca5a5; }
.badge-preview { background: rgba(59,130,246,0.15); color: #93c5fd; }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 28px; }
.data-table th, .data-table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table th { background: var(--surface-2); font-weight: 700; color: var(--text-dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.filter-row { display: flex; gap: 10px; margin-bottom: 20px; max-width: 560px; flex-wrap: wrap; }
.filter-row input, .filter-row select { margin: 0; }

.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: rgba(239,68,68,0.12); color: #fca5a5; border-color: rgba(239,68,68,0.25); }
.alert-success { background: rgba(34,197,94,0.12); color: #86efac; border-color: rgba(34,197,94,0.25); }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-btn { background: none; border: none; padding: 12px 18px; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 13.5px; color: var(--text-dim); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn.active { color: var(--accent-2); border-bottom-color: var(--accent); }

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(3px); align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modal-in .18s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-dim); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal form { padding: 22px; }

/* ─── Auth pages ─────────────────────────────────────────────────────────── */
.auth-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(255,59,78,0.08), transparent 40%), var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 22px; margin-bottom: 20px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 13px; flex-wrap: wrap; gap: 8px; }

/* ============================================================================
   Responsive breakpoints
   ========================================================================= */

/* Tablet: journey widget drops below content */
@media (max-width: 1200px) {
  .app-layout { grid-template-columns: var(--sidebar-w) 1fr; }
  .journey-widget { grid-column: 2; margin: 0 32px 32px; position: static; }
}

/* Mobile: off-canvas sidebar */
@media (max-width: 900px) {
  .hamburger-btn { display: flex; }

  .app-layout, .admin-layout { grid-template-columns: 1fr; }
  .journey-widget { grid-column: 1; margin: 0 20px 24px; }

  .sidebar-app, .sidebar-admin {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: min(300px, 84vw);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar-app.open, .sidebar-admin.open { transform: translateX(0); }
  .sidebar-close-btn {
    display: flex;
    align-items: center; justify-content: center;
    position: absolute; top: 14px; right: 14px;
    width: 32px; height: 32px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
  }

  .topbar { padding: 0 16px 0 64px; }
  .topbar-links { display: none; }
  .membership-pill { font-size: 10px; padding: 6px 10px; }

  .app-content { padding: 20px 16px; }
  .admin-layout .app-content { padding: 76px 16px 20px; }

  .plan-grid, .course-grid, .kpi-row, .bonus-grid { grid-template-columns: 1fr 1fr; }
  .form-card { max-width: none; }

  .data-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  .bonus-hero { grid-template-columns: 1fr; }
  .bonus-hero-media { min-height: 140px; }
  .bonus-toolbar { flex-direction: column; align-items: stretch; }
  .bonus-toolbar input { max-width: none; }
}

/* Small phone */
@media (max-width: 560px) {
  .topbar { height: 60px; }
  .topbar-right { gap: 10px; }
  .avatar-badge { width: 32px; height: 32px; font-size: 12px; }
  .app-content { padding: 16px 14px; }
  .page-header-row { align-items: flex-start; }
  .page-heading { font-size: 19px; }

  .plan-grid, .course-grid, .kpi-row, .bonus-grid { grid-template-columns: 1fr; }
  .bonus-stats-row { gap: 18px; }
  .resource-item { flex-direction: column; align-items: flex-start; }
  .lesson-nav { flex-direction: column; align-items: flex-start; }
  .auth-card { padding: 26px 22px; }
  .filter-row { flex-direction: column; }
  .filter-row input, .filter-row select, .filter-row button { width: 100%; }
  .auth-card .btn, .form-card .btn, .modal form .btn { width: 100%; }
  .modal form { padding: 18px; }

  .thread-detail { padding: 18px; }
  .thread-item { padding: 14px; gap: 10px; }
  .reply-item { gap: 10px; }
  .post-actions { flex-wrap: wrap; gap: 12px; }
  .mod-actions { flex-direction: column; align-items: flex-start; }
}
