/* ============================================================
   Dojo Central — Sistema de Gestión para Academia de Artes Marciales
   ============================================================ */

/* ---------- Tokens: tema claro (por defecto) ---------- */
:root {
  color-scheme: light;
  --page-plane: #f9f9f7;
  --surface-1: #fcfcfb;
  --surface-2: #f3f2ee;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid-line: #e1e0d9;
  --axis-line: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);

  --series-1: #2a78d6; /* azul */
  --series-2: #eb6834; /* naranja */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* amarillo */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* verde */
  --series-7: #4a3aa7; /* violeta */
  --series-8: #e34948; /* rojo */

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --delta-good: #006300;

  --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.06), 0 1px 1px rgba(11, 11, 11, 0.04);
  --shadow-md: 0 4px 16px rgba(11, 11, 11, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page-plane: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232320;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid-line: #2c2c2a;
    --axis-line: #383835;
    --border: rgba(255, 255, 255, 0.1);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;

    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-serious: #ec835a;
    --status-critical: #d03b3b;
    --delta-good: #0ca30c;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page-plane: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232320;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid-line: #2c2c2a;
  --axis-line: #383835;
  --border: rgba(255, 255, 255, 0.1);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;

  --delta-good: #0ca30c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ---------- Sidebar: identidad fija del dojo (no cambia con el tema) ---------- */
:root {
  --dojo-black: #15110f;
  --dojo-black-2: #1e1917;
  --dojo-red: #b5302f;
  --dojo-red-bright: #e0453f;
  --dojo-text: #efe9e4;
  --dojo-text-muted: #a69c94;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

.app-shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  background: var(--dojo-black);
  color: var(--dojo-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden; /* el scroll vive adentro, en .sidebar-nav */
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 14px 22px;
  flex: none;
}
.sidebar-nav {
  flex: 1;
  min-height: 0; /* deja que el flex child se achique y scrollee en vez de desbordar */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--dojo-red) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--dojo-red); border-radius: 999px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--dojo-red-bright); }
.sidebar-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--dojo-red-bright), var(--dojo-red));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex: none;
}
.sidebar-brand .brand-name {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.2;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--dojo-text-muted);
}

.nav-group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dojo-text-muted);
  padding: 14px 12px 6px;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: block; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--dojo-text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: left;
  border-top: none; border-right: none; border-bottom: none;
}
.nav-link .nav-icon { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav-link:hover { background: var(--dojo-black-2); color: var(--dojo-text); }
.nav-link.active {
  background: var(--dojo-black-2);
  color: #fff;
  border-left-color: var(--dojo-red-bright);
}
.nav-parent { justify-content: space-between; }
.nav-chevron { width: 14px; height: 14px; flex: none; transition: transform 0.15s ease; color: var(--dojo-text-muted); }
.nav-parent[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }
.nav-sublist { list-style: none; margin: 2px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-sublist[hidden] { display: none; }
.nav-sublink { padding-left: 30px; font-size: 12px; position: relative; }
.nav-sublink .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dojo-text-muted); flex: none; margin-left: 1px; }
.nav-sublink.active .dot { background: var(--dojo-red-bright); }

.sidebar-footer {
  flex: none;
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
}
.sidebar-user:hover { background: var(--dojo-black-2); }
.avatar-chip {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--dojo-red);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex: none;
}
.sidebar-user .who { font-size: 11.5px; }
.sidebar-user .who .name { font-weight: 600; color: #fff; }
.sidebar-user .who .role { color: var(--dojo-text-muted); }

/* ============================================================
   Topbar + main
   ============================================================ */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-primary);
  padding: 6px;
}
.topbar-title { font-size: 17px; font-weight: 700; margin: 0; }
.topbar-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.topbar-spacer { flex: 1; }
.search-box {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  width: 260px;
  color: var(--text-muted);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; width: 340px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); max-height: 360px; overflow-y: auto; z-index: 60;
}
.search-results .sr-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 10px 14px 4px; font-weight: 700;
}
.search-results .sr-item {
  padding: 9px 14px; font-size: 12px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 10px; color: var(--text-primary);
}
.search-results .sr-item .sr-sub { color: var(--text-muted); font-size: 11px; }
.search-results .sr-item:hover { background: var(--surface-2); }
.search-results .sr-empty { padding: 16px; color: var(--text-muted); font-size: 12px; text-align: center; }
.search-box input {
  border: none; background: none; outline: none; width: 100%;
  font-size: 12.5px; color: var(--text-primary);
}
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.view { display: none; padding: 24px 28px 48px; }
.view.active { display: block; }

