/* Subtítulo de una tarea que viene de un ticket: pequeño, recortado y enlazado a la ficha. */
.task-sub {
  display: block; font-size: 10.5px; color: var(--texto-tenue); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px;
}
.task-sub:hover { text-decoration: underline; color: var(--acento); }

/* WonderPomodoro — Sistema visual (guía de construcción visual)
   Tokens canónicos + alias legacy + semánticos. Usa siempre la variable. */

:root {
  /* Acento configurable + derivadas */
  --acento: #0077B6;
  --acento-hover: #005C8D;
  --acento-activo: #00486F;
  --acento-suave: #9ED2EE;

  /* Escala del texto (Configuración → Apariencia). Es un número, no un porcentaje: `zoom`
     lo multiplica sobre el contenedor del contenido. 1.1 = 110 % de fábrica; `css_colores()`
     la sobreescribe con lo guardado y, sin fila, este es el valor que queda. */
  --escala-texto: 1.1;

  /* Neutros canónicos (fijos) */
  --fondo: #BCDDEE;
  --tarjeta: #FFFFFF;
  --texto: #1E2A33;
  --texto-suave: #44545E;
  --texto-tenue: #6A7A85;
  --borde: #A9C6D8;
  --separador: #D6E6F0;
  --hover: #E8F2F9;
  --fondo-exterior: #BCDDEE;

  /* Semánticos (fijos) */
  --ok: #2F6B3B;         --ok-fondo: #E3F1E5;
  --aviso: #92621B;      --aviso-fondo: #FDF0DD;
  --peligro: #B33430;    --peligro-fondo: #FBE2E1;
  --info: #3B6079;       --info-fondo: #E7EEF4;

  /* Alias legacy (para no romper código ya escrito) */
  --bg: var(--fondo-exterior);
  --screen: var(--fondo);
  --card: var(--tarjeta);
  --text: var(--texto);
  --muted: var(--texto-suave);
  --faint: var(--texto-tenue);
  --border: var(--borde);
  --sep: var(--separador);
  --soft: var(--hover);
  --inp-bg: #FFFFFF;
}

[data-theme="dark"] {
  --fondo: #102530;
  --tarjeta: #17313F;
  --texto: #E8F0F5;
  --texto-suave: #B7C6D1;
  --texto-tenue: #8A9BA8;
  --borde: #244252;
  --separador: #1C3644;
  --hover: #1A3341;
  --fondo-exterior: #0B1B25;
  --acento-suave: #17445C;
  --inp-bg: #102530;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}

a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── botones ── */
.btn {
  border: none; border-radius: 8px; padding: 9px 15px;
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; color: var(--text);
  background: transparent;
}
.btn:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--acento); color: #fff; }
.btn-primary:hover { background: var(--acento-hover); }
.btn-secondary { background: #EDE6D8; color: #5C5346; }
[data-theme="dark"] .btn-secondary { background: #3A332A; color: var(--text); }
.btn-outline { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #D9534F; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; flex-shrink: 0;
  position: relative; top: 1px;
}

/* ── formularios ── */
.lbl { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.lbl .lnk-plus { width: 1.5em; height: 1.5em; font-size: .9em; border-radius: 4px; margin-bottom: 0; }
.inp {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; color: var(--text);
  font-family: inherit; background: var(--inp-bg);
}
.inp:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; }
/* select: quitar la apariencia nativa para que respete el ancho y no trunque el texto.
   Se añade una flecha con SVG inline y padding a la derecha para el icono. */
select.inp {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%236E7A84' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  background-size: 12px 8px; text-overflow: ellipsis; min-width: 140px;
}
/* El hueco de la flecha se reserva SIEMPRE, aunque la plantilla traiga un `padding` corto en línea
   (varias lo hacen para que el control quede compacto). Sin esto, el `padding` en línea pisa este
   valor, la flecha se dibuja encima del texto y el control se ve roto. */
select.inp { padding-right: 34px !important; }
/* Accesibilidad: anillo de foco visible en TODO control interactivo (guía §7 / tipografía §10). */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--acento); outline-offset: 2px;
}
textarea.inp { min-height: 76px; resize: vertical; line-height: 1.5; }
.field { margin-bottom: 12px; }

