/* ═══════════════════════════════════════════════════════════════
   VideoHub — Design System v3
   Premium pastel-rose aesthetic · Modern · Airy · Refined
   
   Typography: DM Sans (headings) + Nunito (body)
   Palette:    Soft rose / blush / warm neutrals
   Philosophy: Generous whitespace, subtle depth, soft motion
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts (optional, graceful fallback) ──────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..800;1,9..40,300..800&family=Nunito:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* ─ Typography ─ */
  --font-heading: "DM Sans", "Segoe UI", "SF Pro Display", sans-serif;
  --font-body:    "Nunito", "Segoe UI", "SF Pro Text", sans-serif;
  --font-mono:    "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --text-xs:   0.72rem;
  --text-sm:   0.82rem;
  --text-base: 0.92rem;
  --text-md:   1rem;
  --text-lg:   1.15rem;
  --text-xl:   1.35rem;
  --text-2xl:  1.65rem;
  --text-3xl:  2rem;

  --leading-tight:  1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* ─ Colors: Rose Palette ─ */
  --rose-50:  #fff5f8;
  --rose-100: #ffe8f0;
  --rose-200: #ffd4e4;
  --rose-300: #ffb3ce;
  --rose-400: #ff8db4;
  --rose-500: #f75e97;
  --rose-600: #e63d7f;
  --rose-700: #c72868;
  --rose-800: #9e2255;
  --rose-900: #6b1a3c;

  /* ─ Colors: Neutral Warm ─ */
  --neutral-50:  #fefcfb;
  --neutral-100: #faf6f5;
  --neutral-200: #f2ebe9;
  --neutral-300: #e5dbd8;
  --neutral-400: #c9b8b3;
  --neutral-500: #a08e88;
  --neutral-600: #7a6b65;
  --neutral-700: #5c4f4a;
  --neutral-800: #3d3330;
  --neutral-900: #231d1b;

  /* ─ Semantic Text ─ */
  --text-strong:    var(--neutral-900);
  --text-primary:   var(--neutral-800);
  --text-secondary: var(--neutral-600);
  --text-tertiary:  var(--neutral-500);
  --text-disabled:  var(--neutral-400);
  --text-on-accent: #fff;
  --text-accent:    var(--rose-600);
  --text-danger:    #b8292f;
  --text-success:   #1a7a42;
  --text-warning:   #9c6b0a;

  /* ─ Semantic Backgrounds ─ */
  --bg-body:        #fffafb;
  --bg-body-subtle: #fff5f7;
  --bg-elevated:    #ffffff;
  --bg-sunken:      var(--neutral-100);
  --bg-overlay:     rgba(35, 29, 27, 0.6);

  /* ─ Accent surfaces ─ */
  --accent-gradient:  linear-gradient(135deg, #ff6ba6 0%, #f75e97 50%, #e84d8a 100%);
  --accent-soft-bg:   var(--rose-50);
  --accent-soft-border: var(--rose-200);

  /* ─ Feedback ─ */
  --success-bg:     #ecfdf3;
  --success-border: #a7f3d0;
  --success-text:   #166534;

  --danger-bg:      #fef2f2;
  --danger-border:  #fca5a5;
  --danger-text:    #991b1b;

  --warning-bg:     #fffbeb;
  --warning-border: #fde68a;
  --warning-text:   #92400e;

  --info-bg:        var(--rose-50);
  --info-border:    var(--rose-200);
  --info-text:      var(--rose-700);

  /* ─ Borders ─ */
  --border-light:   var(--neutral-200);
  --border-default: var(--neutral-300);
  --border-strong:  var(--neutral-400);
  --border-accent:  var(--rose-300);
  --border-focus:   rgba(247, 94, 151, 0.4);

  /* ─ Shadows ─ */
  --shadow-xs:    0 1px 2px rgba(62, 35, 50, 0.04);
  --shadow-sm:    0 2px 8px rgba(62, 35, 50, 0.06), 0 1px 2px rgba(62, 35, 50, 0.04);
  --shadow-md:    0 4px 16px rgba(62, 35, 50, 0.08), 0 2px 4px rgba(62, 35, 50, 0.04);
  --shadow-lg:    0 8px 32px rgba(62, 35, 50, 0.10), 0 2px 8px rgba(62, 35, 50, 0.04);
  --shadow-xl:    0 16px 48px rgba(62, 35, 50, 0.12), 0 4px 12px rgba(62, 35, 50, 0.06);
  --shadow-accent: 0 4px 16px rgba(247, 94, 151, 0.20);
  --shadow-glow:  0 0 0 4px rgba(247, 94, 151, 0.12);
  --shadow-inner: inset 0 1px 3px rgba(62, 35, 50, 0.06);

  /* ─ Radii ─ */
  --radius-xs:   6px;
  --radius-sm:   10px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-pill: 999px;

  /* ─ Spacing scale (4px base) ─ */
  --sp-0:  0;
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-7:  32px;
  --sp-8:  40px;
  --sp-9:  48px;
  --sp-10: 56px;
  --sp-12: 72px;
  --sp-16: 96px;
  --field-pad-x: var(--sp-4);

  /* ─ Sizing ─ */
  --touch-min: 44px;
  --content-xs: 400px;
  --content-sm: 520px;
  --content-md: 860px;
  --content-lg: 1160px;
  --sidebar-width: 300px;

  /* ─ Transitions ─ */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.12s;
  --duration-normal: 0.2s;
  --duration-slow: 0.35s;
}


/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
html.admin-no-smooth { scroll-behavior: auto; }
html.admin-no-smooth * { scroll-behavior: auto !important; }
html, body { min-height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3000;
  transition: opacity var(--duration-fast) var(--ease-out);
}

body::before {
  top: 0;
  height: 2px;
  background: var(--accent-gradient);
  box-shadow: 0 0 10px rgba(247, 94, 151, 0.32);
  transform-origin: left center;
  transform: scaleX(0.08);
}

body::after {
  top: 0;
  bottom: 0;
  background: rgba(35, 29, 27, 0.18);
}

body.is-page-loading::before {
  opacity: 1;
  animation: ui-page-progress 1.3s var(--ease-out) infinite;
}

body.is-page-loading::after {
  opacity: 1;
}

@keyframes ui-page-progress {
  0% { transform: translateX(-30%) scaleX(0.18); }
  45% { transform: translateX(12%) scaleX(0.58); }
  100% { transform: translateX(78%) scaleX(0.28); }
}

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

img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
ul, ol { list-style: none; }


/* ── Ambient background ─────────────────────────────────────── */
.bg {
  background:
    radial-gradient(ellipse 900px 500px at 0% -8%, rgba(255, 180, 210, 0.18), transparent 55%),
    radial-gradient(ellipse 700px 500px at 100% -5%, rgba(255, 200, 225, 0.14), transparent 50%),
    radial-gradient(ellipse 500px 500px at 50% 100%, rgba(255, 210, 230, 0.08), transparent 50%),
    var(--bg-body);
  min-height: 100vh;
}


/* ── Layout ─────────────────────────────────────────────────── */
.container {
  width: min(100%, var(--content-sm));
  margin-inline: auto;
  padding: var(--sp-8) var(--sp-4) var(--sp-9);
}

.container.wide {
  width: min(100%, var(--content-lg));
  padding-top: var(--sp-7);
}


/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  color: var(--text-strong);
  line-height: 1.3;
  letter-spacing: -0.012em;
  font-weight: 700;
}

h1 { font-size: clamp(1.5rem, 5vw, var(--text-2xl)); font-weight: 700; letter-spacing: -0.016em; }
h2 { font-size: clamp(1.1rem, 4vw, var(--text-xl)); margin-bottom: var(--sp-3); }
h3 { font-size: clamp(0.95rem, 3vw, var(--text-lg)); }
h4 { font-size: var(--text-md); }

p { margin-bottom: var(--sp-3); }

.text-strong  { color: var(--text-strong); }
.text-muted   { color: var(--text-secondary); }
.text-soft    { color: var(--text-tertiary); }
.text-accent  { color: var(--text-accent); }
.text-danger  { color: var(--text-danger); }
.text-success { color: var(--text-success); }
.text-xs      { font-size: var(--text-xs); }
.text-sm      { font-size: var(--text-sm); }
.text-base    { font-size: var(--text-base); }
.mono         { font-family: var(--font-mono); }
.font-medium  { font-weight: 600; }
.font-bold    { font-weight: 700; }

.icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  color: inherit;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-md {
  width: 1.25rem;
  height: 1.25rem;
}

.icon-lg {
  width: 1.8rem;
  height: 1.8rem;
}

.page-title {
  margin-bottom: var(--sp-1);
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-5);
}


/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.card + .card { margin-top: var(--sp-5); }

.card--glass {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.card--accent {
  border-color: var(--rose-200);
  background: linear-gradient(180deg, var(--rose-50) 0%, var(--bg-elevated) 40%);
}

.card--flush { padding: 0; }


/* ── Brand / Logo ───────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.brand-mini .top-mode-link--brand {
  display: none;
  height: 34px;
  min-height: 34px;
  padding-inline: var(--sp-3);
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
}

.logo {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800; font-size: 0.85rem;
  letter-spacing: 0.02em;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
  text-decoration: none;
  transition: transform var(--duration-normal) var(--ease-spring),
              box-shadow var(--duration-normal) var(--ease-out);
}

.logo:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(247, 94, 151, 0.28);
}

.logo.sm {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
}

.logo-instagram {
  background-image: url("/static/instagram-profile.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.logo-instagram svg { display: none; }

.brand h1 { margin: 0; letter-spacing: -0.025em; }
.brand-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-strong);
}


/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 1200;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255, 250, 251, 0.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 1px 4px rgba(62, 35, 50, 0.04);
}

.topbar-inner {
  width: min(100%, var(--content-lg));
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
}

.top-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  --topbar-control-height: 34px;
}

.top-actions .btn { flex: 1 1 auto; min-width: 0; }

.top-home-link {
  width: var(--topbar-control-height, var(--touch-min));
  min-width: var(--topbar-control-height, var(--touch-min));
  height: var(--topbar-control-height, var(--touch-min));
  min-height: var(--topbar-control-height, var(--touch-min));
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--topbar-control-height, var(--touch-min));
  box-shadow: var(--shadow-xs);
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.top-home-link:hover {
  background: var(--rose-50);
  border-color: var(--rose-200);
  color: var(--rose-700);
  transform: translateY(-1px);
}

.top-home-link svg {
  width: 18px;
  height: 18px;
  display: block;
}

.top-home-link-icon {
  width: 18px;
  height: 18px;
}


/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  --btn-loading-color: var(--text-on-accent);
  appearance: none;
  border: 1.5px solid transparent;
  min-height: var(--touch-min);
  padding: 0 var(--sp-6);
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: var(--sp-2);
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  position: relative;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    filter var(--duration-normal) var(--ease-out),
    background var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out),
    color var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-accent);
}

.btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 20px rgba(247, 94, 151, 0.28);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
  filter: brightness(0.98);
}

.btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

/* Ghost button */
.btn.ghost {
  --btn-loading-color: var(--text-primary);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.btn.ghost:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  box-shadow: var(--shadow-sm);
  color: var(--rose-700);
  transform: translateY(-1px);
  filter: none;
}

.btn.ghost:active {
  background: var(--rose-100);
  transform: translateY(0);
}

/* Danger button */
.btn.danger {
  --btn-loading-color: var(--text-danger);
  background: var(--bg-elevated);
  color: var(--text-danger);
  border-color: var(--danger-border);
  box-shadow: none;
}

.btn.danger:hover {
  background: var(--danger-bg);
  border-color: #ef4444;
  filter: none;
  transform: translateY(-1px);
}

/* Soft button (accent background, no gradient) */
.btn.soft {
  --btn-loading-color: var(--rose-700);
  background: var(--rose-50);
  color: var(--rose-700);
  border-color: var(--rose-200);
  box-shadow: none;
}

.btn.soft:hover {
  background: var(--rose-100);
  border-color: var(--rose-300);
  filter: none;
  transform: translateY(-1px);
}

/* Disabled */
.btn.disabled, .btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.3);
  transform: none;
}

