/* Plataforma de tarjetas · Secretaría de Educación Guerrero */
:root {
  --guinda: #A4153D;
  --guinda-osc: #7E0F2F;
  --guinda-suave: #F8E8EC;
  --dorado: #BC955C;
  --dorado-suave: #F6EFE4;
  --texto: #2B2B2B;
  --texto-2: #5A5A5A;
  --borde: #DCDCDC;
  --fondo: #F4F3F1;
  --panel: #FFFFFF;
  --ok: #1E7B4F;
  --ok-suave: #E4F3EB;
  --aviso: #B26A00;
  --aviso-suave: #FFF3DD;
  --error: #B3261E;
  --info: #285C9C;
  --info-suave: #E6EEF8;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--texto);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fondo); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--guinda); }
.oculto { display: none !important; }
.muted { color: var(--texto-2); }
.small { font-size: .85rem; }

/* ---------- Barra superior ---------- */
.barra {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel); border-bottom: 3px solid var(--guinda);
  padding: 8px 20px; position: sticky; top: 0; z-index: 20;
}
.barra img.logo { height: 38px; }
.barra .titulo { font-weight: 700; color: var(--guinda); font-size: 1.05rem; }
.barra .titulo small { display: block; font-weight: 500; color: var(--texto-2); font-size: .8rem; }
.barra .espacio { flex: 1; }
.barra .usuario { text-align: right; font-size: .85rem; color: var(--texto-2); }
.barra .usuario b { color: var(--texto); display: block; }
.conexion { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--texto-2); }
.conexion::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #aaa; }
.conexion.on::before { background: #2DA160; }
.conexion.off::before { background: var(--error); animation: parpadeo 1s infinite; }
@keyframes parpadeo { 50% { opacity: .3; } }

/* ---------- Botones y formularios ---------- */
button, .btn {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 14px;
  border: 1px solid var(--borde); background: var(--panel); color: var(--texto);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
button:hover, .btn:hover { border-color: #bbb; background: #fafafa; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--guinda); border-color: var(--guinda); color: #fff; font-weight: 600; }
.btn-primario:hover { background: var(--guinda-osc); border-color: var(--guinda-osc); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn-ok:hover { background: #17633f; border-color: #17633f; }
.btn-dorado { background: var(--dorado); border-color: var(--dorado); color: #fff; font-weight: 600; }
.btn-dorado:hover { background: #a7834e; }
.btn-peligro { color: var(--error); border-color: #e6b8b5; }
.btn-peligro:hover { background: #fdf0ef; border-color: var(--error); }
.btn-chico { padding: 4px 10px; font-size: .85rem; }
.btn-texto { border: none; background: none; color: var(--guinda); padding: 4px 6px; }
.btn-texto:hover { background: var(--guinda-suave); }

label { display: block; font-size: .85rem; font-weight: 600; color: var(--texto-2); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=search], input[type=tel], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; color: var(--texto);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--guinda); outline-offset: 1px; border-color: var(--guinda); }
textarea { resize: vertical; min-height: 70px; }
.campo { margin-bottom: 12px; }
.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; min-width: 0; }
.opciones { display: flex; gap: 8px; flex-wrap: wrap; }
.opciones label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--texto); border: 1px solid var(--borde);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; margin: 0; background: #fff; }
.opciones label:has(input:checked) { border-color: var(--guinda); background: var(--guinda-suave); color: var(--guinda-osc); }
.opciones input { accent-color: var(--guinda); margin: 0; }
.contador { font-size: .8rem; color: var(--texto-2); text-align: right; margin-top: 2px; }
.contador.excede { color: var(--error); font-weight: 600; }
.error-form { color: var(--error); font-size: .9rem; min-height: 1.2em; margin: 6px 0; }

/* ---------- Paneles ---------- */
.panel { background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; }
.contenedor { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--borde); margin-bottom: 14px; }
.pestanas button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--texto-2); font-weight: 600; }
.pestanas button.activa { color: var(--guinda); border-bottom-color: var(--guinda); }
.pestanas .cuenta { background: var(--guinda); color: #fff; border-radius: 10px; font-size: .75rem; padding: 0 7px; min-width: 20px; }
.herramientas { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.herramientas input[type=search] { max-width: 340px; }
.vacio { text-align: center; color: var(--texto-2); padding: 40px 10px; }

/* ---------- Insignias ---------- */
.insignia { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 20px; background: #eee; color: #555; white-space: nowrap; }
.e-pendiente { background: var(--aviso-suave); color: var(--aviso); }
.e-enviada { background: var(--info-suave); color: var(--info); }
.e-respondida { background: var(--ok-suave); color: var(--ok); }
.e-devuelta { background: #FDECEA; color: var(--error); }
.e-descartada { background: #eee; color: #777; }
.i-urgente { background: var(--error); color: #fff; }
.i-aliado { background: var(--dorado-suave); color: #8a6a37; }
.i-problematica { background: var(--guinda-suave); color: var(--guinda); }
.i-vivo { background: #E8E3F6; color: #5B3FA8; }
.i-editada { background: #EEE; color: #555; }

/* ---------- Lista de elementos (mini tarjetas) ---------- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 12px; cursor: pointer;
  border-left: 4px solid var(--guinda); transition: box-shadow .15s, border-color .15s; }
.item.aliado { border-left-color: var(--dorado); }
.item:hover { box-shadow: var(--sombra); }
.item.sel { border-color: var(--guinda); box-shadow: 0 0 0 2px var(--guinda-suave); }
.item .tit { font-weight: 700; margin: 3px 0; }
.item .sub { font-size: .85rem; color: var(--texto-2); }
.item .linea { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.item .acciones { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.item .recorte { font-size: .88rem; color: var(--texto-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .nota { font-size: .85rem; background: var(--aviso-suave); border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.item .comentario { font-size: .85rem; background: #FDECEA; border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rejilla .item { cursor: default; }
@keyframes llegada { from { background: var(--aviso-suave); } to { background: var(--panel); } }
.item.nueva { animation: llegada 3s ease-out; }

/* ---------- Tarjeta (formato oficial) ---------- */
.tarjeta { --escala: 1; background: #fff; border: 2px solid var(--guinda); border-radius: 6px; overflow: hidden; color: #222;
  font-size: calc(15px * var(--escala)); }
.tarjeta.aliado { border-color: var(--dorado); }
.t-cab { background: var(--guinda); color: #fff; font-weight: 700; padding: .5em .9em; letter-spacing: .02em; font-size: 1.05em;
  display: flex; justify-content: space-between; gap: 1em; align-items: center; }
.tarjeta.aliado .t-cab { background: var(--dorado); }
.t-cab .t-num { font-weight: 500; font-size: .85em; opacity: .9; }
.t-meta { display: grid; grid-template-columns: 1.2fr 1.4fr .9fr; border-bottom: 1.5px solid var(--guinda); }
.tarjeta.aliado .t-meta { border-color: var(--dorado); }
.t-meta > div { padding: .45em .8em; border-right: 1.5px solid var(--guinda); min-width: 0; }
.tarjeta.aliado .t-meta > div { border-color: var(--dorado); }
.t-meta > div:last-child { border-right: none; }
.t-rot { color: var(--guinda); font-weight: 700; font-size: .72em; text-transform: uppercase; letter-spacing: .03em; }
.tarjeta.aliado .t-rot { color: #8a6a37; }
.t-val { font-size: 1em; font-weight: 600; overflow-wrap: anywhere; }
.t-val .partido { display: inline-block; font-size: .8em; font-weight: 700; background: #f0f0f0; padding: 0 .4em; border-radius: 4px; margin-left: .3em; }
.t-bloque { padding: .55em .9em; border-bottom: 1.5px solid var(--guinda); }
.tarjeta.aliado .t-bloque { border-color: var(--dorado); }
.t-bloque:last-child { border-bottom: none; }
.t-pregunta .t-txt { font-size: 1em; color: #333; font-style: italic; white-space: pre-wrap; }
.t-respuesta .t-txt { font-size: 1.45em; line-height: 1.38; font-weight: 500; white-space: pre-wrap; color: #111; }
.t-cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(9em, 1fr)); gap: .6em; margin-top: .3em; }
.t-cifra { background: var(--guinda-suave); border-radius: 6px; padding: .5em .7em; }
.tarjeta.aliado .t-cifra { background: var(--dorado-suave); }
.t-cifra .v { font-size: 1.9em; font-weight: 800; color: var(--guinda); line-height: 1.1; }
.tarjeta.aliado .t-cifra .v { color: #8a6a37; }
.t-cifra .e { font-size: .88em; color: #333; line-height: 1.25; }
.t-grafica .t-tit-graf { font-weight: 700; font-size: .95em; margin-bottom: .3em; }
.t-grafica .lienzo { position: relative; height: calc(230px * var(--escala)); max-height: 46vh; }
.t-tabla { width: 100%; border-collapse: collapse; font-size: .95em; }
.t-tabla th, .t-tabla td { border-bottom: 1px solid #e5e5e5; padding: .3em .5em; text-align: right; }
.t-tabla th:first-child, .t-tabla td:first-child { text-align: left; }
.t-tabla thead th { color: var(--guinda); border-bottom: 2px solid var(--guinda); font-size: .85em; text-transform: uppercase; }
.t-fuente { font-size: .78em; color: #666; padding: .35em .9em .5em; }

/* ---------- Editor de tarjeta ---------- */
.editor { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.1fr); gap: 18px; align-items: start; }
.editor .formulario { max-height: calc(100vh - 190px); overflow: auto; padding-right: 6px; }
.editor .vista { position: sticky; top: 0; }
.editor .vista .rot-vista { font-size: .8rem; color: var(--texto-2); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; }
.cifra-fila { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; margin-bottom: 6px; }
fieldset { border: 1px solid var(--borde); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
legend { font-weight: 700; font-size: .85rem; color: var(--guinda); padding: 0 6px; }
.ayuda { font-size: .8rem; color: var(--texto-2); margin: 4px 0 8px; }
textarea.datos { font-family: Consolas, "Courier New", monospace; font-size: .85rem; min-height: 110px; white-space: pre; }

/* ---------- Diálogos ---------- */
dialog { border: none; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-width: min(560px, 94vw); width: 100%; }
dialog.ancho { max-width: min(1240px, 96vw); }
dialog::backdrop { background: rgba(20,10,14,.45); }
dialog .d-cab { padding: 14px 18px; border-bottom: 1px solid var(--borde); display: flex; align-items: center; justify-content: space-between; }
dialog .d-cab h2 { margin: 0; }
dialog .d-cuerpo { padding: 16px 18px; max-height: calc(100vh - 170px); overflow: auto; }
dialog .d-pie { padding: 12px 18px; border-top: 1px solid var(--borde); display: flex; gap: 8px; justify-content: flex-end; background: #fafafa; }

/* ---------- Avisos ---------- */
#avisos { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.aviso { background: #222; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--sombra); max-width: 360px; font-size: .92rem;
  animation: entra .2s ease-out; }
.aviso.error { background: var(--error); }
.aviso.ok { background: var(--ok); }
.aviso.alerta { background: var(--aviso); }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Acceso ---------- */
.acceso { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 30px 16px;
  background: linear-gradient(160deg, var(--guinda) 0%, var(--guinda-osc) 60%, #4d0a1d 100%); }
.acceso .caja { background: #fff; border-radius: 16px; padding: 28px 30px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.acceso .caja.amplia { max-width: 560px; }
.acceso .logos { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.acceso .logos img:first-child { height: 46px; }
.acceso .logos img:last-child { height: 62px; border-radius: 4px; }
.acceso h1 { font-size: 1.25rem; color: var(--guinda); }
.acceso .pie { margin-top: 14px; font-size: .9rem; text-align: center; }
.acceso button[type=submit] { width: 100%; padding: 11px; margin-top: 6px; }
.exito { background: var(--ok-suave); color: var(--ok); padding: 14px; border-radius: 8px; }

/* ---------- Mesa revisora ---------- */
.mesa { display: grid; grid-template-columns: 330px minmax(0, 1fr) 360px; gap: 14px; padding: 14px; height: calc(100vh - 57px); }
.mesa > section { min-height: 0; display: flex; flex-direction: column; }
.mesa .col { background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 12px; display: flex; flex-direction: column; min-height: 0; }
.mesa .col + .col { margin-top: 14px; }
.mesa .scroll { overflow: auto; min-height: 0; flex: 1; padding: 2px; }
.mesa .pestanas { margin-bottom: 10px; }
.mesa .pestanas button { padding: 8px 10px; font-size: .9rem; }
.detalle-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: .9rem; }
.detalle-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 12px; padding: 10px 0; border-bottom: 1px solid var(--borde);
  position: sticky; top: -2px; background: var(--panel); z-index: 2; }
.detalle-acciones .btn-ok { font-size: 1.02rem; padding: 9px 18px; }
.pantalla-sec { border: 3px solid #222; border-radius: 10px; overflow: hidden; background: #222; }
.pantalla-sec .marco { background: #fff; max-height: 330px; overflow: auto; }
.pantalla-sec .marco .tarjeta { --escala: .62; border: none; border-radius: 0; }
.pantalla-sec .rot { color: #fff; font-size: .75rem; padding: 4px 8px; display: flex; justify-content: space-between; }
.solicitud { border-left: 4px solid var(--error); background: #FDECEA; border-radius: 6px; padding: 8px 10px; }
.solicitud.atendida { border-left-color: #bbb; background: #f4f4f4; color: #777; }
.solicitud .s-txt { font-weight: 700; }

/* ---------- Secretario ---------- */
body.secretario { background: #ECEAE7; }
.sec-barra { display: flex; align-items: center; gap: 12px; padding: 6px 16px; background: #fff; border-bottom: 3px solid var(--guinda); }
.sec-barra img { height: 30px; }
.sec-barra .espacio { flex: 1; }
.sec-main { padding: 14px 18px 110px; max-width: 1400px; margin: 0 auto; }
.sec-main .tarjeta { --escala: 1.25; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.sec-pie { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--borde); padding: 12px 18px;
  display: flex; gap: 12px; justify-content: center; align-items: center; box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.sec-pie button { font-size: 1.1rem; padding: 12px 26px; border-radius: 10px; }
.espera { text-align: center; padding: 18vh 20px; color: var(--texto-2); }
.espera img { height: 130px; opacity: .9; margin-bottom: 18px; border-radius: 8px; }
.espera h1 { color: var(--guinda); font-size: 1.8rem; }
.banda { padding: 10px 16px; border-radius: 10px; margin-bottom: 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-weight: 600; }
.banda.historial { background: var(--info-suave); color: var(--info); }
.banda.cola { background: var(--aviso-suave); color: var(--aviso); }
.banda.respondida { background: var(--ok-suave); color: var(--ok); }
@keyframes destello { 0% { box-shadow: 0 0 0 0 rgba(164,21,61,.7); } 100% { box-shadow: 0 0 0 26px rgba(164,21,61,0); } }
.tarjeta.llego { animation: destello 1s ease-out 2; }
.cajon { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw); background: #fff; z-index: 50; box-shadow: -8px 0 30px rgba(0,0,0,.2);
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform .2s ease-out; }
.cajon.abierto { transform: none; }
.cajon .c-cab { padding: 14px 16px; border-bottom: 1px solid var(--borde); display: flex; justify-content: space-between; align-items: center; }
.cajon .c-cuerpo { overflow: auto; padding: 12px; flex: 1; }
.opciones-rapidas { display: flex; flex-direction: column; gap: 8px; }
.opciones-rapidas button { justify-content: flex-start; padding: 12px 14px; font-size: 1rem; }
body.oscuro.secretario { background: #1b1b1d; }
body.oscuro .sec-barra, body.oscuro .sec-pie { background: #26262a; border-color: #333; color: #ddd; }
body.oscuro .espera { color: #aaa; }

/* ---------- Administración ---------- */
table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tabla th { text-align: left; font-size: .78rem; text-transform: uppercase; color: var(--texto-2); border-bottom: 2px solid var(--borde); padding: 8px; }
table.tabla td { border-bottom: 1px solid #eee; padding: 8px; vertical-align: top; }
table.tabla select { padding: 4px 6px; width: auto; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid .ancho { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .mesa { grid-template-columns: 300px 1fr; height: auto; }
  .mesa > section:last-child { grid-column: 1 / -1; }
  .editor { grid-template-columns: 1fr; }
  .editor .formulario { max-height: none; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .mesa { grid-template-columns: 1fr; }
  .t-meta { grid-template-columns: 1fr; }
  .t-meta > div { border-right: none; border-bottom: 1.5px solid var(--guinda); }
  .barra { padding: 8px 12px; }
  .barra img.logo { height: 28px; }
}
@media print {
  .barra, .herramientas, .acciones, .pestanas { display: none !important; }
}