.view-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.view-header h2 { margin: 0 0 4px; font-size: 18px; }
.view-header p { margin: 0; color: var(--text-muted); font-size: 12.5px; }

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--dojo-red); color: #fff; }
.btn-primary:hover { background: var(--dojo-red-bright); }
.btn-ghost { background: var(--surface-1); color: var(--text-primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.chip-btn {
  font-size: 11px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-secondary);
  cursor: pointer;
}
.chip-btn:hover { background: var(--surface-2); }
.chip-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chip-btn:disabled:hover { background: var(--surface-1); }

.icon-mini-btn {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex: none;
}
.icon-mini-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.icon-mini-btn.danger:hover { color: var(--status-critical); border-color: var(--status-critical); }
.icon-mini-btn svg { width: 14px; height: 14px; }
.card-top-actions { display: flex; gap: 6px; }

/* ============================================================
   Tarjetas / Grid de KPIs
   ============================================================ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0; /* evita que una tabla ancha infle la columna del grid */
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 18px 0;
}
.card-header h3 { margin: 0; font-size: 13px; font-weight: 700; }
.card-header .card-actions { display: flex; gap: 8px; }
.card-body { padding: 14px 18px 18px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi-tile .kpi-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.kpi-tile .kpi-value { font-size: 22px; font-weight: 700; margin-top: 6px; }
.kpi-tile .kpi-delta { font-size: 11px; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--delta-good); }
.kpi-delta.down { color: var(--status-critical); }
.kpi-delta .vs { color: var(--text-muted); font-weight: 500; }

.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.charts-grid-3 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.dash-lower {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   Gráficos SVG
   ============================================================ */
.chart-svg-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.grid-line { stroke: var(--grid-line); stroke-width: 1; }
.axis-label { fill: var(--text-muted); font-size: 10px; }
.data-label { fill: var(--text-primary); font-size: 11px; font-weight: 700; }
.area-fill { opacity: 0.1; }
.line-path { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.end-marker { stroke: var(--surface-1); stroke-width: 2; }
.crosshair { stroke: var(--axis-line); stroke-width: 1; }
.bar-mark { transition: opacity 0.1s ease; }
.bar-mark.bar-hover { opacity: 0.8; }
.belt-inline-label { font-size: 11px; font-weight: 700; pointer-events: none; }

.sparkline-svg { width: 100%; height: 34px; display: block; overflow: visible; }
.kpi-tile .kpi-sparkline { margin-top: 10px; }

.heatmap-grid { display: grid; gap: 4px; align-items: stretch; }
.heatmap-corner { }
.heatmap-colhead {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); text-align: center; align-self: end; padding-bottom: 4px;
}
.heatmap-rowhead {
  font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; font-weight: 600;
}
.heatmap-cell {
  min-height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: default;
}
.heatmap-cell.empty { background: var(--surface-2); color: var(--text-muted); font-weight: 500; font-size: 13px; }
.heatmap-scale-legend { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 11px; color: var(--text-muted); }
.heatmap-scale-bar { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(to right, rgb(205, 226, 251), rgb(13, 54, 107)); }

/* Calendario de asistencia (Asistencia): grilla tipo hábito, filas = alumnos,
   columnas = semanas, celda = asistió / faltó / sin clase esa semana. */
.att-cal-grid { display: grid; gap: 4px 6px; align-items: center; overflow-x: auto; }
.att-cal-colhead {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); text-align: center; padding-bottom: 6px; white-space: nowrap;
}
.att-cal-rowhead {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  color: var(--text-primary); padding: 5px 10px 5px 0; white-space: nowrap;
}
.att-cal-cell { display: flex; align-items: center; justify-content: center; padding: 3px 0; }
.att-cal-badge {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.att-cal-badge.present { background: color-mix(in srgb, var(--status-good) 16%, transparent); color: var(--status-good); }
.att-cal-badge.absent { background: color-mix(in srgb, var(--status-critical) 16%, transparent); color: var(--status-critical); }
.att-cal-badge.none { color: var(--text-muted); font-size: 13px; font-weight: 700; }
.att-cal-legend { display: flex; gap: 18px; margin-top: 16px; font-size: 11.5px; color: var(--text-muted); align-items: center; flex-wrap: wrap; }
.att-cal-legend-item { display: flex; align-items: center; gap: 6px; }
.att-cal-empty { color: var(--text-muted); font-size: 12px; padding: 10px 0; }

.belt-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  margin-top: 14px;
}
.belt-legend-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-secondary); }
.belt-swatch { width: 11px; height: 11px; border-radius: 3px; border: 1px solid transparent; flex: none; }

