/* Gestor Automotor — estilos basados en el diseño de Figma */

/* Tipografía Inter (SIL Open Font License, ver fuentes/LICENCIA-Inter.txt); se sirve local, sin internet. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fuentes/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
    color-scheme: light;
    --azul: #2563eb;
    --azul-oscuro: #1d4ed8;
    --azul-suave: #edf3ff;
    --marino: #15315a;
    --texto: #0f1b2d;
    --texto-2: #475569;
    --texto-3: #64748b;
    --fondo: #f5f7fa;
    --superficie: #ffffff;
    --superficie-2: #f8fafc;
    --borde: #e2e8f0;
    --borde-fuerte: #cbd5e1;
    --verde: #15803d;
    --verde-suave: #e9f7ef;
    --ambar: #b45309;
    --ambar-suave: #fff5e4;
    --rojo: #c53030;
    --rojo-suave: #fdeeee;
    --gris-suave: #eef1f5;
    --texto-aviso: #1e3a8a;
    --texto-error: #8b1d1d;
    --texto-exito: #14532d;
    --texto-alerta: #7c3f06;
    --fondo-invalido: #fffafa;
    --placeholder: #94a3b8;
    --toast: #0f1b2d;
    --toast-exito: #14532d;
    --toast-error: #8b1d1d;
    --esqueleto: #e9eef4;
    --esqueleto-brillo: #f6f8fb;
    --radio: 12px;
    --radio-chico: 8px;
    --sombra: 0 1px 2px rgba(15, 27, 45, .04);
    --sombra-hover: 0 6px 18px rgba(15, 27, 45, .08);
    --lateral: 224px;
    --fuente: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/*
 * Modo oscuro. Sin elección guardada sigue a Windows; con el botón del encabezado se fuerza
 * claro (data-tema="claro") u oscuro (data-tema="oscuro"). Los dos bloques tienen los mismos valores.
 */