.btn.is-loading {
  color: transparent !important;
  text-shadow: none;
  cursor: wait;
  pointer-events: none;
}

.btn.is-loading > * {
  opacity: 0;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid var(--btn-loading-color);
  border-right-color: transparent;
  animation: ui-spin 0.72s linear infinite;
}

button.is-loading:not(.btn),
input.is-loading:not(.btn) {
  cursor: wait;
}

button.is-loading:not(.btn) {
  --control-loading-color: currentColor;
  position: relative;
  color: transparent !important;
  text-shadow: none;
}

button.is-loading:not(.btn) > * {
  opacity: 0;
}

button.is-loading:not(.btn)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  margin-left: -6px;
  border-radius: 50%;
  border: 2px solid var(--control-loading-color);
  border-right-color: transparent;
  animation: ui-spin 0.72s linear infinite;
}

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

/* Login submit buttons (shared style moved from inline template CSS) */
.login-submit-btn {
  position: relative;
}

.login-submit-btn.is-loading {
  color: inherit !important;
  cursor: wait;
}

.login-submit-btn.is-loading::after {
  display: none;
}

.login-submit-btn.is-loading > * {
  opacity: 1;
}

.login-submit-btn .login-btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: 1em;
}

.login-submit-btn.is-loading .login-btn-content {
  gap: var(--sp-2);
}

.login-submit-btn .login-btn-price {
  display: inline-block;
  white-space: nowrap;
}

.login-submit-btn .login-btn-spinner {
  width: 0;
  height: 0;
  border-radius: var(--radius-pill);
  border: 0 solid currentColor;
  border-right-color: transparent;
  visibility: hidden;
  opacity: 0;
  flex: 0 0 0;
}

.login-submit-btn.is-loading .login-btn-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
  flex-basis: 14px;
  visibility: visible;
  opacity: 1;
  animation: ui-spin 0.72s linear infinite;
}

.login-submit-btn.is-loading .login-btn-label {
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .login-submit-btn.is-loading .login-btn-spinner {
    animation: none;
  }
}


/* ── Form elements ──────────────────────────────────────────── */
.form { display: grid; gap: var(--sp-4); }
.form-group { display: grid; gap: var(--sp-1); }

label {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--text-strong);
  letter-spacing: 0.01em;
}

label .optional {
  font-weight: 400;
  color: var(--text-tertiary);
}

input[type="email"],
input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition:
    border-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    background var(--duration-normal) var(--ease-out);
}

input[type="email"],
input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
select {
  min-height: var(--touch-min);
  padding: 0 var(--field-pad-x);
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: calc(var(--field-pad-x) + 24px);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a6b65' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right calc(var(--field-pad-x) - 2px) center;
  background-size: 14px 14px;
}

select::-ms-expand {
  display: none;
}

select:disabled {
  cursor: not-allowed;
  color: var(--text-disabled);
  background-color: var(--neutral-100);
  border-color: var(--border-light);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c9b8b3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

textarea {
  padding: var(--sp-3) var(--field-pad-x);
  resize: vertical;
  min-height: 72px;
  line-height: var(--leading-normal);
}

input[type="file"] {
  min-height: var(--touch-min);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.3;
}

input[type="file"]::file-selector-button {
  margin-right: var(--sp-3);
  min-height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-default);
  background: var(--bg-sunken);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

input[type="file"]::file-selector-button:hover {
  background: var(--rose-50);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-disabled);
}

input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
  border-color: var(--border-strong);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--rose-500);
  box-shadow: var(--shadow-glow);
}

a:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Checkbox */
.checkbox {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  user-select: none;
  cursor: pointer;
  font-size: var(--text-base);
}

.checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--rose-500);
  cursor: pointer;
  flex-shrink: 0;
}

.description-textarea {
  font-size: var(--text-sm);
}


/* ── Notice / Alert ─────────────────────────────────────────── */
.notice {
  margin: var(--sp-3) 0 var(--sp-5);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.notice--success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
}

.notice--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.notice--warning {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.markdown-help-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: var(--sp-2);
  color: var(--text-strong);
}

.markdown-help-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
}

.markdown-help-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: var(--sp-2);
}

.markdown-help-item pre {
  margin: var(--sp-1) 0 0;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: var(--neutral-100);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.markdown-help-item code {
  font-family: inherit;
  font-size: inherit;
}


/* ── Toast (minimal JS-friendly) ────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-pill);
  background: var(--neutral-800);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: transform 0.4s var(--ease-spring), opacity 0.3s var(--ease-out);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}


/* ── Badge / Chip ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  border: 1px solid;
  white-space: nowrap;
}

.badge--ready      { color: var(--success-text); background: var(--success-bg); border-color: var(--success-border); }
.badge--hidden     { color: var(--text-secondary); background: var(--bg-sunken); border-color: var(--border-default); }
.badge--processing { color: var(--warning-text); background: var(--warning-bg); border-color: var(--warning-border); }
.badge--error      { color: var(--danger-text); background: var(--danger-bg); border-color: var(--danger-border); }
.badge--admin      { color: var(--rose-700); background: var(--rose-50); border-color: var(--rose-200); }


/* ── Grids ──────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.grid-2 > .card + .card {
  margin-top: 0;
}

.grid-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
}


/* ── Course section ─────────────────────────────────────────── */
.course-section {
  margin-top: var(--sp-7);
  padding: var(--sp-5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.course-section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.course-section:first-child { margin-top: var(--sp-5); }

.course-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-light);
}

.section-icon,
.course-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--rose-50);
  border: 1px solid var(--rose-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rose-700);
  flex-shrink: 0;
  line-height: 1;
}

.section-icon .icon,
.course-icon .icon {
  width: 20px;
  height: 20px;
}

.course-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.course-topline {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-2);
  min-width: 0;
}

.course-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rose-200);
  background: var(--rose-50);
  color: var(--rose-600);
  font-family: var(--font-heading);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.course-topline .course-kind {
  margin-left: auto;
}

.course-kind .icon {
  width: 12px;
  height: 12px;
}

.course-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  min-width: 0;
}

.module-title-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.module-title-toggle .course-title {
  transition: color var(--duration-fast) var(--ease-out);
}

.module-title-toggle:hover .course-title {
  color: var(--rose-700);
}

.module-title-toggle:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.course-chip {
  display: inline-flex;
  width: fit-content;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rose-200);
  background: var(--rose-50);
  color: var(--rose-600);
  font-family: var(--font-heading);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.course-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 750;
}

.course-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.course-count--topline {
  margin-left: 0;
  margin-right: auto;
  text-align: left;
  white-space: nowrap;
  flex-shrink: 0;
}

.course-count--titleline {
  margin-left: var(--sp-2);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

@media (max-width: 560px) {
  .course-kind {
    padding: 2px 8px;
    gap: 4px;
    font-size: 0.62rem;
  }

  .course-kind .icon {
    width: 10px;
    height: 10px;
  }

  .course-count--topline {
    margin-left: 0;
    margin-right: auto;
    text-align: left;
    white-space: nowrap;
    font-size: 0.74rem;
  }

  .course-title-row {
    flex-wrap: wrap;
  }

  .course-count--titleline {
    margin-left: 0;
    width: 100%;
    text-align: left;
    white-space: normal;
  }
}

.course-progress {
  margin-top: var(--sp-2);
  width: 100%;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--neutral-200);
  overflow: hidden;
}

.course-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.4s var(--ease-out);
}

.course-lessons-grid {
  margin-top: var(--sp-1);
}

.videos-view + .videos-view {
  margin-top: var(--sp-7);
}

.course-modules-grid {
  display: grid;
  gap: var(--sp-4);
}

.module-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--neutral-100) 0%, var(--bg-elevated) 22%);
  padding: var(--sp-4);
}

.module-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-light);
}

.module-header-content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.module-header-content--link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

.module-header-content--link .module-title {
  transition: color var(--duration-fast) var(--ease-out);
}

.module-header-content--link:hover .module-title {
  color: var(--rose-700);
}

.module-header-content--link:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.module-toggle-indicator {
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--neutral-100);
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.module-header .module-toggle-indicator,
.course-header .module-toggle-indicator {
  margin-top: 2px;
}

.module-toggle-indicator[data-module-toggle][aria-expanded="true"] {
  transform: rotate(180deg);
  color: var(--rose-600);
  border-color: var(--rose-200);
  background: var(--rose-50);
}

[data-module-toggle]:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.module-title {
  margin: 0;
  font-size: var(--text-base);
  display: block;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}


/* ── Video tile ─────────────────────────────────────────────── */
.video-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  box-shadow: var(--shadow-xs);
  transition:
    box-shadow var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
}

.video-tile:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--rose-200);
  transform: translateY(-2px);
}

.video-tile--watched {
  border-color: var(--success-border);
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--success-bg) 100%);
}

.video-tile-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.video-number {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--rose-50);
  border: 1.5px solid var(--rose-200);
  display: flex;
  align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--rose-600);
  flex-shrink: 0;
  margin-top: 1px;
}

.video-number--done {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.video-title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(1rem, 0.96rem + 0.12vw, 1.1rem);
  line-height: 1.35;
  color: var(--text-strong);
  display: block;
  white-space: normal;
  word-break: break-word;
}

.video-tile-info {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.video-tile-info .icon {
  margin-right: 2px;
}

.video-tile-progress {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--neutral-200);
  overflow: hidden;
  margin-top: 2px;
}

.video-tile-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.4s var(--ease-out);
}

.video-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    108deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 38%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(255, 255, 255, 0.12) 62%,
    transparent 100%
  );
  transform: translateX(-100%);
}

body.is-page-loading .course-lessons-grid .video-tile::after {
  opacity: 0.8;
  animation: ui-tile-loading-shimmer 1s ease-in-out infinite;
}

@keyframes ui-tile-loading-shimmer {
  to { transform: translateX(100%); }
}


/* ── Player ─────────────────────────────────────────────────── */
.player-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-300);
  background: #0a0a0a;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player {
  width: 100%;
  display: block;
  max-height: min(72vh, 760px);
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #000;
}

.player-wrap--portrait {
  padding: clamp(6px, 1.2vw, 12px);
}

.player-wrap--portrait .player {
  width: min(100%, 520px);
  max-height: min(82vh, 900px);
  aspect-ratio: 9/16;
  border-radius: var(--radius-md);
}

.player-wrap:fullscreen,
.player-wrap:-webkit-full-screen,
.player-wrap:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}

.player-wrap:fullscreen .player,
.player-wrap:-webkit-full-screen .player,
.player-wrap:-ms-fullscreen .player {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
}

.player:fullscreen,
.player:-webkit-full-screen,
.player:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  object-fit: contain;
  background: #000;
}

.player-wrap:fullscreen::backdrop,
.player-wrap:-webkit-full-screen::backdrop {
  background: #000;
}

.player:fullscreen::backdrop,
.player:-webkit-full-screen::backdrop {
  background: #000;
}

.watch-meta-row {
  margin-top: var(--sp-5);
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.watch-controls {
  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  gap: var(--sp-2);
}

.watch-controls > * {
  justify-self: center;
}

.player-wrap--portrait + .watch-meta-row {
  width: min(100%, 520px);
  margin-inline: auto;
}

.watch-control-icon-btn,
.watch-control-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--bg-sunken);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
  text-decoration: none;
  flex-shrink: 0;
}

.watch-control-icon-btn {
  width: 36px;
  padding: 0;
}

.watch-control-menu {
  position: relative;
}

.watch-control-menu-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-family: var(--font-heading);
  font-weight: 700;
}

.watch-control-btn--dynamic {
  width: auto;
  min-width: 36px;
  padding: 0 var(--sp-2);
}

.watch-control-icon-btn:hover,
.watch-control-menu-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-200);
  color: var(--rose-700);
}

.watch-control-icon-btn:active,
.watch-control-menu-btn:active {
  background: var(--rose-100);
}

.watch-control-icon-btn:focus-visible,
.watch-control-menu-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.watch-control-menu-dropdown {
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 84px;
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 2px;
  z-index: 20;
}

