:root {
  --fondo: #F7F6F2; --tarjeta: #FFFFFF; --tinta: #1C1F26; --suave: #5B6170; --tenue: #8A909B; --borde: #E3E1DA;
  --gris: #ECEAE3; --azul: #2F5BEA; --azul-osc: #1E3FB0; --chip: #EEF2FD; --chip-tinta: #1E3FB0;
  --banda: #1C1F26; --banda-tinta: #FFFFFF; --banda-suave: #C9CDD5; --ambar: #B45309; --ambar-fondo: #FEF3C7;
  --verde: #0F7A5E; --verde-fondo: #DCF5EC; --rojo: #B42318; --rojo-fondo: #FDECEA; --estrella: #E0A100;
  --sombra: 0 6px 18px rgba(28,31,38,0.22); --sel: #FFFFFF;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #15171C; --tarjeta: #1E2128; --tinta: #ECEDEF; --suave: #A3A9B4; --tenue: #7D8491; --borde: #2E323B;
    --gris: #252830; --azul: #6E8FFF; --azul-osc: #9DB4FF; --chip: #1D2747; --chip-tinta: #AFC2FF;
    --banda: #252A36; --banda-tinta: #FFFFFF; --banda-suave: #B9BFCA; --ambar: #F5B84A; --ambar-fondo: #3A2E14;
    --verde: #5FD3AE; --verde-fondo: #12352B; --rojo: #FF8A80; --rojo-fondo: #3B1A18; --estrella: #F2C230;
    --sombra: 0 6px 18px rgba(0,0,0,0.5); --sel: #343844;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fondo); color: var(--tinta); }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
button { font: inherit; color: inherit; }
a { color: var(--azul); }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; position: relative; }
.pantalla { padding: calc(20px + env(safe-area-inset-top)) 18px calc(150px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; }
.cab { display: flex; flex-direction: column; gap: 4px; }
.cab .fecha { margin: 0; font-size: 14px; font-weight: 500; color: var(--suave); }
.cab .fila-tit { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cab h1 { margin: 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 38px; font-weight: 700; letter-spacing: -0.5px; }
.cab .cuenta { margin: 0; font-size: 15px; font-weight: 600; color: var(--azul); white-space: nowrap; }
.cab .sub { margin: 0; font-size: 15px; color: var(--suave); }
.barra { height: 6px; border-radius: 4px; background: var(--borde); overflow: hidden; margin-top: 4px; }
.barra > div { height: 100%; border-radius: 4px; background: var(--azul); transition: width .25s; }
.refrescar { border: 0; background: transparent; color: var(--suave); width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.refrescar.girando svg { animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--gris); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--suave); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--tinta); box-shadow: 0 1px 3px rgba(28,31,38,0.14); }
.controles { display: flex; flex-direction: column; gap: 8px; }

.banda { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--gris);
  font-size: 14px; color: var(--suave); }
.banda svg { flex: none; }
.oscuro { padding: 14px 16px; border-radius: 14px; background: var(--banda); color: var(--banda-tinta); }
.oscuro p { margin: 0; }
.oscuro .peq { font-size: 13px; color: var(--banda-suave); margin-top: 4px; }
.offline { padding: 8px 12px; border-radius: 10px; background: var(--ambar-fondo); color: var(--ambar); font-size: 13px; font-weight: 500; }

.lista { display: flex; flex-direction: column; gap: 8px; }
.fila { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 12px; border-radius: 14px;
  background: var(--tarjeta); border: 1px solid var(--borde); touch-action: pan-y; transition: transform .18s; }
.fila.arrastrando { transition: none; }
.fila .chk { flex: none; width: 28px; height: 28px; margin: 1px 0 0; padding: 0; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: var(--tarjeta); border: 2px solid var(--tenue); }
.fila .chk.on { background: var(--azul); border-color: var(--azul); }
.fila .cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; padding-top: 3px; cursor: pointer;
  background: none; border: 0; text-align: left; }