:root[data-tema="oscuro"] {
    color-scheme: dark;
    --azul: #3b82f6;
    --azul-oscuro: #2563eb;
    --azul-suave: #172a4d;
    --marino: #0b1a33;
    --texto: #e6edf5;
    --texto-2: #b4c0cf;
    --texto-3: #8796a8;
    --fondo: #0d131c;
    --superficie: #151d29;
    --superficie-2: #1b2534;
    --borde: #263244;
    --borde-fuerte: #34445a;
    --verde: #4ade80;
    --verde-suave: #12321f;
    --ambar: #fbbf24;
    --ambar-suave: #3a2a0b;
    --rojo: #f87171;
    --rojo-suave: #3b1717;
    --gris-suave: #222d3d;
    --texto-aviso: #bfd4ff;
    --texto-error: #fecaca;
    --texto-exito: #bbf7d0;
    --texto-alerta: #fde68a;
    --fondo-invalido: #2a1616;
    --placeholder: #6b7a8d;
    --toast: #e6edf5;
    --toast-exito: #166534;
    --toast-error: #991b1b;
    --esqueleto: #1e2938;
    --esqueleto-brillo: #283547;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3);
    --sombra-hover: 0 6px 18px rgba(0, 0, 0, .35);
}
:root[data-tema="oscuro"] .toast { color: #0d131c; }
:root[data-tema="oscuro"] .toast.exito, :root[data-tema="oscuro"] .toast.error { color: #fff; }

@media (prefers-color-scheme: dark) {
    :root:not([data-tema="claro"]) .toast { color: #0d131c; }
    :root:not([data-tema="claro"]) .toast.exito, :root:not([data-tema="claro"]) .toast.error { color: #fff; }
    :root:not([data-tema="claro"]) {
        color-scheme: dark;
        --azul: #3b82f6;
        --azul-oscuro: #2563eb;
        --azul-suave: #172a4d;
        --marino: #0b1a33;
        --texto: #e6edf5;
        --texto-2: #b4c0cf;
        --texto-3: #8796a8;
        --fondo: #0d131c;
        --superficie: #151d29;
        --superficie-2: #1b2534;
        --borde: #263244;
        --borde-fuerte: #34445a;
        --verde: #4ade80;
        --verde-suave: #12321f;
        --ambar: #fbbf24;
        --ambar-suave: #3a2a0b;
        --rojo: #f87171;
        --rojo-suave: #3b1717;
        --gris-suave: #222d3d;
        --texto-aviso: #bfd4ff;
        --texto-error: #fecaca;
        --texto-exito: #bbf7d0;
        --texto-alerta: #fde68a;
        --fondo-invalido: #2a1616;
        --placeholder: #6b7a8d;
        --toast: #e6edf5;
        --toast-exito: #166534;
        --toast-error: #991b1b;
        --esqueleto: #1e2938;
        --esqueleto-brillo: #283547;
        --sombra: 0 1px 2px rgba(0, 0, 0, .3);
        --sombra-hover: 0 6px 18px rgba(0, 0, 0, .35);
    }
}

.boton-tema { flex: none; }
.boton-tema .ico { width: 18px; height: 18px; }
.superior-derecha { display: flex; align-items: center; gap: 12px; }
.boton-tema-flotante {
    position: fixed; top: 16px; right: 16px; z-index: 5;
    background: var(--superficie); border: 1px solid var(--borde); width: 40px; height: 40px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--fuente);
    font-size: 14px;
    line-height: 1.45;
    color: var(--texto);
    background: var(--fondo);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}

@keyframes aparecer { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 32px; line-height: 1.15; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

.ico { width: 18px; height: 18px; flex: none; vertical-align: middle; }

.oculto-visual {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Estructura ---------- */

.lateral {
    position: fixed; inset: 0 auto 0 0; width: var(--lateral);
    background: var(--superficie); border-right: 1px solid var(--borde);
    display: flex; flex-direction: column; padding: 24px 16px; z-index: 20;
}

.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 28px; color: var(--texto); }
.marca:hover { text-decoration: none; }
.marca-logo {
    width: 36px; height: 36px; border-radius: 9px; background: var(--azul); color: #fff;
    display: grid; place-items: center;
}
.marca-logo .ico { width: 22px; height: 22px; }

/* Logo de la gestoría (Natalia Cabrero). Va sobre blanco para que se vea igual en modo oscuro. */
.marca-imagen {
    display: block; background: #fff; border-radius: 12px; padding: 10px 12px; margin: 0 0 24px;
    border: 1px solid var(--borde);
}
.marca-imagen img { display: block; width: 100%; height: auto; }
.logo-movil { display: none; }
.logo-movil img { display: block; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--borde); }
.login-logo { background: #fff; border-radius: 14px; padding: 8px 18px; margin: 0 auto 22px; max-width: 280px; }
.login-logo img { display: block; width: 100%; height: auto; }
.marca-nombre { font-size: 20px; font-weight: 700; line-height: 1; display: block; }
.marca-sub { font-size: 9px; letter-spacing: .08em; color: var(--texto-3); text-transform: uppercase; }

.menu-titulo { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-3); margin: 0 0 8px 0; }
.menu { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 4px; }
.menu a {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radio-chico);
    color: var(--texto-2); font-weight: 500;
}
.menu a:hover { background: var(--superficie-2); text-decoration: none; }
.menu a[aria-current="page"] { background: var(--azul-suave); color: var(--azul); font-weight: 600; }

.lateral-pie { margin-top: auto; font-size: 12px; color: var(--texto-3); padding: 0 8px; }

.principal { margin-left: var(--lateral); min-height: 100vh; display: flex; flex-direction: column; }

.superior {
    height: 72px; background: var(--superficie); border-bottom: 1px solid var(--borde);
    display: flex; align-items: center; justify-content: space-between; padding: 0 32px; gap: 16px;
}
.migas { font-size: 13px; color: var(--texto-3); display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; }
.migas a { color: var(--texto-3); }
.migas span[aria-current] { color: var(--texto); font-weight: 500; }
.fecha-hoy { font-size: 13px; color: var(--texto-3); white-space: nowrap; }

main { padding: 40px 32px 32px; flex: 1; width: 100%; max-width: 1280px; }

.pie {
    padding: 0 32px 24px; font-size: 11px; color: var(--texto-3);
    display: flex; justify-content: space-between; gap: 12px;
}

.nav-movil { display: none; }

/* ---------- Encabezado de página ---------- */

.encabezado { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.encabezado p { margin: 8px 0 0; color: var(--texto-2); }
.acciones { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Botones ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: var(--radio-chico); border: 1px solid var(--borde);
    background: var(--superficie); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active:not([disabled]) { transform: scale(.98); }
.btn-primario { box-shadow: 0 1px 2px rgba(37, 99, 235, .25); }
.btn-primario:hover { box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }
.btn:hover { background: var(--superficie-2); text-decoration: none; }
.btn:focus-visible, .campo input:focus-visible, .campo select:focus-visible, .campo textarea:focus-visible,
.menu a:focus-visible, a:focus-visible, button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 1px;
}
.btn-primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn-primario:hover { background: var(--azul-oscuro); }
.btn-peligro { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn-peligro:hover { filter: brightness(.9); }
.btn-borrar { color: var(--rojo); }
.btn-borrar:hover { background: var(--rojo-suave); border-color: var(--rojo-suave); }
.btn-chico { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-icono { width: 34px; height: 34px; padding: 0; border-color: transparent; background: transparent; color: var(--texto-3); }
.btn-icono:hover { background: var(--gris-suave); color: var(--texto); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.enlace-flecha { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }
.enlace-flecha .ico { width: 14px; height: 14px; }

/* ---------- Tarjetas ---------- */

.tarjeta {
    background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
    box-shadow: var(--sombra);
}
.tarjeta-cuerpo { padding: 24px; }
.tarjeta-cabecera {
    padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--borde); flex-wrap: wrap;
}
.tarjeta-cabecera p { margin: 4px 0 0; color: var(--texto-3); font-size: 13px; }
.tarjeta-pie {
    padding: 16px 24px; border-top: 1px solid var(--borde); color: var(--texto-3); font-size: 13px;
}

.grilla { display: grid; gap: 20px; }
.grilla-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grilla-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grilla-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.columnas { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.pila { display: grid; gap: 24px; align-content: start; }
.mb { margin-bottom: 24px; }

.dato-num { padding: 22px 22px 20px; display: block; color: var(--texto); }
a.tarjeta, button.tarjeta { transition: transform .15s, box-shadow .15s, border-color .15s; }
a.tarjeta:hover, button.tarjeta:hover { transform: translateY(-2px); box-shadow: var(--sombra-hover); }
a.dato-num:hover { text-decoration: none; border-color: var(--borde-fuerte); }
.dato-num .rotulo { display: flex; justify-content: space-between; align-items: center; color: var(--texto-2); font-size: 13px; }
.dato-num .rotulo .ico { color: var(--azul); }
.dato-num .valor { display: block; font-size: 32px; font-weight: 600; margin: 14px 0 10px; line-height: 1; }
.dato-num .detalle { display: block; font-size: 12px; color: var(--texto-3); }

.estado-num { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; color: var(--texto); }
.estado-num:hover { text-decoration: none; border-color: var(--borde-fuerte); }
.estado-num .valor { font-size: 24px; font-weight: 600; }
.estado-num[aria-pressed="true"] { border-color: var(--azul); box-shadow: 0 0 0 2px var(--azul-suave); }

/* ---------- Insignias y chips ---------- */

.insignia {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gris-suave); color: var(--texto-2);
}
.insignia::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.insignia.PENDIENTE { background: var(--ambar-suave); color: var(--ambar); }
.insignia.EN_PROCESO { background: var(--azul-suave); color: var(--azul); }
.insignia.FINALIZADO { background: var(--verde-suave); color: var(--verde); }
.insignia.CANCELADO { background: var(--rojo-suave); color: var(--rojo); }
.insignia.inactivo { background: var(--gris-suave); color: var(--texto-3); }
.insignia.activo { background: var(--verde-suave); color: var(--verde); }

.patente {
    display: inline-block; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--borde-fuerte);
    background: var(--superficie-2); font-weight: 700; font-size: 13px; letter-spacing: .02em; white-space: nowrap;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    border: 1px solid var(--borde); background: var(--superficie); border-radius: 6px; padding: 5px 10px;
    font: inherit; font-size: 12px; color: var(--texto-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--azul-suave); border-color: var(--azul-suave); color: var(--azul); font-weight: 600; }

.avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--azul-suave); color: var(--azul);
    display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none;
}
.avatar.cuadrado { border-radius: 10px; }
.avatar.grande { width: 64px; height: 64px; font-size: 22px; }

/* ---------- Pestañas ---------- */

.pestanas { display: flex; gap: 28px; border-bottom: 1px solid var(--borde); margin: 0 24px; overflow-x: auto; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas button {
    background: none; border: 0; border-bottom: 2px solid transparent; padding: 18px 0 12px; font: inherit;
    color: var(--texto-2); cursor: pointer; white-space: nowrap;
}
.pestanas button[aria-selected="true"] { color: var(--azul); border-bottom-color: var(--azul); font-weight: 600; }

/* ---------- Filtros ---------- */

.filtros { display: flex; gap: 12px; padding: 20px 24px; flex-wrap: wrap; align-items: flex-end; }
.filtros .campo { margin: 0; }
.buscador { position: relative; flex: 1 1 260px; }
.buscador .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--texto-3); }
.buscador .campo input { padding-left: 40px; }
.buscador .ico { z-index: 1; pointer-events: none; }
.contador { color: var(--texto-3); font-size: 13px; align-self: center; }

/* ---------- Formularios ---------- */

.campo { display: grid; gap: 6px; margin-bottom: 18px; min-width: 0; }
.campo label, .campo .etiqueta { font-size: 13px; font-weight: 500; color: var(--texto); }
.campo input, .campo select, .campo textarea {
    width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--borde-fuerte); border-radius: var(--radio-chico);
    background: var(--superficie); font: inherit; color: var(--texto);
}
.campo textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.campo input::placeholder, .campo textarea::placeholder { color: var(--placeholder); }
.campo input, .campo select, .campo textarea { transition: border-color .15s, box-shadow .15s; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.campo input[disabled], .campo select[disabled] { background: var(--superficie-2); color: var(--texto-3); }
.campo .ayuda { font-size: 12px; color: var(--texto-3); }
.campo .error { font-size: 12px; color: var(--rojo); font-weight: 500; }
.campo.invalido > input, .campo.invalido > select, .campo.invalido > textarea { border-color: var(--rojo); background: var(--fondo-invalido); }
.campo-fila { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.campo-fila.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.req { color: var(--rojo); }

.seccion-form { margin-bottom: 20px; }
.subtitulo-form { margin: 8px 0 14px; padding-top: 16px; border-top: 1px solid var(--borde); font-size: 14px; color: var(--texto-2); }

/* Carga de socios (persona jurídica) */
.lista-socios { display: grid; gap: 12px; margin-bottom: 12px; }
.socio {
    border: 1px solid var(--borde); border-radius: 10px; padding: 14px; background: var(--superficie-2);
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; align-items: end;
}
/* Fila 1: nombre, DNI, CUIL. Fila 2: cargo, porcentaje y quitar. */
.socio > :nth-child(1) { grid-column: span 6; }
.socio > :nth-child(2) { grid-column: span 3; }
.socio > :nth-child(3) { grid-column: span 3; }
.socio > :nth-child(4) { grid-column: span 7; }
.socio > :nth-child(5) { grid-column: span 4; }
.socio > :nth-child(6) { grid-column: span 1; justify-self: end; }
.socio .campo { margin: 0; }
.socio .campo label { font-size: 12px; }
.socio .quitar { align-self: end; }
.socio-error { grid-column: 1 / -1; color: var(--rojo); font-size: 12px; font-weight: 500; }
@media (max-width: 860px) {
    .socio > :nth-child(1) { grid-column: 1 / -1; }
    .socio > :nth-child(2), .socio > :nth-child(3) { grid-column: span 6; }
    .socio > :nth-child(4) { grid-column: span 7; }
    .socio > :nth-child(5) { grid-column: span 3; }
    .socio > :nth-child(6) { grid-column: span 2; }
}
.seccion-form h2 { margin-bottom: 20px; }

.opciones-tipo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opcion-tipo {
    display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--borde);
    border-radius: 10px; cursor: pointer; background: var(--superficie);
}
.opcion-tipo:has(input:checked) { border-color: var(--azul); background: var(--azul-suave); }
.opcion-tipo:has(input:disabled) { cursor: not-allowed; opacity: .75; }
.opcion-tipo input { margin-left: auto; width: 18px; height: 18px; accent-color: var(--azul); }
.opcion-tipo .ico { color: var(--texto-3); }
.opcion-tipo strong { display: block; }
.opcion-tipo small { color: var(--texto-3); }

.barra-form {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 20px;
    border-top: 1px solid var(--borde); flex-wrap: wrap;
}
.barra-form .nota { color: var(--texto-3); font-size: 13px; }

/* ---------- Tablas ---------- */

.tabla-envoltura { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
    text-align: left; font-size: 12px; font-weight: 600; color: var(--texto-2); background: var(--superficie-2);
    padding: 12px 20px; border-bottom: 1px solid var(--borde); white-space: nowrap;
}
.tabla td { padding: 16px 20px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr.clic { cursor: pointer; transition: background-color .12s; }
.tabla tbody tr.clic:hover { background: var(--superficie-2); }
.tabla tbody tr.clic .flecha .ico { transition: transform .15s; }
.tabla tbody tr.clic:hover .flecha .ico { transform: translateX(3px); color: var(--azul); }
.menu a { transition: background-color .15s, color .15s; }
.tabla .sec { display: block; font-size: 12px; color: var(--texto-3); margin-top: 2px; }
.tabla .principal-celda { font-weight: 500; }
.tabla .flecha { width: 36px; color: var(--texto-3); text-align: right; }

.persona { display: flex; align-items: center; gap: 12px; }

/* ---------- Listas ---------- */

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--borde); }
.lista > li:last-child { border-bottom: 0; }
.lista .crece { flex: 1; min-width: 0; }
.lista .sec { display: block; font-size: 12px; color: var(--texto-3); }
.icono-caja {
    width: 40px; height: 40px; border-radius: 10px; background: var(--azul-suave); color: var(--azul);
    display: grid; place-items: center; flex: none;
}

