/* ==========================================================================
   Mi Academia · estilos
   Identidad visual replicada del modo oscuro de la plataforma de la academia
   (app.vivirdeia.com, basada en Circle). Valores extraídos de sus variables
   CSS y estilos calculados:
     · Cabecera y barra lateral: #000 · fondo principal: #191B1F (grey-900)
     · Tarjetas: #1F2227 (grey-850) · borde #42464D · separadores #2B2E33
     · Texto: #F7F9FA / #E4E7EB / #A5A9AD / #545861
     · Marca: verde #028F4F (botones, elemento activo) · acento logo #44CE8E
     · Tipografía: Inter (InterVariable) · radios 8 px (controles) y 16 px (tarjetas)
     · Barra de progreso: 6 px, pista #2B2E33, relleno blanco
   ========================================================================== */
:root {
  /* Fondos */
  --bg-shell: #000000;          /* cabecera y barra lateral */
  --bg: #191B1F;                /* color-background-secondary / layout */
  --surface: #1F2227;           /* color-background-primary */
  --surface-2: #24272D;         /* tarjeta anidada / hover suave */
  --surface-active: #42464D;    /* color-background-active */
  --surface-disabled: #2B2E33;  /* color-background-disabled */
  --logo-box: #1C1C1C;

  /* Bordes */
  --line: #42464D;              /* color-border-primary */
  --line-2: #2B2E33;            /* color-border-secondary */
  --line-hover: #717680;        /* color-border-hover */
  --line-shell: #1A1A1A;

  /* Texto */
  --ink: #F7F9FA;               /* color-text-primary */
  --ink-2: #E4E7EB;             /* color-text-secondary */
  --muted: #A5A9AD;             /* color-text-tertiary */
  --faint: #545861;             /* color-text-disabled */
  --article: #ECEFF2;

  /* Marca */
  --brand: #028F4F;
  --brand-hover: #027A43;
  --brand-active: #016A3A;
  --accent: #44CE8E;            /* verde del logo </> */
  --accent-soft: rgba(68, 206, 142, .12);
  --accent-line: rgba(68, 206, 142, .35);

  /* Estados (paleta dark de la plataforma) */
  --success-bg: #2A4539;  --success-tx: #86EFAC;
  --warn-bg: #493F2D;     --warn-tx: #FCD34D;   --warn-line: #6B5A36;
  --danger-bg: #483136;   --danger-tx: #FCA5A5; --danger: #F87171;
  --info-bg: #2D3B50;     --info-tx: #93C5FD;
  --level-mid: #7A91FD;   /* color-text-level-mid: usado para «repaso» */

  --overlay: rgba(66, 70, 77, .6); /* color-background-overlay */
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: none;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);
  --font: 'Inter', 'InterVariable', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --header: 64px;
  --sidebar: 272px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.modal-open { overflow: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); }
