/* Reusable components: buttons, brand, header, footer, cards, messages, forms, layouts. */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 26px; border-radius: 999px;
  font-family: inherit; font-weight: 600; font-size: 0.98rem; line-height: 1.2;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  cursor: pointer; border: none;
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--navy-950);
  box-shadow: 0 10px 30px -10px rgba(212, 166, 74, .6);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -10px rgba(212, 166, 74, .8); }
.btn-ghost { border: 1px solid rgba(255,255,255,.2); color: var(--text); background: rgba(255,255,255,.03); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-light); }
.btn-block { width: 100%; }

/* ---------- Badge / chip ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(212,166,74,.1); border: 1px solid rgba(212,166,74,.35);
  color: var(--gold-light); font-size: .8rem; font-weight: 600;
  margin-bottom: 22px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(74,222,128,.2); }
.chip { padding: 7px 14px; border-radius: 999px; font-size: .82rem; background: var(--navy-700); border: 1px solid var(--line); color: var(--text); }

/* ---------- Cards ---------- */
.card {
  padding: 30px 26px; border-radius: var(--radius);
  background: var(--navy-800); border: 1px solid var(--line);
  transition: transform .25s ease, border-color .25s ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(212,166,74,.4); }
.card--static:hover { transform: none; border-color: var(--line); }
.card-icon {
  width: 50px; height: 50px; border-radius: 12px; margin-bottom: 20px;
  display: grid; place-items: center;
  background: rgba(212,166,74,.12); color: var(--gold);
}
.card-icon svg { width: 26px; height: 26px; }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--text-muted); font-size: .95rem; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; letter-spacing: .06em; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--navy-950); font-size: 1rem; font-weight: 800;
}
.brand small { color: var(--gold); font-weight: 600; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled,
.site-header.solid { background: rgba(7, 13, 24, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.nav-links { display: flex; gap: 28px; font-size: .92rem; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-actions form { display: contents; }
.nav .btn { padding: 10px 20px; font-size: .88rem; }
@media (max-width: 860px) { .nav-links { display: none; } }
@media (max-width: 480px) {
  .nav-actions .btn-reserve { display: none; }
  .nav .btn { padding: 9px 16px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--text-muted); font-size: .85rem; }
.site-footer--sticky-cta { padding-bottom: 110px; }
.foot { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
@media (min-width: 761px) { .site-footer--sticky-cta { padding-bottom: 32px; } }

/* ---------- Messages ---------- */
.messages { list-style: none; display: grid; gap: 10px; margin-bottom: 24px; }
.message {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: 10px;
  background: var(--navy-800); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  font-size: .95rem;
}
.message::before { content: "ℹ"; color: var(--gold-light); font-weight: 700; }
.message--success { border-left-color: var(--success); }
.message--success::before { content: "✓"; color: var(--success); }
.message--warning::before { content: "⚠"; }
.message--error { border-left-color: var(--danger); }
.message--error::before { content: "⚠"; color: var(--danger); }
.messages-bar { padding-top: 92px; }
.messages-bar .messages { margin-bottom: 0; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 20px; }
.form > div { display: grid; gap: 6px; }
.form label { font-weight: 600; font-size: .92rem; }
.form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.form select,
.form textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--navy-950); color: var(--text);
  border: 1px solid var(--text-muted);
  font: inherit; font-size: 1rem;
}
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible {
  border-color: var(--gold-light); outline: 2px solid var(--gold-light); outline-offset: 1px;
}
.form input[aria-invalid="true"] { border-color: var(--danger); }
.form .helptext { font-size: .85rem; color: var(--text-muted); }
.form .helptext ul { padding-left: 1.2em; }
.errorlist { list-style: none; display: grid; gap: 4px; color: var(--danger); font-size: .9rem; font-weight: 600; }
.errorlist li::before { content: "⚠ "; }
.errorlist.nonfield {
  padding: 12px 16px; border-radius: 10px;
  background: rgba(248, 113, 113, .08); border: 1px solid var(--danger);
}

/* ---------- Page layouts ---------- */
.page { padding: 120px 0 80px; min-height: 70vh; }
.page h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; text-transform: uppercase; margin-bottom: 16px; }
.page .card { margin-top: 32px; max-width: 640px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.auth-page {
  min-height: 100svh; display: grid; place-items: center;
  padding: 110px 0 70px;
  background:
    radial-gradient(ellipse 80% 60% at 85% 20%, rgba(212,166,74,.14), transparent 60%),
    radial-gradient(ellipse 70% 70% at 0% 100%, rgba(37,58,97,.7), transparent 60%),
    var(--navy-950);
}
.auth-card {
  position: relative; width: 100%; max-width: 460px; margin: 0 auto;
  background: linear-gradient(160deg, var(--navy-700), var(--navy-800));
  border: 1px solid rgba(212,166,74,.25);
  border-radius: 22px; padding: 36px 30px;
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.8);
}
.auth-card::before {
  content: ""; position: absolute; top: 0; left: 30px; right: 30px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.auth-card .brand-mark { margin-bottom: 18px; }
.auth-card h1 { font-size: clamp(1.9rem, 6vw, 2.4rem); font-weight: 800; text-transform: uppercase; margin-bottom: 12px; }
.auth-card p { color: var(--text-muted); margin-bottom: 16px; }
.auth-card .form { margin-top: 8px; }
.auth-card .form .btn { margin-top: 4px; }
.auth-links { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .92rem; }
.auth-links a, .auth-card p a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 480px) { .auth-card { padding: 30px 20px; } }

/* ---------- Student area ---------- */
.chip--preview { display: inline-block; font-size: .75rem; font-weight: 600; color: var(--gold-light); border-color: rgba(212,166,74,.35); background: rgba(212,166,74,.1); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 16px 0; padding: 12px 16px; border-radius: 10px;
  background: var(--navy-800); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  font-size: .92rem;
}
.notice__icon { color: var(--gold-light); font-weight: 700; }
.notice a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }
.notice--warning { background: rgba(212,166,74,.08); border-color: rgba(212,166,74,.35); border-left-color: var(--gold-light); }

.breadcrumbs { margin-bottom: 22px; font-size: .88rem; color: var(--text-muted); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--gold); }
.breadcrumbs a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumbs [aria-current="page"] { color: var(--text); }