.datos-def { display: grid; gap: 18px; margin: 0; }
.datos-def dt { font-size: 12px; color: var(--texto-3); margin-bottom: 4px; }
.datos-def dd { margin: 0; font-size: 15px; word-break: break-word; }
.datos-def.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.separador { border: 0; border-top: 1px solid var(--borde); margin: 20px 0; }

.texto-pre { white-space: pre-wrap; color: var(--texto-2); margin: 0; }
.apagado { color: var(--texto-3); }

/* ---------- Ficha ---------- */

.ficha-cab { display: flex; align-items: center; gap: 20px; padding: 28px 24px; flex-wrap: wrap; }
.ficha-cab .crece { flex: 1; min-width: 220px; }
.ficha-cab h2 { font-size: 24px; }
.ficha-cab p { margin: 6px 0 0; color: var(--texto-2); }
.ficha-cab small { color: var(--texto-3); }
.ficha-num { display: flex; gap: 48px; }
.ficha-num strong { display: block; font-size: 26px; font-weight: 600; }
.ficha-num span { color: var(--texto-2); }

/* ---------- Documentos ---------- */

.zona-carga {
    display: block; position: relative;
    border: 1.5px dashed var(--borde-fuerte); border-radius: 10px; background: var(--superficie-2);
    padding: 28px 16px; text-align: center; color: var(--texto-3); font-size: 12px; cursor: pointer;
}
.zona-carga strong { display: block; color: var(--azul); font-size: 14px; margin: 6px 0 4px; }
.zona-carga.arrastrando { border-color: var(--azul); background: var(--azul-suave); }
.zona-carga .ico { color: var(--azul); width: 22px; height: 22px; }

