:root {
  --azul: #1631a6;
  --azul-osc: #0f2378;
  --azul-claro: #eef1fb;
  --amarillo: #fff100;
  --fondo: #f4f5f9;
  --sup: #ffffff;
  --borde: #e3e6ef;
  --borde-f: #d9dce6;
  --texto: #1b1f2e;
  --texto-2: #3a4054;
  --tenue: #5b6275;
  --verde: #1d6b35; --verde-f: #e3f4e8;
  --rojo: #9b1c1c;  --rojo-f: #fde6e4;
  --ambar: #6b4a00; --ambar-f: #fff6cc;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--texto); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; }
a { color: var(--azul); }
a:hover { color: var(--azul-osc); }
h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 17px; font-weight: 700; }
button, input, select { font-family: inherit; font-size: 14px; }

/* ---------- estructura ---------- */
.marco { display: flex; flex-wrap: wrap; min-height: 100vh; }
.menu { flex: 1 1 220px; max-width: 240px; background: var(--azul); color: #fff; display: flex; flex-direction: column; padding-bottom: 20px; }
.menu-franja { height: 6px; background: var(--amarillo); }
.menu-marca { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 2px; }
.menu-marca b { font-size: 18px; }
.menu-marca span { font-size: 12px; color: #c9d2f5; }
.menu-grupo { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.menu-titulo { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #aebbf0; padding: 14px 12px 4px; }
.menu a, .menu .pronto { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #fff; text-decoration: none; font-size: 14px; }
.menu a:hover { background: rgba(255,255,255,.10); color: #fff; }
.menu a.activo { background: var(--amarillo); color: var(--texto); font-weight: 600; }
.menu .pronto { color: #aebbf0; cursor: default; }
.menu .pronto small { margin-left: auto; font-size: 10px; background: rgba(255,255,255,.12); padding: 2px 6px; border-radius: 6px; }
.menu-pie { margin-top: auto; padding: 16px 22px 0; font-size: 12px; color: #c9d2f5; display: flex; flex-direction: column; gap: 8px; }
.menu-pie button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 7px; padding: 7px 10px; cursor: pointer; font-size: 13px; text-align: left; }
.menu-pie button:hover { background: rgba(255,255,255,.1); }
.contenido { flex: 999 1 560px; min-width: 0; padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; }
.encabezado { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.encabezado p { margin: 4px 0 0; color: var(--tenue); font-size: 13px; }

/* ---------- piezas ---------- */
.tarjeta { background: var(--sup); border: 1px solid var(--borde); border-radius: 12px; padding: 16px 18px; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.dato { display: flex; flex-direction: column; gap: 4px; }
.dato small { font-size: 12px; color: var(--tenue); font-weight: 600; }
.dato b { font-size: 26px; }
.dato span { font-size: 12px; color: var(--tenue); }
.columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.lista { display: flex; flex-direction: column; }
.lista > div { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #f0f1f5; }
.lista > div:last-child { border-bottom: none; }
.vacio { color: var(--tenue); font-style: italic; padding: 8px 0; }
.tenue { color: var(--tenue); }

.boton { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 8px; border: none; background: var(--azul); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none; font-size: 14px; }
.boton:hover { background: var(--azul-osc); color: #fff; }
.boton.sec { background: #fff; color: var(--texto-2); border: 1px solid var(--borde-f); }
.boton.sec:hover { background: var(--fondo); color: var(--texto); }
.boton:disabled { opacity: .55; cursor: wait; }

.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 9px; font-size: 14px; line-height: 1.45; }
.aviso.ok { background: var(--verde-f); color: var(--verde); }
.aviso.error { background: var(--rojo-f); color: var(--rojo); }
.aviso.amarillo { background: var(--ambar-f); color: var(--ambar); }
.aviso.info { background: var(--azul-claro); color: var(--azul); }
.aviso svg { flex-shrink: 0; margin-top: 2px; }

.etiqueta { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.t-dia { color: #1631a6; background: #e6ebfb; }
.t-manana { color: #7a4f00; background: #fff1c7; }
.t-tarde { color: #8f3a10; background: #fde5d6; }
.t-vac { color: #1d6b35; background: #e3f4e8; }
.t-singoce { color: #5a3d8a; background: #f1eef7; }
.t-otros { color: #3a4054; background: #eef0f4; }
.t-sintipo { color: #8a1616; background: #fde6e4; }
.t-lic { color: #8a1616; background: #fdeceb; }
.estado { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.estado.activo { background: var(--verde-f); color: var(--verde); }
.estado.otro { background: #eef0f4; color: var(--texto-2); }

.puntos { display: inline-flex; gap: 3px; vertical-align: middle; }
.puntos i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #dfe3ef; }
.puntos i.lleno { background: var(--azul); }
.puntos i.medio { background: linear-gradient(90deg, var(--azul) 50%, #dfe3ef 50%); }
.puntos.grandes i { width: 16px; height: 16px; }
.neg { color: var(--rojo); font-weight: 700; }
.pos { color: var(--verde); font-weight: 700; }

/* ---------- tablas ---------- */
.tabla-caja { background: var(--sup); border: 1px solid var(--borde); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--azul-claro); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-2); padding: 10px 12px; border-bottom: 1px solid var(--borde-f); white-space: nowrap; position: sticky; top: 0; }
td { padding: 10px 12px; border-bottom: 1px solid #eceef4; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8f9fd; }
tr.clic { cursor: pointer; }
td.dif { background: var(--rojo-f); color: var(--rojo); font-weight: 700; }
td.dif small { display: block; font-weight: 500; font-size: 11px; }
.num { text-align: right; white-space: nowrap; }

.barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.buscador { position: relative; flex: 0 1 320px; }
.buscador svg { position: absolute; left: 11px; top: 11px; color: var(--tenue); }
.buscador input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--borde-f); border-radius: 8px; background: #fff; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 20px; border: 1px solid var(--borde-f); background: #fff; color: var(--texto-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.chip:hover { border-color: var(--azul); color: var(--azul); }
.chip.sel { background: var(--azul-claro); border-color: var(--azul); color: var(--azul); }
.chip em { font-style: normal; font-size: 11px; background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 10px; }

/* ---------- formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.campo input { padding: 10px 12px; border: 1px solid #c9cfe0; border-radius: 8px; background: #fff; }
.campo input:focus { outline: 2px solid var(--azul); outline-offset: -1px; }
.subir { border: 2px dashed #c9cfe0; border-radius: 12px; padding: 28px; text-align: center; background: #fafbfe; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- acceso ---------- */
.acceso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--fondo); }
.acceso-caja { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; border-top: 6px solid var(--amarillo); box-shadow: 0 6px 30px rgba(20,30,70,.10); padding: 32px 30px; display: flex; flex-direction: column; gap: 16px; }
.acceso-caja h1 { color: var(--azul); }

/* ---------- ficha ---------- */
.ficha-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 20px; }
.ficha-datos div { display: flex; flex-direction: column; gap: 2px; }
.ficha-datos small { font-size: 12px; color: var(--tenue); font-weight: 600; }
.semana { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.semana div { background: var(--azul-claro); border-radius: 8px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.semana small { font-size: 11px; font-weight: 700; color: var(--azul); text-transform: uppercase; }

@media (max-width: 760px) {
  .menu { max-width: none; flex-basis: 100%; }
  .menu-grupo { flex-direction: row; flex-wrap: wrap; }
  .menu .pronto, .menu-titulo { display: none; }
  .contenido { padding: 18px 16px 40px; }
  .semana { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- etapa 2: hoja de permisos ---------- */
.pasos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; }
.pasos-titulo { font-size: 13px; color: var(--texto-2); margin-right: 4px; }
.paso { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #8a90a2; padding: 5px 10px 5px 5px; border-radius: 20px; }
.paso i { font-style: normal; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #8a90a2; color: #fff; font-size: 12px; font-weight: 700; }
.paso.hecho { color: var(--verde); background: #eef8f1; }
.paso.hecho i { background: var(--verde); }
.paso.actual { color: var(--azul); background: var(--azul-claro); font-weight: 700; }
.paso.actual i { background: var(--azul); }
.flecha { color: #9aa0b2; }
.pasos-ayuda { margin-left: auto; font-size: 13px; color: var(--azul); font-weight: 600; }

.hoja table { min-width: 1120px; }
.hoja td { padding: 8px 10px; }
.hoja tr.borrador td { background: #f7f9ff; border-bottom: 2px solid var(--azul); padding: 6px; }
.hoja tr.borrador.amarillo td { background: #fffbe3; }
.hoja tr.borrador.rojo td { background: #fdeceb; }
.hoja tr.borrador-avisos td { background: #fbfbfe; padding: 8px 12px; }
#b-avisos { display: flex; flex-direction: column; gap: 6px; }
#b-avisos .aviso { padding: 8px 12px; font-size: 13px; }
.celda { width: 100%; padding: 8px 9px; border: 1px solid #c9cfe0; border-radius: 6px; background: #fff; font-size: 13px; color: var(--texto); }
.celda:focus { outline: 2px solid var(--azul); outline-offset: -1px; }
.celda:disabled { background: #f1f2f6; color: #8a90a2; }
.celda.toca, .boton.toca { box-shadow: 0 0 0 3px rgba(22,49,166,.22); border-color: var(--azul); }
.selector { display: flex; align-items: center; gap: 6px; cursor: pointer; text-align: left; min-height: 37px; }
.saldo-borrador { display: flex; flex-direction: column; gap: 1px; }
.saldo-borrador b { font-size: 14px; }
.saldo-borrador small { font-size: 11px; color: var(--tenue); }
.boton.chico { padding: 8px 12px; font-size: 13px; }
.boton:disabled { background: #c3c8d6; cursor: not-allowed; opacity: 1; }
.hoja tr.nueva td { background: #eef8f1; }
.hoja tr.editando td { background: #fff6cc; }
.nombre-fila { color: inherit; text-decoration: none; font-weight: 600; }
.nombre-fila:hover { color: var(--azul); text-decoration: underline; }
.icono-boton { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--texto-2); cursor: pointer; }
.icono-boton:hover { background: var(--azul-claro); color: var(--azul); }
.icono-boton.peligro:hover { background: var(--rojo-f); color: var(--rojo); }
.t-ic { display: inline-flex; }
.t-ic.t-dia, .t-ic.t-manana, .t-ic.t-tarde, .t-ic.t-vac, .t-ic.t-singoce, .t-ic.t-otros, .t-ic.t-sintipo { background: transparent; }
button.chip { cursor: pointer; font-family: inherit; }
select.chip { cursor: pointer; padding-right: 8px; }

.flotante { position: fixed; z-index: 50; background: #fff; border: 1px solid #c9cfe0; border-radius: 10px; box-shadow: 0 10px 28px rgba(20,30,70,.16); overflow: hidden; max-height: 70vh; overflow-y: auto; }
.sug-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: none; background: #fff; padding: 9px 12px; cursor: pointer; color: var(--texto); font-family: inherit; }
.sug-item b { font-size: 14px; font-weight: 600; }
.sug-item small { font-size: 12px; color: var(--tenue); }
.sug-item.sel, .sug-item:hover { background: var(--azul-claro); }
.sug-item.inactivo b { color: var(--tenue); }
.sug-vacio { padding: 10px 12px; color: var(--tenue); font-size: 13px; }
.sug-pie { padding: 6px 12px; font-size: 11px; color: var(--tenue); background: #f6f7fb; border-top: 1px solid #eceef4; }
.tipos { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.tipo-opcion { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: none; background: #fff; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--texto); font-family: inherit; }
.tipo-opcion:hover, .tipo-opcion:focus { background: var(--azul-claro); outline: none; }
.tipo-opcion > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.tipo-opcion b { font-size: 14px; font-weight: 600; }
.tipo-opcion small { font-size: 12px; color: var(--tenue); }
.t-caja { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }

/* ---------- etapa 2: formularios ---------- */
.formulario { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.campo input, .campo select { padding: 10px 12px; border: 1px solid #c9cfe0; border-radius: 8px; background: #fff; }
.campo small { font-size: 12px; color: var(--tenue); }
.acciones { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
input.dias { width: 90px; padding: 7px 9px; border: 1px solid #c9cfe0; border-radius: 7px; text-align: right; }
input.dias.cambiado { border-color: var(--azul); background: var(--azul-claro); }

svg.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.ico-t { stroke-width: 2.2; }

.flotante[hidden], [hidden] { display: none !important; }
