/* SYNTAXIA Kanban — estilos compartidos (web y Android) */
:root {
    --fondo: #F4F6FA; --superficie: #FFFFFF; --borde: #E2E8F0; --texto: #0F172A; --suave: #64748B;
    --primario: #2563EB; --primario-osc: #1D4ED8; --peligro: #DC2626; --aviso: #D97706; --ok: #16A34A;
    --barra: #0B1220; --radio: 10px; --sombra: 0 1px 2px rgba(15,23,42,.06), 0 2px 8px rgba(15,23,42,.06);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--texto);
}
@media (prefers-color-scheme: dark) {
    :root { --fondo: #0B1220; --superficie: #111A2E; --borde: #22304A; --texto: #E2E8F0; --suave: #94A3B8; --barra: #060B16; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); height: 100%; }
h1 { font-size: 1.35rem; margin: 0; }
h3 { margin: 0 0 .75rem; font-size: 1rem; }
h4 { margin: 1.1rem 0 .4rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); }
input, select, textarea { font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borde);
    border-radius: 8px; padding: .5rem .6rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primario) 40%, transparent); border-color: var(--primario); }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; width: 44px; height: 34px; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--suave); }
label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--texto); white-space: nowrap; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .85em; }
.nota { color: var(--suave); font-size: .82rem; }
.vacio, .vacio-col { color: var(--suave); text-align: center; padding: 2rem 1rem; font-size: .9rem; }
.vacio-col { padding: 1rem; border: 1px dashed var(--borde); border-radius: 8px; }

/* Botones */
.btn { border: 1px solid var(--borde); background: var(--superficie); color: var(--texto); padding: .5rem .9rem; border-radius: 8px;
    cursor: pointer; font: inherit; font-size: .9rem; white-space: nowrap; }