.watch-control-menu--speed .watch-control-menu-dropdown {
  min-width: 72px;
}

.watch-control-menu-dropdown[hidden] {
  display: none !important;
}

.watch-control-menu-item {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.25;
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
}

.watch-control-menu-item:hover {
  background: var(--rose-50);
  border-color: var(--rose-200);
  color: var(--rose-700);
}

.watch-control-menu-item.is-active {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-700);
}

.watch-control-icon-btn[hidden] {
  display: none !important;
}

.watch-control-icon-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.watch-control-icon {
  width: 14px;
  height: 14px;
}


/* ── Autoplay overlay ───────────────────────────────────────── */
.autoplay-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 10;
  animation: fadeIn 0.3s var(--ease-out);
}

.autoplay-overlay[hidden] { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.autoplay-overlay-inner {
  text-align: center;
  color: #fff;
  padding: var(--sp-6);
  max-width: 380px;
}

.autoplay-overlay-text {
  font-size: var(--text-md);
  margin-bottom: var(--sp-2);
  color: rgba(255, 255, 255, 0.8);
}

.autoplay-overlay-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--sp-5);
}

.autoplay-overlay-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
}

.autoplay-overlay-actions .btn.ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.autoplay-overlay-actions .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.22);
}


/* ── Video description ──────────────────────────────────────── */
.video-description {
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  border-radius: var(--radius-md);
  background: var(--bg-sunken);
  border: 1px solid var(--border-light);
}

.video-description-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.video-description-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0;
}

.video-description-expand-btn {
  appearance: none;
  border: 1px solid var(--border-default);
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.video-description-expand-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-700);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.video-description-expand-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.description-reader-open {
  overflow: hidden;
}

.description-reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: rgba(18, 16, 20, 0.78);
}

.description-reader-dialog {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border: 0;
  background: var(--bg-elevated);
  overflow: hidden;
}

.description-reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.68) 100%);
}

.description-reader-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.description-reader-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.description-reader-size-btn {
  appearance: none;
  border: 1px solid var(--border-default);
  min-width: 32px;
  min-height: 32px;
  padding: 0 var(--sp-2);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.description-reader-size-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-700);
}

.description-reader-size-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.description-reader-size-btn:disabled {
  opacity: 0.5;
  cursor: default;
  background: var(--neutral-100);
  border-color: var(--border-light);
  color: var(--text-tertiary);
}

.description-reader-close-btn {
  appearance: none;
  border: 1px solid var(--border-default);
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.description-reader-close-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-700);
}

.description-reader-close-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.description-reader-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(20px, 3vw, 44px) clamp(18px, 4vw, 64px) clamp(24px, 4vw, 56px);
  font-size: clamp(1rem, 1.1vw, 1.08rem);
  line-height: 1.82;
  color: var(--text-primary);
}

.video-description-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  white-space: normal;
  word-break: break-word;
}

.description-reader-body.video-description-body {
  font-size: clamp(1rem, 1.1vw, 1.08rem);
  line-height: 1.82;
}

.video-description-body > *:first-child { margin-top: 0; }
.video-description-body > *:last-child { margin-bottom: 0; }

.video-description-body p,
.video-description-body ul,
.video-description-body ol,
.video-description-body blockquote,
.video-description-body pre {
  margin: 0 0 var(--sp-3);
}

.video-description-body ul,
.video-description-body ol {
  padding-left: 1.3em;
}

.video-description-body li + li {
  margin-top: 2px;
}

.video-description-body blockquote {
  padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--border-accent);
  border-radius: var(--radius-xs);
  background: var(--rose-50);
  color: var(--text-secondary);
}

.video-description-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--neutral-100);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1px 4px;
}

.video-description-body pre {
  overflow-x: auto;
  padding: var(--sp-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--neutral-100);
}

.video-description-body pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.video-description-body a {
  color: var(--rose-700);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

@media (max-width: 720px) {
  .video-description-head {
    align-items: center;
    flex-direction: row;
  }

  .video-description-expand-btn {
    width: 32px;
    min-width: 32px;
  }

  .description-reader-overlay {
    padding: 0;
  }

  .description-reader-dialog {
    width: 100%;
    border-radius: 0;
    border: 0;
  }

  .description-reader-head {
    padding: var(--sp-3);
  }

  .description-reader-actions {
    gap: var(--sp-1);
  }

  .description-reader-body {
    padding: var(--sp-4) var(--sp-3) var(--sp-5);
  }
}


/* ── Access info ────────────────────────────────────────────── */
.access-info {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--border-light);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.access-info--expired {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--text-danger);
}


/* ── Progress bar ───────────────────────────────────────────── */
.progress-wrap { margin-top: var(--sp-3); display: grid; gap: var(--sp-2); }

.progress {
  width: 100%; height: 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--bg-sunken);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.3s var(--ease-out);
}


/* ── Skeletons ─────────────────────────────────────────────── */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--neutral-200), #f6f0ee, var(--neutral-200));
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.65) 48%, transparent 100%);
  transform: translateX(-100%);
  animation: ui-skeleton-shimmer 1.25s ease-in-out infinite;
}

.skeleton-line {
  height: 0.78rem;
  margin-bottom: var(--sp-2);
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line--short {
  width: 46%;
}

.skeleton-line--medium {
  width: 68%;
}

.skeleton-card {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

@keyframes ui-skeleton-shimmer {
  100% { transform: translateX(100%); }
}


/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-sunken);
  padding: var(--sp-9) var(--sp-6);
  color: var(--text-secondary);
  text-align: center;
  font-size: var(--text-base);
}

.empty-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
  opacity: 0.6;
}

.empty-state-icon .icon {
  width: 40px;
  height: 40px;
}


/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  margin-top: var(--sp-7);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════ */
.login-page.bg {
  background:
    radial-gradient(ellipse 900px 520px at 10% -8%, rgba(175, 227, 255, 0.34), transparent 62%),
    radial-gradient(ellipse 780px 480px at 100% -12%, rgba(255, 190, 225, 0.32), transparent 58%),
    radial-gradient(ellipse 700px 420px at 52% 112%, rgba(162, 245, 226, 0.24), transparent 64%),
    linear-gradient(155deg, #f8fbff 0%, #fff8fb 42%, #f8fffd 100%);
}

.login-wrap {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-5);
}

.glass-ambient {
  position: absolute;
  inset: -50px;
  z-index: 1;
  pointer-events: none;
}

.glass-orb {
  --orb-size: clamp(160px, 22vw, 320px);
  --orb-tilt: 0deg;
  position: absolute;
  width: var(--orb-size);
  height: var(--orb-size);
  border-radius: 44% 56% 64% 36% / 36% 56% 44% 64%;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(138deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.2) 36%, rgba(255, 255, 255, 0.1) 100%),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.04) 58%),
    linear-gradient(152deg, rgba(136, 224, 255, 0.22) 0%, rgba(255, 162, 209, 0.22) 58%, rgba(150, 235, 213, 0.2) 100%);
  box-shadow:
    0 20px 44px rgba(116, 102, 146, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -16px 28px rgba(255, 255, 255, 0.14);
  filter: saturate(1.12);
  transform: rotate(var(--orb-tilt));
  animation: liquid-orb-float 12s ease-in-out infinite, liquid-orb-morph 16s ease-in-out infinite;
}

.glass-orb--one {
  top: -4%;
  left: 4%;
  --orb-tilt: -16deg;
}

.glass-orb--two {
  top: 10%;
  right: 5%;
  --orb-size: clamp(140px, 19vw, 270px);
  --orb-tilt: 18deg;
  animation-delay: -3.1s;
}

.glass-orb--three {
  bottom: -2%;
  left: 10%;
  --orb-size: clamp(150px, 21vw, 300px);
  --orb-tilt: -12deg;
  animation-delay: -5.8s;
}

.glass-orb--four {
  right: 10%;
  bottom: 8%;
  --orb-size: clamp(120px, 15vw, 220px);
  --orb-tilt: 24deg;
  opacity: 0.84;
  animation-delay: -8.2s;
}

.glass-ripple {
  --ripple-size: clamp(130px, 18vw, 260px);
  position: absolute;
  width: var(--ripple-size);
  height: var(--ripple-size);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.06) 52%, rgba(255, 255, 255, 0) 72%);
  box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.25);
  opacity: 0.58;
  animation: liquid-ripple 9.4s ease-in-out infinite;
}

.glass-ripple--one {
  top: 16%;
  left: 22%;
}

.glass-ripple--two {
  right: 18%;
  bottom: 20%;
  --ripple-size: clamp(110px, 15vw, 210px);
  animation-delay: -3.2s;
}

.glass-ripple--three {
  top: 54%;
  right: 38%;
  --ripple-size: clamp(84px, 11vw, 150px);
  animation-delay: -6.1s;
}

.glass-bubble {
  --bubble-size: clamp(20px, 2.4vw, 38px);
  --bubble-rise: 92px;
  --bubble-drift-x: 0px;
  position: absolute;
  width: var(--bubble-size);
  height: var(--bubble-size);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.16) 44%, rgba(255, 255, 255, 0.04) 76%, rgba(255, 255, 255, 0) 100%),
    linear-gradient(150deg, rgba(151, 236, 255, 0.16) 0%, rgba(255, 170, 215, 0.14) 58%, rgba(171, 241, 223, 0.16) 100%);
  box-shadow:
    0 10px 18px rgba(118, 114, 168, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.78);
  animation: liquid-bubble-rise 9.8s ease-in-out infinite;
}

.glass-bubble--one {
  left: 7%;
  top: 10%;
  --bubble-size: clamp(18px, 2.2vw, 32px);
  --bubble-rise: 112px;
  --bubble-drift-x: 16px;
  animation-delay: -0.8s;
}

.glass-bubble--two {
  left: 18%;
  bottom: 18%;
  --bubble-size: clamp(16px, 2vw, 30px);
  --bubble-rise: 78px;
  --bubble-drift-x: -10px;
  animation-delay: -3.6s;
}

.glass-bubble--three {
  left: 33%;
  top: 36%;
  --bubble-size: clamp(14px, 1.8vw, 26px);
  --bubble-rise: 74px;
  --bubble-drift-x: 12px;
  animation-delay: -5.2s;
}

.glass-bubble--four {
  right: 8%;
  top: 14%;
  --bubble-size: clamp(20px, 2.5vw, 36px);
  --bubble-rise: 104px;
  --bubble-drift-x: -14px;
  animation-delay: -2.3s;
}

.glass-bubble--five {
  right: 20%;
  top: 48%;
  --bubble-size: clamp(14px, 1.9vw, 28px);
  --bubble-rise: 88px;
  --bubble-drift-x: 9px;
  animation-delay: -6.7s;
}

.glass-bubble--six {
  right: 34%;
  top: 8%;
  --bubble-size: clamp(12px, 1.6vw, 24px);
  --bubble-rise: 60px;
  --bubble-drift-x: -8px;
  animation-delay: -8.9s;
}

.glass-bubble--seven {
  left: 48%;
  bottom: 14%;
  --bubble-size: clamp(16px, 2vw, 28px);
  --bubble-rise: 98px;
  --bubble-drift-x: 11px;
  animation-delay: -4.3s;
}

.glass-bubble--eight {
  right: 42%;
  top: 24%;
  --bubble-size: clamp(11px, 1.4vw, 20px);
  --bubble-rise: 68px;
  --bubble-drift-x: -9px;
  animation-delay: -7.4s;
}