.fila .tit { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.fila .tit.hecha { color: var(--tenue); text-decoration: line-through; }
.meta { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 12px; color: var(--suave); }
.punto { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.badge.quedo { background: var(--ambar-fondo); color: var(--ambar); }
.badge.nuevo { background: var(--verde-fondo); color: var(--verde); }
.fuente { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px;
  background: var(--chip); color: var(--chip-tinta); font-size: 12px; font-weight: 500; line-height: 1.35; text-decoration: none;
  overflow-wrap: anywhere; }
.btn-ico { flex: none; width: 40px; height: 40px; margin: -4px -2px -4px 0; padding: 0; border: 0; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--tenue); }
.btn-ico.on.sol { color: var(--azul); }
.btn-ico.on.estrella { color: var(--estrella); }
.btn-mas { flex: none; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--borde); background: var(--gris);
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--tinta); }

.grupo { display: flex; flex-direction: column; gap: 8px; }
.grupo h2 { margin: 8px 2px 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 20px; font-weight: 700;
  display: flex; align-items: baseline; justify-content: space-between; }
.grupo h2 .n { font-family: Inter, sans-serif; font-size: 13px; font-weight: 600; color: var(--suave); }
.grupo h3 { margin: 4px 2px 0; font-size: 14px; font-weight: 600; color: var(--suave); }
.vacio { padding: 16px; border-radius: 14px; border: 1px dashed var(--borde); color: var(--suave); font-size: 14px; text-align: center; }
.nota { margin: 0; font-size: 13px; line-height: 1.45; color: var(--suave); text-align: center; }

.algun { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.algun .cabeza { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 12px 14px;
  border-radius: 14px; border: 1px solid var(--borde); background: var(--gris); cursor: pointer; text-align: left; }
.algun .cabeza b { font-family: "Space Grotesk", Inter, sans-serif; font-size: 18px; }
.algun .cabeza span { font-size: 13px; color: var(--suave); }
.buscar { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--tinta); font: inherit; }

.tema { display: flex; flex-direction: column; gap: 8px; }
.tema h2 { margin: 8px 2px 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 20px; font-weight: 700; }
.linea { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--tarjeta);
  border: 1px solid var(--borde); }
.linea .arriba { display: flex; align-items: center; gap: 10px; }
.linea .nombre { flex: 1; margin: 0; font-size: 16px; font-weight: 600; }
.linea .n { font-size: 13px; font-weight: 600; color: var(--suave); white-space: nowrap; }
.alerta { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--rojo-fondo); color: var(--rojo); }
.linea ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.linea li { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.linea li.hecha { color: var(--tenue); text-decoration: line-through; }

nav.abajo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--tarjeta); border-top: 1px solid var(--borde);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
nav.abajo .dentro { width: 100%; max-width: 640px; display: flex; justify-content: space-around; }
nav.abajo a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 72px; min-height: 48px;
  justify-content: center; font-size: 12px; font-weight: 500; color: var(--suave); text-decoration: none; }
nav.abajo a[aria-current="page"] { color: var(--azul); font-weight: 600; }
.fab { position: fixed; right: max(18px, calc(50vw - 302px)); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 6;
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--tinta); color: var(--fondo); box-shadow: var(--sombra);
  display: flex; align-items: center; justify-content: center; cursor: pointer; }

#hoja .fondo { position: fixed; inset: 0; z-index: 20; background: rgba(10,12,16,0.45); }
#hoja .panel > * { flex-shrink: 0; }
#hoja .panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 640px; margin: 0 auto; max-height: 92vh;
  overflow-y: auto; background: var(--fondo); border-radius: 20px 20px 0 0; padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; box-shadow: var(--sombra); }
.panel h2 { margin: 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 22px; }
.panel .tit-hoja { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; }
.panel label.et { font-size: 13px; font-weight: 600; color: var(--suave); }
.panel textarea { width: 100%; min-height: 96px; padding: 12px; border-radius: 12px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--tinta); font: inherit; font-size: 17px; resize: vertical; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.desliza { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.chip { flex: none; min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--borde); background: var(--tarjeta);
  font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--tinta); }
