/* FH Tareas — sistema de diseño según handoff "sidebar + tablero compacto" (08/2026).
   Tokens: IBM Plex Sans, bordó #7a2436, fondo #f4f5f7, cards blancas radius 10. */
:root {
  --primario: #7a2436;
  --primario-oscuro: #5c1a29;
  --primario-suave: #f8eef0;
  --fondo: #f4f5f7;
  --tarjeta: #ffffff;
  --borde: #e4e6ea;
  --borde-interno: #e9ebee;
  --borde-fila: #f0f1f4;
  --borde-input: #dfe2e8;
  --texto: #23262d;
  --texto-2: #3d4250;
  --texto-3: #5c6270;
  --suave: #6a7080;
  --apagado: #8a8f9b;
  --vacio: #d4d8df;
  --verde: #3f9d63;
  --amarillo: #9a6a10;
  --amarillo-fondo: #fcf5e3;
  --amarillo-borde: #f0e3bd;
  --rojo: #b3362b;
  --rojo-punto: #c4453a;
  --rojo-fondo: #fdf1f0;
  --azul: #4a6fd4;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

/* ---------- shell: sidebar + contenido ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 206px; flex: none; background: #fff; border-right: 1px solid var(--borde);
  padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .marca { display: flex; align-items: center; gap: 9px; padding: 0 4px; text-decoration: none; color: inherit; }
.sidebar .marca img { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.sidebar .marca .nombre { font-size: 13px; font-weight: 600; line-height: 1.1; }
.sidebar .marca .bajada { font-size: 10.5px; color: var(--apagado); }
.sidebar .buscador-global {
  background: var(--borde-fila); border: 0; border-radius: 8px; padding: 5px 10px;
  font-size: 11.5px; color: var(--apagado); display: flex; gap: 8px; align-items: center;
  cursor: pointer; text-align: left; width: 100%; margin: 0; font-family: inherit;
}
.sidebar .buscador-global:hover { background: #e9ebee; }
.sidebar .buscador-global kbd {
  margin-left: auto; font-size: 9.5px; background: #fff; border: 1px solid var(--borde-input);
  border-radius: 4px; padding: 0 5px; color: var(--texto-3); font-family: inherit;
}
.sidebar .grupo-label {
  font-size: 9.5px; letter-spacing: 1.2px; color: #9aa0ab; font-weight: 600;
  padding: 0 8px 5px; text-transform: uppercase;
}
.sidebar .grupo { display: flex; flex-direction: column; gap: 1px; }
.sidebar .grupo a {
  padding: 5px 8px; border-radius: 7px; font-size: 12.5px; color: var(--texto-2);
  text-decoration: none; display: flex; justify-content: space-between; align-items: center;
}
.sidebar .grupo a:hover { background: var(--borde-fila); }
.sidebar .grupo a.activo { background: var(--primario-suave); color: var(--primario); font-weight: 600; }
.sidebar .badge {
  font-size: 10px; font-weight: 700; background: var(--borde-fila); color: var(--texto-3);
  border-radius: 999px; padding: 1px 6px;
}
.sidebar .grupo a.activo .badge { background: var(--primario); color: #fff; }
.sidebar .pie-usuario {
  margin-top: auto; border-top: 1px solid #eceef1; padding: 9px 6px 0;
  display: flex; align-items: center; gap: 8px;
}
.sidebar .avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #e9e2df; color: var(--primario);
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
}
.sidebar .pie-usuario .quien { font-size: 12px; color: var(--texto-2); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .pie-usuario a { font-size: 11px; color: var(--apagado); text-decoration: none; }

.contenido { flex: 1; min-width: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 20px 60px; }

/* barra superior solo para celular */
.barra-movil {
  display: none; background: #fff; border-bottom: 1px solid var(--borde);
  padding: 10px 14px; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 55;
}
.barra-movil img { width: 28px; height: 28px; border-radius: 7px; }
.barra-movil .titulo { font-weight: 600; font-size: 14px; }
.barra-movil button { background: none; border: 1px solid var(--borde-input); color: var(--texto-2);
  border-radius: 7px; padding: 4px 10px; font-size: 16px; margin: 0; line-height: 1; }
.telon { display: none; position: fixed; inset: 0; background: rgba(35,38,45,.4); z-index: 70; }

@media (max-width: 1100px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 80; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }
  .app-shell.menu-abierto .sidebar { transform: none; }
  .app-shell.menu-abierto .telon { display: block; }
  .barra-movil { display: flex; }
  main { padding: 14px 12px 60px; }
}