.glass-bubble--large {
  --bubble-size: clamp(46px, 6.2vw, 88px);
  --bubble-rise: 132px;
  border-color: rgba(255, 255, 255, 0.66);
  box-shadow:
    0 16px 28px rgba(118, 114, 168, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  animation-duration: 12.4s;
}

.glass-bubble--nine {
  left: 24%;
  top: 4%;
  --bubble-drift-x: 18px;
  animation-delay: -2.8s;
}

.glass-bubble--ten {
  right: 4%;
  bottom: 6%;
  --bubble-size: clamp(40px, 5.4vw, 76px);
  --bubble-rise: 118px;
  --bubble-drift-x: -16px;
  animation-delay: -9.1s;
}

.glass-bubble--eleven {
  left: 4%;
  bottom: 4%;
  --bubble-size: clamp(36px, 4.8vw, 66px);
  --bubble-rise: 108px;
  --bubble-drift-x: 14px;
  animation-delay: -5.6s;
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(100%, var(--content-xs));
}

.login-card .card {
  position: relative;
  overflow: hidden;
  padding: var(--sp-8) var(--sp-7);
  animation: liquid-card-in 0.64s var(--ease-out);
}

.login-page .login-card .card > * {
  position: relative;
  z-index: 1;
}

.login-page .login-card .card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0.16) 36%, rgba(255, 255, 255, 0.4) 76%, rgba(255, 255, 255, 0.12) 100%);
  pointer-events: none;
}

.login-page .login-card .card::after {
  content: "";
  position: absolute;
  inset: -40% -30%;
  background: linear-gradient(114deg, transparent 36%, rgba(255, 255, 255, 0.44) 50%, transparent 64%);
  transform: translate3d(-54%, 0, 0) rotate(7deg);
  opacity: 0;
  pointer-events: none;
  animation: liquid-sheen 6.6s var(--ease-out) infinite;
}

@keyframes liquid-orb-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(var(--orb-tilt));
  }
  50% {
    transform: translate3d(0, -16px, 0) rotate(calc(var(--orb-tilt) + 4deg));
  }
}

@keyframes liquid-orb-morph {
  0%,
  100% {
    border-radius: 44% 56% 64% 36% / 36% 56% 44% 64%;
  }
  35% {
    border-radius: 58% 42% 52% 48% / 46% 34% 66% 54%;
  }
  70% {
    border-radius: 52% 48% 38% 62% / 58% 44% 56% 42%;
  }
}

@keyframes liquid-ripple {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.44;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.72;
  }
}

@keyframes liquid-bubble-rise {
  0%,
  12% {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.72);
  }
  30% {
    opacity: 0.66;
  }
  65% {
    opacity: 0.42;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--bubble-drift-x), calc(var(--bubble-rise) * -1), 0) scale(1.06);
  }
}

@keyframes liquid-sheen {
  0%,
  20% {
    transform: translate3d(-54%, 0, 0) rotate(7deg);
    opacity: 0;
  }
  34% {
    opacity: 0.46;
  }
  56% {
    transform: translate3d(52%, 0, 0) rotate(7deg);
    opacity: 0;
  }
  100% {
    transform: translate3d(52%, 0, 0) rotate(7deg);
    opacity: 0;
  }
}

@keyframes liquid-card-in {
  0% {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.986);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@media (max-width: 760px) {
  .glass-ambient {
    inset: -90px -28px;
  }

  .glass-orb {
    opacity: 0.72;
  }

  .glass-orb--four,
  .glass-ripple--three,
  .glass-bubble--six,
  .glass-bubble--eight,
  .glass-bubble--ten,
  .glass-bubble--eleven {
    display: none;
  }
}

.login-card .notice {
  margin: var(--sp-2) 0 var(--sp-4);
  border-width: 1.5px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--sp-3);
}

.login-card .notice .notice-icon {
  margin-top: 2px;
  flex-shrink: 0;
  opacity: 0.92;
}

.login-card .notice > span {
  min-width: 0;
  line-height: 1.45;
}

.login-separator {
  margin: calc(var(--sp-3) / 4) 0;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.login-separator::before,
.login-separator::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border-light);
}

.login-separator span {
  padding: 0 var(--sp-3);
}

.payment-course-buttons {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
}

.login-card .form {
  grid-template-columns: minmax(0, 1fr);
}

.login-card .form > * {
  min-width: 0;
}

.login-card .form-group > label {
  text-align: center;
}

.login-card #shared-email {
  text-align: center;
}

.payment-course-buttons .btn {
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.35;
  padding: var(--sp-3) var(--sp-5);
}

.login-hint {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-light);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-relaxed);
}

.login-hint--tight {
  margin-top: var(--sp-3);
  padding-top: 0;
  border-top: 0;
}

.login-retry {
  margin-top: 0;
  display: grid;
  gap: var(--sp-3);
}

.login-retry-wait {
  min-height: var(--touch-min);
  padding: var(--sp-2) var(--sp-4);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  color: var(--text-secondary);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  text-align: center;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.2;
}

.login-retry-wait-label {
  min-width: 0;
}

.login-retry-wait-time {
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.login-retry-wait-time [data-retry-countdown] {
  font-weight: 800;
  color: var(--text-strong);
  min-width: 2ch;
  text-align: right;
}

.login-retry [data-retry-submit] {
  min-height: var(--touch-min);
}


/* ═══════════════════════════════════════════════════════════════
   ERROR PAGE
   ═══════════════════════════════════════════════════════════════ */
.error-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--danger-bg);
  border: 2px solid var(--danger-border);
  display: flex;
  align-items: center; justify-content: center;
  color: var(--text-danger);
  flex-shrink: 0;
}

.error-icon .icon {
  width: 24px;
  height: 24px;
}


/* ═══════════════════════════════════════════════════════════════
   ADMIN PAGES
   ═══════════════════════════════════════════════════════════════ */

/* Compact admin sizing */
.admin-page {
  font-size: 14px;
  line-height: 1.5;
}

.admin-page .container.wide {
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-9);
}

.admin-page .card {
  padding: var(--sp-5);
  border-radius: var(--radius-md);
}

.admin-page .card + .card { margin-top: var(--sp-4); }

.admin-page h2 {
  margin-bottom: var(--sp-3);
  font-size: clamp(1rem, 3.2vw, 1.2rem);
}

.admin-page p { margin-bottom: var(--sp-2); }

.admin-page .grid-2 {
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  align-items: start;
}

.admin-page .form { gap: var(--sp-3); }
.admin-page .form-group { gap: 2px; }
.admin-page label { font-size: var(--text-xs); }

.upload-source-row {
  --upload-source-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-2);
  align-items: stretch;
}

.upload-source-row .field-save-wrap--source {
  min-width: 0;
}

.upload-source-row .field-save-wrap--file input[type="file"],
.upload-source-row .field-save-wrap--source input[type="url"] {
  height: var(--upload-source-height);
  min-height: var(--upload-source-height);
}

.upload-source-row .field-save-wrap--file input[type="file"] {
  padding: 0 8px;
  line-height: calc(var(--upload-source-height) - 2px);
  display: block;
  box-sizing: border-box;
}

.upload-source-row .field-save-wrap--file input[type="file"]::file-selector-button {
  height: calc(var(--upload-source-height) - 8px);
  min-height: calc(var(--upload-source-height) - 8px);
  margin: 0 10px 0 0;
  padding: 0 var(--sp-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  box-sizing: border-box;
}

.field-save-wrap--source input[type="url"] {
  padding-right: 44px;
}

.field-save-wrap--source input[type="url"][hidden] {
  display: none;
}

.upload-source-toggle {
  min-height: var(--upload-source-height);
  padding-inline: var(--sp-3);
  white-space: nowrap;
}

.upload-source-toggle--icon {
  width: 40px;
  min-width: 40px;
  height: var(--upload-source-height);
  min-height: var(--upload-source-height);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}

.upload-source-toggle--icon .icon {
  width: 19px;
  height: 19px;
}

#youtube-mode-toggle.upload-source-toggle--icon {
  width: 40px;
  min-width: 40px;
  min-height: var(--upload-source-height);
}

#youtube-mode-toggle.upload-source-toggle--icon .icon {
  width: calc(var(--upload-source-height) - 4px);
  height: calc(var(--upload-source-height) - 4px);
}

.admin-page input[type="email"],
.admin-page input[type="text"],
.admin-page input[type="url"],
.admin-page select {
  min-height: 38px;
  font-size: var(--text-sm);
}

.admin-page textarea {
  min-height: 54px;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
}

.admin-page input[type="file"] {
  min-height: 38px;
  padding: 6px;
  font-size: var(--text-xs);
}

.admin-page .btn {
  font-size: var(--text-xs);
  padding-inline: var(--sp-3);
  min-height: 36px;
  border-radius: var(--radius-xs);
}

.admin-page .btn.ghost { min-height: 34px; }

.admin-page .topbar-inner {
  min-height: 56px;
  padding: var(--sp-2) var(--sp-4);
  gap: var(--sp-3);
}

.admin-page .logo.sm {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
}

.admin-page .brand-name { font-size: var(--text-base); }

.admin-page .top-actions { gap: var(--sp-2); }


/* ── Admin section header ───────────────────────────────────── */
.admin-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.admin-search-wrap { flex: 1 1 200px; max-width: 300px; }

.admin-search {
  width: 100%;
  min-height: 36px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: 0 var(--sp-3);
}

/* ── Tables (admin, desktop) ────────────────────────────────── */
.table {
  width: 100%;
  margin-top: var(--sp-4);
  display: grid;
  gap: var(--sp-3);
}

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  align-items: stretch;
}

.row.users > div, .row.courses > div, .row.modules > div {
  position: relative;
  padding-top: 22px;
}

.row.users > div::before, .row.courses > div::before, .row.modules > div::before {
  content: attr(data-label);
  position: absolute; top: 0; left: 0;
  font-family: var(--font-heading);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.row.users > div form, .row.courses > div form, .row.modules > div form { margin: 0; }
.row.users > div form + form, .row.courses > div form + form, .row.modules > div form + form { margin-top: var(--sp-2); }
.row.head { display: none; }

.user-email--admin { color: var(--rose-600); font-weight: 700; }
.user-email--active { color: var(--success-text); font-weight: 700; }


/* ── Inline forms ───────────────────────────────────────────── */
.inline-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
  align-items: stretch;
}

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-form select { min-width: 0; }
.course-add-form,
.module-add-form,
.course-rename-form,
.module-rename-form,
.module-course-form,
.course-offer-form,
.video-course-form,
.video-module-form,
.video-modules-form { grid-template-columns: 1fr; }

.table--courses .course-offer-form {
  justify-content: center;
  align-items: center;
}

.table--courses .course-rename-form input[type="text"],
.table--courses .course-offer-input {
  min-height: 36px;
}

.table--courses .course-offer-input--price,
.table--courses .course-offer-input--days {
  font-size: var(--text-base);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.2;
}

.course-offer-field--price {
  position: relative;
}

.course-offer-field--price input.course-offer-input--price {
  padding-right: 58px;
}

.course-offer-currency {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
  color: var(--text-tertiary);
  pointer-events: none;
}

.course-offer-hint {
  margin: var(--sp-2) 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-tertiary);
  text-align: right;
}

.table--modules .module-rename-form input[type="text"] {
  min-height: 36px;
}

#upload-form input[name="title"],
#upload-course-select,
#upload-module-select,
#youtube-url-input,
.video-rename-form input[name="title"],
.video-course-form select,
.video-module-form select,
.module-course-form select {
  min-height: 38px;
  height: 38px;
}

.module-course-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.module-add-form input[name="title"],
.module-add-form select[name="course_id"] {
  min-height: 38px;
  height: 38px;
}

.video-modules-select[multiple] {
  min-height: 96px;
  height: auto;
  padding-top: 6px;
  padding-bottom: 6px;
  padding-right: var(--field-pad-x);
  background-image: none;
  font-size: var(--text-sm);
}

.video-modules-select optgroup {
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-tertiary);
}

.video-modules-wrap {
  padding-right: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.video-modules-caption {
  margin: 0 0 2px;
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  line-height: 1.1;
}

.video-modules-picker {
  min-height: 114px;
  max-height: 136px;
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 248, 250, 0.92) 100%);
  padding: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  scroll-snap-type: y proximity;
  scrollbar-gutter: stable;
}

.video-modules-course {
  --video-modules-indent: 12px;
  padding: 2px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
}

.video-modules-course + .video-modules-course {
  margin-top: 3px;
}

.video-modules-course.is-hidden .video-modules-course-title {
  color: var(--text-muted);
}