/* ── tarjetas y contenedores ── */
.card { background: var(--card); border-radius: 14px; padding: 18px; }
.screen-wrap { max-width: 900px; margin: 0 auto; padding: 18px 14px 60px; }
.foot { text-align: center; font-size: 11px; color: var(--faint); margin-top: 16px; }

/* ── escala del texto ──
   La hoja está escrita en px (más de 900 valores entre CSS y plantillas), así que no se puede
   pasar a `rem` sin convertirla entera. `zoom` escala el contenedor del contenido —texto, cajas,
   iconos, imágenes y rellenos— y reflowea, como el zoom del navegador. La cabecera, el menú y los
   avisos quedan fuera del contenedor: conservan su tamaño y el armazón no se descuadra.
   `.lienzo` es el contenido privado; `.pub`, el login y las pantallas de acceso; `.pub-wrap`, el
   portal del invitado. Lo que un día se pinte fuera de ellos no se escala. */
.lienzo, .pub, .pub-wrap { zoom: var(--escala-texto); }

/* El editor de la respuesta (HugeRTE) trae su propia escala en píxeles y, dentro del `zoom` de
   arriba, su barra de botones sale desproporcionada frente a la caja de escribir: se ata a la
   escala de la ficha para que ocupe lo que debe (guía visual §7). */
/* El campo del código espacia las cifras a propósito; el texto de ayuda no tiene por qué
   heredarlo (se leía «C ó d i g o»). */
#ver-codigo::placeholder { letter-spacing: normal; font-size: 13px; }

.lienzo .tox .tox-tbtn svg, .pub .tox .tox-tbtn svg { width: 16px; height: 16px; }
.lienzo .tox .tox-tbtn, .pub .tox .tox-tbtn { height: 24px; min-width: 24px; }
.lienzo .tox .tox-tbtn--select, .pub .tox .tox-tbtn--select { padding: 0 2px; }
.lienzo .tox .tox-toolbar__group, .pub .tox .tox-toolbar__group { padding: 0 2px; }
.lienzo .tox .tox-editor-header, .pub .tox .tox-editor-header { padding: 2px 0; }
.lienzo .tox .tox-toolbar, .pub .tox .tox-toolbar { padding: 0; }
/* La caja de escribir, con más aire: la barra ya ocupa menos, pero la ficha se lee mejor así. */
.lienzo .tox .tox-edit-area__iframe, .pub .tox .tox-edit-area__iframe { min-height: 150px; }