.progress-meter { display: grid; gap: 6px; margin: 16px 0; }
.progress-meter__head { display: flex; justify-content: space-between; font-size: .9rem; color: var(--text-muted); }
.progress-meter__head strong { color: var(--gold-light); }
.progress-meter__detail { font-size: .85rem; color: var(--text-muted); }
.progress {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 10px; border: none; border-radius: 999px;
  background: var(--navy-950); overflow: hidden;
}
.progress::-webkit-progress-bar { background: var(--navy-950); border-radius: 999px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold-light), var(--gold)); border-radius: 999px; }
.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--gold-light), var(--gold)); border-radius: 999px; }

.course-grid { list-style: none; display: grid; gap: 20px; margin-top: 32px; }
.page .course-grid .card { margin-top: 0; max-width: none; }
.course-card { display: flex; flex-direction: column; gap: 4px; }
.course-card h2 a:hover { color: var(--gold-light); }
.course-card__access { font-size: .9rem; color: var(--text-muted); }
.course-card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 16px; }
.course-card .chip--preview { align-self: flex-start; margin-bottom: 8px; }
@media (min-width: 760px) { .course-grid { grid-template-columns: repeat(2, 1fr); } }

.course-summary { max-width: 520px; margin-bottom: 12px; }

.module { padding: 28px 0 0; }
.module__title { margin-bottom: 14px; color: var(--gold-light); }
.lesson-list { list-style: none; display: grid; gap: 10px; }
.lesson-item__link {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--navy-800); border: 1px solid var(--line);
  transition: border-color .2s ease;
}
a.lesson-item__link:hover { border-color: rgba(212,166,74,.4); }
.lesson-item__icon { width: 22px; height: 22px; flex-shrink: 0; color: var(--text-muted); }
.lesson-item__title { flex: 1 1 12rem; font-weight: 600; }
.lesson-item__status { font-size: .85rem; color: var(--text-muted); }
.lesson-item--done .lesson-item__icon,
.lesson-item--done .lesson-item__status { color: var(--success); }
.lesson-item--locked .lesson-item__link { background: transparent; border-style: dashed; }
.lesson-item--locked .lesson-item__title { color: var(--text-muted); }