.video-modules-course-title {
  margin: 0 0 2px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.025em;
  color: var(--text-tertiary);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  scroll-snap-align: start;
}

.video-modules-course-title::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rose-300);
  opacity: 0.9;
  flex: 0 0 auto;
}

.video-modules-options {
  display: grid;
  gap: 2px;
  padding-left: var(--video-modules-indent);
  padding-right: 2px;
}

.video-module-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 27px;
  height: 27px;
  max-height: 27px;
  padding: 0 6px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-spring);
  scroll-snap-align: start;
}

.video-module-chip:hover {
  border-color: var(--rose-300);
  background: rgba(255, 246, 250, 0.98);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.video-module-chip.is-selected {
  border-color: var(--rose-300);
  background: linear-gradient(135deg, rgba(255, 237, 246, 0.95) 0%, rgba(255, 251, 253, 0.98) 100%);
  box-shadow: 0 0 0 1px rgba(238, 77, 147, 0.08) inset;
}

.video-module-chip.is-hidden {
  opacity: 0.86;
}

.video-module-chip-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  border-radius: inherit;
}

.video-module-chip-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  line-height: 1.05;
  font-weight: 400;
}

.video-module-chip.is-selected .video-module-chip-main {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-primary);
}

.video-module-chip-flag {
  flex: 0 0 auto;
  font-size: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--rose-700);
  background: rgba(253, 242, 248, 0.95);
  border: 1px solid rgba(238, 77, 147, 0.25);
  border-radius: 999px;
  padding: 1px 4px;
  text-transform: uppercase;
  letter-spacing: 0.015em;
}

.video-modules-picker-empty {
  padding: 5px 7px;
  border: 1px dashed var(--border-default);
  border-radius: 7px;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
}

.admin-side-stack {
  display: grid;
  gap: var(--sp-3);
  align-content: start;
}

.admin-side-stack > .card,
.admin-side-stack > .card + .card {
  margin-top: 0;
}

.admin-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-2);
  margin-top: 0;
  margin-bottom: 0;
}

.admin-top-grid--single {
  grid-template-columns: 1fr;
}

.top-views-card {
  margin-top: 0;
  padding: var(--sp-4);
}

.top-views-card > h2 {
  margin-bottom: var(--sp-2);
}

.admin-top-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #fffafb 100%);
  box-shadow: var(--shadow-xs);
  padding: var(--sp-2);
}

.admin-top-title {
  margin: 0 0 4px;
  font-family: var(--font-heading);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.admin-top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-top-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px var(--sp-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 245, 248, 0.7) 100%);
  padding: 5px var(--sp-2);
  min-height: 0;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.admin-top-item:hover {
  border-color: var(--rose-300);
  box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 232, 240, 0.6) 100%);
}

.admin-top-item-main {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.admin-top-item-rank {
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-secondary);
  line-height: 1;
}

.admin-top-item[data-rank="1"] .admin-top-item-rank {
  border-color: transparent;
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-accent);
}

.admin-top-item[data-rank="2"] .admin-top-item-rank {
  border-color: var(--rose-200);
  background: var(--rose-50);
}

.admin-top-item[data-rank="3"] .admin-top-item-rank {
  border-color: var(--neutral-300);
  background: var(--neutral-100);
}

.admin-top-item-title {
  min-width: 0;
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.12;
}

.admin-top-item-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-family: var(--font-heading);
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.08;
}

.admin-top-item-sub::before {
  content: "";
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--rose-300);
}

.admin-top-item-meta {
  justify-self: end;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  line-height: 1;
}


/* ── Video admin cards ──────────────────────────────────────── */
.video-admin-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.video-admin-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.video-admin-card:hover { box-shadow: var(--shadow-md); }

.video-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.video-order-wrap { display: inline-flex; align-items: center; gap: 4px; }
.video-order-move { margin: 0; }
.table-order-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--sp-2);
}

.table-order-wrap--inline {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.table-order-wrap--mobile {
  display: none;
}

.table-meta-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: nowrap;
}

.table-order-mobile-form {
  margin: 0;
  display: none;
  align-items: center;
  gap: 4px;
}

.table-lessons-count {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

.title-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2);
}

.order-icon-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: var(--text-xs);
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.order-icon-btn .icon {
  width: 13px;
  height: 13px;
}

.order-icon-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-600);
}

.order-drag-handle {
  cursor: grab;
}

.order-drag-handle .icon {
  width: 14px;
  height: 14px;
}

.order-drag-handle:active {
  cursor: grabbing;
}

.order-icon-btn:focus-visible,
.field-save-btn:focus-visible,
.video-state-toggle:focus-visible,
.head-icon-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

.video-order {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.row.is-dragging {
  opacity: 0.55;
}

.video-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid;
  flex: 0 0 auto;
}

.video-state-toggle-form { margin: 0; }
.video-replace-form { margin: 0; display: inline-flex; }

.video-state-toggle {
  appearance: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.video-state-toggle:hover { filter: brightness(0.96); }
.video-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.video-state-icon .icon {
  width: 15px;
  height: 15px;
}

.video-state.on { color: var(--success-text); background: var(--success-bg); border-color: var(--success-border); }
.video-state.off { color: var(--danger-text); background: var(--danger-bg); border-color: var(--danger-border); }

.table--courses .video-state,
.table--modules .video-state {
  width: 28px;
  height: 28px;
}

.video-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.head-icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.head-icon-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-600);
  transform: scale(1.04);
}

.head-icon-btn--danger {
  color: var(--text-danger);
  border-color: var(--danger-border);
}

.head-icon-btn--danger:hover {
  background: var(--danger-bg);
  border-color: #ef4444;
  color: #dc2626;
  transform: scale(1.04);
}

.head-icon-btn svg {
  width: 14px; height: 14px;
  fill: currentColor;
  display: block;
}

.video-rename-form { display: grid; grid-template-columns: 1fr; gap: var(--sp-2); }
.video-description-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  flex: 1 1 auto;
  min-height: 0;
}
.video-description-form .field-save-wrap--textarea {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}
.video-description-form .field-save-wrap--textarea textarea {
  flex: 1 1 auto;
  min-height: 160px;
  height: 100%;
  padding-right: 80px;
}
.video-progress-block { display: grid; gap: var(--sp-2); }
.video-status-row { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.video-status-actions { display: inline-flex; align-items: center; }
.video-restart-form { margin: 0; }

.video-restart-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning-text);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.video-restart-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #9a5804;
  transform: rotate(-12deg);
}

.video-restart-btn .icon {
  width: 13px;
  height: 13px;
}

.video-restart-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

.video-restart-btn--error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--text-danger);
}

.video-restart-btn--error:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
  transform: scale(1.04);
}

.video-restart-btn--error:focus-visible {
  outline: 3px solid var(--danger-border);
  outline-offset: 1px;
}

.field-save-wrap { position: relative; }
.field-save-wrap input[type="text"],
.field-save-wrap input[type="url"],
.field-save-wrap input[type="number"],
.field-save-wrap textarea,
.field-save-wrap select { padding-right: 44px; }
.field-save-wrap--file input[type="file"] { padding-right: 44px; }

.field-save-btn {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--rose-600);
  display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-spring);
}

.field-save-wrap--textarea .field-save-btn {
  top: 8px;
  transform: none;
}

.field-save-wrap--multiselect .field-save-btn {
  top: 8px;
  transform: none;
}

.description-actions-stack {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.description-expand-btn,
.description-help-btn,
.description-preview-btn {
  position: static;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-spring),
    color var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}

.field-save-wrap--textarea:focus-within .description-expand-btn,
.field-save-wrap--textarea:focus-within .description-help-btn,
.field-save-wrap--textarea:focus-within .description-preview-btn {
  opacity: 1;
}

.description-expand-btn:hover,
.description-help-btn:hover,
.description-preview-btn:hover,
.description-actions-stack .field-save-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-200);
  color: var(--rose-600);
  transform: scale(1.1);
}

.description-expand-btn svg,
.description-help-btn svg,
.description-preview-btn svg {
  width: 14px;
  height: 14px;
}

.description-actions-stack .field-save-btn {
  position: static;
  top: auto;
  right: auto;
  transform: none;
}

.field-save-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-200);
  transform: translateY(-50%) scale(1.1);
}

.field-save-wrap--textarea .field-save-btn:hover {
  transform: scale(1.1);
}

.field-save-btn svg {
  width: 14px; height: 14px;
  fill: currentColor;
  display: block;
}

.description-expand-btn:focus-visible,
.description-help-btn:focus-visible,
.description-preview-btn:focus-visible,
.description-fullscreen-close:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

.description-help-popover[hidden] {
  display: none !important;
}

.description-help-popover {
  position: fixed;
  z-index: 4300;
  width: min(520px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  padding: var(--sp-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.description-help-popover.is-open {
  opacity: 1;
  transform: translateY(0);
}

.description-help-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.description-help-popover-title {
  margin: 0;
  font-size: var(--text-sm);
}

.description-help-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.description-help-close:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-600);
}

.description-help-close:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

.description-help-popover-body {
  display: grid;
  gap: var(--sp-2);
}

.description-help-group {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: var(--sp-2);
  background: var(--neutral-100);
}

.description-help-group-title {
  margin-bottom: var(--sp-1);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
}

.description-help-group pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.description-help-group code {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.description-preview-popover[hidden] {
  display: none !important;
}

.description-preview-popover {
  position: fixed;
  z-index: 4300;
  width: min(460px, calc(100vw - 16px));
  max-height: min(72vh, 620px);
  padding: var(--sp-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.description-preview-popover.is-open {
  opacity: 1;
  transform: translateY(0);
}

.description-preview-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.description-preview-popover-title {
  margin: 0;
  font-size: var(--text-sm);
}

.description-preview-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.description-preview-close:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-600);
}

.description-preview-close:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

.description-preview-popover-body {
  min-height: 56px;
}

.description-preview-content {
  font-size: var(--text-sm);
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.description-preview-empty {
  margin: 0;
  color: var(--text-tertiary);
}

@media (min-width: 721px) {
  .description-preview-popover {
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    width: min(calc(100vw - 28px), 1120px) !important;
    max-width: min(calc(100vw - 28px), 1120px);
    height: min(calc(100dvh - 28px), calc(100dvh - 28px));
    max-height: calc(100dvh - 28px) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    padding-top: var(--sp-4);
    padding-bottom: var(--sp-4);
    box-sizing: border-box;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translate(-50%, -50%) !important;
  }

  .description-preview-popover.is-open {
    transform: translate(-50%, -50%) !important;
  }

  .description-preview-popover-head {
    margin-bottom: var(--sp-3);
  }

  .description-preview-popover-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    padding: var(--sp-4);
  }
}

.description-fullscreen-modal[hidden] {
  display: none !important;
}

.description-fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: 4200;
  display: grid;
  place-items: center;
  padding: var(--sp-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.description-fullscreen-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.description-fullscreen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 29, 27, 0.42);
}

.description-fullscreen-dialog {
  position: relative;
  width: min(100%, 1120px);
  height: min(100%, calc(100vh - 28px));
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  overflow: hidden;
}

.description-fullscreen-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-2);
}

.description-fullscreen-title {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.3rem);
}

.description-fullscreen-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.description-fullscreen-close:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-600);
}

.description-fullscreen-close svg {
  width: 14px;
  height: 14px;
}

.description-fullscreen-textarea {
  width: 100%;
  flex: 1 1 auto;
  min-height: 220px;
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: max(16px, var(--text-base));
  line-height: 1.55;
  resize: none;
  overflow: auto;
  overscroll-behavior: contain;
}

.description-fullscreen-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.description-modal-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.description-modal-icon-btn svg {
  width: 14px;
  height: 14px;
}

.description-modal-icon-btn:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
  color: var(--rose-600);
  transform: translateY(-1px);
}

.description-modal-icon-btn--apply {
  color: var(--success-text);
  border-color: var(--success-border);
}