/* Deslizador del tamaño del texto (Apariencia): nativo, accesible y con el acento del tema. */
.escala-linea { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.escala-linea input[type="range"] {
  flex: 1 1 220px; max-width: 420px; height: 28px; cursor: pointer; accent-color: var(--acento);
}
.escala-valor {
  font-size: 13px; font-weight: 600; color: var(--texto); min-width: 52px;
  font-variant-numeric: tabular-nums;
}

/* ── cabecera autenticada ── */
.hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand span { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1; }
.hd-acts { display: flex; align-items: center; gap: 12px; }
.mbtn {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 13px; font-size: 12.5px; line-height: 1; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  height: 33px;
}
.mbtn i {
  font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; flex-shrink: 0;
  position: relative; top: 1px;
}
/* Botón de solo icono (sin texto): quitar el ajuste de línea para centrarlo. */
.mbtn i:only-child { top: 0; }
.ibtn { font-size: 19px; color: var(--text); cursor: pointer; position: relative; background: none; border: none; line-height: 1; }
.dot { position: absolute; top: -4px; right: -7px; background: #D9534F; color: #fff; font-size: 9px; font-weight: 700; border-radius: 9px; padding: 1px 5px; line-height: 1.3; }
.av {
  width: 33px; height: 33px; border-radius: 50%; background: var(--acento);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; line-height: 1; flex-shrink: 0; cursor: pointer; border: none;
}
.tind {
  display: flex; align-items: center; gap: 5px; background: #FBE2E1; color: #B33430;
  font-size: 12px; font-weight: 600; border-radius: 8px; padding: 6px 10px; cursor: pointer; line-height: 1;
}

/* ── logo ── */
.logo-box { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-box img { display: block; }
.logo-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--acento); color: #fff; font-weight: 700; border-radius: 8px;
  font-size: 12px; letter-spacing: .02em;
}

/* ── avisos ── */
.note { display: flex; gap: 9px; align-items: flex-start; background: #EDEAE3; border-radius: 9px; padding: 10px 12px; margin-top: 12px; }
.note i { color: #5C5346; font-size: 15px; flex-shrink: 0; }
.note p { font-size: 11.5px; color: #5C5346; line-height: 1.45; }
.note.w { background: #FDF0DD; }
.note.w i, .note.w p { color: #92621B; }
.note.e { background: #FBE2E1; }
.note.e i, .note.e p { color: #B33430; }
.note.ok { background: #E3F1E5; }
.note.ok i, .note.ok p { color: #2F6B3B; }

/* ── login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.pub { width: 100%; max-width: 380px; }
.pub-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 18px; }
.pub-logo span:not(.logo-box):not(.logo-fallback) { display: block; font-size: 17px; font-weight: 600; color: var(--text); margin-top: 8px; }
.sep-or { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.sep-or::before, .sep-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.sep-or span { font-size: 10.5px; color: var(--faint); }

/* ── instalador ── */
.install-wrap { max-width: 620px; margin: 0 auto; padding: 24px 16px 60px; }
.requisito { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 12.5px; color: var(--text); }
.requisito .ok { color: #2F6B3B; }
.requisito .fail { color: #B33430; }

/* ── dropdowns ── */
.dd { position: relative; }
.dd-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  min-width: 220px; padding: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.14);
  z-index: 50; display: none;
}
.dd.open .dd-menu { display: block; }
.dd.left .dd-menu { left: 0; right: auto; }
.dd-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px;
  font-size: 12.5px; color: var(--text); text-decoration: none; cursor: pointer;
}
.dd-item i {
  font-size: 16px; color: var(--muted); width: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  height: 1em; flex-shrink: 0;
  position: relative; top: 1px;
}
.dd-item:hover { background: var(--soft); text-decoration: none; }
.dd-sep { height: 1px; background: var(--sep); margin: 6px 4px; }
.dd-label { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-suave); padding: 8px 11px 5px; }

/* ── launcher del menú (popup cuando el desplegable no cabe en pantalla) ── */
.menu-launcher {
  position: fixed; inset: 0; z-index: 220;
  background: rgba(0,0,0,.42);
  display: none; align-items: center; justify-content: center;
  padding: 18px;
}
.menu-launcher.open { display: flex; }
.ml-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
  max-width: 760px; width: 100%; max-height: calc(100vh - 40px);
  overflow-y: auto; padding: 18px 20px 20px;
}
.ml-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; font-size: 14px; color: var(--text);
}
.ml-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  justify-items: center;
}
.ml-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px; border-radius: 14px; text-decoration: none; color: var(--text);
  position: relative; transition: background .15s;
}
.ml-item:hover { background: var(--soft); text-decoration: none; }
.ml-item i { font-size: 28px; color: var(--acento); }
.ml-item span { font-size: 11px; text-align: center; line-height: 1.2; }
.ml-count {
  position: absolute; top: 4px; right: 8px;
  background: var(--acento); color: #fff; font-size: 9px; border-radius: 9px;
  padding: 1px 6px;
}

/* ── pestañas ── */
.tabs { display: inline-flex; background: #EDE6D8; border-radius: 9px; padding: 3px; gap: 3px; margin-bottom: 14px; }
[data-theme="dark"] .tabs { background: #2A251E; }
.tb { border: none; background: none; font-family: inherit; font-size: 12.5px; color: var(--muted); padding: 6px 13px; border-radius: 7px; cursor: pointer; }
.tb.active { background: var(--card); color: var(--text); font-weight: 600; }

/* ── listas / tablas ── */
.row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-top: 1px solid var(--sep); }
.row:first-of-type { border-top: none; }
.rmain { flex: 1; min-width: 0; }
.rmain b { font-size: 12.5px; color: var(--text); font-weight: 500; display: block; }
.rmain small { font-size: 11px; color: var(--muted); }
.rdate { font-size: 11px; color: var(--faint); flex-shrink: 0; }
.cols { display: flex; align-items: center; gap: 11px; padding: 8px 0; }
.cols span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mav {
  width: 30px; height: 30px; border-radius: 50%; color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.chk {
  width: 17px; height: 17px; border: 1.5px solid #C9BEA8; border-radius: 5px; background: var(--card);
  cursor: pointer; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center;
}
.chk.on { background: var(--acento); border-color: var(--acento); }
.chk.on::after { content: '✓'; color: #fff; font-size: 11px; line-height: 1; }

/* ── configuración ── */
.cfg { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; }
@media (max-width: 720px) { .cfg { grid-template-columns: 1fr; } }
.cnav { background: var(--card); border-radius: 12px; padding: 8px; }
.cn {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px;
  font-size: 12px; color: var(--text); text-decoration: none; cursor: pointer;
}
.cn i { font-size: 15px; color: var(--muted); width: 15px; }
.cn:hover { background: var(--soft); text-decoration: none; }
.cn.active { background: var(--acento-suave); color: var(--text); font-weight: 600; }
.cn.active i { color: var(--acento); }
.cn .n { margin-left: auto; font-size: 9.5px; color: var(--faint); }
/* El contador del ítem activo se lee sobre `--acento-suave`, no sobre la tarjeta: el tenue
   (calibrado al 3.0) no llegaría al AA sobre un suave medio; hereda el texto principal. */
.cn.active .n { color: var(--texto); }
.cndiv { height: 1px; background: var(--sep); margin: 7px 5px; }
.blk { border-top: 1px solid var(--sep); padding-top: 15px; margin-top: 15px; }
.blk:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.btitle { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 9px; }
.r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 620px) { .r2 { grid-template-columns: 1fr; } }

/* ── toggles ── */
.tog { width: 36px; height: 21px; border-radius: 11px; background: #E3D6BE; position: relative; cursor: pointer; border: none; flex-shrink: 0; }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; }
.tog.on { background: var(--acento); }
.tog.on::after { left: 18px; }
.togrow { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; border-top: 1px solid var(--sep); }
.togrow:first-child { border-top: none; }
.togrow div { flex: 1; }
.togrow b { display: block; font-size: 12.5px; color: var(--text); }
.togrow small { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ── métricas / stats ── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 620px) { .stat-row { grid-template-columns: 1fr 1fr; } }
.stat { border: 1px solid var(--sep); border-radius: 10px; padding: 12px; background: var(--card); }
.stat b { display: block; font-size: 21px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10.5px; color: var(--muted); }

/* ── inicio / temporizador ── */
.space { margin-bottom: 12px; }
.cols2 { display: grid; grid-template-columns: 7fr 5fr; gap: 12px; }
@media (max-width: 700px) { .cols2 { grid-template-columns: 1fr; } }
.timer { text-align: center; padding: 20px; }
.timer .big { font-size: 40px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.timer .cur { font-size: 12px; color: var(--muted); margin: 4px 0 14px; }
.timer .day { font-size: 11px; color: var(--faint); margin-bottom: 12px; }
.tbtns { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }

/* ── pills ── */
.pill { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 4px 9px; display: inline-block; }

/* ── selector de color ── */
.variant-chip { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(0,0,0,.06); display: inline-block; }
.contrast-tag { font-size: 10px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.c-ok { background: #E3F1E5; color: #2F6B3B; }
.c-warn { background: #FDF0DD; color: #92621B; }
.c-bad { background: #FBE2E1; color: #B33430; }
/* Las píldoras y rótulos diminutos van sobre `--soft`, una superficie distinta de la tarjeta y
   del fondo; `--texto-tenue` (calibrado al 3.0) no llega al AA de texto pequeño. Usan
   `--texto-suave`, que sí lo cumple en las tres superficies. */
.sec-num { font-size: 10px; color: var(--texto-suave); background: var(--soft); border-radius: 6px; padding: 2px 6px; font-weight: 600; }
/* Componente `selector_color` (paper §5): muestra nativa + hex + restaurar, en una fila. */
.color-field { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.color-sel { display: inline-flex; align-items: center; gap: 6px; }
.color-sel input[type="color"] {
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0; background: none; cursor: pointer; flex-shrink: 0;
}
.color-sel input[type="text"] {
  width: 104px; height: 40px; padding: 6px 8px; font-family: ui-monospace, monospace;
  font-size: 12px; text-transform: uppercase;
}
.color-sel-restaurar {
  width: 26px; height: 26px; border: none; background: none; color: var(--faint);
  cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; flex-shrink: 0;
}
.color-sel-restaurar:hover { background: var(--soft); color: var(--acento); }
.color-sel.invalido input[type="text"] { border-color: #D9534F; }
/* Vista previa del componente real, no un cuadrado de color. */
.color-preview { flex: 1; min-width: 240px; background: var(--soft); border: 1px solid var(--sep); border-radius: 10px; padding: 12px; }
.preview-label { font-size: 10.5px; color: var(--texto-suave); margin: 0; }
.preview-strip { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
/* El enlace se lee sobre `--soft`, no sobre la tarjeta: el acento como color de texto no siempre
   llega a AA ahí (con un acento oscuro en tema oscuro se queda en 2.7:1). El texto sale del
   texto de la superficie y el subrayado conserva la identidad del acento. */
.preview-link { color: var(--texto); font-size: 12px; text-decoration: underline; text-decoration-color: var(--acento); text-underline-offset: 2px; }
.variants { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.variant { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--texto-suave); }
.contrast-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
/* Estados: la píldora real, los cuatro colores y el medidor, en una rejilla compacta. */
.theme-toggle { display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 10px; background: var(--soft); border-radius: 8px; }
.theme-opt { border: none; background: none; font-family: inherit; font-size: 11.5px; color: var(--muted); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.theme-opt.active { background: var(--card); color: var(--text); font-weight: 600; }
.state-grid { display: flex; flex-direction: column; }
.state-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--sep); }
.state-preview { min-width: 108px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 2px; }
.state-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; flex: 1; min-width: 300px; }
.mini-color { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-label { font-size: 9.5px; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .04em; }
.state-campos .color-sel input[type="color"] { width: 30px; height: 30px; border-radius: 6px; }
.state-campos .color-sel input[type="text"] { width: 84px; height: 30px; padding: 3px 6px; font-size: 11px; }
.textos-grid { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.texto-sugerido { display: block; font-size: 10.5px; color: var(--texto-suave); margin-top: 4px; }
/* Contraste del texto sobre la tarjeta y sobre el fondo: el peor de los dos. */
.texto-medidor { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.texto-medidor .texto-sugerido { margin-top: 0; }

/* ── toast ── */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #3E2E22; color: #fff; border-radius: 10px; padding: 11px 15px; font-size: 12.5px; box-shadow: 0 10px 26px rgba(0,0,0,.2); display: flex; align-items: center; gap: 8px; animation: tin .18s ease; max-width: 320px; }
.toast i { color: #E8B96A; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tout { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px); } }
.toast.bye { animation: tout .2s ease forwards; }

/* ── crear dependencia al vuelo (botón [+]) ── */
.lnk-plus { width: 26px; height: 26px; border: 1px solid var(--border); background: var(--card); color: var(--acento); border-radius: 6px; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lnk-plus:hover { background: var(--acento-suave); }
.lmcard { color: var(--text); }
.lmcard iframe { min-height: 420px; }

/* ── Ayuda: botón circular "?" (arriba a la derecha) ── */
.ayuda-fab { position: fixed; top: 66px; right: 16px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.22); z-index: 300; }
.ayuda-fab:hover { background: var(--acento-hover); transform: scale(1.05); }


/* ── botón mini (icono pequeño) ── */
.mini { border: 1px solid var(--border); background: var(--card); border-radius: 6px; width: 26px; height: 26px; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.mini:hover { background: var(--soft); color: var(--text); }

/* ── paginación ── */
.pag { display: flex; justify-content: space-between; align-items: center; padding-top: 13px; flex-wrap: wrap; gap: 8px; }
.pag small { font-size: 11px; color: var(--muted); }
.pg { min-width: 25px; height: 25px; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 6px; font-size: 11px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; text-decoration: none; }
.pg:hover { text-decoration: none; }
.pg.on { background: var(--acento); color: #fff; border-color: var(--acento); }
.pag-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pag-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.pag-tools label { display: inline-flex; gap: 6px; align-items: center; }
.pag input[type="number"] { padding: 3px 6px; font-size: 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); }
.th-sort { color: var(--text); text-decoration: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.th-sort:hover { color: var(--acento); text-decoration: none; }

/* ── clases canónicas de la guía visual ── */
.page-title { font-size: 18px; font-weight: 600; color: var(--texto); margin-bottom: 3px; }
.page-sub { font-size: 12px; color: var(--texto-suave); margin-bottom: 14px; line-height: 1.5; }
.block-title { font-size: 13px; font-weight: 600; color: var(--texto); margin-bottom: 9px; }
.block-note { font-size: 11px; color: var(--texto-suave); margin-bottom: 12px; }
/* El subtítulo de pantalla (`psub`) es texto explicativo, no decoración: sale de `--texto-suave`
   y no hereda `--texto`. Antes no tenía regla y cada plantilla le ponía un gris a mano. */
.psub { font-size: 12px; color: var(--texto-suave); margin: 0 0 14px; line-height: 1.5; }
.hint { font-size: 11px; color: var(--texto-suave); margin-top: 5px; }
.r3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 620px) { .r3 { grid-template-columns: 1fr; } }

/* barra de submódulos */
.submod { display: flex; align-items: center; gap: 4px; background: #EDE6D8; border-radius: 10px; padding: 4px; margin-bottom: 14px; flex-wrap: wrap; }
[data-theme="dark"] .submod { background: #2A251E; }
.sub-item { border: none; background: none; font-family: inherit; font-size: 12.5px; color: var(--texto-suave); padding: 7px 12px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 6px; text-decoration: none; }
.sub-item:hover { background: rgba(255,255,255,.6); text-decoration: none; }
[data-theme="dark"] .sub-item:hover { background: rgba(255,255,255,.06); }
.sub-item.active { background: var(--tarjeta); color: var(--texto); font-weight: 600; }
.sub-item i { font-size: 14px; }
.sub-item.new { margin-left: auto; background: var(--acento); color: #fff; }

/* estados de ticket (usan --estado-* de la configuración) */
.sq { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.s-nuevo { background: var(--estado-nuevo-fondo); color: var(--estado-nuevo-texto); }
.s-abierto { background: var(--estado-abierto-fondo); color: var(--estado-abierto-texto); }
.s-prog { background: var(--estado-en_progreso-fondo); color: var(--estado-en_progreso-texto); }
.s-espera { background: var(--estado-en_espera-fondo); color: var(--estado-en_espera-texto); }
.s-res { background: var(--estado-resuelto-fondo); color: var(--estado-resuelto-texto); }
.s-cerrado { background: var(--estado-cerrado-fondo); color: var(--estado-cerrado-texto); }
.s-reab { background: var(--estado-reabierto-fondo); color: var(--estado-reabierto-texto); }

/* estado vacío */
.empty { text-align: center; padding: 32px 16px; color: var(--texto-suave); }
.empty i { font-size: 34px; color: var(--texto-tenue); }
.empty b { display: block; margin-top: 10px; font-size: 13px; color: var(--texto); }
.empty p { font-size: 12px; margin-top: 4px; }

/* retorno desde pantalla profunda */
.back-btn { border: 1px solid var(--borde); background: var(--tarjeta); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--texto); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.back-ctx { font-size: 11px; color: var(--texto-tenue); }

/* chips de filtro */
.chip { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--texto); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.chip.set { border-color: var(--acento); color: var(--acento); }

/* barra de acciones en bloque */
.bulk { background: #3E2E22; border-radius: 11px; padding: 9px 12px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 10px; }
.bulk b { color: #fff; font-size: 12.5px; }
.bbtn { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #F3E7D3; border-radius: 7px; padding: 6px 10px; font-size: 11.5px; cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 5px; }

/* tabla de desempeño (matrices comparables) */
.tw { overflow-x: auto; }
table.pf { width: 100%; border-collapse: collapse; min-width: 520px; }
table.pf th { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); font-weight: 600; padding: 0 7px 8px; text-align: right; white-space: nowrap; }
table.pf th:first-child { text-align: left; }
table.pf td { font-size: 12px; color: var(--texto); padding: 9px 7px; border-top: 1px solid var(--separador); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.pf td:first-child { text-align: left; }
table.pf tr:hover td { background: var(--hover); }

/* ── tareas y mensajes ── */
.wtitle { font-size: 12.5px; color: var(--texto-suave); font-weight: 600; margin-bottom: 11px; display: flex; justify-content: space-between; align-items: center; }
.task { display: flex; align-items: center; gap: 9px; padding: 8px 0; }
.task-name { flex: 1; font-size: 12.5px; color: var(--texto); min-width: 0; }
.task-time { font-size: 10.5px; color: var(--texto-tenue); font-variant-numeric: tabular-nums; }
.task.run { background: var(--acento-suave); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.thread { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.bub { max-width: 80%; padding: 8px 11px; border-radius: 12px; font-size: 12px; line-height: 1.45; }
.bin { background: var(--separador); color: var(--texto); align-self: flex-start; border-bottom-left-radius: 3px; }
.bout { background: var(--acento); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.composer { display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--separador); padding-top: 11px; }
.combo { display: flex; align-items: center; gap: 6px; border: 1px solid var(--borde); border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--texto); cursor: pointer; flex-shrink: 0; width: 150px; background: var(--tarjeta); }
.combo .mav { width: 20px; height: 20px; font-size: 9px; }
.combo span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Mensajería (T15): panel de conversaciones + hilo ── */
/* El atributo `hidden` debe GANAR al `display` que ponen las clases. El navegador
   lo oculta desde su hoja de estilos, pero cualquier `display` de autor lo pisa:
   pasaba con `.msg-panel{display:flex}` (el panel del selector se quedaba abierto
   tapando el hilo y la fila de envío) y con `.pill` (los badges a 0 se veían). */
[hidden] { display: none !important; }
.msg-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--separador); }
.msg-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; }
.msg-head-left b { font-size: 13px; white-space: nowrap; }
/* "Mensajes (N)": palabra + contador, los dos dentro del enlace al módulo. */
.msg-head-link { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--texto); }
.msg-head-link:hover { text-decoration: none; }
.msg-head-link:hover b { color: var(--acento); }
.msg-count { color: var(--acento); font-size: 12px; font-weight: 700; white-space: nowrap; }
.msg-head > .ibtn { margin-left: auto; flex: none; }
.msg-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.msg-sel { display: flex; align-items: center; gap: 7px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; max-width: 300px; font-family: inherit; margin-left: auto; }
.msg-sel .mav { width: 20px; height: 20px; font-size: 9px; flex: none; }
.msg-sel-nombre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.msg-body { display: flex; flex: 1; min-height: 0; }
.msg-panel { width: 336px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--separador); }
.msg-buscar { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border-bottom: 1px solid var(--separador); color: var(--texto-tenue); }
.msg-lista { flex: 1; overflow-y: auto; padding: 4px 6px 8px; min-height: 0; }
.msg-bloque { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-tenue); margin: 8px 8px 3px; }
.msg-divisor { height: 1px; background: var(--separador); margin: 7px 8px; }
.msg-row { position: relative; display: flex; align-items: center; }
.msg-row-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--texto); flex: 1; min-width: 0; }
.msg-row-link:hover { text-decoration: none; }
.msg-row:hover .msg-row-link { background: var(--hover); }
.msg-row.actual .msg-row-link { background: var(--acento-suave); }
.msg-row-main { flex: 1; min-width: 0; }
.msg-row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.msg-row-top b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-row-top small { font-size: 10.5px; color: var(--texto-tenue); white-space: nowrap; flex: none; }
.msg-row-sub { display: block; font-size: 11px; color: var(--texto-suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-row-badge { background: var(--acento); color: #fff; line-height: 1.2; flex: none; }
.msg-pin { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); opacity: 0; border: none; background: transparent; color: var(--texto-suave); cursor: pointer; padding: 4px; line-height: 1; }
/* La chincheta (y el trueque hora→chincheta al pasar el ratón) son de la pantalla
   completa: el widget no la muestra, así que ahí la hora NO se oculta (T25). */
.msg[data-modo="completo"] .msg-row:hover .msg-pin { opacity: 1; }
.msg[data-modo="completo"] .msg-row:hover .msg-row-top small { visibility: hidden; }
.msg-pin:hover { color: var(--acento); }
.msg-hilo { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 0; max-height: 56vh; }
.msg-nuevo { display: flex; align-items: center; gap: 8px; color: var(--acento); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.msg-nuevo::before, .msg-nuevo::after { content: ''; flex: 1; height: 1px; background: var(--acento); opacity: .35; }
.msg-composer { padding: 12px 16px; display: flex; gap: 8px; border-top: 1px solid var(--separador); }
/* Modo compacto (widget): el selector es el primer control de la fila de envío
   —[buscador] [mensaje] [adjuntar] [enviar]— y su popup se despliega HACIA ARRIBA,
   porque la fila de envío está pegada al borde inferior de la tarjeta. */
.msg[data-modo="compacto"] .msg-sel { margin-left: 0; max-width: 190px; flex: 0 1 auto; }
.msg[data-modo="compacto"] .msg-body { position: relative; }
.msg[data-modo="compacto"] .msg-panel { position: absolute; top: auto; bottom: 0; left: 8px; right: 8px; width: auto; max-height: 280px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 12px 28px rgba(0, 0, 0, .14); z-index: 30; }
.msg[data-modo="compacto"] .msg-hilo { min-height: 96px; max-height: 220px; }
.msg[data-modo="completo"] .msg-body { height: 440px; }
@media (max-width: 768px) {
  .msg[data-modo="completo"] .msg-body { flex-direction: column; height: auto; }
  .msg[data-modo="completo"] .msg-panel { width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid var(--separador); }
}

/* ── Matriz de niveles × zonas (T16) ── */
table.pf.matriz th, table.pf.matriz td { padding: 6px 5px; }
table.pf.matriz thead th { position: sticky; top: 0; background: var(--tarjeta); z-index: 1; }
table.pf.matriz thead th.matriz-esq { left: 0; top: 0; z-index: 5; }
table.pf.matriz tbody tr:hover td { background: var(--hover); }

/* ── responsive: rejilla de 12 → una columna en ≤768px (guía §5) ── */
@media (max-width: 768px) {
  .space .inicio-col { min-width: 100% !important; flex: 1 1 100% !important; }
  .screen-wrap { padding: 16px 10px 50px; }
}