.btn:hover { border-color: var(--primario); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primario { background: var(--primario); border-color: var(--primario); color: #fff; }
.btn-primario:hover { background: var(--primario-osc); }
.btn-peligro { color: var(--peligro); border-color: color-mix(in srgb, var(--peligro) 40%, var(--borde)); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-icono { background: none; border: 0; color: inherit; font-size: 1.25rem; cursor: pointer; padding: .1rem .4rem; border-radius: 6px; line-height: 1; }
.btn-icono:hover:not(:disabled) { background: color-mix(in srgb, var(--suave) 15%, transparent); }
.btn-icono:disabled { opacity: .25; }
.btn-link { background: none; border: 0; color: inherit; cursor: pointer; text-decoration: underline; font: inherit; font-size: .85rem; }
.ancho { width: 100%; }

/* Estructura */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem; padding: .55rem 1.25rem;
    background: var(--barra); color: #E2E8F0; }
.marca { display: flex; align-items: center; gap: .6rem; }
.marca strong { display: block; letter-spacing: .08em; font-size: .95rem; }
.marca small { display: block; color: #94A3B8; font-size: .72rem; }
.marca.grande { margin-bottom: 1.25rem; }
.marca.grande strong { color: var(--texto); font-size: 1.2rem; }
.logo { width: 38px; height: 38px; object-fit: contain; }
.marca.grande .logo { width: 64px; height: 64px; }
.login .marca.grande { background: #0B1220; border-radius: 12px; padding: .8rem 1rem; }
.login .marca.grande strong { color: #fff; }
.menu { display: flex; gap: .25rem; flex: 1; }
.menu a { color: #CBD5E1; text-decoration: none; padding: .45rem .8rem; border-radius: 8px; font-size: .9rem; }
.menu a:hover { background: rgba(255,255,255,.07); }
.menu a.active { background: rgba(37,99,235,.25); color: #fff; }
.usuario { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.usuario strong, .usuario small { display: block; }
.usuario small { color: #94A3B8; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: #64748B; }
.punto.en-linea { background: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700;
    background: #334155; color: #fff; flex-shrink: 0; }
.avatar.sm { width: 22px; height: 22px; font-size: .6rem; }
.contenido { padding: 1rem 1.25rem 2rem; flex: 1; min-width: 0; }
.pagina-cab { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filtros input, .filtros select { width: auto; min-width: 150px; }
.filtros .buscar { min-width: 220px; }
.filtros label { flex-direction: row; align-items: center; }
.solo-movil { display: none; }

/* Tablero */
.tablero { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: .75rem; overflow-x: auto;
    padding-bottom: .5rem; scroll-snap-type: x mandatory; align-items: start; }
.columna { background: color-mix(in srgb, var(--superficie) 60%, var(--fondo)); border: 1px solid var(--borde); border-top: 4px solid var(--col);
    border-radius: var(--radio); display: flex; flex-direction: column; max-height: calc(100vh - 190px); scroll-snap-align: start; transition: background .15s; }
.columna.sobre { background: color-mix(in srgb, var(--col) 12%, var(--superficie)); outline: 2px dashed var(--col); }
.columna.excedida { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--peligro) 45%, transparent); }
.columna-cab { display: flex; justify-content: space-between; align-items: center; padding: .65rem .75rem; cursor: help; }
.columna-nombre { font-weight: 700; font-size: .9rem; }
.nota-col { font-size: .72rem; color: var(--suave); padding: 0 .75rem .3rem; }
.columna-cuerpo { padding: 0 .5rem .6rem; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.wip { font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--suave) 18%, transparent); font-style: normal; }
.wip-ok { background: #DCFCE7; color: #166534; }
.wip-lleno { background: #FEF3C7; color: #92400E; }
.wip-excedido { background: #FEE2E2; color: #991B1B; }

.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-left: 4px solid var(--clase); border-radius: 8px; padding: .55rem .6rem;
    box-shadow: var(--sombra); cursor: pointer; display: flex; flex-direction: column; gap: .35rem; position: relative; }
.tarjeta[draggable=true] { cursor: grab; }
.tarjeta:hover { border-color: color-mix(in srgb, var(--primario) 50%, var(--borde)); }
.tarjeta.bloqueada { background: repeating-linear-gradient(135deg, var(--superficie), var(--superficie) 10px, color-mix(in srgb, var(--peligro) 6%, var(--superficie)) 10px, color-mix(in srgb, var(--peligro) 6%, var(--superficie)) 20px); }
.tarjeta.hecha { opacity: .75; }
.tarjeta-cab { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.codigo { font-family: Consolas, monospace; font-size: .72rem; color: var(--suave); margin-right: auto; }
.tarjeta-titulo { font-size: .86rem; line-height: 1.3; font-weight: 500; }
.tarjeta-pie { display: flex; align-items: center; gap: .4rem; font-size: .72rem; color: var(--suave); }
.tarjeta-pie .modulo { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.tarjeta-mover { display: none; position: absolute; right: .3rem; top: .3rem; background: var(--superficie); border-radius: 6px; }
.tarjeta:hover .tarjeta-mover { display: flex; }
.chip { font-size: .64rem; font-weight: 700; padding: .1rem .4rem; border-radius: 4px; background: color-mix(in srgb, var(--suave) 15%, transparent); font-style: normal; }
.chip-bloq { background: #FEE2E2; color: #991B1B; }
.chip-urg { background: #DC2626; color: #fff; }
.chip-bug { background: #FCE7F3; color: #9D174D; }
.chip-aviso { background: #FEF3C7; color: #92400E; }
.prio { font-size: .8rem; }
.prio-1 { color: #DC2626; } .prio-2 { color: #D97706; } .prio-3 { color: #94A3B8; }
.edad { font-weight: 700; font-style: normal; }
.edad.vieja { color: #fff; background: var(--aviso); padding: 0 .35rem; border-radius: 4px; }
.leyenda { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .78rem; color: var(--suave); margin-top: .75rem; }
.leyenda span { display: flex; gap: .35rem; align-items: center; }

/* Panel lateral de detalle */
.panel-fondo { position: fixed; inset: 0; background: rgba(2,6,23,.35); z-index: 40; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--superficie); z-index: 41;
    overflow-y: auto; padding: 1rem 1.25rem 2rem; box-shadow: -8px 0 30px rgba(2,6,23,.2); animation: entra .18s ease-out; }
@keyframes entra { from { transform: translateX(30px); opacity: 0; } }
.panel-cab { display: flex; justify-content: space-between; align-items: center; border-left: 4px solid var(--clase); padding-left: .6rem; }
.panel-cab .estado { font-size: .78rem; font-weight: 700; margin: 0 .5rem; padding: .15rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--primario) 14%, transparent); color: var(--primario); }
.panel-titulo { font-size: 1.15rem; margin: .6rem 0; }
.acciones { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.datos { display: grid; grid-template-columns: 130px 1fr; gap: .35rem .75rem; font-size: .86rem; margin: .5rem 0; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.descripcion { white-space: pre-wrap; font-size: .9rem; background: var(--fondo); padding: .6rem .75rem; border-radius: 8px; }
.vb { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .5rem; }
.vb-item { border: 1px solid var(--borde); border-radius: 8px; padding: .5rem .6rem; display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
.vb-item.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--superficie)); }
.vb-item div { display: flex; gap: .3rem; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.comentarios { display: grid; gap: .6rem; margin-bottom: .5rem; }
.comentario { display: flex; gap: .5rem; font-size: .86rem; }
.comentario p { margin: .15rem 0 0; white-space: pre-wrap; }
.nuevo-comentario { display: flex; gap: .4rem; align-items: flex-end; }
.historial { list-style: none; padding: 0 0 0 .9rem; margin: 0; border-left: 2px solid var(--borde); display: grid; gap: .55rem; font-size: .82rem; }
.historial li { display: grid; position: relative; }
.historial li::before { content: ""; position: absolute; left: -1.27rem; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primario); }
.historial li.forzado::before { background: var(--aviso); }
.historial li.bloqueo::before { background: var(--peligro); }
.historial time, .historial small { color: var(--suave); font-size: .75rem; }

/* Modal y avisos */
.modal-fondo { position: fixed; inset: 0; background: rgba(2,6,23,.45); z-index: 60; display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--superficie); border-radius: 12px; width: min(480px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(2,6,23,.3); }
.modal-ancho { width: min(820px, 100%); }
.modal-cab { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--borde); }
.modal-cab h3 { margin: 0; }
.modal-cuerpo { padding: 1rem 1.1rem; overflow-y: auto; display: grid; gap: .75rem; }
.modal-pie { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--borde); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.form .col-2 { grid-column: 1 / -1; }
.alerta { padding: .55rem .75rem; border-radius: 8px; font-size: .86rem; }
.alerta.error { background: #FEE2E2; color: #991B1B; }
.toasts { position: fixed; bottom: 1rem; right: 1rem; z-index: 80; display: grid; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; border-radius: 10px; color: #fff; box-shadow: 0 8px 24px rgba(2,6,23,.25); font-size: .88rem; animation: entra .2s; }
.toast span { flex: 1; }
.toast.ok { background: #15803D; }
.toast.error { background: #B91C1C; }
.toast .btn { background: #fff; color: #B91C1C; border: 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: radial-gradient(circle at 20% 20%, rgba(37,99,235,.18), transparent 45%), radial-gradient(circle at 80% 80%, rgba(124,58,237,.18), transparent 45%), var(--fondo); }
.login-caja { width: min(380px, 100%); background: var(--superficie); padding: 2rem; border-radius: 16px; box-shadow: 0 20px 50px rgba(2,6,23,.12); display: grid; gap: 1rem; }

/* Métricas */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem .9rem; display: grid; gap: .15rem; box-shadow: var(--sombra); }
.kpi span { font-size: .78rem; color: var(--suave); }
.kpi strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.kpi small { font-size: .75rem; color: var(--suave); }
.kpi.destacado { border-color: var(--primario); }
.kpi.alerta-kpi strong { color: var(--peligro); }
.progreso { height: 6px; background: color-mix(in srgb, var(--suave) 18%, transparent); border-radius: 999px; overflow: hidden; }
.progreso i { display: block; height: 100%; background: linear-gradient(90deg, #2563EB, #16A34A); border-radius: 999px; }
.rejilla-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tarjeta-panel { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; box-shadow: var(--sombra); margin-bottom: 1rem; min-width: 0; }
.rejilla-2 .tarjeta-panel { margin-bottom: 0; }
.tabla { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tabla th { text-align: left; color: var(--suave); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; padding: .45rem .5rem; border-bottom: 1px solid var(--borde); cursor: default; }
.tabla td { padding: .45rem .5rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla.compacta td { padding: .3rem .5rem; }
.tabla.lista tbody tr { cursor: pointer; }
.tabla.lista tbody tr:hover { background: color-mix(in srgb, var(--primario) 6%, transparent); }
.tabla.lista th { cursor: pointer; }
.tabla .corto { width: 90px; }
.tabla-scroll { overflow-x: auto; }
.fila-alerta td { background: color-mix(in srgb, var(--peligro) 7%, transparent); }
tr.inactivo { opacity: .5; }
.punto-color { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; }
.montecarlo { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.mc { border: 1px solid var(--borde); border-radius: 8px; padding: .5rem; display: grid; text-align: center; }
.mc span, .mc small { font-size: .72rem; color: var(--suave); }
.mc.destacado { border-color: var(--primario); background: color-mix(in srgb, var(--primario) 8%, var(--superficie)); }
.barra-modulo { display: grid; grid-template-columns: 210px 1fr 120px; gap: .6rem; align-items: center; font-size: .84rem; margin-bottom: .45rem; }
.barra-modulo small { color: var(--suave); }
.fila-form { display: flex; gap: .5rem; margin-bottom: .6rem; }
.grafico { width: 100%; height: auto; }
.grafico .rejilla { stroke: var(--borde); }
.grafico .eje { fill: var(--suave); font-size: 11px; }
.grafico .valor { fill: var(--texto); font-size: 11px; font-weight: 700; }
.grafico .barra { fill: var(--primario); }
.leyenda-graf { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--suave); }
.leyenda-graf i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -2px; }

/* Carga */
.cargando, .cargando-pantalla { display: grid; place-items: center; padding: 3rem; }
.cargando-pantalla { min-height: 100vh; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--borde); border-top-color: var(--primario); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* Móvil (Android y navegador del celular) */
@media (max-width: 760px) {
    .solo-movil { display: inline-block; }
    .solo-escritorio { display: none; }
    .barra { gap: .6rem; padding: .5rem .75rem; flex-wrap: wrap; }
    .menu { display: none; order: 3; flex-basis: 100%; flex-direction: column; }
    .app.menu-abierto .menu { display: flex; }
    .usuario { margin-left: auto; }
    .contenido { padding: .75rem .6rem 5rem; }
    .tablero { grid-auto-columns: 86vw; }
    .columna { max-height: calc(100vh - 230px); }
    .tarjeta-mover { display: flex; position: static; justify-content: space-between; background: none; border-top: 1px solid var(--borde); padding-top: .25rem; }
    .tarjeta-mover .btn-icono { font-size: 1.6rem; padding: .1rem 1rem; }
    .filtros input, .filtros select, .filtros .buscar { min-width: 0; flex: 1 1 45%; }
    .form { grid-template-columns: 1fr; }
    .rejilla-2 { grid-template-columns: 1fr; }
    .montecarlo { grid-template-columns: 1fr 1fr; }
    .barra-modulo { grid-template-columns: 1fr; gap: .2rem; }
    .datos { grid-template-columns: 110px 1fr; }
    .vb { grid-template-columns: 1fr; }
}

.zona-peligro { border-color: color-mix(in srgb, var(--peligro) 55%, var(--borde)); }
.zona-peligro h3 { color: var(--peligro); }
.zona-peligro .fila-form { margin-top: .6rem; }

/* ---------- Ingreso y registro (como el licenciador) ---------- */
.acceso { width: min(400px, 100%); display: grid; gap: 1rem; }
.acceso.ancha { width: min(580px, 100%); }
.acceso .login-caja { width: auto; }
.acceso-titulo h2 { margin: 0; font-size: 1.15rem; }
.acceso-titulo p { margin: .2rem 0 0; color: var(--suave); font-size: .85rem; }
.campo-icono { position: relative; display: flex; align-items: center; }
.campo-icono svg { position: absolute; left: .7rem; width: 16px; height: 16px; fill: var(--suave); pointer-events: none; }
.campo-icono input { width: 100%; padding-left: 2.2rem; }
.campo-icono .ojo { position: absolute; right: .45rem; background: none; border: 0; color: var(--suave); font-size: .75rem; cursor: pointer; padding: .2rem .35rem; }
.campo-icono .ojo:hover { color: var(--primario); }
.separador { display: flex; align-items: center; gap: .6rem; color: var(--suave); font-size: .8rem; }
.separador::before, .separador::after { content: ""; flex: 1; height: 1px; background: var(--borde); }
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.rejilla-2 input { width: 100%; box-sizing: border-box; }
@media (max-width: 560px) { .rejilla-2 { grid-template-columns: 1fr; } }
.alerta.ok { background: #DCFCE7; color: #166534; }
.etiqueta-bloqueo { font-size: .72rem; color: var(--peligro); font-weight: 600; }
.etiqueta-registro { font-size: .7rem; color: var(--suave); }
.acceso-ajustes { display: grid; gap: .8rem; justify-items: start; margin: .4rem 0; }
.acceso-ajustes label.check { display: inline-flex; width: auto; justify-content: flex-start; }
.acceso-ajustes .fila { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.acceso-ajustes .fila .btn { height: 38px; }
.tabla-desliza { overflow-x: auto; }