.chart-tooltip {
  position: fixed;
  z-index: 200;
  display: none;
  background: var(--dojo-black);
  color: #fff;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  max-width: 220px;
}

.chart-table-wrap { overflow-x: auto; }
.chart-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.chart-table th, .chart-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.chart-table th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.chart-table td { font-variant-numeric: tabular-nums; }

/* ============================================================
   Tablas de datos (alumnos, pagos)
   ============================================================ */
.table-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 14px;
}
.select-input, .text-input {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 12px;
}
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-1); }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted); font-weight: 600;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface-1);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12.5px; vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-person { display: flex; align-items: center; gap: 10px; }
.row-person .name { font-weight: 600; }
.row-person .sub { font-size: 11px; color: var(--text-muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex: none;
}
.tnum { font-variant-numeric: tabular-nums; }
.product-thumb { width: 38px; height: 38px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; overflow: hidden; background: var(--surface-2); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb svg { width: 18px; height: 18px; }

.belt-dot { display: inline-flex; align-items: center; gap: 7px; }
.belt-dot span.dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid transparent; flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge svg { width: 12px; height: 12px; flex: none; }
.badge-good { background: color-mix(in srgb, var(--status-good) 14%, transparent); color: var(--status-good); }
.badge-warning { background: color-mix(in srgb, var(--status-warning) 20%, transparent); color: #946200; }
.badge-critical { background: color-mix(in srgb, var(--status-critical) 14%, transparent); color: var(--status-critical); }
.badge-neutral { background: var(--surface-2); color: var(--text-secondary); }

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .badge-warning { color: var(--status-warning); }
}
:root[data-theme="dark"] .badge-warning { color: var(--status-warning); }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 11.5px; color: var(--text-muted); }

/* ============================================================
   Horario semanal
   ============================================================ */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.schedule-day { min-width: 0; }
.schedule-day h4 {
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); text-align: center;
}
.class-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--surface-1);
  border-left: 3px solid var(--card-accent, var(--series-1));
}
.class-card .time { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.class-card .program { font-weight: 700; font-size: 12px; margin: 3px 0 2px; }
.class-card .meta { font-size: 11px; color: var(--text-secondary); }
.class-card .capacity-track {
  height: 5px; border-radius: 3px; background: var(--surface-2); margin-top: 8px; overflow: hidden;
}
.class-card .capacity-fill { height: 100%; border-radius: 3px; background: var(--card-accent, var(--series-1)); }
.class-card .capacity-text { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   Instructores
   ============================================================ */
.instructor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.instructor-card { padding: 18px; }
.instructor-top { display: flex; align-items: center; gap: 12px; }
.instructor-top .avatar { width: 46px; height: 46px; font-size: 13.5px; }
.instructor-top .title { font-size: 11px; color: var(--text-muted); }
.instructor-top .name { font-weight: 700; font-size: 13.5px; }
.instructor-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tag {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-secondary);
}
.instructor-stats {
  display: flex; gap: 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.instructor-stats .stat b { display: block; font-size: 14px; }
.instructor-stats .stat span { font-size: 11px; color: var(--text-muted); }
.instructor-contact { margin-top: 12px; font-size: 11.5px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }

/* ============================================================
   Modal — ficha de alumno
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,11,11,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface-1);
  border-radius: var(--radius);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 22px; border-bottom: 1px solid var(--border);
}
.modal-header .avatar { width: 52px; height: 52px; font-size: 15px; }
.modal-student-id { display: flex; gap: 14px; }
.modal-student-id .name { font-size: 15px; font-weight: 700; }
.modal-student-id .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-body { padding: 18px 22px 22px; }
.modal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.modal-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.modal-stat .label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.modal-stat .value { font-size: 13.5px; font-weight: 700; margin-top: 4px; }
.modal-section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin: 18px 0 10px; }
.progress-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; }

/* ============================================================
   Configuración
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-row input, .form-row select {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); font-size: 12.5px;
}
.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.plan-row .plan-name { font-weight: 600; font-size: 12.5px; }
.plan-row .plan-price { font-weight: 700; }

/* ============================================================
   Alertas / lista lateral
   ============================================================ */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item { display: flex; gap: 10px; align-items: flex-start; font-size: 11.5px; }
.alert-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.alert-item .title { font-weight: 600; }
.alert-item .meta { color: var(--text-muted); font-size: 11px; }

.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.activity-item:last-child { border-bottom: none; }
.activity-item .ico {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none;
}
.activity-item .when { color: var(--text-muted); font-size: 11px; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-container {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  background: var(--dojo-black); color: #fff;
  padding: 12px 16px; border-radius: 10px; font-size: 12px;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 320px;
  animation: toast-in 0.18s ease;
  border-left: 3px solid var(--status-good);
}
.toast.toast-error { border-left-color: var(--status-critical); }
.toast .toast-ico { color: var(--status-good); flex: none; display: flex; }
.toast.toast-error .toast-ico { color: var(--status-critical); }
.toast.toast-out { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   Check-in de asistencia
   ============================================================ */
.checkin-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; }
.checkin-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.checkin-card-head .program { font-weight: 700; font-size: 12.5px; }
.checkin-card-head .meta { font-size: 11px; color: var(--text-muted); }
.checkin-count { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); }
.checkin-list { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; }
.checkin-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.checkin-row:hover { background: var(--surface-2); }
.checkin-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--dojo-red); flex: none; }
.checkin-row.present { color: var(--text-primary); }
.checkin-row:not(.present) { color: var(--text-muted); }

/* ============================================================
   Recepción — semáforo de ingreso
   ============================================================ */
.semaforo-panel {
  border-radius: var(--radius); padding: 28px; text-align: center; color: #fff;
  animation: semaforo-in 0.2s ease;
}
.semaforo-panel.verde { background: linear-gradient(160deg, #0ca30c, #087a08); }
.semaforo-panel.amarillo { background: linear-gradient(160deg, #e0a500, #a87900); }
.semaforo-panel.rojo { background: linear-gradient(160deg, #d03b3b, #a12424); }
.semaforo-panel .sem-avatar {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700;
  background: rgba(255, 255, 255, 0.22); border: 2px solid rgba(255, 255, 255, 0.5); overflow: hidden;
}
.semaforo-panel .sem-avatar img { width: 100%; height: 100%; object-fit: cover; }
.semaforo-panel .sem-name { font-size: 17px; font-weight: 700; }
.semaforo-panel .sem-sub { font-size: 12px; opacity: 0.9; margin-top: 2px; }
.semaforo-panel .sem-status { font-size: 13.5px; font-weight: 700; margin-top: 14px; text-transform: uppercase; letter-spacing: 0.03em; }
.semaforo-panel .sem-detail { font-size: 11.5px; opacity: 0.9; margin-top: 4px; }
@keyframes semaforo-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

/* ============================================================
   Foto de alumno (upload + preview)
   ============================================================ */
.photo-upload { display: flex; align-items: center; gap: 14px; }
.photo-upload .photo-preview {
  width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none;
  border: 1px solid var(--border); color: var(--text-muted);
}
.photo-upload .photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   Comprobante simulado (SUNAT)
   ============================================================ */
.receipt-disclaimer {
  background: color-mix(in srgb, var(--status-warning) 18%, transparent);
  color: #946200; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 11px; font-weight: 600;
  margin-bottom: 16px; display: flex; gap: 8px; align-items: center;
}
:root[data-theme="dark"] .receipt-disclaimer { color: var(--status-warning); }
.receipt-doc { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 18px; font-size: 12px; }
.receipt-doc .receipt-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.receipt-doc .receipt-num { font-weight: 700; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; text-align: center; }
.receipt-doc .receipt-row { display: flex; justify-content: space-between; padding: 4px 0; }
.receipt-doc .receipt-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }

/* ============================================================
   Caja
   ============================================================ */
.shift-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }

/* ============================================================
   Notificaciones (cola simulada)
   ============================================================ */
.notif-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px;
}
.notif-item .notif-title { font-weight: 600; font-size: 12.5px; }
.notif-item .notif-body { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; max-width: 520px; }
.notif-item .notif-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ============================================================
   Sub-tabs (p. ej. Planes y Grados)
   ============================================================ */
.subtab-bar { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.subtab-btn {
  padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px;
}
.subtab-btn:hover { color: var(--text-primary); }
.subtab-btn.active { color: var(--dojo-red); border-bottom-color: var(--dojo-red); }
.subtab-panel { display: none; }
.subtab-panel.active { display: block; }

.program-tab-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.program-tab-btn {
  padding: 7px 14px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); cursor: pointer;
}
.program-tab-btn.active { background: var(--dojo-red); border-color: var(--dojo-red); color: #fff; }

/* ============================================================
   Planes de membresía (tarjetas)
   ============================================================ */
.plan-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface-1); border-top: 3px solid var(--plan-color, var(--series-1)); }
.plan-card.inactive { opacity: 0.55; }
.plan-card .plan-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.plan-card .plan-card-name { font-weight: 700; font-size: 13.5px; }
.plan-card .plan-card-price { font-size: 19px; font-weight: 700; margin-top: 6px; }
.plan-card .plan-card-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 8px; min-height: 32px; }
.plan-card .plan-card-stats { display: flex; gap: 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.plan-card .plan-card-stats .stat b { display: block; font-size: 13.5px; }
.plan-card .plan-card-stats .stat span { font-size: 10.5px; color: var(--text-muted); }
.plan-card .plan-card-actions { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }

/* ============================================================
   Escalas de graduación (niveles)
   ============================================================ */
.level-row { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.level-row:last-child { border-bottom: none; }
.level-row .level-rank { width: 20px; color: var(--text-muted); font-size: 11px; font-weight: 700; flex: none; }
.level-row .level-swatch { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid transparent; }
.level-row .level-name { font-weight: 600; font-size: 12.5px; flex: 1; min-width: 0; }
.level-row .level-meta { font-size: 11px; color: var(--text-muted); width: 190px; flex: none; }
.level-row .level-count { font-size: 11px; color: var(--text-muted); width: 90px; flex: none; }
@media (max-width: 700px) {
  .level-row { flex-wrap: wrap; }
  .level-row .level-meta, .level-row .level-count { width: auto; }
}

.cat-dot-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ============================================================
   Ventas — POS (Realizar venta)
   ============================================================ */
.pos-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 14px; }
.pos-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit;
}
.pos-card:hover { border-color: var(--dojo-red); box-shadow: var(--shadow-sm); }
.pos-card:disabled { opacity: 0.45; cursor: not-allowed; }
.pos-card .pos-card-img { width: 100%; aspect-ratio: 1.5; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-muted); overflow: hidden; }
.pos-card .pos-card-img img { width: 100%; height: 100%; object-fit: cover; }
.pos-card .pos-card-body { padding: 8px 10px 10px; }
.pos-card .pos-card-name { font-weight: 600; font-size: 11px; line-height: 1.3; min-height: 2.4em; }
.pos-card .pos-card-price { font-weight: 700; font-size: 12.5px; margin-top: 3px; }
.pos-card .pos-card-stock { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.pos-cart { position: sticky; top: 14px; }
.pos-cart .card-header h3 { font-size: 12.5px; }
.pos-cart .card-body { padding: 12px 16px 16px; }
.pos-cart .form-row { margin-bottom: 12px; }
.pos-cart .form-row label { font-size: 10.5px; }
.pos-cart-section {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  padding: 8px; margin-bottom: 12px;
}
.pos-cart-items { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.pos-cart-empty { text-align: center; color: var(--text-muted); font-size: 11px; padding: 20px 8px; }
.pos-cart-row { display: flex; align-items: center; gap: 6px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 6px 6px 8px; }
.pos-cart-row-info { flex: 1; min-width: 0; }
.pos-cart-row .name { font-weight: 600; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-cart-row .price { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.pos-cart-row .price b { color: var(--text-secondary); font-weight: 600; }
.pos-cart-row .qty-controls { display: flex; align-items: center; gap: 3px; flex: none; }
.pos-cart-row .qty-controls button { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); cursor: pointer; font-size: 11px; line-height: 1; }
.pos-cart-row .qty-controls span { width: 16px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.pos-cart-remove {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid transparent; background: none;
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none;
}
.pos-cart-remove svg { width: 13px; height: 13px; }
.pos-cart-remove:hover { background: color-mix(in srgb, var(--status-critical) 12%, transparent); color: var(--status-critical); border-color: color-mix(in srgb, var(--status-critical) 30%, transparent); }
.pos-total-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px;
}
.pos-total-row span:last-child { font-size: 16px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pos-cart-actions { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }

/* ============================================================
   Ingreso de stock — carrito de entrada
   ============================================================ */
/* Modal de entrada/salida: un poco más ancho y con letra algo más chica
   que el resto de la app, para que quepa cómodo el carrito. */
.movement-modal .modal-student-id .name { font-size: 13.5px; }
.movement-modal .form-row label { font-size: 11px; }
.movement-modal .program-tab-bar { margin-bottom: 16px; }
.movement-modal .program-tab-btn { font-size: 11px; padding: 6px 12px; }

.cart-search-row { display: flex; gap: 10px; align-items: center; }
.cart-search-box {
  position: relative; flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; color: var(--text-muted);
}
.cart-search-box input { border: none; background: none; outline: none; width: 100%; font-size: 12px; color: var(--text-primary); }
.cart-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 1px dashed var(--border); border-radius: var(--radius); padding: 30px 20px;
  color: var(--text-muted); font-size: 11.5px; margin-top: 14px; text-align: center;
}
.cart-empty-state[hidden] { display: none; }

.cart-items-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cart-item-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.cart-item-row .cart-item-info { flex: 1; min-width: 0; }
.cart-item-row .cart-item-name { font-weight: 600; font-size: 12px; }
.cart-item-row .cart-item-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.cart-item-row .cart-field { display: flex; flex-direction: column; gap: 3px; flex: none; }
.cart-item-row .cart-field span { font-size: 9.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.cart-item-row input {
  width: 76px; padding: 6px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary); font-size: 12px; font-variant-numeric: tabular-nums;
}
.cart-item-row .icon-mini-btn { background: var(--surface-1); align-self: flex-end; }
.cart-item-row .icon-mini-btn.danger { color: var(--status-critical); }
.cart-summary {
  display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
  padding: 10px 14px; font-size: 11.5px; color: var(--text-secondary);
}
.cart-summary[hidden] { display: none; }
.cart-summary b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.movement-modal .form-row input, .movement-modal .form-row select { font-size: 12px; padding: 8px 11px; }

/* ============================================================
   Varios
   ============================================================ */
.badge-frozen { background: color-mix(in srgb, var(--series-4) 20%, transparent); color: #946200; }
:root[data-theme="dark"] .badge-frozen { color: var(--series-4); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1180px) {
  .instructor-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid, .dash-lower { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .schedule-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -260px; top: 0; width: 240px; z-index: 50;
    transition: left 0.2s ease; box-shadow: var(--shadow-md);
  }
  .sidebar.open { left: 0; }
  .hamburger { display: flex; }
  .search-box { display: none; }
  .instructor-grid { grid-template-columns: 1fr; }
  .schedule-grid { grid-template-columns: repeat(2, 1fr); }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .schedule-grid { grid-template-columns: 1fr; }
  .view { padding: 18px 14px 40px; }
  .topbar { padding: 12px 14px; }
}