/* ---------- Avisos y mensajes ---------- */

.aviso {
    display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 20px;
    background: var(--azul-suave); color: var(--texto-aviso);
}
.aviso.error { background: var(--rojo-suave); color: var(--texto-error); }
.aviso.exito { background: var(--verde-suave); color: var(--texto-exito); }
.aviso.alerta { background: var(--ambar-suave); color: var(--texto-alerta); }
.aviso .ico { margin-top: 1px; }

.vacio { padding: 44px 24px; text-align: center; color: var(--texto-3); }
.vacio strong { display: block; color: var(--texto); font-size: 15px; margin-bottom: 4px; }
.vacio-icono {
    width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px; display: grid; place-items: center;
    background: var(--azul-suave); color: var(--azul);
}
.vacio-icono .ico { width: 30px; height: 30px; }
.vacio .btn { margin-top: 18px; }

.cargando { padding: 32px; text-align: center; color: var(--texto-3); }

/* Bloques grises animados mientras carga el contenido */
.esqueleto { display: grid; gap: 14px; padding: 22px 24px; }
.esqueleto span {
    display: block; height: 14px; border-radius: 6px;
    background: linear-gradient(90deg, var(--esqueleto) 0%, var(--esqueleto-brillo) 50%, var(--esqueleto) 100%);
    background-size: 200% 100%; animation: brillo 1.3s ease-in-out infinite;
}
.esqueleto span:nth-child(1) { width: 45%; height: 18px; }
.esqueleto span:nth-child(2) { width: 92%; }
.esqueleto span:nth-child(3) { width: 78%; }
.esqueleto span:nth-child(4) { width: 64%; }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Gráfico de trámites por estado (anillo) */
.grafico { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.anillo {
    width: 132px; height: 132px; border-radius: 50%; flex: none; position: relative;
    background: var(--gris-suave);
}
.anillo::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--superficie); }
.anillo-centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; }
.anillo-centro strong { font-size: 26px; line-height: 1; }
.anillo-centro span { font-size: 11px; color: var(--texto-3); }
.leyenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; flex: 1; min-width: 150px; }
.leyenda li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.leyenda .punto { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.leyenda .cant { margin-left: auto; font-weight: 600; }
.barra-estado { height: 6px; border-radius: 3px; background: var(--gris-suave); overflow: hidden; margin-top: 4px; }
.barra-estado span { display: block; height: 100%; border-radius: 3px; transition: width .6s ease-out; }

#mensajes {
    position: fixed; top: 16px; right: 16px; z-index: 100; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px));
}
.toast {
    background: var(--toast); color: #fff; border-radius: 10px; padding: 12px 16px; font-size: 13px;
    box-shadow: 0 8px 24px rgba(15, 27, 45, .18); display: flex; gap: 10px; align-items: flex-start;
    animation: entrar-toast .25s ease-out;
}
.toast.exito { background: var(--toast-exito); }
.toast.error { background: var(--toast-error); }
@keyframes entrar-toast { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

dialog.dialogo {
    border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px));
    box-shadow: 0 24px 48px rgba(15, 27, 45, .25); color: var(--texto); background: var(--superficie);
}
dialog.dialogo[open] { animation: aparecer .2s ease-out; }
dialog.dialogo::backdrop { background: rgba(15, 27, 45, .45); }
.dialogo form { padding: 24px; }
.dialogo p { color: var(--texto-2); margin: 10px 0 20px; }
.dialogo .acciones { justify-content: flex-end; }