/* ---------- base ---------- */
h1 { font-size: 17px; font-weight: 600; margin: 6px 0 12px; }
h2 { font-size: 15px; font-weight: 600; margin: 22px 0 10px; }
h3 { font-size: 13px; margin: 0 0 6px; }
.suave { color: var(--suave); font-size: 12.5px; }
.oculto { display: none !important; }
a { color: var(--primario); }

.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px;
  padding: 16px; margin-bottom: 14px;
}
.tarjeta.login { max-width: 380px; margin: 6vh auto; text-align: center; }
.tarjeta.login form { text-align: left; }
.tarjeta.login .logo { max-width: 220px; width: 70%; margin: 0 auto 8px; display: block; }
.tarjeta.login .logo-tile { width: 72px; height: 72px; border-radius: 16px; margin: 8px auto 12px;
                            display: block; box-shadow: 0 4px 14px rgba(122, 36, 54, .25); }
.tarjeta.login .marca-login { font-size: 19px; font-weight: 700; color: var(--texto); letter-spacing: .2px; }
/* instancias de otro estudio: inicial sobre bordó en vez del logo F&H */
.marca-inicial { display: flex; align-items: center; justify-content: center;
                 width: 34px; height: 34px; border-radius: 9px; background: var(--primario);
                 color: #fff; font-weight: 700; font-size: 17px; flex: none; }
.tarjeta.login .marca-inicial { width: 72px; height: 72px; border-radius: 16px; margin: 8px auto 12px;
                                box-shadow: 0 4px 14px rgba(122, 36, 54, .25); }

label { display: block; font-size: 12.5px; font-weight: 600; margin: 10px 0 4px; color: var(--texto-2); }
input, select, textarea {
  width: 100%; padding: 8px 10px; font-size: 14px; border: 1px solid var(--borde-input);
  border-radius: 7px; background: #fff; margin-top: 4px; font-family: inherit; color: var(--texto);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--primario); outline-offset: 1px;
}
input::placeholder { color: var(--apagado); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primario); }
input.mini { width: 70px; padding: 6px; }
input.mediano { width: 130px; padding: 6px; }