.description-modal-icon-btn--apply:hover {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.description-modal-icon-btn:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

body.is-description-modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .video-modules-wrap {
    padding-right: 0;
    min-width: 0;
  }

  .video-modules-picker {
    max-height: 128px;
    min-height: 112px;
    width: 100%;
    max-width: 100%;
    padding: 3px;
    scrollbar-gutter: stable;
  }

  .video-modules-course {
    --video-modules-indent: 10px;
    padding: 1px;
    border-radius: 6px;
  }

  .video-module-chip {
    min-height: 28px;
    height: 28px;
    max-height: 28px;
    padding: 0 6px;
    width: 100%;
  }

  .video-module-chip-main {
    font-size: 0.74rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .description-help-popover {
    width: auto;
    max-width: none;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    max-height: min(56dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px));
    box-sizing: border-box;
  }

  .description-preview-popover {
    width: auto;
    max-width: none;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    max-height: min(56dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px));
    box-sizing: border-box;
  }

  .description-fullscreen-modal {
    inset: 0;
    place-items: stretch;
    padding: 0;
  }

  .description-fullscreen-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    border-radius: 0;
    border: 0;
    padding: var(--sp-3);
    padding-top: max(var(--sp-3), env(safe-area-inset-top));
    padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
    box-sizing: border-box;
  }

  .description-fullscreen-textarea {
    height: 100%;
    max-height: none;
    min-height: 0;
    font-size: 16px;
  }
}

.field-save-btn--upload {
  color: var(--success-text);
  border-color: var(--success-border);
}

.field-save-btn--upload:hover {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.field-save-btn--add {
  color: var(--rose-700);
  border-color: var(--rose-300);
}

.field-save-btn[hidden] { display: none !important; }

.autosave-form.is-dirty input[type="text"],
.autosave-form.is-dirty input[type="number"],
.autosave-form.is-dirty textarea,
.autosave-form.is-dirty select {
  border-color: var(--rose-500);
  box-shadow: var(--shadow-glow);
}

.autosave-form.is-dirty .video-modules-picker {
  border-color: var(--rose-500);
  box-shadow: var(--shadow-glow);
}

.input-no-spinner {
  appearance: textfield;
  -moz-appearance: textfield;
}

.input-no-spinner::-webkit-outer-spin-button,
.input-no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.video-error {
  padding: var(--sp-3);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  word-break: break-word;
  font-size: var(--text-sm);
  color: var(--text-danger);
}

.video-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.video-actions--single { grid-template-columns: 1fr; }
.video-actions form { width: 100%; }
.video-actions .btn { width: 100%; }


/* ── User admin cards ───────────────────────────────────────── */
.user-admin-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.user-admin-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  padding: var(--sp-3);
  display: grid;
  gap: var(--sp-2);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.user-admin-card:hover { box-shadow: var(--shadow-sm); }

.user-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.user-admin-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-admin-body { display: grid; gap: var(--sp-2); }

.user-admin-email {
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: normal;
  max-width: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-admin-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
}

.user-admin-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.user-admin-actions form { margin: 0; }

.user-access-days-form {
  grid-template-columns: max-content;
  justify-content: start;
}

.user-access-days-form .field-save-wrap {
  width: 180px;
  max-width: 100%;
}

.access-days-input {
  width: 100%;
  max-width: none;
}

.user-courses-form {
  gap: var(--sp-1);
  margin-top: 6px;
}

.user-courses-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.user-courses-grid .checkbox {
  font-size: var(--text-xs);
  gap: 5px;
}

.user-courses-grid .checkbox input[type="checkbox"] {
  width: 14px; height: 14px;
}

.user-course-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.user-course-access-row:hover {
  border-color: var(--border-default);
}

.user-course-access-row.is-expired {
  opacity: 1;
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.user-course-access-item {
  align-items: center;
  min-width: 0;
}

.user-course-access-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.user-course-access-title {
  line-height: 1.24;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.user-course-access-meta {
  font-size: 0.66rem;
  line-height: 1.2;
  color: var(--text-tertiary);
}

.user-course-access-meta--expired {
  color: var(--text-danger);
}

.user-course-access-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.user-course-access-controls input.course-days-input[type="text"] {
  width: calc(5ch + 22px);
  min-width: calc(5ch + 22px);
  max-width: calc(5ch + 22px);
  flex: 0 0 calc(5ch + 22px);
  box-sizing: border-box;
  height: 34px;
  min-height: 34px;
  border-radius: 12px;
  padding: 0 8px;
  text-align: center;
  font-size: 0.66rem;
  line-height: 1;
  font-family: var(--font-heading);
  font-weight: 700;
}

.user-course-access-days-suffix {
  font-size: 0.72rem;
  line-height: 1;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

@media (max-width: 560px) {
  .user-course-access-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .user-course-access-controls {
    padding-left: 24px;
  }

  .user-course-access-controls input.course-days-input[type="text"] {
    box-sizing: border-box;
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    flex: 0 0 50px;
    height: 28px;
    min-height: 28px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 14px !important;
  }
}

.user-courses-save {
  width: fit-content;
  min-height: 30px;
}


/* ── Storage info (admin) ───────────────────────────────────── */
.storage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.storage-head h2 {
  margin-bottom: 0;
}

.storage-stats { display: grid; gap: var(--sp-2); }

.storage-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  font-size: var(--text-sm);
}

.storage-stat:not(:last-child) { border-bottom: 1px solid var(--border-light); }

.storage-stat-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.storage-stat-label { color: var(--text-secondary); }

.storage-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-strong);
}

.storage-delete-form { margin: 0; }
.storage-delete-btn { width: 24px; height: 24px; }
.storage-delete-btn svg { width: 12px; height: 12px; }

.storage-total {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-strong);
  margin-bottom: 0;
  white-space: nowrap;
}


/* ── Admin compact overrides ────────────────────────────────── */
.admin-page .table { margin-top: var(--sp-3); gap: var(--sp-2); }
.admin-page .table--courses { gap: var(--sp-1); }
.admin-page .table--modules { gap: var(--sp-1); }