h1 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.6px; }
h2 { font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: -0.4px; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -0.2px; }
p { margin: 0; }
code { font-size: 12px; background: var(--surface-disabled); color: var(--ink-2); padding: 2px 6px; border-radius: 6px; }
::selection { background: rgba(68, 206, 142, .3); }
.ic { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 18px; }
.xsmall { font-size: 12px; }
.center { text-align: center; justify-content: center; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 0; min-width: 0; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.pad { padding: 12px 16px; }
.tx-sage { color: var(--accent); }
.tx-warn { color: var(--warn-tx); }
.tx-beige { color: var(--level-mid); }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.only-mobile { display: none !important; }
/* Etiqueta tipo «MÓDULO» de la academia */
.eyebrow { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

/* ---------- Estructura: cabecera negra + barra lateral negra ---------- */
.app { min-height: 100vh; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 25; height: var(--header);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; background: var(--bg-shell); border-bottom: 1px solid var(--line-shell);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.sidebar {
  position: fixed; top: var(--header); bottom: 0; left: 0; width: var(--sidebar);
  background: var(--bg-shell); display: flex; flex-direction: column; padding: 20px 12px 16px; z-index: 20;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.main { margin-left: var(--sidebar); padding-top: var(--header); min-height: 100vh; display: flex; flex-direction: column; }
.view { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 32px 72px; outline: none; }
.view > * + * { margin-top: 24px; }
.bottomnav { display: none; }

/* Marca: caja con </> en verde + «Vivir de IA» */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--logo-box); color: var(--accent); border: 1px solid var(--line-2);
}
.brand-name { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.brand-name b { color: var(--accent); font-weight: 600; }
.brand-sub { font-size: 12px; font-weight: 500; color: var(--muted); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line-2); white-space: nowrap; }
.brand-mobile { display: none; }

/* Navegación lateral (mismo patrón que la academia) */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 14px; line-height: 20px; font-weight: 600; color: #FFFFFF; padding: 0 12px; margin: 18px 0 8px; }
.nav-group:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 8px;
  text-decoration: none; color: #FFFFFF; font-weight: 500; font-size: 14px; line-height: 20px; position: relative;
  transition: background-color .15s;
}
.nav-item .ic { color: var(--ink-2); }
.nav-item:hover { background: var(--logo-box); }
.nav-item.active { background: var(--brand); color: #FFFFFF; }
.nav-item .nav-ext { margin-left: auto; color: var(--faint); }
.only-desktop { display: inline-flex; }
.nav-item.active .ic { color: #FFFFFF; }
.badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 9999px;
  background: var(--warn-bg); color: var(--warn-tx); font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.nav-item.active .badge { background: rgba(0, 0, 0, .25); color: #fff; }
.badge-soft { background: var(--surface-disabled); color: var(--ink-2); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 20px; }
.side-progress { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; background: var(--logo-box); border: 1px solid var(--line-shell); }
.side-progress strong { color: var(--ink); }
.save-status { font-size: 12px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; justify-content: center; }
.save-status.ok .ic { color: var(--accent); }
.save-status.error { color: var(--danger-tx); }
.save-status.top { display: inline-flex; }

/* ---------- Botones (32 px · radio 8 · 14/500) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 500; font-size: 14px; line-height: 20px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s; user-select: none;
}
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, a:focus-visible, .chip:focus-visible { outline: 2px solid #D2D7DB; outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #FFFFFF; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }
.btn-soft, .btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-soft:hover, .btn-ghost:hover { border-color: var(--line-hover); background: var(--surface-2); }
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger-tx); }
.btn-danger-soft:hover { background: #5A3A40; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; flex: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-active); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line); background: var(--surface); color: var(--ink); }
.icon-btn.bordered:hover { border-color: var(--line-hover); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger-tx); }
.link { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; color: var(--ink); text-decoration: none; font-weight: 500; padding: 0 4px; border-radius: 8px; }
.link:hover { color: var(--accent); }

/* ---------- Tarjetas (fondo #1F2227 · borde #42464D · radio 16 · padding 24) ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; display: flex; align-items: center; gap: 8px; }
.card-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.h-sm { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--ink); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .muted { margin-top: 4px; font-weight: 500; }
.motivation { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.motivation .ic { color: var(--accent); }

/* ---------- Barras de progreso (como la academia: 6 px, blanco sobre #2B2E33) ---------- */
.bar { height: 6px; border-radius: 9999px; background: var(--line-2); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: #FFFFFF; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar-xl { height: 8px; }
.bar-thin { height: 4px; }
.bar-hair { height: 2px; border-radius: 0; background: transparent; }
.bar-hair > span { background: var(--accent); }
.bigbar-wrap { position: relative; margin: 24px 0; }
.bar-marker { position: absolute; top: -6px; bottom: -6px; width: 0; }
.bar-marker i { position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--accent); border-radius: 2px; }
.bar-marker em { position: absolute; top: 24px; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 500; color: var(--accent); white-space: nowrap; }

/* ---------- Portada del curso (estilo de las portadas de lección) ---------- */
.hero {
  position: relative; overflow: hidden; padding: 32px;
  background:
    radial-gradient(60% 90% at 100% 0%, rgba(68, 206, 142, .16), transparent 60%),
    radial-gradient(40% 60% at 0% 100%, rgba(2, 143, 79, .10), transparent 70%),
    #0F0F0F;
  border-color: var(--line);
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero > * { position: relative; }
.hero-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 9999px; margin-bottom: 16px; }
.hero-title { font-size: 32px; line-height: 40px; font-weight: 700; letter-spacing: -0.8px; margin-bottom: 6px; }
.hero-title .hl { color: var(--accent); }
.hero .muted { color: var(--ink-2); font-weight: 500; }
.hero-pct { text-align: right; line-height: 1; }
.hero-pct .num { font-size: 56px; font-weight: 700; letter-spacing: -2px; color: var(--ink); }
.hero-pct .unit { font-size: 24px; font-weight: 700; color: var(--accent); margin-left: 2px; }
.hero-pct .small { margin-top: 8px; color: var(--muted); }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-top: 20px; border-top: 1px solid var(--line-2); }
.hero-stats > div { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 12px; line-height: 16px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.value { font-size: 18px; line-height: 26px; font-weight: 700; letter-spacing: -0.3px; color: var(--ink); }

.stats-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.stat-head { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.stat-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--logo-box); border: 1px solid var(--line-2); color: var(--accent); }
.stat-ic.flame { color: var(--warn-tx); }
.stat-value { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.6px; }
.stat-value .muted { font-size: 16px; font-weight: 500; letter-spacing: 0; }

.dayhero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 8px; text-decoration: none; margin-bottom: 12px; border: 1px solid var(--line); }
.dayhero > div { flex: 1; }
.dayhero p { color: var(--muted); }
.dayhero.rest { background: var(--surface-2); color: var(--muted); }
.dayhero.review { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.dayhero.review:hover { background: rgba(68, 206, 142, .18); }

/* ---------- Alertas ---------- */
.alert { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 8px; border: 1px solid; flex-wrap: wrap; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-tx); }
.alert-info { background: var(--info-bg); border-color: #3E5272; color: var(--info-tx); }
.alert-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.alert-text strong { color: var(--ink); font-weight: 600; }
.alert-text span { color: var(--ink-2); font-size: 13px; }
.alert-actions { display: flex; gap: 8px; }

/* ---------- Filas de clase (como la lista de lecciones de la academia) ---------- */
.litems { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.litem { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--surface); transition: background-color .15s; }
.litem + .litem { border-top: 1px solid var(--line-2); }
.litem:hover { background: var(--surface-2); }
.litem.done .litem-title { color: var(--muted); }
.litem.late { box-shadow: inset 3px 0 0 var(--warn-tx); }
.litem-body { flex: 1; min-width: 0; }
.litem-title { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--ink); }
.litem-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-top: 2px; }
.litem-meta > span:not(.dot) { color: var(--muted); }
.litem-meta .tx-warn { color: var(--warn-tx) !important; }
.litem-meta .tx-sage { color: var(--accent) !important; }
.litem-actions { display: flex; gap: 2px; }

/* Casilla circular: pendiente = círculo gris · completada = círculo blanco con check */
.check { position: relative; display: inline-grid; flex: none; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.check .box {
  width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--faint); background: transparent;
  display: grid; place-items: center; color: transparent; transition: all .15s;
}
.check .box .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.check:hover .box { border-color: var(--muted); }
.check input:checked + .box { background: var(--ink); border-color: var(--ink); color: var(--bg); animation: pop .25s ease; }
.check input:focus-visible + .box { outline: 2px solid #D2D7DB; outline-offset: 2px; }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* Píldoras de estado */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-pending { background: var(--surface-disabled); color: var(--ink-2); }
.pill-in_progress { background: var(--info-bg); color: var(--info-tx); }
.pill-done { background: var(--success-bg); color: var(--success-tx); }
.pill-warn { background: var(--warn-bg); color: var(--warn-tx); }
.pill-review { background: #31374E; color: var(--level-mid); }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.tag-today { background: var(--brand); color: #fff; }

/* Vacío */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 32px 16px; }
.empty-ic { width: 44px; height: 44px; border-radius: 10px; background: var(--logo-box); border: 1px solid var(--line-2); color: var(--accent); display: grid; place-items: center; margin-bottom: 4px; }
.empty-title { font-weight: 600; font-size: 16px; }
.empty .muted { max-width: 380px; font-size: 14px; margin-bottom: 8px; }
.small-empty { padding: 24px 8px; color: var(--faint); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.field-title { font-size: 14px !important; color: var(--ink) !important; font-weight: 600 !important; }
input[type=text], input[type=url], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 8px 12px;
  font-size: 14px; line-height: 20px; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-hover); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A5A9AD' 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 11px center; }
select option { background: var(--surface); color: var(--ink); }
textarea { resize: vertical; line-height: 1.6; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #D2D7DB; box-shadow: none; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.input-sm { width: auto; padding: 5px 10px; font-size: 13px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; }
.hint { font-size: 13px; line-height: 18px; color: var(--muted); background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; margin: 4px 0 12px; }
.hint strong { color: var(--ink-2); }
.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.checkline input { width: 16px; height: 16px; accent-color: var(--brand); }

/* Segmentado: estilo de las pestañas superiores de la academia */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-shell); border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.seg label, .seg button { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span, .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; border: 0; background: transparent; }
.seg input:checked + span, .seg button.active { background: var(--logo-box); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg input:focus-visible + span { outline: 2px solid #D2D7DB; }
.seg-sm button { padding: 4px 10px; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; cursor: pointer; font-weight: 500; color: var(--ink); }
.chip span { color: var(--muted); font-size: 12px; font-weight: 500; }
.chip:hover { border-color: var(--line-hover); }
.chip.active { border-color: var(--accent-line); background: var(--accent-soft); }
.chip-static { cursor: default; height: auto; min-height: 30px; padding: 4px 10px; background: var(--bg); }
.chip-static button, .chip-static a { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; display: inline-flex; }
.tagchip { display: inline-flex; padding: 1px 8px; border-radius: 6px; background: var(--surface-disabled); color: var(--ink-2); font-size: 12px; font-weight: 500; border: 1px solid transparent; cursor: pointer; }
.tagchip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ---------- Calendario ---------- */
.week-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ws-item { display: flex; flex-direction: column; gap: 2px; }
.ws-bar { grid-column: 1 / -1; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; align-items: start; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 220px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.day.weekend { background: #1C1F23; }
.day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.day-name { display: block; font-weight: 700; font-size: 14px; text-transform: capitalize; letter-spacing: -0.2px; }
.day-date { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.day-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); padding-bottom: 10px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.day-meta span { display: inline-flex; align-items: center; gap: 4px; }
.day-body { display: flex; flex-direction: column; gap: 8px; }
.day .litem { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); align-items: flex-start; }
.day .litem + .litem { border-top: 1px solid var(--line-2); }
.day .litem:hover { border-color: var(--line); }
.day .litem.done { background: transparent; }
.day .litem .check { margin-top: 0; }
.day .litem-title { font-size: 13px; line-height: 18px; }
.day .litem-meta { font-size: 11px; }
.day .litem-meta .trunc { max-width: 100%; }
.day .litem-actions { grid-column: 2; justify-content: flex-start; margin: -4px 0 -4px -7px; }
.day .litem-actions .icon-btn { width: 28px; height: 28px; }
.view[data-view="calendario"] { max-width: 1520px; }
.slot { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; font-size: 13px; text-decoration: none; }
.slot div { display: flex; flex-direction: column; }
.slot strong { font-weight: 600; color: var(--ink); }
.slot span { color: var(--muted); font-size: 12px; font-weight: 500; }
.slot-review { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent-line); }
.slot-review:hover { background: rgba(68, 206, 142, .18); }
.slot-review.is-done { border-style: solid; }
.slot-rest { background: var(--bg); color: var(--muted); border: 1px solid var(--line-2); }
.slot-empty { border: 1px dashed var(--line); justify-content: center; text-align: center; }

.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.wk { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; transition: border-color .15s, background-color .15s; color: var(--ink); }
.wk:hover { border-color: var(--line-hover); }
.wk.now { border-color: var(--line); }
.wk.active { background: var(--logo-box); border-color: var(--accent); }
.wk.met .wk-n::after { content: ' ✓'; color: var(--accent); }
.wk-n { font-weight: 700; font-size: 13px; }
.wk-d, .wk-t { font-size: 12px; font-weight: 500; color: var(--muted); }
.wk-bar { width: 100%; }

/* ---------- Contenido del curso (como «Contenido» de la academia) ---------- */
.source { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 500; }
.source a { color: var(--accent); }
.editbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 8px; background: var(--accent-soft); border-color: var(--accent-line); }
.editbar strong { color: var(--ink); }
.modules { display: flex; flex-direction: column; gap: 12px; }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.module-toggle { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink); }
.module-toggle:hover { background: var(--surface-2); }
.module-idx { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--logo-box); border: 1px solid var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; flex: none; font-variant-numeric: tabular-nums; }
.module.st-done .module-idx { background: var(--success-bg); border-color: transparent; color: var(--success-tx); }
.module.st-in_progress .module-idx { color: var(--accent); border-color: var(--accent-line); }
.module-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.module-title { font-weight: 600; font-size: 14px; line-height: 20px; color: var(--ink); }
.module-meta { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.module-right { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.module-body { border-top: 1px solid var(--line-2); padding: 0 16px; }
.medit { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px 4px; background: var(--bg); border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.add-lesson { margin: 12px 0; }

.lesson { transition: background-color .15s; }
.lesson + .lesson { border-top: 1px solid var(--line-2); }
.lesson-main { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.lesson-title { flex: 1; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer; padding: 2px 0; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.lesson-title:hover .t { color: #fff; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.lesson-title .t { font-size: 14px; font-weight: 500; line-height: 20px; }
.lesson.done .lesson-title .t { color: var(--muted); }
.lesson-sub { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.lesson-sub span { display: inline-flex; align-items: center; gap: 3px; }
.lesson-actions { display: flex; align-items: center; gap: 4px; }
.status-select { width: auto; height: 28px; padding: 0 28px 0 10px; font-size: 12px; font-weight: 500; border-radius: 6px; border-color: transparent; background-position: right 9px center; }
.status-select:hover { border-color: transparent; }
.status-select.st-pending { background-color: var(--surface-disabled); color: var(--ink-2); }
.status-select.st-in_progress { background-color: var(--info-bg); color: var(--info-tx); }
.status-select.st-done { background-color: var(--success-bg); color: var(--success-tx); }
.lesson-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 0 16px 36px; }
.lesson-detail .field { margin: 0; }
.lesson-detail-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ledit { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 0 0 14px 36px; }
.ledit .field { margin: 0; }
.w-dur { width: 110px; }
.w-mod { width: 200px; }
.ledit-actions { display: flex; gap: 6px; padding-bottom: 2px; }

/* ---------- Repaso ---------- */
.done-toggle { display: flex; align-items: center; gap: 14px; cursor: pointer; position: relative; padding: 18px 24px; }
.done-toggle input { position: absolute; opacity: 0; }
.done-toggle .box { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--faint); display: grid; place-items: center; color: transparent; flex: none; transition: all .15s; }
.done-toggle > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.done-toggle.is-done { border-color: var(--accent-line); background: linear-gradient(90deg, var(--accent-soft), var(--surface) 70%); }
.done-toggle input:checked + .box { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.done-toggle input:focus-visible + .box { outline: 2px solid #D2D7DB; outline-offset: 2px; }
.review-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.review-form { display: flex; flex-direction: column; gap: 12px; }
.review-form .card { padding: 18px 20px; }
.review-form .field { margin: 0; }
.review-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--header) + 16px); }
.review-side .card { padding: 20px; }
.mini-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.mini-list li { display: flex; gap: 8px; align-items: flex-start; }
.mini-list li .ic { margin-top: 2px; }
.mini-list strong { color: var(--ink); font-weight: 600; }
.mini-list a { color: var(--ink); }
.hist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hist button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink); }
.hist button:hover { background: var(--surface-2); }
.hist button.active { background: var(--surface-active); }

/* ---------- Apuntes ---------- */
.notes { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.notes-list { padding: 14px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: calc(var(--header) + 16px); max-height: calc(100vh - var(--header) - 32px); }
.notes-list .seg { margin: 0; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--bg); }
.search input { border: 0 !important; padding: 8px 0; background: transparent; }
.search:focus-within { border-color: #D2D7DB; }
.note-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.note-item { width: 100%; text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.note-item:hover { background: var(--surface-2); }
.note-item.active { background: var(--surface-active); }
.note-item-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.note-item-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-body { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.note-item-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); align-items: center; }
.note-item-meta > span { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-editor { min-height: 520px; padding: 24px 28px; }
.editor { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.editor-title { border: 0 !important; box-shadow: none !important; padding: 4px 0 !important; font-size: 32px !important; line-height: 40px !important; font-weight: 700; letter-spacing: -0.8px; background: transparent !important; }
.editor-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.editor-meta .field { margin: 0; }
.editor-flags { padding: 4px 0 10px; border-bottom: 1px solid var(--line-2); }
.editor-body { border: 0 !important; box-shadow: none !important; padding: 8px 0 !important; min-height: 340px; flex: 1; font-size: 16px; line-height: 24px; color: var(--article); resize: none; background: transparent !important; }

/* ---------- Estadísticas ---------- */
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 20px; }
.kpi .value { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.6px; }
.kpi .value small { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi-new { box-shadow: inset 0 2px 0 var(--accent); }
.kpi-rev { box-shadow: inset 0 2px 0 var(--level-mid); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-new { background: var(--accent); }
.sw-rev { background: var(--level-mid); }
.sw-real { background: var(--ink-2); }
.sw-target { height: 2px; width: 14px; border-radius: 0; background: var(--ink); }
.sw-plan { height: 0; width: 16px; border-top: 2px dashed var(--muted); border-radius: 0; }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.chart { width: 100%; height: auto; display: block; min-width: 520px; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-weight: 500; font-family: var(--font); }
.chart .axis-strong { fill: var(--ink); font-weight: 700; }
.chart .b-new { fill: var(--accent); }
.chart .b-review { fill: var(--level-mid); }
.chart .b-target { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; opacity: .85; }
.chart .l-plan { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .l-real { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .l-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.chart .today-line { stroke: var(--line-hover); stroke-dasharray: 2 3; }
.heatmap { display: flex; gap: 4px; padding-bottom: 4px; }
.hm-col { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.hm-lab { font-size: 11px; font-weight: 500; color: var(--muted); height: 14px; }
.hm-d { font-size: 11px; font-weight: 500; color: var(--muted); height: 18px; line-height: 18px; width: 14px; text-align: center; }
.hm { display: block; width: 18px; height: 18px; border-radius: 4px; background: var(--line-2); }
.hm.h1 { background: #22503A; }
.hm.h2 { background: #2E8A5D; }
.hm.h3 { background: var(--accent); }
.hm.hr { background: var(--level-mid); }
.hm.future { opacity: .45; }
.hm.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend .hm { width: 10px; height: 10px; border-radius: 3px; }
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; color: var(--ink-2); font-weight: 500; }
.table td strong { color: var(--ink); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.current td { background: var(--surface-2); }
.table tr.future td { color: var(--faint); }
.sessions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.sessions li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; color: var(--ink-2); }
.sessions li strong { color: var(--ink); }
.sessions li:last-child { border-bottom: 0; }

/* ---------- Sincronización ---------- */
.save-status.warn { color: var(--warn-tx); }
.save-status.ok .ic { color: var(--accent); }
.sync-card { border-color: var(--accent-line); background: linear-gradient(180deg, rgba(68, 206, 142, .06), var(--surface) 60%); }
.sync-card .card-head h3 .ic { color: var(--accent); }
.sync-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.sync-step { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); }
.sync-step strong { color: var(--ink); }
.sync-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--logo-box); border: 1px solid var(--accent-line); color: var(--accent); font-size: 12px; font-weight: 700; flex: none; }
.sync-code { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 12px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.code-big { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 18px; letter-spacing: .06em; color: var(--accent); background: none; padding: 0; user-select: all; word-break: break-all; }
.code-input { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 16px !important; letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 640px) { .sync-steps { grid-template-columns: 1fr; } .code-big { font-size: 13.5px; letter-spacing: .01em; white-space: nowrap; word-break: normal; } }

/* ---------- Ajustes ---------- */
.saved-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--success-tx); background: var(--success-bg); padding: 2px 8px; border-radius: 6px; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 10px; }
.file-btn { position: relative; }
.backups { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; max-height: 280px; overflow-y: auto; }
.backups li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
.backups li + li { border-top: 1px solid var(--line-2); }
.backups li.muted { padding: 14px; }
.backups li > div { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.danger-zone { border-color: #5A3A40; }

/* ---------- Ventanas emergentes ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.in { opacity: 1; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.98); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.modal-wide { max-width: 680px; }
.modal-backdrop.in .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 24px 12px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: -0.4px; }
.modal-head p { margin-top: 2px; }
.modal-body { padding: 16px 24px; }
.modal-body p { line-height: 22px; color: var(--ink-2); }
.modal-body p strong { color: var(--ink); }
.modal-body.center { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 24px 20px; flex-wrap: wrap; border-top: 1px solid var(--line-2); }
.modal-foot > .btn:first-child:last-child { margin-left: auto; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

/* Temporizador */
.ring-wrap { position: relative; width: 220px; height: 220px; margin: 6px auto; }
.ring { display: block; }
.ring-bg { fill: none; stroke: var(--line-2); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 8px rgba(68, 206, 142, .35)); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring-time { font-size: 44px; line-height: 52px; font-weight: 700; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; }
.timer-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
.timer-pill[hidden] { display: none; }
.timer-pill.paused { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-tx); }
.timer-pill-label { font-weight: 500; }

/* Avisos */
#toast-root { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: all .22s; }
.toast.in { opacity: 1; transform: none; }
.toast-ok .ic { color: var(--brand); }
.toast-error { background: var(--danger-bg); color: var(--danger-tx); border: 1px solid #6A434A; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-grid { grid-template-columns: 1fr; }
  .review-side { position: static; }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; --header: 56px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; padding-top: env(safe-area-inset-top); height: calc(var(--header) + env(safe-area-inset-top)); }
  .main { padding-top: calc(var(--header) + env(safe-area-inset-top)); }
  .brand-sub { display: none; }
  .brand-name { font-size: 18px; }
  .brand-mark { width: 32px; height: 32px; }
  .only-mobile { display: inline-flex !important; }
  .only-desktop { display: none !important; }
  .view { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--bg-shell); border-top: 1px solid var(--line-shell);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav .nav-item { flex: 1 1 0; min-width: 0; height: auto; flex-direction: column; gap: 3px; padding: 6px 0; font-size: 10px; line-height: 12px; letter-spacing: -0.01em; white-space: nowrap; font-weight: 500; background: none !important; color: var(--muted); border-radius: 8px; }
  .bottomnav .nav-item .ic { color: var(--muted); }
  .bottomnav .nav-item.active { color: #fff; }
  .bottomnav .nav-item.active .ic { color: var(--accent); }
  .bottomnav .badge { position: absolute; top: 2px; right: 50%; margin-right: -20px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .two-col { grid-template-columns: 1fr; }
  .notes { grid-template-columns: 1fr; }
  .notes.has-note .notes-list { display: none; }
  .notes:not(.has-note) .notes-editor { display: none; }
  .notes-list { position: static; max-height: none; }
  .notes-editor { padding: 18px; min-height: 60vh; }
  .editor-meta { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .card { padding: 18px; }
  .hero { padding: 22px; }
  .hero-top { flex-direction: column; gap: 8px; }
  .hero-pct { text-align: left; display: flex; align-items: baseline; gap: 2px; }
  .hero-pct .small { margin: 0 0 0 8px; }
  .hero-pct .num { font-size: 48px; }
  .hero-title { font-size: 24px; line-height: 32px; letter-spacing: -0.6px; }
  .hero-stats { grid-template-columns: 1fr; gap: 10px; }
  .hero-stats > div { flex-direction: row; justify-content: space-between; align-items: baseline; }
  .hero-stats .value { font-size: 16px; text-align: right; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats-grid .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: 16px; }
  .stat-value { font-size: 20px; }
  .page-head { align-items: flex-start; }
  .page-head > .btn-lg { width: 100%; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day .litem { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .day .litem-actions { grid-column: 3; grid-row: 1; margin: 0; }
  .kpis, .kpis-3 { grid-template-columns: 1fr 1fr; }
  .kpis-3 .kpi:first-child { grid-column: 1 / -1; }
  .litem { padding: 12px; gap: 12px; }
  .lesson-main { flex-wrap: wrap; gap: 10px; }
  .lesson-title { flex-basis: calc(100% - 40px); }
  .lesson-actions { width: 100%; justify-content: flex-end; padding-left: 30px; }
  .lesson-detail { grid-template-columns: 1fr; padding: 0 0 14px; }
  .ledit { padding: 0 0 14px; }
  .module-body { padding: 0 12px; }
  .w-dur, .w-mod { width: 100%; }
  .ledit .field.grow { flex-basis: 100%; }
  .module-toggle { padding: 14px 12px; gap: 10px; }
  .module-right .pill { display: none; }
  .trunc { max-width: 150px; }
  .alert-actions { width: 100%; }
  .alert-actions .btn { flex: 1; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; border-bottom: 0; }
  .modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .modal-foot .row { width: 100%; }
  .modal-foot .btn, .modal-foot .row .btn { flex: 1; }
  .save-status.top { display: none; }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