/* ---------- Ingreso y usuario ---------- */

.pagina-login {
    background:
        radial-gradient(circle at 15% 20%, rgba(37, 99, 235, .16), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(37, 99, 235, .12), transparent 45%),
        var(--fondo);
}
.pagina-login::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .5;
    background-image: radial-gradient(var(--borde) 1px, transparent 1px); background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(circle at center, #000 0%, transparent 70%);
    mask-image: radial-gradient(circle at center, #000 0%, transparent 70%);
}
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; max-width: none; position: relative; }
.login-tarjeta {
    width: min(420px, 100%); padding: 40px 32px 32px; text-align: center;
    box-shadow: 0 20px 50px rgba(15, 27, 45, .12); border-top: 4px solid var(--azul);
}
.login-marca .marca-logo { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 6px 16px rgba(37, 99, 235, .35); }
.login-marca { justify-content: center; padding: 0 0 28px; }
.login-tarjeta h1 { font-size: 26px; }
.login-texto { color: var(--texto-2); margin: 8px 0 24px; }
.login-pie { color: var(--texto-3); font-size: 12px; margin: 20px 0 0; }
.login-tarjeta .aviso { text-align: left; }
.boton-google { min-height: 44px; display: flex; justify-content: center; align-items: center; }

.usuario { display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--borde); margin-top: 12px; }
.usuario .avatar { width: 36px; height: 36px; font-size: 12px; overflow: hidden; }
.usuario .avatar img { width: 100%; height: 100%; object-fit: cover; }
.usuario-datos { flex: 1; min-width: 0; }
.usuario-datos strong { display: block; font-size: 13px; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-datos span { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.salir-movil { display: none; }

/* ---------- Adaptación a celulares y tablets ---------- */

@media (max-width: 1100px) {
    .columnas { grid-template-columns: 1fr; }
    .grilla-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .lateral { display: none; }
    .principal { margin-left: 0; padding-bottom: 76px; }
    .superior { height: 60px; padding: 0 16px; }
    .fecha-hoy { display: none; }
    .salir-movil { display: inline-flex; flex: none; }
    .logo-movil { display: block; flex: none; }
    .superior { justify-content: flex-start; }
    .superior .migas { flex: 1; }
    main { padding: 24px 16px; }
    .pie { padding: 0 16px 16px; flex-direction: column; }
    h1 { font-size: 26px; }

    .nav-movil {
        display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0;
        background: var(--superficie); border-top: 1px solid var(--borde); z-index: 30;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .nav-movil a {
        display: grid; justify-items: center; gap: 4px; padding: 10px 2px 12px; font-size: 11px; color: var(--texto-3);
    }
    .nav-movil a:hover { text-decoration: none; }
    .nav-movil a[aria-current="page"] { color: var(--azul); font-weight: 600; }

    .grilla-2, .grilla-3, .campo-fila, .campo-fila.tres, .datos-def.dos { grid-template-columns: 1fr; }
    .opciones-tipo { grid-template-columns: 1fr; }
    .tarjeta-cuerpo { padding: 18px; }
    .tarjeta-cabecera { padding: 16px 18px; }
    .filtros { padding: 16px 18px; }
    .filtros > * { flex: 1 1 100%; }
    .pestanas { margin: 0 18px; gap: 20px; }
    .ficha-num { gap: 28px; }
    .encabezado .acciones { width: 100%; }
    .encabezado .acciones .btn { flex: 1; }

    /* Las tablas se muestran como tarjetas apiladas */
    table.tabla.apilable thead { display: none; }
    table.tabla.apilable, .tabla.apilable tbody, .tabla.apilable tr, .tabla.apilable td { display: block; width: 100%; }
    .tabla.apilable tr { padding: 14px 18px; border-bottom: 1px solid var(--borde); position: relative; }
    .tabla.apilable tbody tr:last-child { border-bottom: 0; }
    .tabla.apilable td { border: 0; padding: 3px 28px 3px 0; }
    .tabla.apilable td[data-rotulo]::before {
        content: attr(data-rotulo) ": "; color: var(--texto-3); font-size: 12px;
    }
    .tabla.apilable td.flecha { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: auto; padding: 0; }
}

/* Quien prefiere menos movimiento (opción de Windows) no ve animaciones. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 480px) {
    .grilla-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .estado-num { padding: 14px; }
    .dato-num .valor { font-size: 26px; }
}