button {
  background: var(--primario); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; margin-top: 8px;
  font-family: inherit;
}
button:hover { background: var(--primario-oscuro); }
button.principal { width: 100%; padding: 13px; font-size: 16px; font-weight: 700; margin-top: 14px; }
button.chico { padding: 5px 10px; font-size: 12px; margin: 0; }
button.peligro { background: #fff; border: 1px solid var(--borde-input); color: var(--rojo); }
button.peligro:hover { background: var(--rojo-fondo); }
button.gris, button.secundario { background: #fff; border: 1px solid var(--borde-input); color: var(--texto-2); }
button.gris:hover, button.secundario:hover { background: var(--borde-fila); }
button.atajo { background: var(--primario-suave); color: var(--primario); padding: 7px 12px; font-size: 13px; margin: 0; }
.atajos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.fila-doble { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.en-linea { display: flex; gap: 8px; align-items: center; }
.en-linea input { margin-top: 0; }
.en-linea button { margin-top: 0; }
.buscador { margin-bottom: 14px; }
.selector-periodo { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.selector-periodo label { display: flex; align-items: center; gap: 8px; margin: 0; }
.selector-periodo select, .selector-periodo input { width: auto; margin: 0; }

.aviso { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px; }
.aviso.ok { background: #e8f5ee; color: #1b7a4e; border: 1px solid #cfe9db; }
.aviso.error { background: var(--rojo-fondo); color: var(--rojo); border: 1px solid #f4d9d6; }

.tabla-envoltura { overflow-x: auto; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--borde-fila); vertical-align: middle; }
th { background: #f8f9fb; font-size: 10.5px; color: var(--suave); font-weight: 600;
     letter-spacing: .4px; text-transform: uppercase; border-bottom: 1px solid var(--borde-interno); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: #fbfbfd; }
.fila-alerta, .fila-alerta:hover td { background: var(--rojo-fondo); }
.fila-inactiva { opacity: .5; }
.alerta-texto { color: var(--rojo); }

.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.chip.verde { background: #e8f5ee; color: var(--verde); }
.chip.amarillo { background: var(--amarillo-fondo); color: var(--amarillo); }
.chip.azul { background: var(--primario-suave); color: var(--primario); }
.chip.rojo { background: var(--rojo-fondo); color: var(--rojo); }
.chip.gris { background: var(--borde-fila); color: var(--texto-3); }
input.mensual { width: 110px; padding: 6px; }
.copiar { float: right; }

/* KPIs: barra única estilo handoff */
.tarjetas-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tarjeta.resumen { text-align: center; padding: 12px; margin-bottom: 0; }
.tarjeta.resumen .numero { font-size: 24px; font-weight: 700; margin: 4px 0; color: var(--texto);
  font-variant-numeric: tabular-nums; }
.tarjeta.resumen h3 { font-size: 11px; color: var(--apagado); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.borde-rojo { border-color: #f4d9d6; }
.borde-rojo .numero { color: var(--rojo); }

.kpi-barra {
  background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  display: flex; align-items: center; padding: 12px 18px; gap: 20px; margin-bottom: 12px;
  overflow-x: auto;
}
.kpi-barra .kpi { display: flex; align-items: baseline; gap: 8px; flex: none; }
.kpi-barra .kpi .numero { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-barra .kpi .rojo { color: var(--rojo); }
.kpi-barra .kpi .ambar { color: var(--amarillo); }
.kpi-barra .kpi .etiqueta { font-size: 11.5px; color: var(--apagado); line-height: 1.25; }
.kpi-barra .separador { width: 1px; height: 30px; background: var(--borde); flex: none; }
.kpi-barra .alerta-ambar {
  margin-left: auto; font-size: 11.5px; color: var(--amarillo); background: var(--amarillo-fondo);
  border: 1px solid var(--amarillo-borde); border-radius: 6px; padding: 4px 10px; white-space: nowrap;
  text-decoration: none; flex: none;
}

/* control segmentado (vistas) */
.segmentado { display: flex; border: 1px solid var(--borde-input); border-radius: 8px; overflow: hidden; background: #fff; flex: none; }
.segmentado a { padding: 5px 11px; font-size: 12px; color: var(--texto-3); text-decoration: none; white-space: nowrap; }
.segmentado a + a { border-left: 1px solid var(--borde-input); }
.segmentado a.activo { background: var(--texto-2); color: #fff; font-weight: 600; }

.encabezado-vista { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.encabezado-vista h1 { margin: 0; white-space: nowrap; }
.encabezado-vista .acciones { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.lista-pendientes { padding-left: 20px; }
.lista-pendientes li { margin-bottom: 4px; font-size: 13.5px; }

/* cuadro de edición (dialog nativo) */
dialog {
  border: 1px solid var(--borde); border-radius: 12px; padding: 0;
  max-width: 440px; width: 92%; box-shadow: 0 10px 40px rgba(0,0,0,.25); color: var(--texto);
}
dialog::backdrop { background: rgba(35,38,45,.45); }
dialog .cabecera { background: var(--primario); color: #fff; padding: 12px 18px; font-weight: 700; }
dialog .cuerpo { padding: 18px; }
dialog .pie { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
dialog .separador { border-top: 1px solid var(--borde); margin: 18px 0 14px; }
dialog button.gris { background: #fff; border: 1px solid var(--borde-input); color: var(--texto-2); }
.editar-link { background: none; border: 1px solid var(--borde-input); color: var(--primario); padding: 5px 12px;
  border-radius: 8px; font-size: 12px; cursor: pointer; margin: 0; }
.editar-link:hover { background: var(--primario-suave); }

@media (max-width: 600px) {
  .fila-doble { grid-template-columns: 1fr; gap: 0; }
  th, td { padding: 7px 6px; }
  .encabezado-vista .acciones { margin-left: 0; width: 100%; }
}

/* modo espejo */
.banda-espejo {
  background: var(--texto); color: #fff; padding: 9px 18px;
  display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 60; font-size: 13.5px;
}
.banda-espejo form { margin: 0; }
.banda-espejo button {
  background: #fff; color: var(--texto); border: 0; border-radius: 8px;
  padding: 5px 14px; font-size: 13px; cursor: pointer; margin: 0;
}

/* buscador global (Ctrl/⌘K) */
.paleta-telon { position: fixed; inset: 0; background: rgba(35,38,45,.4); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.paleta { background: #fff; border-radius: 12px; width: min(520px, 92vw);
  box-shadow: 0 18px 60px rgba(0,0,0,.28); overflow: hidden; }
.paleta input { border: 0; border-bottom: 1px solid var(--borde-interno); border-radius: 0;
  padding: 14px 16px; font-size: 15px; margin: 0; }
.paleta input:focus { outline: none; }
.paleta .resultados { max-height: 46vh; overflow-y: auto; padding: 6px; }
.paleta .resultados a { display: flex; justify-content: space-between; padding: 8px 10px;
  border-radius: 7px; font-size: 13px; color: var(--texto-2); text-decoration: none; }
.paleta .resultados a .tipo { color: var(--apagado); font-size: 11px; }
.paleta .resultados a:hover, .paleta .resultados a.marcado { background: var(--primario-suave); color: var(--primario); }
.paleta .nada { padding: 14px; color: var(--apagado); font-size: 13px; }

/* matriz de vencimientos estilo handoff */
.venc-matriz table { font-variant-numeric: tabular-nums; }
.venc-matriz th:first-child { min-width: 190px; }
.venc-matriz td { height: 38px; padding: 0 8px; }
.venc-matriz td:first-child { font-size: 12.5px; font-weight: 600; padding: 0 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.venc-matriz .celda { text-align: center; font-size: 11.5px; white-space: nowrap; }
.venc-matriz .celda a { text-decoration: none; color: inherit; display: block; }
.venc-matriz .celda .punto { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 5px; vertical-align: 1px; }
.venc-matriz .celda .cod { color: var(--apagado); }
.venc-matriz .celda .cod.ok { color: var(--verde); font-weight: 700; }
.venc-matriz .celda .cod.tarde { color: #b35a17; font-weight: 700; }
.venc-matriz .celda .cod.vencida { color: var(--rojo); font-weight: 700; }
.venc-matriz .celda.vacia { color: var(--vacio); font-size: 11px; }
.venc-matriz td.celda-vencida { background: var(--rojo-fondo); }
.venc-matriz td.celda-vencida strong { color: var(--rojo); }
.venc-matriz .filtros { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-bottom: 1px solid var(--borde-interno); flex-wrap: wrap; }
.venc-matriz .filtros input, .venc-matriz .filtros select { width: auto; margin: 0; padding: 5px 10px; font-size: 12px; }
.venc-matriz .filtros .links { margin-left: auto; display: flex; gap: 12px; font-size: 12px; font-weight: 600; }
.venc-matriz .filtros .links a { text-decoration: none; }
.venc-matriz .stepper { display: flex; align-items: center; border: 1px solid var(--borde-input);
  border-radius: 7px; overflow: hidden; font-size: 12px; flex: none; background: #fff; }
.venc-matriz .stepper a { padding: 4px 9px; color: var(--apagado); text-decoration: none; }
.venc-matriz .stepper a:hover { background: var(--borde-fila); }
.venc-matriz .stepper .mes { padding: 4px 11px; font-weight: 600; border-left: 1px solid var(--borde-input);
  border-right: 1px solid var(--borde-input); }
.venc-matriz .pie-tabla { display: flex; align-items: center; padding: 8px 12px; gap: 14px;
  border-top: 1px solid var(--borde-interno); font-size: 11.5px; color: var(--apagado); flex-wrap: wrap; }
.venc-matriz .pie-tabla .leyenda { margin-left: auto; }