.admin-page .table--courses .row.courses {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.admin-page .table--courses .row.courses:not(.head) > div {
  padding-top: 14px;
}

.admin-page .table--modules .row.modules:not(.head) > div {
  padding-top: 14px;
}

.admin-page .row {
  gap: var(--sp-1);
  padding: var(--sp-3);
}

.admin-page .row.head {
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.68rem;
}

.admin-page .row.users > div,
.admin-page .row.courses > div,
.admin-page .row.modules > div { padding-top: 18px; }

.admin-page .row.users > div::before,
.admin-page .row.courses > div::before,
.admin-page .row.modules > div::before { font-size: 0.6rem; }

.admin-page .inline-form { gap: var(--sp-1); }

.admin-page .video-admin-list { margin-top: var(--sp-3); gap: var(--sp-2); }
.admin-page .video-admin-card { padding: var(--sp-3); gap: var(--sp-2); }

.admin-page .video-rename-form,
.admin-page .video-progress-block,
.admin-page .video-actions { gap: var(--sp-1); }

.admin-page .admin-section-header { margin-bottom: var(--sp-2); gap: var(--sp-2); }
.admin-page .admin-search { min-height: 34px; font-size: var(--text-sm); }

.admin-page .storage-total { margin-bottom: 0; font-size: 1.3rem; }
.admin-page .storage-stat { padding: 6px 0; font-size: var(--text-xs); }

.admin-page .head-icon-btn { width: 28px; height: 28px; }
/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .skeleton::after {
    display: none;
  }

  body::before,
  body::after {
    transition: none;
  }

  body.is-page-loading::before {
    animation: none;
    transform: scaleX(0.56);
  }

  body.is-page-loading .course-lessons-grid .video-tile::after {
    animation: none;
    opacity: 0.2;
    transform: none;
  }

  .login-page .glass-orb,
  .login-page .glass-ripple,
  .login-page .glass-bubble,
  .login-page .login-card .card,
  .login-page .login-card .card::after {
    animation: none !important;
    transform: none !important;
  }

  .login-page .login-card .card::after {
    opacity: 0.16;
  }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════ */

/* ── 480px: Tablet small ────────────────────────────────────── */
@media (min-width: 480px) {
  .container { padding-left: var(--sp-6); padding-right: var(--sp-6); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .inline-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .course-add-form, .module-add-form, .course-rename-form, .module-rename-form, .module-course-form, .course-offer-form, .video-course-form, .video-module-form { grid-template-columns: 1fr; }
  .video-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .video-actions--single { grid-template-columns: 1fr; }
  .video-rename-form { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .top-views-card {
    padding: var(--sp-4);
  }

  .admin-top-card {
    padding: 6px;
  }

  .admin-top-item {
    padding: 4px 6px;
    gap: 4px 6px;
  }

  .admin-top-item-rank {
    min-width: 30px;
    height: 22px;
    font-size: 0.64rem;
  }

  .admin-top-item-title {
    font-size: 0.8rem;
  }

  .admin-top-item-sub {
    font-size: 0.64rem;
  }

  .admin-top-item-meta {
    min-width: 30px;
    height: 22px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .admin-page .table--courses .row.courses,
  .admin-page .table--modules .row.modules {
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: var(--sp-2);
    row-gap: var(--sp-2);
  }

  .admin-page .table--courses .row.courses > div[data-label="Название"],
  .admin-page .table--courses .row.courses > div[data-label="Оплата"],
  .admin-page .table--modules .row.modules > div[data-label="Модуль"],
  .admin-page .table--modules .row.modules > div[data-label="Курс"] {
    grid-column: 1 / -1;
  }

  .admin-page .table--courses .row.courses > div[data-label="Уроков"] { order: 1; }
  .admin-page .table--courses .row.courses > div[data-label="Состояние"] { order: 2; }
  .admin-page .table--courses .row.courses > div[data-label="Название"] { order: 3; }
  .admin-page .table--courses .row.courses > div[data-label="Оплата"] { order: 4; }
  .admin-page .table--modules .row.modules > div[data-label="Уроков"] { order: 1; }
  .admin-page .table--modules .row.modules > div[data-label="Состояние"] { order: 2; }
  .admin-page .table--modules .row.modules > div[data-label="Модуль"] { order: 3; }
  .admin-page .table--modules .row.modules > div[data-label="Курс"] { order: 4; }

  .admin-page .table--courses .row.courses > div[data-label="Состояние"],
  .admin-page .table--courses .row.courses > div[data-label="Уроков"],
  .admin-page .table--modules .row.modules > div[data-label="Состояние"],
  .admin-page .table--modules .row.modules > div[data-label="Уроков"] {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0;
  }

  .admin-page .table--courses .row.courses > div[data-label="Уроков"],
  .admin-page .table--modules .row.modules > div[data-label="Уроков"] {
    grid-column: 1 / 3;
    width: 100%;
  }

  .admin-page .table--courses .row.courses > div[data-label="Состояние"],
  .admin-page .table--modules .row.modules > div[data-label="Состояние"] {
    grid-column: 3 / 4;
  }

  .admin-page .table--courses .row.courses > div[data-label="Состояние"]::before,
  .admin-page .table--courses .row.courses > div[data-label="Уроков"]::before,
  .admin-page .table--modules .row.modules > div[data-label="Состояние"]::before,
  .admin-page .table--modules .row.modules > div[data-label="Уроков"]::before {
    content: none;
  }

  .admin-page .table--courses .row.courses .table-order-wrap--desktop-inline,
  .admin-page .table--modules .row.modules .table-order-wrap--desktop-inline {
    display: none;
  }

  .admin-page .table--courses .row.courses .table-order-mobile-form,
  .admin-page .table--modules .row.modules .table-order-mobile-form {
    display: inline-flex;
  }

  .admin-page .table--courses .row.courses > div[data-label="Уроков"] .table-meta-inline,
  .admin-page .table--modules .row.modules > div[data-label="Уроков"] .table-meta-inline {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--sp-3);
  }

  .admin-page .table--courses .row.courses > div[data-label="Уроков"] .table-order-mobile-form,
  .admin-page .table--modules .row.modules > div[data-label="Уроков"] .table-order-mobile-form {
    position: static;
    z-index: auto;
  }

  .admin-page .table--courses .row.courses > div[data-label="Уроков"] .table-lessons-count,
  .admin-page .table--modules .row.modules > div[data-label="Уроков"] .table-lessons-count {
    position: static;
    left: auto;
    transform: none;
    text-align: center;
    justify-self: center;
    min-width: 0;
  }

  .admin-page .table--courses .row.courses > div[data-label="Состояние"],
  .admin-page .table--modules .row.modules > div[data-label="Состояние"] {
    justify-content: flex-end;
  }
}

/* ── 768px: Tablet/Desktop ──────────────────────────────────── */
@media (min-width: 768px) {
  .container.wide {
    padding-top: var(--sp-8);
    padding-bottom: var(--sp-10);
  }

  .card { padding: var(--sp-7); }
  .topbar-inner { flex-wrap: nowrap; }
  .top-actions { width: auto; flex-wrap: nowrap; flex: 0 1 auto; }
  .top-actions .btn { flex: 0 0 auto; }

  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-sidebar { grid-template-columns: 1fr var(--sidebar-width); }
  .admin-page .grid-2 { align-items: stretch; }
  .admin-side-stack {
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .top-views-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .top-views-card .admin-top-grid { flex: 1 1 auto; }
  .top-views-card .admin-top-card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .top-views-card .admin-top-list {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .top-views-card .admin-top-item {
    flex: 1 1 auto;
    min-height: 40px;
  }
  .admin-top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-top-grid--single { grid-template-columns: 1fr; }

  /* Desktop table view */
  .table {
    gap: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-elevated);
  }

  .row {
    border: 0;
    border-top: 1px solid var(--border-light);
    border-radius: 0;
    box-shadow: none;
    padding: var(--sp-3) var(--sp-5);
    align-items: center;
  }

  .row:hover:not(.head) { background: var(--rose-50); }

  .row.head {
    display: grid;
    border-top: 0;
    background: var(--bg-sunken);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: var(--sp-3) var(--sp-5);
  }

  .row.users { grid-template-columns: 2.2fr 1fr 1fr 1.4fr; }
  .row.courses { grid-template-columns: 1.6fr 0.9fr 0.7fr 2.3fr; }
  .row.modules { grid-template-columns: 1.6fr 1fr 0.9fr 0.7fr; }

  .table--courses .row.courses {
    grid-template-columns: minmax(0, 1fr) 170px 72px 240px;
    column-gap: 12px;
  }

  .table--modules .row.modules {
    grid-template-columns: minmax(0, 1fr) 170px 72px 240px;
    column-gap: 12px;
  }

  /* Explicit modules columns order: Module -> State -> Lessons -> Course */
  .table--modules .row.modules > div[data-label="Модуль"],
  .table--modules .row.modules.head > div:nth-child(1) { order: 1; }

  .table--modules .row.modules > div[data-label="Состояние"],
  .table--modules .row.modules.head > div:nth-child(2) { order: 2; }

  .table--modules .row.modules > div[data-label="Уроков"],
  .table--modules .row.modules.head > div:nth-child(3) { order: 3; }

  .table--modules .row.modules > div[data-label="Курс"],
  .table--modules .row.modules.head > div:nth-child(4) { order: 4; }

  .table--courses .row.courses:not(.head) {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .admin-page .table--courses .row.courses.head {
    min-height: 44px;
    height: 44px;
    padding: 0 var(--sp-5);
    align-items: center;
  }

  .admin-page .table--modules .row.modules.head {
    min-height: 44px;
    height: 44px;
    padding: 0 var(--sp-5);
    align-items: center;
  }

  .table--courses .row.courses > div:first-child {
    min-width: 0;
  }

  .table--modules .row.modules > div:first-child {
    min-width: 0;
  }

  .table--courses .course-rename-form {
    width: 100%;
  }

  .table--modules .module-rename-form {
    width: 100%;
  }

  .table--courses .row.courses.head > div {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1.2;
    padding-top: 0;
    padding-bottom: 0;
  }

  .table--modules .row.modules.head > div {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1.2;
    padding-top: 0;
    padding-bottom: 0;
  }

  .table--courses .row.courses > div[data-label="Состояние"],
  .table--courses .row.courses > div[data-label="Уроков"],
  .table--courses .row.courses > div[data-label="Оплата"] {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .table--modules .row.modules > div[data-label="Состояние"],
  .table--modules .row.modules > div[data-label="Уроков"] {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .row.users > div, .row.courses > div, .row.modules > div { padding-top: 0; }
  .row.users > div::before, .row.courses > div::before, .row.modules > div::before { content: none; }
  .row.users > div form + form, .row.courses > div form + form, .row.modules > div form + form { margin-top: var(--sp-1); }
  .admin-page .table--courses .row.courses:not(.head) > div { padding-top: 0; }
  .admin-page .table--modules .row.modules:not(.head) > div { padding-top: 0; }

  .user-courses-grid { grid-template-columns: 1fr; }
  .user-admin-list { grid-template-columns: 1fr; }
  .video-admin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .admin-page .card { padding: var(--sp-5); }

  .markdown-help-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-add-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .module-add-form {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    align-items: center;
  }

  .table--courses .course-offer-form {
    grid-template-columns: max-content max-content;
    width: fit-content;
    margin-inline: auto;
    gap: var(--sp-1);
  }

  .table--courses .course-offer-field--price {
    width: calc(11ch + 70px);
    max-width: calc(11ch + 70px);
  }

  .table--courses .course-offer-field--days {
    width: calc(4ch + 64px);
    max-width: calc(4ch + 64px);
  }
}

/* ── 1024px: Desktop ────────────────────────────────────────── */
@media (min-width: 1024px) {
  .container { padding-top: var(--sp-9); }
  .container.wide { padding-left: var(--sp-7); padding-right: var(--sp-7); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-admin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── 1280px: Wide desktop ───────────────────────────────────── */
@media (min-width: 1280px) {
  .container.wide { width: min(100%, 1200px); }
  .user-admin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-admin-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

/* Fade-in for page content */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
.course-section {
  animation: slideUp 0.4s var(--ease-out) both;
}

.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }

.video-tile {
  animation: slideUp 0.35s var(--ease-out) both;
}

.admin-page .card,
.admin-page .course-section,
.admin-page .video-tile {
  animation: none;
}

/* Stagger lesson tiles */
.course-lessons-grid .video-tile:nth-child(1) { animation-delay: 0.04s; }
.course-lessons-grid .video-tile:nth-child(2) { animation-delay: 0.08s; }
.course-lessons-grid .video-tile:nth-child(3) { animation-delay: 0.12s; }
.course-lessons-grid .video-tile:nth-child(4) { animation-delay: 0.16s; }
.course-lessons-grid .video-tile:nth-child(5) { animation-delay: 0.2s; }
.course-lessons-grid .video-tile:nth-child(6) { animation-delay: 0.24s; }
.course-lessons-grid .video-tile:nth-child(n+7) { animation-delay: 0.28s; }


/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2       { gap: var(--sp-2); }
.gap-3       { gap: var(--sp-3); }
.gap-4       { gap: var(--sp-4); }
.mt-0        { margin-top: 0; }
.mt-2        { margin-top: var(--sp-2); }
.mt-3        { margin-top: var(--sp-3); }
.mt-4        { margin-top: var(--sp-4); }
.mt-5        { margin-top: var(--sp-5); }
.mb-0        { margin-bottom: 0; }
.mb-2        { margin-bottom: var(--sp-2); }
.mb-3        { margin-bottom: var(--sp-3); }
.mb-4        { margin-bottom: var(--sp-4); }
.w-full      { width: 100%; }
.text-center { text-align: center; }

[hidden] { display: none !important; }


/* ─────────────────────────────────────────────────────────────
   DESIGN POLISH (quick wins)
   - Less scrolling (modules grid on desktop)
   ───────────────────────────────────────────────────────────── */

@media (min-width: 768px) {
  .course-modules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.grid.course-lessons-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 680px) {
  .grid.course-lessons-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* ─────────────────────────────────────────────────────────────
   DESIGN POLISH (continued)
   - Segmented control in topbar
   - User menu (logout dropdown)
   - Lesson thumbnail placeholders
   ───────────────────────────────────────────────────────────── */

/* Unified topbar controls */
.top-actions .btn:not(.segmented-btn),
.top-actions .segmented-btn {
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  font-size: var(--text-xs);
}

.top-actions .btn:not(.segmented-btn) {
  padding-inline: var(--sp-3);
  border-radius: var(--radius-xs);
}

.top-actions .segmented-btn {
  padding-inline: var(--sp-3);
}

.top-actions .segmented {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: var(--radius-xs);
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  align-items: stretch;
}

.top-actions .top-mode-link {
  flex: 1 1 auto;
  min-width: 0;
}

.top-actions--admin .segmented {
  flex: 0 1 auto;
  min-width: 0;
}

.top-actions .top-logout-btn {
  width: var(--topbar-control-height);
  min-width: var(--topbar-control-height);
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  padding-inline: 0;
  gap: 0;
  flex: 0 0 var(--topbar-control-height);
  color: var(--rose-700);
  border-color: var(--rose-300);
  background: var(--rose-50);
}

.top-actions .top-logout-icon {
  width: 18px;
  height: 18px;
  max-width: none;
  flex: 0 0 18px;
  color: var(--rose-700);
  display: block;
}

.top-actions .top-logout-label {
  display: none;
}

@media (min-width: 768px) {
  .top-actions {
    --topbar-half-width: clamp(150px, 16vw, 220px);
  }

  .top-actions .segmented {
    width: calc(var(--topbar-half-width) * 2);
    min-width: calc(var(--topbar-half-width) * 2);
    flex: 0 0 calc(var(--topbar-half-width) * 2);
  }

  .top-actions .top-mode-link {
    width: var(--topbar-half-width);
    min-width: var(--topbar-half-width);
    flex: 0 0 var(--topbar-half-width);
  }

  .top-actions .top-logout-btn {
    flex: 0 0 auto;
  }

  .top-actions--admin {
    --topbar-half-width: clamp(120px, 14vw, 190px);
  }
}

@media (max-width: 767px) {
  .admin-page input[type="email"],
  .admin-page input[type="text"],
  .admin-page input[type="number"],
  .admin-page input[type="password"],
  .admin-page select,
  .admin-page textarea {
    font-size: 16px !important;
  }

  .topbar-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--sp-2);
  }

  .admin-page .brand-name,
  .admin-account .brand-name {
    display: none;
  }

  .brand-mini {
    gap: var(--sp-2);
    flex: 0 0 auto;
  }

  .top-actions {
    margin-left: 0;
    justify-content: flex-start;
    align-items: center;
    gap: var(--sp-1);
    flex-wrap: nowrap;
    flex: 1 1 0;
    min-width: 0;
  }

  .admin-page .brand-mini .top-mode-link--brand,
  .admin-account .brand-mini .top-mode-link--brand {
    display: none;
  }

  .admin-page .top-actions .top-mode-link--nav,
  .admin-account .top-actions .top-mode-link--nav {
    display: none;
  }

  .top-actions .segmented {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
  }

  .top-actions .top-home-link {
    order: 0;
    width: 34px;
    min-height: 34px;
  }

  .top-actions .top-logout-btn {
    order: 2;
    width: var(--topbar-control-height);
    min-width: var(--topbar-control-height);
    flex: 0 0 var(--topbar-control-height);
  }

  .top-actions .top-mode-link {
    order: 3;
    flex: 1 1 100%;
  }

  .top-actions .segmented-btn {
    padding-inline: var(--sp-1);
    gap: var(--sp-1);
    min-width: 0;
  }

  .top-actions .segmented-btn span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-actions--admin {
    gap: var(--sp-1);
  }

  .top-actions--admin:not(.top-actions--dual-switch) .segmented {
    flex: 0 0 auto;
  }

  .top-actions--admin:not(.top-actions--dual-switch) .segmented .segmented-btn {
    width: var(--topbar-control-height);
    max-width: none;
    min-width: var(--topbar-control-height);
    padding-inline: 0;
    gap: 0;
    flex: 0 0 var(--topbar-control-height);
  }

  .top-actions--admin:not(.top-actions--dual-switch) .segmented .segmented-btn span {
    display: none;
  }

  .top-actions--dual-switch.is-dual-switch-compact .segmented-btn {
    padding-inline: 0;
    gap: var(--sp-1);
  }

  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="admin"] .segmented--admin-catalog,
  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="catalog"] .segmented--admin-main {
    flex: 0 0 auto;
  }

  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="admin"] .segmented--admin-main,
  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="catalog"] .segmented--admin-catalog {
    flex: 1 1 0;
    min-width: 0;
  }

  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="admin"] .segmented--admin-catalog .segmented-btn,
  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="catalog"] .segmented--admin-main .segmented-btn {
    width: var(--topbar-control-height);
    max-width: none;
    min-width: var(--topbar-control-height);
    padding-inline: 0;
    gap: 0;
    flex: 0 0 var(--topbar-control-height);
  }

  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="admin"] .segmented--admin-catalog .segmented-btn span,
  .top-actions--dual-switch.is-dual-switch-compact[data-active-switch-group="catalog"] .segmented--admin-main .segmented-btn span {
    display: none;
  }
}

.segmented {
  display: flex;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
}

.segmented-btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 var(--sp-5);
  min-height: var(--touch-min);
  gap: var(--sp-2);
}