.chip[aria-pressed="true"] { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }
.chip.propuesta { border-color: var(--azul); }
.ayuda { margin: 0; font-size: 13px; color: var(--suave); }
.acciones { display: flex; flex-direction: column; gap: 8px; }
.accion { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--borde); background: var(--tarjeta);
  font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 10px; color: var(--tinta);
  text-decoration: none; }
.primario { width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: var(--azul); color: #fff; font-size: 16px;
  font-weight: 600; cursor: pointer; }
.primario:disabled { opacity: .5; }
.secundario { width: 100%; min-height: 46px; border: 1px solid var(--borde); border-radius: 14px; background: transparent;
  font-size: 15px; font-weight: 500; cursor: pointer; }

#aviso { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: 560px; padding: 10px 14px; border-radius: 12px; background: var(--tinta); color: var(--fondo);
  font-size: 14px; box-shadow: var(--sombra); display: none; }
#aviso.ver { display: flex; gap: 12px; align-items: center; }
#aviso.error { background: var(--rojo); color: #fff; }
#aviso button { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 4px; }

.alta { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px; max-width: 420px; margin: 0 auto; }
.alta h1 { margin: 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 34px; }
.alta p { margin: 0; color: var(--suave); }
.alta input { width: 100%; min-height: 50px; padding: 12px; border-radius: 12px; border: 1px solid var(--borde); background: var(--tarjeta);
  color: var(--tinta); font: inherit; font-size: 18px; }