.media-slot {
  display: grid; place-items: center; gap: 10px; text-align: center;
  margin-top: 28px; padding: 28px 20px; border-radius: var(--radius);
  background: var(--navy-800); border: 1px dashed rgba(212,166,74,.35);
  color: var(--text-muted);
}
.media-slot svg { width: 44px; height: 44px; color: var(--gold); }
.media-slot--video { aspect-ratio: 16 / 9; }

/* ---------- Lesson video (Bunny Stream) ---------- */
.video-player { margin-top: 28px; scroll-margin-top: 90px; }
/* The frame is what goes fullscreen (real or simulated): iframe + watermark + button together. */
.video-player__frame {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--navy-950); border: 1px solid var(--line);
}
.video-player__stage { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.video-player__iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.video-watermark {
  position: absolute; z-index: 1;
  /* left: x% + translate(-x%) keeps the label inside the stage for any x in 0–100. */
  left: var(--wm-x, 4%); top: var(--wm-y, 6%);
  transform: translate(calc(var(--wm-x, 4%) * -1), calc(var(--wm-y, 6%) * -1));
  max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-body); font-size: clamp(.7rem, 1.8vw, 1rem); font-weight: 600;
  color: var(--text); opacity: .35; text-shadow: 0 1px 3px var(--navy-950);
  pointer-events: none; user-select: none;
  transition: left 1.2s ease, top 1.2s ease, transform 1.2s ease;
}
.video-player__fullscreen {
  position: absolute; z-index: 2; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(7,13,24,.7); color: var(--text);
  font: 600 .8rem/1.2 var(--font-body); cursor: pointer;
}
.video-player__fullscreen:hover { border-color: var(--gold); color: var(--gold-light); }
.video-player__fullscreen:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.video-player__fullscreen svg { width: 16px; height: 16px; }
.video-player__fullscreen[hidden] { display: none; }
.video-player__caption {
  display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px;
  font-size: .85rem; color: var(--text-muted);
}

/* Fullscreen: real (Fullscreen API) and simulated (no API, e.g. iPhone; see video-player.js). */
.video-player__frame:fullscreen {
  display: grid; place-items: center; width: 100%; height: 100%;
  border: 0; border-radius: 0; background: var(--navy-950);
}
.video-player__frame--pseudo-fullscreen {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  width: 100dvw; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  border: 0; border-radius: 0; background: var(--navy-950);
}
/* Largest 16:9 box that fits the screen (iframes have no object-fit). */
.video-player__frame:fullscreen .video-player__stage { width: min(100%, calc(100dvh * 16 / 9)); }
.video-player__frame--pseudo-fullscreen .video-player__stage {
  width: min(100%, calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9));
}
.video-player__frame--pseudo-fullscreen .video-player__fullscreen {
  top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right));
}
/* No page scroll behind the simulated fullscreen. */
html.is-video-pseudo-fullscreen,
html.is-video-pseudo-fullscreen body { overflow: hidden; overscroll-behavior: none; }

@media (prefers-reduced-motion: reduce) {
  .video-watermark { transition: none; }
}

.page .card p a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }

.materials { margin-top: 32px; scroll-margin-top: 90px; }
.materials__empty, .materials__note { color: var(--text-muted); font-size: .92rem; }
.materials__note { margin-top: 14px; }
.material-group { margin-top: 18px; }
.material-group__title { margin-bottom: 10px; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.material-list { list-style: none; display: grid; gap: 10px; }
.material-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--navy-800); border: 1px solid var(--line);
}
.material-item__icon { width: 24px; height: 24px; flex-shrink: 0; color: var(--gold); }
.material-item__title { flex: 1 1 12rem; font-weight: 600; }
.material-item .chip--preview { margin-left: 6px; vertical-align: middle; }
@media (max-width: 480px) { .material-item .btn { width: 100%; justify-content: center; } }

.lesson-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 28px; scroll-margin-top: 90px; }
.lesson-progress__status { color: var(--success); font-weight: 600; }

.lesson-nav { display: grid; gap: 12px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.lesson-nav__link {
  display: grid; gap: 2px; padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: rgba(255,255,255,.03);
  transition: border-color .2s ease;
}
.lesson-nav__link:hover { border-color: var(--gold); }
.lesson-nav__label { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.lesson-nav__title { font-weight: 600; }
.lesson-nav__link--next { text-align: right; }
@media (min-width: 640px) {
  .lesson-nav { grid-template-columns: 1fr 1fr; }
  .lesson-nav__link--next { grid-column: 2; }
}

/* ---------- My devices ---------- */
.devices { padding: 0; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.devices__intro { color: var(--text-muted); font-size: .95rem; margin: 8px 0 18px; max-width: 62ch; }
.device-list { list-style: none; display: grid; gap: 10px; max-width: 640px; }
.device-item {
  display: grid; gap: 4px; padding: 14px 18px; border-radius: 12px;
  background: var(--navy-800); border: 1px solid var(--line);
}
.device-item--current { border-color: rgba(212,166,74,.35); }
.device-item__label { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.device-item__meta { color: var(--text-muted); font-size: .88rem; }
.devices .page-actions form { display: contents; }

/* ---------- Teacher's panel ---------- */
.btn-small { padding: 9px 16px; font-size: .88rem; }
.panel-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 4px 0 28px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: .95rem; color: var(--text-muted); }
.panel-nav a:hover { color: var(--text); }
.panel-nav a[aria-current="page"] { color: var(--gold-light); font-weight: 600; text-decoration: underline; text-underline-offset: 6px; }
.panel-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.panel-search { grid-auto-flow: column; align-items: end; gap: 10px; flex: 1 1 320px; max-width: 520px; }
.panel-search label { font-size: .85rem; }
.student-list { list-style: none; display: grid; gap: 12px; }
.page .student-list .card { margin-top: 0; max-width: none; }
.student-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 20px 22px; }
.student-item__main { display: grid; gap: 4px; min-width: 0; }
.student-item__email { color: var(--text-muted); font-size: .92rem; overflow-wrap: anywhere; }
.student-item__courses { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.student-item__courses .chip { font-size: .78rem; padding: 4px 10px; }
.student-item__side { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.status-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.status-tag::before { content: "●"; }
.status-tag--ok { color: var(--success); }
.status-tag--pending { color: var(--gold-light); }
.status-tag--pending::before { content: "✉"; }
.panel-form { max-width: 640px; }
.panel-form > p { margin-bottom: 20px; }
.pagination { display: flex; align-items: center; gap: 14px; margin-top: 24px; color: var(--text-muted); font-size: .92rem; }
@media (min-width: 720px) { .student-item__side { align-items: flex-end; } }

/* ---------- Teacher's panel: tracking ---------- */
.panel-section { margin-top: 40px; }
.panel-section > h2 { margin-bottom: 14px; }
.panel-empty, .panel-note, .panel-count, .muted { color: var(--text-muted); font-size: .92rem; }
.panel-note { margin-top: 12px; }
.panel-link { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.panel-link:hover { color: var(--text); }
.panel-toolbar__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.count-pill { display: inline-grid; place-items: center; min-width: 1.8em; padding: 0 .5em; margin-left: 6px; border-radius: 999px; background: rgba(212,166,74,.15); border: 1px solid rgba(212,166,74,.35); color: var(--gold-light); font-size: .85rem; vertical-align: middle; }

.stat-grid { list-style: none; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-card > a, .stat-card > div {
  display: grid; gap: 6px; height: 100%; padding: 18px 18px 16px; border-radius: var(--radius);
  background: var(--navy-800); border: 1px solid var(--line); transition: border-color .2s ease;
}
.stat-card > a:hover { border-color: rgba(212,166,74,.4); }
.stat-card__value { font-family: var(--font-head); font-size: 2.4rem; font-weight: 800; line-height: 1; color: var(--gold-light); }
.stat-card__label { font-size: .88rem; color: var(--text-muted); }
.stat-card--warning > a { border-color: rgba(212,166,74,.45); }

.attention-group__title { margin: 22px 0 10px; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.attention-list { list-style: none; display: grid; gap: 8px; }
.attention-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  background: var(--navy-800); border: 1px solid var(--line); border-left: 3px solid var(--gold);
}
.attention-item--alert { border-left-color: var(--danger); }
.attention-item__icon { color: var(--gold-light); font-weight: 700; }
.attention-item--alert .attention-item__icon { color: var(--danger); }
.attention-item__main { display: grid; gap: 2px; min-width: 0; }
.attention-item__detail { color: var(--text-muted); font-size: .9rem; }

.panel-filters { grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
.panel-filters label { font-size: .85rem; }
.panel-filters__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
@media (min-width: 760px) { .panel-filters { grid-template-columns: 2fr 1.4fr 1.2fr auto; align-items: end; } }

.panel-columns { display: grid; gap: 16px; }
.page .panel-columns .card { margin-top: 0; max-width: none; }
@media (min-width: 760px) { .panel-columns { grid-template-columns: 3fr 2fr; } }
.panel-card { padding: 22px; }
.panel-card h2 { margin-bottom: 12px; }
.data-list { display: grid; gap: 10px; }
.data-list div { display: grid; gap: 2px; }
.data-list dt { font-size: .8rem; color: var(--text-muted); }
.data-list dd { overflow-wrap: anywhere; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-danger { color: var(--danger); border-color: rgba(248,113,113,.5); }
.btn-danger:hover { color: var(--danger); border-color: var(--danger); }

.state-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--navy-700); color: var(--text-muted); white-space: nowrap; }
.state-tag--current { color: var(--success); border-color: rgba(74,222,128,.35); }
.state-tag--current::before { content: "✓ "; }
.state-tag--expiring { color: var(--gold-light); border-color: rgba(212,166,74,.45); }
.state-tag--expiring::before { content: "⏳ "; }
.state-tag--expired, .state-tag--cancelled { color: var(--danger); border-color: rgba(248,113,113,.45); }
.state-tag--expired::before, .state-tag--cancelled::before { content: "✕ "; }

.enrollment-list { list-style: none; display: grid; gap: 12px; }
.page .enrollment-list .card { margin-top: 0; max-width: none; }
.enrollment-card { padding: 20px 22px; }
.enrollment-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.enrollment-card__dates { margin: 6px 0 10px; color: var(--text-muted); font-size: .9rem; }
.panel-details summary { cursor: pointer; color: var(--gold-light); font-size: .9rem; }
.panel-details ol { margin: 8px 0 0 1.4em; color: var(--text-muted); font-size: .9rem; display: grid; gap: 2px; }

/* Tables: a real table from 720px; stacked label/value cards on phones. */
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th { text-align: left; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.data-table th a { color: inherit; text-decoration: underline; text-decoration-color: transparent; }
.data-table th a:hover, .data-table th[aria-sort] a { text-decoration-color: currentColor; text-underline-offset: 4px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table .num { text-align: right; white-space: nowrap; }
@media (max-width: 719px) {
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table tr { display: grid; gap: 4px; padding: 12px 14px; margin-bottom: 10px; border-radius: 12px; background: var(--navy-800); border: 1px solid var(--line); }
  .data-table td { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; padding: 2px 0; border: 0; text-align: left; }
  .data-table td::before { content: attr(data-label); color: var(--text-muted); font-size: .8rem; }
  .data-table .num { text-align: left; }
  /* Sortable tables keep their header on phones as a row of sort links. */
  .data-table--sortable thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: block; margin-bottom: 10px; }
  .data-table--sortable thead tr { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 0; background: none; border: 0; }
  .data-table--sortable th { padding: 0; border: 0; }
}

/* ---------- Legal pages ---------- */
.foot-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-legal a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.foot-legal a:hover { color: var(--gold-light); text-decoration-color: currentColor; }
.legal-meta { color: var(--text-muted); font-size: .92rem; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 18px 0 32px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: .92rem; color: var(--text-muted); }
.legal-nav a:hover { color: var(--text); }
.legal-nav a[aria-current="page"] { color: var(--gold-light); font-weight: 600; }
.legal-text { max-width: 74ch; line-height: 1.7; }
.legal-text h2 { margin: 34px 0 12px; font-size: 1.5rem; }
.legal-text p, .legal-text ul, .legal-text ol { margin-bottom: 14px; color: var(--text); }
.legal-text ul, .legal-text ol { padding-left: 1.3em; display: grid; gap: 6px; }
.legal-text a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }
.legal-text code { font-size: .9em; color: var(--gold-light); }
.legal-table { margin: 6px 0 18px; }
.legal-box { margin: 14px 0 18px; padding: 16px 18px; border-radius: 12px; background: var(--navy-800); border: 1px solid var(--line); border-left: 3px solid var(--gold); }
.legal-box p:last-child { margin-bottom: 0; }
/* Missing owner data: visible on purpose until it is configured (.env). */
.legal-placeholder { padding: 0 4px; border-radius: 4px; background: rgba(212,166,74,.2); color: var(--gold-light); font-weight: 600; }

/* Checkbox fields (Django field group: label, help, errors, input): box on the left. */
.form-field:has(> input[type="checkbox"]) { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 4px 12px; }
.form-field > input[type="checkbox"] { grid-column: 1; grid-row: 1; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); }
.form-field:has(> input[type="checkbox"]) > :not(input) { grid-column: 2; }
.form-field:has(> input[type="checkbox"]) > label { grid-row: 1; font-weight: 500; line-height: 1.5; }
.form-field label a { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Two-factor authentication & legal acceptance ---------- */
.steps { padding-left: 1.2em; display: grid; gap: 12px; margin: 8px 0 18px; color: var(--text-muted); }
.qr { margin: 12px 0; padding: 12px; width: max-content; max-width: 100%; border-radius: 12px; background: #fff; }
.qr svg { display: block; max-width: 100%; height: auto; }
.secret-key code { font-size: 1.05rem; letter-spacing: .08em; color: var(--gold-light); overflow-wrap: anywhere; }
.form-hint { font-size: .85rem; color: var(--text-muted); }
.recovery-codes { list-style: none; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 22px; }
.recovery-codes code { display: block; padding: 8px 10px; border-radius: 8px; background: var(--navy-950); border: 1px solid var(--line); font-size: 1rem; letter-spacing: .08em; text-align: center; color: var(--gold-light); }
.legal-changes { list-style: none; display: grid; gap: 6px; margin: 0 0 18px; }
.legal-changes a, .auth-card code { color: var(--gold-light); }
.legal-changes a { text-decoration: underline; text-underline-offset: 3px; }
.link-button { padding: 0; border: 0; background: none; color: var(--gold-light); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth-links form { display: inline; }
.inline-link { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }
