/* Consola del entrenador. Pensada para una pantalla ANCHA: la razón de existir de esta página es
   que un plan de 14 semanas se vea entero de una vez, que es justo lo que un teléfono no puede
   hacer. Densa a propósito, poco cromo, cero animación. */

:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1c232b;
  --muted: #5b6774;
  --line: #dfe4ea;
  --accent: #2a78d6;
  --accent-deep: #1c5cab;
  --past: #f0f2f5;
  --current: #e8f1fc;
  --draft: #fbfaf6;
  --danger: #b4432c;
  --warn: #a8730a;
  --ok: #2f7d4f;
  --shadow: 0 1px 3px rgba(20, 30, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d; --panel: #1c222a; --ink: #e6ebf1; --muted: #94a0ad; --line: #2b333d;
    --accent: #5aa0ee; --accent-deep: #7cb6f5; --past: #191e25; --current: #1b2836; --draft: #1e2029;
    --danger: #e2795f; --on-danger: #14181d; --warn: #d9a441; --ok: #6cc08c; --shadow: none;
  }
}

* { box-sizing: border-box; }

/* EL ATRIBUTO `hidden` MANDA SOBRE CUALQUIER `display` DE ESTA HOJA.
   Sin esto, `hidden` NO esconde nada a lo que una clase le dé un display: la regla de la hoja de
   usuario (`[hidden] { display: none }`) pierde por especificidad contra cualquier selector de
   clase. Aquí se rompían DOS cosas a la vez, y fue lo primero que Guille vio al abrirla:
     - `.login` (display:grid) seguía pintada DESPUÉS de entrar;
     - `.drawer` (display:flex) se veía ANTES de entrar y, con la ventana no muy ancha, se montaba
       encima del formulario de acceso, así que lo que se escribía podía acabar en los campos del
       editor en vez de en los del login (que quedaban vacíos: "credenciales incorrectas").
   Se arregla una vez y en global, no elemento a elemento, porque el siguiente panel que se añada
   con `hidden` tendría exactamente el mismo problema. */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
h1, h2, h3 { margin: 0; font-weight: 700; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent; padding: 8px 14px; }
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-deep); }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost:hover { border-color: var(--muted); }
button.danger { background: var(--danger); color: var(--on-danger, #fff); }
button.sm { padding: 4px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); font: inherit;
}
.error { color: var(--danger); }
.meta { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.req { color: var(--danger); font-weight: 700; text-transform: none; }

/* --- login --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; }
.login-sub { color: var(--muted); margin: 2px 0 20px; }
.login-card button { width: 100%; margin-top: 6px; }
.login-fine { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin-top: 16px; }

/* Aviso de modo demo: ancho completo, color de alarma y salida a un clic. */
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--warn); color: #fff; font-size: 13px;
}
.demo-exit { color: #fff; font-weight: 700; white-space: nowrap; }

/* --- estructura --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 800; }
.brand span { font-weight: 500; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 12.5px; }
/* Limpieza 09-10: sin columna de pupilos, el panel va a ancho completo. */
.layout { padding: 18px; }
.topbar-nav { display: flex; gap: 6px; margin-right: auto; margin-left: 18px; }
@media (max-width: 600px) { .topbar { flex-wrap: wrap; gap: 8px; } .topbar-nav { margin-left: 0; order: 3; } }

/* --- plan --- */
.plan { min-width: 0; }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 44px; text-align: center; color: var(--muted); }
.plan-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.plan-head h2 { font-size: 20px; }
.plan-head > div:first-child { flex: 1 1 240px; min-width: 0; } /* 9b review: the title block takes the free width, so on desktop the buttons stay on the right and only drop below when they do not fit */
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; max-width: 100%; } /* 9b: at 390 px the three buttons wrapped nowhere and pushed the PAGE to 875 px */

/* Cada semana es una FILA con siete columnas. El plan entero se lee de arriba abajo sin abrir
   nada: eso es lo que la app de móvil no puede dar. */
.weeks { display: flex; flex-direction: column; gap: 10px; }
.week { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.week-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.week-n { font-weight: 800; }
.week-dates { color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.tag.current { border-color: var(--accent); color: var(--accent); }
.tag.deload { border-color: var(--warn); color: var(--warn); }
.tag.draft { border-color: var(--line); color: var(--muted); }
.tag.amended { border-color: var(--ok); color: var(--ok); }
.tag.race { border-color: var(--danger); color: var(--danger); font-weight: 800; }
.week.race .days { background: color-mix(in srgb, var(--danger) 7%, var(--panel)); }
.week-metrics { margin-left: auto; color: var(--muted); font-size: 12px; }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { border-right: 1px solid var(--line); padding: 8px; min-height: 78px; }
.day:last-child { border-right: none; }
.day-name { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 5px; }
.week.past .days { background: var(--past); }
.week.current .days { background: var(--current); }
.week.draft .days { background: var(--draft); }

.sess { width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 5px 6px; margin-bottom: 4px; color: var(--ink); }
.sess:hover { border-color: var(--accent); }
.sess[disabled]:hover { border-color: transparent; }
.sess-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.sess-sub { font-size: 11px; color: var(--muted); }
.sess.done .sess-title::after { content: " ✓"; color: var(--ok); }
.sess.missed .sess-title::after { content: " ✕"; color: var(--danger); }
.rest { color: var(--muted); font-size: 11.5px; font-style: italic; }
/* El "+ añadir" de un día de descanso: visible sin gritar, para que no compita con las sesiones
   de verdad que hay alrededor. */
.sess.add { border: 1px dashed var(--line); color: var(--muted); }
/* Arrastre: la sesión que viaja se atenúa y el día que la recibe se marca. Sin señal de destino,
   soltar es adivinar. */
.sess[draggable="true"] { cursor: grab; }
.sess.arrastrando { opacity: .4; cursor: grabbing; }
.day.soltar-aqui { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); outline: 2px dashed var(--accent); outline-offset: -3px; }
.sess.add:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.draft-note { padding: 8px 12px; color: var(--muted); font-size: 12px; border-top: 1px dashed var(--line); }
.ctx { padding: 10px 12px 12px; border-top: 1px dashed var(--line); }
.ctx label { margin-bottom: 6px; }
.ctx-area { font-size: 13px; }
.ctx-previo { color: var(--ok); font-size: 12px; margin: 4px 0 6px; }
.ctx-pie { color: var(--muted); font-size: 11.5px; margin: 2px 0 8px; }

/* --- avisos --- */
.alarm { border-radius: 9px; padding: 8px 11px; margin-bottom: 8px; font-size: 13px; border: 1px solid; }
.alarm.high { border-color: var(--danger); color: var(--danger); }
.alarm.medium { border-color: var(--warn); color: var(--warn); }
.alarm.low { border-color: var(--line); color: var(--muted); }

/* --- editor lateral --- */
.drawer {
  position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh;
  background: var(--panel); border-left: 1px solid var(--line); z-index: 20;
  display: flex; flex-direction: column; box-shadow: -4px 0 22px rgba(0,0,0,.10);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 16px; overflow-y: auto; }
.drawer-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Talos A4: the toast never takes a click (pointer-events: none) and sits in the bottom-right corner, away from the centred editor and pop-over
   buttons and from the draft chip on the left (review A4 #5) */
.toast { position: fixed; right: 16px; bottom: 16px; max-width: min(420px, calc(100vw - 32px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 9px; z-index: 40; font-size: 13px; pointer-events: none; }

/* Backlog 4 residue 2: the console's own confirmation (dialogo.js) instead of window.confirm. Above the
   editor (30), the draft panel (35), the message panel and the toast (40); ink on panel in both themes. */
.cw-dialogo-fondo { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(10, 20, 30, .45); }
.cw-dialogo { width: min(420px, 100%); background: var(--panel); color: var(--ink); border: 1px solid var(--muted); border-radius: 12px; box-shadow: 0 10px 34px rgba(10, 20, 30, .35); padding: 18px 20px 16px; }
.cw-dialogo-texto { margin: 0 0 16px; font-size: 14px; line-height: 1.45; white-space: pre-line; }
.cw-dialogo-botones { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.cw-dialogo button { min-height: 32px; padding: 6px 16px; border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; }
.cw-dialogo .cw-dialogo-cancelar { background: var(--panel); color: var(--ink); border: 1px solid var(--muted); }
.cw-dialogo .cw-dialogo-aceptar { background: var(--ink); color: var(--panel); border: 1px solid var(--ink); }
.cw-dialogo button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* MOVER LA CARRERA. Panel plegado dentro de la cabecera del plan, no un modal: la decisión se toma
   mirando las semanas que hay debajo, así que taparlas sería quitarle al coach justo el contexto
   que necesita. */
.race-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  background: var(--panel);
}
.race-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.race-row label { font-size: 13px; color: var(--muted); }
.race-row input[type="date"] {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: inherit;
  font: inherit;
}

/* Panel de instrucciones para la IA al generar un plan nuevo (2026-09-06). */
.brief { margin: 10px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, transparent); }
.brief label { display: block; font-weight: 600; }
.brief .muted { font-weight: 400; color: var(--muted); }
.brief textarea { width: 100%; margin-top: 8px; font: inherit; line-height: 1.4; resize: vertical; }
.brief-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Panel de entrenadores (multicoach 08-09; F3a 25-09). Vive en el área ancha, no en la columna de
   300 px: Guille pidió verlo "más grande" porque los nombres no se leían. Letra de 15 px, una fila
   por pupilo, cabecera fija y SIN desplazamiento horizontal a 1280 px: las columnas se reparten el
   ancho (table-layout fixed) y los chips saltan de línea en vez de empujar la tabla. */
.admin-view { font-size: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.admin-view .meta { font-size: 13.5px; }
.admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.admin-head h2 { font-size: 20px; }
.admin-aviso { border: 1px solid var(--warn); color: var(--warn); border-radius: 9px; padding: 8px 12px; margin: 0 0 12px; }
.admin-coaches { margin-bottom: 14px; }
.admin-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-tools input[type=search] { flex: 1 1 280px; max-width: 420px; margin: 0; font-size: 15px; }
.admin-check { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--ink); font-weight: 500; }
.admin-check input { width: 16px; height: 16px; margin: 0; }
.admin-view table { width: 100%; border-collapse: collapse; }
.admin-view th, .admin-view td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.admin-view th, .admin-view td.num, .admin-view .tag { white-space: nowrap; overflow-wrap: normal; }
.admin-view table.coaches td:nth-child(n+2), .admin-view table.coaches th:nth-child(n+2) { width: 1%; }
.admin-view th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--panel); }
.admin-table thead th { position: sticky; top: 52px; z-index: 2; }
.admin-view table.coaches { width: auto; min-width: 60%; }
.admin-view td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.pupils-admin { table-layout: fixed; }
table.pupils-admin col.c-pupil { width: 32%; }
table.pupils-admin col.c-plan { width: 170px; }
table.pupils-admin col.c-since { width: 110px; }
table.pupils-admin col.c-add { width: 190px; }
.acc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-name { font-weight: 600; }
.acc-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
/* El desambiguador ("· 6666", "· mario.perez"): distinto por PESO y color, no solo por color. */
.tagid { color: var(--muted); font-weight: 400; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
button.xs { padding: 1px 7px; font-size: 12px; border-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
td.chips { display: table-cell; }
td.chips .chip { margin: 0 6px 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--current); font-size: 14px; }
.chip-x { background: transparent; border: none; padding: 0 6px; font-size: 16px; line-height: 1; color: var(--muted); border-radius: 999px; }
.chip-x:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
td.since { font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-view select { margin: 0; font-size: 14px; padding: 6px 8px; }
.label-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.label-edit input { flex: 1 1 160px; margin: 0; font-size: 15px; }
.label-edit .meta { flex-basis: 100%; }
.tag.warn { color: var(--warn); }

/* ---- PANEL DE PUPILOS (Coach Desk D, tramo 1) -------------------------------------------------
   Luz = forma + color + palabra: el ámbar y el verde no llegan a 3:1 contra el blanco del panel
   (WCAG 1.4.11), así que el color nunca va solo. Cuadrado = actuar, triángulo = vigilar,
   anillo = OK, anillo discontinuo = sin datos. */
.panel-home { display: flex; flex-direction: column; gap: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.panel-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.panel-alcance { margin-top: 8px; }
.fchip { font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.fchip.on { border-color: var(--accent); color: var(--accent-deep); background: var(--current); }
/* Tier del pupilo junto al nombre (vivía en la lista izquierda). Texto, no solo color. */
.tier { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.tier-coach { border-color: var(--accent); color: var(--accent-deep); }
.panel-table { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable th, .ptable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ptable th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--past); white-space: nowrap; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable td.n, .ptable th.n { text-align: right; }
.ptable .pname { background: transparent; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; border-bottom: 1px dashed var(--muted); }
.ptable .pname:hover, .ptable .pname:focus-visible { color: var(--accent-deep); outline: none; }
/* A1-cita: glifo de la cita del pupilo en "Por qué". Forma (chip con borde) además del color; texto
   --accent-deep sobre --panel: 6,6:1 en claro y 7,5:1 en oscuro; borde --accent 4,4:1 y 5,9:1. */
.ptable .cita { display: inline-block; min-width: 1.4em; padding: 0 5px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent-deep); font-weight: 700; line-height: 1.3; text-align: center; cursor: help; }
.ptable .pflags { margin: 4px 0 0; padding: 0; list-style: none; font-size: 0.9em; color: var(--muted); }
.ptable .pflags li + li { margin-top: 2px; }
.ptable .cita:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 1px; }
.light { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.light i { display: inline-block; width: 11px; height: 11px; flex: none; }
.light.red { color: var(--danger); } .light.red i { background: var(--danger); border-radius: 2px; }
.light.amber { color: var(--warn); }
.light.amber i { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--warn); }
.light.ok { color: var(--ok); } .light.ok i { border: 2px solid var(--ok); border-radius: 50%; }
.light.grey { color: var(--muted); } .light.grey i { border: 2px dashed var(--muted); border-radius: 50%; }
.spark { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; vertical-align: middle; }
.spark i { display: block; width: 6px; border-radius: 1px; }
.spark i.done { height: 14px; background: var(--accent); }
.spark i.extra { height: 8px; background: var(--accent); opacity: .5; }
.spark i.miss { height: 14px; border: 1px solid var(--muted); }
.spark i.none { height: 3px; background: var(--line); }
#panel-sweep.error { color: var(--danger); }

/* ---- CRONÓMETRO (Coach Desk D, tramo 1) ---- */
.timer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; }
.timer label { display: inline-flex; align-items: center; gap: 6px; }
.timer-show { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; min-width: 4ch; }
.timer-add input { width: 5em; }

/* ---- CHAT WEB (Coach Desk D) ---- */
.chat { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin: 8px 0; display: flex; flex-direction: column; max-height: 70vh; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.chat-context { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 8px 12px; background: var(--past); font-size: 13px; }
.chat-context > div { display: flex; flex-direction: column; gap: 2px; }
.chat-context .k { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.chat-aviso { margin: 8px 12px 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--warn); font-size: 13px; }
.chat-aviso.error { border-color: var(--danger); color: var(--danger); font-weight: 600; }
.chat-thread { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; overflow-y: auto; min-height: 120px; }
.chat-thread .msg { max-width: 80%; padding: 7px 10px; border-radius: 12px; background: var(--past); font-size: 14px; align-self: flex-start; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-thread .msg.me { align-self: flex-end; background: var(--current); }
.chat-thread .msg .t { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-composer textarea { flex: 1; font: inherit; }

/* Zona de peligro (borrar cuenta). Cerrada por defecto; el rojo lleva ademas borde y texto, no solo color. */
.danger-zone { margin: 28px 0 8px; border: 1px dashed var(--danger); border-radius: 10px; padding: 8px 14px; }
.danger-zone > summary { cursor: pointer; font-weight: 700; color: var(--danger); }
.danger-zone[open] > summary { margin-bottom: 8px; }
.dz-table { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
.dz-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dz-table td, .dz-table th { padding: 3px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.dz-table td.n, .dz-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.dz-table tr.zero td { color: var(--muted); }
.dz-table tr.total td { font-weight: 700; }
.dz-note { border: 1px solid var(--danger); border-radius: 8px; padding: 6px 10px; margin: 6px 0; font-size: 13px; }
.dz-actions { display: flex; gap: 8px; }

/* Plan por cuenta (vista Entrenadores). El nivel se distingue por TEXTO, peso y borde, no solo por color. */
.admin-view td.plan { min-width: 150px; white-space: normal; }
.plan-nivel { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.plan-nivel.plan-plan { border-color: var(--accent); color: var(--accent-deep); font-weight: 700; }
.plan-nivel.plan-coach { border: 2px solid var(--accent); color: var(--accent-deep); font-weight: 800; }
.plan-nivel.plan-nd { font-style: italic; }

/* --- BORRADOR DEL COACH (coach-borrador, 15-10) ---------------------------------------------
   Cada estado se distingue por TEXTO y FORMA además del color (WCAG 1.4.11): la insignia lleva
   palabra, el borde izquierdo de cada operación cambia de grosor/estilo según estado. */
.draft { border: 2px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin: 12px 0 16px; background: var(--panel); }
.draft h4 { margin: 12px 0 6px; font-size: 13px; }
.draft h5 { margin: 10px 0 4px; font-size: 12.5px; color: var(--muted); }
.draft-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.draft-bar.vacio { color: var(--muted); }
.draft-badge { background: var(--accent); color: #fff; padding: 3px 11px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.draft-stalebadge { color: var(--warn); font-weight: 600; font-size: 12.5px; }
.draft-health { margin: 10px 0 0; padding: 9px 12px; border: 2px solid var(--danger); border-radius: 9px; color: var(--ink); font-size: 13px; }
.draft-health ul { margin: 4px 0 0; padding-left: 18px; }
.draft-race { margin: 10px 0 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; }
.draft-race h4 { margin: 0 0 4px; }
.draft-race .race-line { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.draft-race .race-name { font-weight: 700; font-size: 15px; }
.draft-ai { margin-top: 12px; }
.draft-ai textarea { width: 100%; font: inherit; resize: vertical; }
.draft-ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.draft-ai-row .meta { flex: 1; min-width: 160px; }
button.xs { padding: 2px 7px; font-size: 12px; }
.draft-ai-result { margin-top: 8px; font-size: 12.5px; }
.draft-ai-result ol, .draft-ai-result ul { margin: 2px 0 6px; padding-left: 20px; }
.ops { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.op { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.op-linea { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.op-estado { font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em; }
.op-applied { border-left: 4px solid var(--ok); }
.op-applied .op-estado { color: var(--ok); }
.op-needs_confirmation { border-left: 4px dashed var(--warn); }
.op-needs_confirmation .op-estado { color: var(--warn); }
.op-refused { border-left: 6px solid var(--danger); }
.op-refused .op-estado { color: var(--danger); }
.op-dropped { border-left: 4px dotted var(--muted); color: var(--muted); }
.op-texto { color: var(--muted); margin-top: 2px; }
.op-cita { font-style: italic; }
.op-flags, .send-flags ul, .send-bloqueos ul { margin: 4px 0 0; padding-left: 18px; }
.op-flag { color: var(--warn); }
.op-regenera { margin-top: 4px; font-weight: 600; color: var(--warn); }
.op-botones { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.op-botones:empty { display: none; }
.draft-send { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); }
.send-bloqueos { margin-top: 8px; color: var(--danger); }
.draft-botones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; justify-content: flex-end; }
.draft-stale { margin-top: 12px; padding: 10px 12px; border: 2px solid var(--warn); border-radius: 9px; }
.stale-diff { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0 10px; }
.stale-diff th, .stale-diff td { text-align: left; padding: 3px 8px; border-bottom: 1px solid var(--line); }
.demo-banner #demo-draft-note { flex-basis: 100%; font-weight: 700; }

/* MONETIZACIÓN (16-10, solo admin). Reutiliza .admin-view; lo propio: tres totales, la etiqueta real/prueba
   y las filas de prueba, que se distinguen por COLOR Y FORMA (borde izquierdo discontinuo, etiqueta con borde
   discontinuo y la palabra), no solo por color. En móvil la tabla pasa a tarjetas (una cuenta por tarjeta). */
.money-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 4px 0 14px; }
.mtot { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--bg); }
.mtot-n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mtot-t { font-weight: 700; margin-top: 2px; }
.mtot.pago .mtot-n { color: var(--ok); }
.mtot.promo .mtot-n { color: var(--accent); }
.mtot-extra { grid-column: 1 / -1; margin: 0; }
.money-aviso { display: flex; flex-direction: column; gap: 4px; }
.money-view table.money { width: 100%; }
.money-view td.num { white-space: nowrap; }
.mname { font-weight: 700; }
.memail { font-size: 13.5px; overflow-wrap: anywhere; }
.money-view table.money td:first-child { min-width: 230px; }
.mkind { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--line); text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.mkind.k-real { border-color: var(--ok); color: var(--ok); }
.mkind.k-test, .mkind.k-probable_test { border: 1.5px dashed var(--warn); color: var(--warn); }
.mkind.k-promo { border-color: var(--accent); color: var(--accent); }
.mkind.k-unverified { border-style: dotted; color: var(--muted); }
.mkind.k-free { color: var(--muted); }
.mreason { display: block; font-size: 12px; color: var(--warn); margin-top: 3px; }
tr.es-prueba > td { background: color-mix(in srgb, var(--warn) 7%, transparent); }
tr.mrow.es-prueba > td:first-child { box-shadow: inset 4px 0 0 0 var(--warn); }
.macc { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; margin-bottom: 4px; }
.macc.o-promo > span:first-child { color: var(--accent); }
.macc code, .mdet code { font-size: 12px; color: var(--muted); }
tr.mdetail > td { background: var(--bg); }
.mdet h4 { margin: 4px 0 6px; font-size: 14px; }
.mdet h5 { margin: 10px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.money-view table.mhist { width: 100%; font-size: 13.5px; }
.money-view table.mhist th { font-size: 11.5px; }
.mrc { margin-top: 10px; }
.mrc > button { margin-bottom: 6px; }
@media (max-width: 760px) {
  .money-totals { grid-template-columns: 1fr; gap: 8px; }
  .money-view { padding: 12px; }
  .money-view .admin-head { flex-direction: column; }
  .money-view table.money thead { display: none; }
  .money-view table.money, .money-view table.money tbody, .money-view table.money tr, .money-view table.money td { display: block; width: 100%; }
  .money-view table.money tr.mrow { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 6px 4px; }
  .money-view table.money td { border-bottom: none; padding: 4px 10px; }
  .money-view table.money td[data-col]::before { content: attr(data-col); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
  .money-view table.money td.num { text-align: left; }
  .money-view table.mhist { display: block; overflow-x: auto; }
}

/* Pestañas de la ficha y pestaña Datos (minimos-pestana). Solo lectura. */
.pestanas { display: flex; gap: 4px; margin: 8px 0; border-bottom: 1px solid var(--line); }
.pestana { background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 6px 14px; color: var(--muted); font: inherit; cursor: pointer; }
.pestana[aria-selected="true"] { background: var(--panel); border-color: var(--line); color: var(--ink); font-weight: 600; margin-bottom: -1px; }
.datos { max-width: 960px; }
.datos h2 { margin: 6px 0; }
.datos-bloque { margin: 14px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.datos-bloque h3 { margin: 0 0 2px; }
.datos-grupo { margin: 12px 0 4px; }
.datos-grupo h4 { margin: 0 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.datos-dl { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 3px 14px; margin: 0; font-size: 13px; }
.datos-dl dt { color: var(--muted); }
.datos-dl dd { margin: 0; overflow-wrap: anywhere; }
.datos-lista { margin: 4px 0; padding-left: 18px; font-size: 13px; }
.datos-lista.pflags { list-style: disc; color: var(--ink); }
.datos-nota { font-size: 12px; margin: 4px 0; }
.datos-semana { border-collapse: collapse; font-size: 13px; margin: 6px 0; width: 100%; }
.datos-semana caption { text-align: left; color: var(--muted); padding-bottom: 3px; }
.datos-semana th, .datos-semana td { text-align: left; padding: 3px 10px 3px 0; border-top: 1px solid var(--line); vertical-align: top; }
.datos-semana tr.bloqueado th, .datos-semana tr.bloqueado td { color: var(--muted); }

/* consola-mejoras 31-10: sortable headers, panel search, "Visto" */
.th-sort { background: transparent; border: 0; padding: 0; margin: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover, .th-sort:focus-visible { color: var(--accent-deep); outline: none; text-decoration: underline; }
.th-sort .sort-ind { font-size: 10px; min-width: 1em; }
.panel-busqueda { margin: 8px 0 0; }
.panel-busqueda select { margin: 0; }
.tag-visto { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 8px; border: 1px dashed var(--muted); border-radius: 999px; color: var(--muted); }
.visto-nota { color: var(--muted); font-size: 12.5px; }
.pupil-email { margin: 0; overflow-wrap: anywhere; user-select: all; }

/* consola-mejoras 31-10: the in-console guide */
.cw-guia-fondo { position: fixed; inset: 0; z-index: 70; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 16px; background: rgba(10, 20, 30, .45); }
.cw-guia { width: min(1040px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; background: var(--panel); color: var(--ink); border: 1px solid var(--muted); border-radius: 12px; box-shadow: 0 10px 34px rgba(10, 20, 30, .35); }
.cw-guia-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.cw-guia-cab h2 { margin: 0; font-size: 18px; }
.cw-guia-cuerpo { flex: 1 1 auto; min-height: 0; display: flex; }
.cw-guia-indice { flex: 0 0 230px; overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cw-guia-ir { text-align: left; white-space: normal; }
.cw-guia-contenido { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 8px 22px 24px; line-height: 1.5; font-size: 14px; }
.cw-guia-contenido:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cw-guia-sec h3 { margin: 22px 0 6px; font-size: 16px; }
.cw-guia-p { margin: 6px 0; overflow-wrap: anywhere; }
.cw-guia-lista { margin: 6px 0; padding-left: 22px; }
.cw-guia-lista li { margin: 3px 0; overflow-wrap: anywhere; }
.cw-guia-tabla-w { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; }
.cw-guia-tabla { border-collapse: collapse; font-size: 12.5px; min-width: 760px; }
.cw-guia-tabla th, .cw-guia-tabla td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cw-guia-tabla th { background: var(--past); color: var(--muted); font-size: 11.5px; }
.cw-guia-motivo { font-weight: 700; }
@media (max-width: 720px) { .cw-guia-cuerpo { flex-direction: column; } .cw-guia-indice { flex: 0 0 auto; max-height: 28%; border-right: 0; border-bottom: 1px solid var(--line); } }

/* b1-cosmetico (2026-11-07, 4b): on a phone (390 px) the alarm box (#plan-alarms: ALL alarms, red pain and red-flag included)
   started at 939 px, below the first screen (844) and under the draft/AI box, so the coach could type an instruction to the AI
   before seeing a red alarm. On narrow screens only it goes ABOVE the draft (measured: 698 px, inside the first screen).
   Desktop keeps the markup order (alarm at 536 of 900, already visible). Order, not markup: one rule, desktop untouched. */
@media (max-width: 600px) {
  #plan-main { display: flex; flex-direction: column; }
  #plan-main > #plan-alarms { order: 1; }
  #plan-main > #draft { order: 2; }
  #plan-main > #weeks { order: 3; }
}
.week-avisos { list-style: none; margin: 0; padding: 4px 12px 6px; font-size: 12px; color: var(--warn); border-bottom: 1px solid var(--line); }