.top-actions .segmented .segmented-btn {
  flex: 1 1 50%;
  width: 50%;
  max-width: 50%;
  min-width: 0;
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  justify-content: center;
  border-radius: 0;
  color: var(--text-secondary);
}

.top-actions .segmented .segmented-btn .icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 1.1rem;
}

.top-actions .segmented .segmented-btn:hover {
  background: var(--rose-50);
  transform: none;
}

.top-actions .segmented .segmented-btn.is-active,
.top-actions .segmented .segmented-btn.is-active:hover {
  background: var(--accent-gradient);
  color: var(--text-on-accent);
  transform: none;
}

.segmented-btn + .segmented-btn {
  border-left: 1px solid var(--border-light);
}

.user-menu {
  position: relative;
}

.user-menu-btn {
  width: 100%;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  gap: var(--sp-3);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--rose-50);
  border: 1px solid var(--rose-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-xs);
  color: var(--rose-700);
  flex: 0 0 auto;
}

.user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 34ch;
  min-width: 0;
}

.user-menu-caret {
  flex: 0 0 auto;
  opacity: 0.8;
}

@media (max-width: 420px) {
  .user-menu .user-email { display: none; }
  .user-menu-btn { justify-content: center; }
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  max-width: min(320px, 92vw);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: rgba(255, 252, 253, 0.96);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1400;
}

@media (max-width: 767px) {
  .user-menu-dropdown {
    left: 0;
    right: 0;
    min-width: unset;
  }
}

.user-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-strong);
}

.user-menu-item:hover {
  background: var(--rose-50);
}

.watch-title {
  margin-top: 0;
}

.video-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: radial-gradient(120% 120% at 20% 20%, var(--rose-50) 0%, var(--bg-elevated) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.18) 48%, transparent 100%);
  opacity: 0.7;
  transform: translateX(-30%);
}

.video-thumb .icon {
  width: 26px;
  height: 26px;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}

.video-thumb--done {
  background: radial-gradient(120% 120% at 20% 20%, var(--success-bg) 0%, var(--bg-elevated) 75%);
}

.video-thumb--done .icon {
  opacity: 1;
}


/* ─────────────────────────────────────────────────────────────
   DESIGN POLISH v3
   - Topbar: stronger “scrolled” state
   - Videos: search bar (filters lessons)
   - Fix: unify lesson thumbnail placeholder in tiles
   ───────────────────────────────────────────────────────────── */

.topbar.is-scrolled {
  background: rgba(255, 250, 251, 0.94);
  border-bottom-color: rgba(160, 90, 130, 0.18);
  box-shadow: 0 10px 28px rgba(62, 35, 50, 0.10);
}

.admin-page .topbar {
  box-shadow: 0 1px 4px rgba(62, 35, 50, 0.04);
}

.admin-page .topbar.is-scrolled {
  box-shadow: 0 10px 28px rgba(62, 35, 50, 0.10);
}

.videos-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.videos-page .videos-catalog-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.videos-page .container.wide {
  padding-top: var(--sp-4);
}

.videos-page .videos-view .course-section:first-of-type {
  margin-top: 0;
}

.videos-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-light);
}

.videos-userline {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--neutral-100);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.videos-userline strong {
  color: var(--text-primary);
}

.videos-intro .access-info {
  margin-left: auto;
}

.videos-page:not(.admin-account) .videos-userline {
  display: none !important;
}

@media (max-width: 720px) {
  .videos-intro {
    align-items: stretch;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
    padding-bottom: var(--sp-2);
  }

  .videos-userline {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .videos-intro .access-info {
    width: 100%;
    margin-left: 0;
  }
}

.searchbar {
  position: relative;
  flex: 1 1 360px;
  min-width: 240px;
}

.searchbar input[type="text"] {
  padding-left: 42px;
  padding-right: 44px;
}

.searchbar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.65;
  pointer-events: none;
}

.searchbar-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 34px;
  padding: 0 10px;
  border-radius: 12px;
}

.searchbar-clear:hover,
.searchbar-clear:active,
.searchbar-clear.btn.ghost:hover,
.searchbar-clear.btn.ghost:active {
  transform: translateY(-50%);
}

.searchbar-count {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-tertiary);
}

.videos-search-toggle {
  display: none;
}

.videos-page .top-actions {
  flex-wrap: nowrap;
  justify-content: flex-start;
  min-width: 0;
}

.videos-page .top-actions .videos-toolbar--topbar {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin-right: var(--sp-2);
}

.videos-page .top-actions .videos-toolbar--topbar .searchbar {
  flex: 1 1 auto;
  min-width: 0;
}

.videos-page .top-actions .videos-toolbar--topbar .searchbar input[type="text"] {
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  padding-left: 38px;
  padding-right: 40px;
}

.videos-page .top-actions .videos-toolbar--topbar .searchbar-icon {
  left: 12px;
}

.videos-page .top-actions .videos-toolbar--topbar .searchbar-clear {
  right: 6px;
  min-height: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
}

.videos-page .top-actions .videos-toolbar--topbar .searchbar-count {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  white-space: nowrap;
}

.watch-page .top-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

@media (min-width: 768px) {
  .videos-page .top-actions {
    --topbar-half-width: clamp(120px, 14vw, 190px);
    flex: 1 1 auto;
  }

  .watch-page .top-actions {
    --topbar-half-width: clamp(120px, 14vw, 190px);
    flex: 1 1 auto;
  }
}

@media (max-width: 1090px) {
  .videos-page .top-actions .videos-toolbar--topbar .searchbar-count {
    display: none;
  }
}

@media (max-width: 767px) {
  .videos-page .top-actions {
    position: relative;
  }

  .videos-page .top-actions .videos-toolbar--topbar {
    order: 0;
    flex: 0 0 var(--topbar-control-height);
    width: var(--topbar-control-height);
    min-width: var(--topbar-control-height);
    margin-right: 0;
    justify-content: center;
  }

  .videos-page .top-actions .videos-toolbar--topbar .videos-search-toggle {
    display: inline-flex;
    width: var(--topbar-control-height);
    min-width: var(--topbar-control-height);
    height: var(--topbar-control-height);
    min-height: var(--topbar-control-height);
    padding-inline: 0;
    justify-content: center;
    border-radius: var(--radius-xs);
  }

  .videos-page .top-actions .videos-toolbar--topbar .searchbar,
  .videos-page .top-actions .videos-toolbar--topbar .searchbar-count {
    display: none;
  }

  .videos-page .top-actions .top-logout-btn {
    order: 3;
  }

  .videos-page.is-videos-search-open .top-actions .segmented,
  .videos-page.is-videos-search-open .top-actions .top-logout-btn {
    opacity: 0;
    pointer-events: none;
  }

  .videos-page.is-videos-search-open .top-actions .videos-toolbar--topbar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
    z-index: 4;
    margin-left: 0;
  }

  .videos-page.is-videos-search-open .top-actions .videos-toolbar--topbar .videos-search-toggle {
    display: none;
  }

  .videos-page.is-videos-search-open .top-actions .videos-toolbar--topbar .searchbar {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
  }

  .videos-page.is-videos-search-open .top-actions .videos-toolbar--topbar .searchbar input[type="text"] {
    width: 100%;
  }

  .videos-page.is-videos-search-open .top-actions .videos-toolbar--topbar .searchbar-count {
    display: none;
  }
}

.search-empty {
  margin-top: var(--sp-6);
}

.video-tile-header .video-thumb {
  width: 44px;
  min-height: 52px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(255, 229, 239, 0.90));
  border: 1px solid rgba(160, 90, 130, 0.18);
  box-shadow: 0 10px 24px rgba(120, 40, 80, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 3px;
  position: relative;
}

.video-tile-header .video-thumb-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-spring),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    filter var(--duration-fast) var(--ease-out);
}

.video-tile-header .video-thumb-link:hover {
  border-color: var(--rose-300);
  box-shadow: 0 18px 34px rgba(120, 40, 80, 0.14);
  transform: translateY(-1px);
  filter: saturate(1.03);
}

.video-tile-header .video-thumb-link:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 1px;
}

.video-tile-header .video-thumb::after {
  content: none;
}

.video-tile-header .video-thumb--done {
  background: linear-gradient(165deg, rgba(239, 252, 246, 0.95), rgba(230, 246, 238, 0.90));
  border-color: var(--success-border);
}

.video-tile-header .video-thumb--disabled {
  opacity: 0.6;
  filter: grayscale(0.12);
  box-shadow: none;
}

.video-tile-header .video-meta {
  --video-title-lines: 3;
  --video-title-size: 0.92rem;
  --video-title-line-height: 1.3;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  min-height: calc(var(--video-title-size) * var(--video-title-line-height) * var(--video-title-lines));
}

.video-tile-header .video-meta .video-title {
  margin: 0;
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
  font-size: var(--video-title-size);
  line-height: var(--video-title-line-height);
}

.video-tile-header .video-thumb .video-number {
  position: static;
  width: 24px;
  height: 24px;
  margin-top: 0;
  border-width: 1px;
  font-size: 0.68rem;
  line-height: 1;
}

.video-tile-header .video-thumb .video-thumb-duration {
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-tertiary);
  line-height: 1;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════
   COMPACT MOBILE LESSON LIST
   Tighter tiles, clamped titles
   ═══════════════════════════════════════════════════════════════ */

/* --- Mobile compact (< 680px) --- */
@media (max-width: 679px) {
  /* Tighter tile padding */
  .video-tile {
    padding: 10px 12px;
    gap: 6px;
    border-radius: var(--radius-sm);
  }

  /* No lift on touch */
  .video-tile:hover {
    transform: none;
  }

  /* Smaller thumbnail */
  .video-tile-header .video-thumb {
    width: 40px;
    min-height: 46px;
    border-radius: 10px;
    padding: 3px 2px;
    box-shadow: 0 8px 16px rgba(120, 40, 80, 0.07);
  }

  .video-tile-header .video-thumb .video-number {
    width: 18px;
    height: 18px;
    font-size: 0.58rem;
  }

  .video-tile-header .video-thumb .video-thumb-duration {
    font-size: 0.54rem;
  }

  /* Tighter gap between thumb and text */
  .video-tile-header {
    gap: 9px;
  }

  .video-tile-header .video-meta {
    --video-title-size: 0.85rem;
  }

  /* Tighter lesson grid */
  .grid.course-lessons-grid {
    gap: 6px;
  }

  .course-lessons-grid {
    margin-top: 4px;
  }

  /* Thinner progress bar */
  .video-tile-progress {
    height: 3px;
    margin-top: 0;
  }

  /* Compact module section */
  .module-section {
    padding: 12px;
  }

  .module-header {
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  /* Compact course section spacing */
  .course-modules-grid {
    gap: 12px;
  }

  /* Less padding on main card */
  .videos-page .card.videos-catalog-card {
    padding: 0;
  }
}