.alta input.codigo { letter-spacing: 6px; font-size: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.alta .msg { font-size: 14px; color: var(--suave); }
.alta .msg.error { color: var(--rojo); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.meta-l { display: inline-flex; align-items: flex-start; gap: 6px; }
.meta-l .punto { margin-top: 4px; }

/* ── Horizontal (móvil apaisado) ─────────────────────────────────────────── */
body.apaisado #app { max-width: none; }
.horizontal { height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.hbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--borde);
  background: var(--tarjeta); min-height: 48px; }
.htit { display: flex; align-items: baseline; gap: 8px; flex: none; white-space: nowrap; }
.htit b { font-family: "Space Grotesk", Inter, sans-serif; font-size: 20px; }
.htit span { font-size: 12px; color: var(--suave); display: inline-flex; align-items: center; gap: 6px; }
.hcuenta { color: var(--azul); }
.hbarra { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: var(--borde); overflow: hidden; }
.hbarra span { display: block; height: 100%; background: var(--azul); }
.hextra { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.hextra::-webkit-scrollbar { display: none; }
.hchips { display: flex; gap: 4px; }
.hfila2 { flex: none; padding: 6px 10px; border-bottom: 1px solid var(--borde); background: var(--tarjeta); overflow-x: auto; scrollbar-width: none; }
.hfila2::-webkit-scrollbar { display: none; }
.hchip { flex: none; min-height: 30px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--borde); background: var(--fondo);
  font-size: 12px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.hchip[aria-pressed="true"] { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }
.hbtn { flex: none; min-height: 34px; min-width: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--borde);
  background: var(--gris); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.hbtn[aria-pressed="true"] { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }
.hzoom { display: inline-flex; gap: 4px; flex: none; }
.htabs { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--gris); flex: none; }
.htabs a { min-height: 32px; padding: 0 10px; display: flex; align-items: center; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--suave); text-decoration: none; }
.htabs a[aria-current="page"] { background: var(--sel); color: var(--tinta); box-shadow: 0 1px 3px rgba(28,31,38,0.14); }
.horizontal .refrescar { width: 34px; height: 34px; }
.horizontal .offline { margin: 6px 10px 0; }
.hcuerpo { flex: 1; min-height: 0; overflow: auto; padding: 10px 10px 80px; }
.tablero { display: flex; gap: 10px; align-items: flex-start; min-width: min-content; }
.col { flex: none; width: 210px; display: flex; flex-direction: column; gap: 6px; }
.col-cab { margin: 0; padding: 0 2px; font-family: "Space Grotesk", Inter, sans-serif; font-size: 15px; font-weight: 700;
  display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-cab span { font-family: Inter, sans-serif; font-size: 12px; color: var(--suave); font-weight: 600; }
.col-persona .col-cab { font-size: 13px; }
.col-lista { display: flex; flex-direction: column; gap: 6px; }
.col-hoy .col-lista { padding: 6px; border-radius: 12px; background: var(--chip); min-height: 60px; }
.col-algun { opacity: .9; }
.col-vacia { margin: 4px 2px; font-size: 12px; color: var(--tenue); }
.carta { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px 30px 8px 10px; border-radius: 10px;
  background: var(--tarjeta); border: 1px solid var(--borde); border-left-width: 4px; transition: opacity .15s; }
.carta.enhoy { box-shadow: inset 0 0 0 2px var(--azul); }
.carta.hecha .ctit { color: var(--tenue); text-decoration: line-through; }
.carta.atenuada { opacity: .28; }
.carta-cuerpo { all: unset; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.carta-cuerpo:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; border-radius: 4px; }
.ctit { font-size: 13.5px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.cest { color: var(--estrella); }
.cmeta { font-size: 11px; color: var(--suave); line-height: 1.3; }
.carta .fuente, .hoyc .fuente { font-size: 11px; padding: 3px 6px; }
.cmenu { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border: 0; background: transparent; color: var(--tenue);
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: 8px; }
.hoy-h { display: flex; flex-direction: column; gap: 12px; }
.franja { position: relative; height: 46px; border-radius: 10px; background: var(--gris); flex: none; margin-top: 12px; }
.franja .hora { position: absolute; top: -15px; transform: translateX(-50%); font-size: 10px; color: var(--tenue); }
.franja .tramo { position: absolute; top: 6px; bottom: 6px; border-radius: 6px; font-size: 10.5px; padding: 3px 5px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; }
.franja .reunion { background: var(--tenue); color: var(--fondo); opacity: .75; }
.franja .libre { background: var(--azul); color: #fff; font-weight: 600; top: 10px; bottom: 10px; display: flex; align-items: center; }
.rejilla { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hoyc { display: flex; gap: 8px; align-items: flex-start; padding: 9px; border-radius: 12px; background: var(--tarjeta);
  border: 1px solid var(--borde); border-left-width: 4px; }
.hoyc .chk { flex: none; width: 26px; height: 26px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--tarjeta); border: 2px solid var(--tenue); cursor: pointer; }
.hoyc .chk.on { background: var(--azul); border-color: var(--azul); }
.hoyc .cuerpo { display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; }
.hoyc.hecha .ctit { color: var(--tenue); text-decoration: line-through; }
.tablero-tema .col { width: 230px; }
.linea-h { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: var(--tarjeta); border: 1px solid var(--borde); }
.linea-h .arriba { display: flex; align-items: center; gap: 8px; }
.lnom { font-size: 14px; font-weight: 600; }
.lbarra { height: 5px; border-radius: 3px; background: var(--gris); overflow: hidden; }
.lbarra span { display: block; height: 100%; min-width: 2px; }
.lpie { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--suave); }
.linea-h ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.linea-h li.hecha { color: var(--tenue); text-decoration: line-through; }
.linea-h .fuente { font-size: 11px; padding: 2px 6px; }
body.apaisado .fab { right: calc(14px + env(safe-area-inset-right)); bottom: 14px; width: 52px; height: 52px; }
body.apaisado #aviso { bottom: 76px; }
body.apaisado #hoja .panel { max-height: 96vh; }
.fila.revisar .cuerpo { cursor: default; }
.botones { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.btn-mas.suave { background: transparent; color: var(--suave); }
.btn-mas.enlace { display: inline-flex; align-items: center; text-decoration: none; }
.badge.urgente { background: var(--rojo-fondo); color: var(--rojo); }
.revisar-sec h2 { color: var(--tinta); }
.col-revisar .col-lista { padding: 6px; border-radius: 12px; background: var(--ambar-fondo); }
.carta.correo { border-left-color: var(--ambar); }
