/* ===================================================
   Tribunal de Faltas — Design System v3
   Paleta institucional azul municipal
   Tamaño accesible para adultos mayores
   =================================================== */

:root {
    --bg:           #f0f4f8;
    --surface:      #ffffff;
    --primary:      #1a3a5c;
    --primary-dark: #0f2540;
    --primary-light:#2454a4;
    --accent:       #1565c0;
    --text:         #1a2332;
    --text-muted:   #5a6a7e;
    --border:       #ccd6e0;
    --border-light: #e4eaf0;

    --btn-primary:  #1565c0;
    --btn-danger:   #c0392b;
    --btn-success:  #1e7e34;
    --btn-warn:     #b7640a;
    --btn-neutral:  #5a6a7e;

    --shadow-sm:    0 1px 6px rgba(26,58,92,0.08);
    --shadow:       0 4px 24px rgba(26,58,92,0.11);
    --shadow-lg:    0 8px 40px rgba(26,58,92,0.14);
    --radius:       14px;
    --radius-sm:    8px;
    --radius-pill:  100px;

    --font-base:    17px;
    --font-sm:      15px;
    --font-xs:      13px;
    --font-lg:      19px;
    --font-xl:      22px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: var(--font-base); }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); }
a:hover { color: var(--primary); }

/* ── SPLASH LOADING ── */
.splash-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1.5rem;
    background: var(--surface);
}
.splash-title {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}
.splash-spinner {
    width: 52px; height: 52px;
    border: 5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LAYOUT ── */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

/* ── HEADER con degradado azul institucional ── */
.app-header {
    background: linear-gradient(135deg, #0f2540 0%, #1a3a6e 55%, #1e4d8c 100%);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 68px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(10,30,70,0.35);
}

.header-brand { display: flex; align-items: center; gap: 0.85rem; }

.header-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.4px;
}
.header-subtitle {
    font-size: var(--font-xs);
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}

.app-content {
    flex: 1;
    padding: 1.5rem 1rem;
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
}

/* ── NAV (píldoras) ── */
.app-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 0.35rem;
    padding: 0.55rem 1.25rem;
    box-shadow: var(--shadow-sm);
    align-items: center;
}
.nav-link {
    padding: 0.42rem 1.15rem;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    border: 1.5px solid var(--border-light);
    background: transparent;
}
.nav-link:hover {
    color: #17a589;
    background: rgba(23,165,137,0.07);
    border-color: rgba(23,165,137,0.25);
    text-decoration: none;
}
.nav-link.active {
    color: #fff;
    background: #17a589;
    border-color: #17a589;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(23,165,137,0.30);
}

/* ── ESTADO BANNER ── */
.estado-inactiva-banner {
    background: #fde8e6;
    color: #922b21;
    border-bottom: 2px solid #e74c3c;
    text-align: center;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: var(--font-sm);
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border: none;
    border-radius: var(--radius-pill);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s, background 0.15s;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Botones del header (sobre fondo oscuro) */
.header-actions .btn {
    padding: 0.42rem 1.05rem;
    font-size: var(--font-xs);
    border-radius: var(--radius-pill);
    border: 1.5px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    font-weight: 600;
}
.header-actions .btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.20);
    border-color: rgba(255,255,255,0.45);
}

/* Chip de usuario en header */
.header-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.9rem 0.38rem 0.5rem;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.13);
    border: 1.5px solid rgba(255,255,255,0.22);
    color: #fff;
    font-size: var(--font-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.header-user-chip:hover { background: rgba(255,255,255,0.22); }
.header-user-avatar {
    width: 26px; height: 26px;
    background: rgba(255,255,255,0.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Botón estado de la app */
.btn-estado-app {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 1.05rem;
    font-size: var(--font-xs);
    border-radius: var(--radius-pill);
    border: 1.5px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.2px;
    transition: background 0.15s;
}
.btn-estado-app:hover { background: rgba(255,255,255,0.20); }
.btn-estado-app.inactiva {
    border-color: rgba(192,57,43,0.6);
    background: rgba(192,57,43,0.25);
}

/* Punto verde de estado activa */
.dot-activa {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46,204,113,0.8);
    flex-shrink: 0;
}

/* Botón Salir */
.header-actions .btn-logout {
    background: rgba(192,57,43,0.60);
    border-color: rgba(220,80,60,0.50);
    color: #fff;
}
.header-actions .btn-logout:hover:not(:disabled) {
    background: rgba(192,57,43,0.90);
    border-color: rgba(220,80,60,0.80);
}

/* Botones de contenido */
.btn-primary {
    background: var(--btn-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(21,101,192,0.25);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }

.btn-danger { background: var(--btn-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }

.btn-success { background: var(--btn-success); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }

.btn-warning { background: var(--btn-warn); color: #fff; }
.btn-warning:hover:not(:disabled) { filter: brightness(1.1); }

.btn-secondary {
    background: var(--surface);
    color: var(--accent);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(21,101,192,0.05);
    border-color: var(--accent);
}

.btn-imprimir { background: #39784b; color: #fff; }
.btn-imprimir:hover:not(:disabled) { filter: brightness(1.1); }

.btn-sm {
    padding: 0.32rem 0.85rem;
    font-size: var(--font-xs);
}
.btn-lg {
    padding: 0.78rem 1.9rem;
    font-size: var(--font-lg);
}

/* ── PANEL / CARD ── */
.panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
}
.panel-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
    letter-spacing: 0.2px;
}

/* ── FORM ── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--font-base);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.13);
}
.form-control::placeholder { color: #a8b8c8; }

select.form-control { cursor: pointer; }

.form-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
.form-check input[type="checkbox"] {
    width: 20px; height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}
.form-check label { font-size: var(--font-sm); font-weight: 500; cursor: pointer; }

.error-msg {
    color: var(--btn-danger);
    font-size: var(--font-sm);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
}
.success-msg {
    color: var(--btn-success);
    font-size: var(--font-sm);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* ── TABS internas (Automotores / Inmuebles / Personas) ── */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: transparent;
    padding: 0;
}
.tab-btn {
    padding: 0.85rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-size: var(--font-base);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.tab-btn i { font-size: 1rem; opacity: 0.85; }
.tab-btn:hover { color: var(--accent); }
.tab-btn:hover i { opacity: 1; }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 700;
}
.tab-btn.active i { opacity: 1; }

/* ── SEARCH BAR ── */
.search-bar {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: stretch;
}

/* Wrapper del input con ícono de lupa */
.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
}
.search-input-wrap .bi-search {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    line-height: 1;
}
.search-input-wrap .form-control {
    padding-left: 2.8rem;
    border-radius: var(--radius-pill);
    border-width: 2px;
    height: 100%;
    font-size: var(--font-base);
}
.search-input-wrap .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.13);
}

/* El botón Buscar dentro de search-bar hereda pill del .btn base */
.search-bar > .btn-primary {
    border-radius: var(--radius-pill);
}

/* ── RESULT TABLE ── */
.result-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-base);
}
.result-table th {
    background: var(--primary);
    color: #ffffff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.result-table td {
    padding: 0.7rem 1rem;
    border-top: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
    line-height: 1.5;
}
.result-table tr:nth-child(even) td { background: #f5f8fc; }
.result-table tr:hover td { background: #eaf1fa; }

.result-field-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--font-sm);
}

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.badge-admin   { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-user    { background: #e2e8ea; color: var(--text-muted); border: 1px solid var(--border); }

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(150deg, #0f2540 0%, #1a3a6e 50%, #e8f0fb 100%);
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
}
.login-logo-title {
    font-size: var(--font-xl);
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}
.login-logo-sub {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* ── VEDI LOGIN ── */
.btn-vedi {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: #1a5276;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.25rem;
}
.btn-vedi:hover:not(:disabled) { background: #154360; }
.btn-vedi:disabled { opacity: 0.6; cursor: not-allowed; }
.vedi-logo {
    background: #fff;
    color: #1a5276;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.login-divisor {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: var(--font-sm);
}
.login-divisor::before,
.login-divisor::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,37,64,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
    backdrop-filter: blur(3px);
}
.modal-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 12px 48px rgba(15,37,64,0.25);
    border: 1px solid var(--border);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}
.modal-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--btn-danger); background: #fde8e6; }
.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

/* ── SPINNER (inline) ── */
.spinner {
    display: inline-block;
    width: 1.1rem; height: 1.1rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
.spinner-dark {
    border-color: rgba(21,101,192,0.2);
    border-top-color: var(--accent);
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state-text { font-size: var(--font-base); }

/* ── SECTION DIVIDER ── */
.section-divider {
    border: none;
    border-top: 2px solid var(--border-light);
    margin: 1.25rem 0;
}

/* ── LOG ROW COLORS ── */
.log-row-ok td      { background: #f0fff4; }
.log-row-error td   { background: #fff5f5; }
.log-row-warn td    { background: #fffbf0; }
.log-row-info td    { background: #f0f5ff; }
.log-row-neutral td { background: #f9f9f9; }

.accion-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-ok      { background: #d4edda; color: #155724; }
.badge-error   { background: #f8d7da; color: #721c24; }
.badge-warn    { background: #fff3cd; color: #856404; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #e2e8ea; color: #5a6a7e; }

.log-badge { padding: 0.2rem 0.6rem; border-radius: 20px; font-weight: 600; }
.log-badge.log-ok      { background:#d4edda; color:#155724; }
.log-badge.log-error   { background:#f8d7da; color:#721c24; }
.log-badge.log-warn    { background:#fff3cd; color:#856404; }
.log-badge.log-info    { background:#dbeafe; color:#1e40af; }
.log-badge.log-neutral { background:#e2e8ea; color:#5a6a7e; }

.logs-table td { padding: 0.45rem 0.75rem; font-size: 0.88rem; }
.logs-table th { padding: 0.6rem 0.75rem; }

.log-row-clickable { cursor: pointer; transition: filter 0.1s; }
.log-row-clickable:hover { filter: brightness(0.94); }

.log-detalle-row td { padding: 0 !important; border-top: none !important; }
.log-detalle-box {
    background: var(--surface);
    border-top: 2px solid var(--accent);
    border-bottom: 2px solid var(--border-light);
    padding: 1rem 1.25rem;
    animation: slideDown 0.15s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.log-detalle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem 1.5rem;
}
.log-detalle-item { display: flex; flex-direction: column; gap: 0.2rem; }
.log-detalle-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.log-detalle-valor {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

/* ── FILTER BAR ── */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--surface);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.filter-bar .form-group { margin: 0; }

/* ── RESPONSIVE ── */
@media (min-width: 600px) {
    .app-content { padding: 2rem 1.5rem; }
    .login-card { padding: 3rem 2.5rem; }
}
@media (min-width: 900px) {
    .app-content { padding: 2rem 2.5rem; }
}

/* ── CURSOR DE CARGA GLOBAL ── */
body:has(.spinner),
body:has(.spinner) * { cursor: wait !important; }

/* ── COMPARACION SUGIT/RENTAS ── */
.fila-discrepancia td { background: #fff8e1 !important; }
.fila-discrepancia td:first-child {
    border-left: 4px solid #f0a500;
    padding-left: calc(1rem - 4px);
}

/* ── SEPARADOR HEADER ── */
.header-sep {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,0.22);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

/* ── BIENVENIDA (estado vacío antes de buscar) ── */
.bienvenida {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem 3rem;
    text-align: center;
    gap: 0.75rem;
    animation: fadeIn 0.4s ease;
}
.bienvenida-icono {
    font-size: 3rem;
    opacity: 0.13;
    color: var(--primary);
    margin-bottom: 0.25rem;
}
.bienvenida-titulo {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--primary);
    opacity: 0.55;
}
.bienvenida-sub {
    font-size: var(--font-sm);
    color: var(--text-muted);
    opacity: 0.75;
}

/* ── SKELETON LOADER ── */
.skeleton-wrap {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: fadeIn 0.2s ease;
}
.skeleton-header {
    height: 42px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #dde4ec 25%, #eef2f6 50%, #dde4ec 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-row {
    height: 52px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #e8edf3 25%, #f3f6f9 50%, #e8edf3 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-row:nth-child(2) { animation-delay: 0.1s; opacity: 0.9; }
.skeleton-row:nth-child(3) { animation-delay: 0.2s; opacity: 0.8; }
.skeleton-row:nth-child(4) { animation-delay: 0.3s; opacity: 0.7; }
.skeleton-row:nth-child(5) { animation-delay: 0.4s; opacity: 0.6; }
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── TOAST / SNACKBAR (sin resultados) ── */
.toast-sin-resultados {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f0f4f8;
    border: 1.5px solid var(--border);
    border-left: 4px solid #94a3b8;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    animation: slideDown 0.25s ease;
}
.toast-sin-resultados .toast-icon { font-size: 1.4rem; flex-shrink: 0; }
.toast-sin-resultados .toast-texto { font-size: var(--font-sm); color: var(--text-muted); font-weight: 500; }

/* Variante para "formato inválido": mismo diseño, acento en ámbar para
   diferenciarlo de "no encontrado" (que usa el gris neutro de arriba). */
.toast-sin-resultados.toast-advertencia {
    background: #fef9e7;
    border-color: #f0dfa0;
    border-left-color: #f0c040;
}
.toast-sin-resultados.toast-advertencia .toast-texto { color: #7d6608; }
.toast-sin-resultados.toast-advertencia .toast-texto strong { color: #5c4a04; }

/* ── AVISO FIJO DE FUENTE DE DATOS ──
   Cuadro informativo permanente (no es un toast: no aparece ni desaparece).
   Avisa al usuario que una de las fuentes no está disponible, para que no
   interprete la ausencia de datos de SUGIT como que el vehículo no los tiene. */
.aviso-fuente {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1.1rem;
    background: #eef4fb;
    border: 1.5px solid #c7dcf0;
    border-left: 4px solid #2f6fab;
    border-radius: var(--radius-sm);
    margin-top: 0.85rem;
}
.aviso-fuente-icono {
    font-size: 1.15rem;
    color: #2f6fab;
    flex-shrink: 0;
}
.aviso-fuente-texto {
    font-size: var(--font-sm);
    color: #234b70;
    font-weight: 500;
    line-height: 1.4;
}
.aviso-fuente-texto strong { color: #16334d; font-weight: 700; }

/* ── ANIMACIÓN ENTRADA RESULTADOS ── */
.resultado-animado {
    animation: fadeInUp 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── BADGES FUENTE (RENTAS / SUGIT) ── */
.badge-rentas {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: rgba(21,101,192,0.15);
    color: #1565c0;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.badge-sugit {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: rgba(180,83,9,0.13);
    color: #b45309;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ── DISCREPANCIA más visible ── */
.icono-discrepancia {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #f0a500;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    margin-right: 0.4rem;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ── LOGIN franja superior ── */
.login-card {
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: '';
    display: block;
    height: 5px;
    background: linear-gradient(90deg, #0f2540, #1565c0, #17a589);
    position: absolute;
    top: 0; left: 0; right: 0;
}
.login-logo { margin-top: 0.75rem; }

/* ── MODAL CONFIRMACIÓN ESTADO APP ── */
.confirmacion-estado-box {
    max-width: 520px;
    padding: 0;
    overflow: hidden;
}

.conf-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}
.conf-header-danger  { background: linear-gradient(135deg, #7b1e1e, #c0392b); color: #fff; }
.conf-header-success { background: linear-gradient(135deg, #145a32, #1e7e34); color: #fff; }

.conf-header-icono {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.conf-header-titulo {
    font-size: var(--font-lg);
    font-weight: 800;
    letter-spacing: 0.5px;
}
.conf-header-sub {
    font-size: var(--font-xs);
    opacity: 0.8;
    margin-top: 0.1rem;
    font-weight: 500;
}

.conf-cuerpo {
    padding: 1.25rem 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.conf-alerta {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    line-height: 1.6;
}
.conf-alerta ul {
    margin: 0.5rem 0 0 1.2rem;
    padding: 0;
}
.conf-alerta li { margin-bottom: 0.3rem; }

.conf-alerta-danger {
    background: #fde8e6;
    border: 1.5px solid #f5c6cb;
    border-left: 4px solid #c0392b;
    color: #6b1a1a;
}
.conf-alerta-warn {
    background: #fff8e1;
    border: 1.5px solid #f0d080;
    border-left: 4px solid #f0a500;
    color: #7a5500;
}
.conf-alerta-info {
    background: #e8f5e9;
    border: 1.5px solid #c3e6cb;
    border-left: 4px solid #1e7e34;
    color: #145a32;
}

.conf-verificacion {
    padding: 1.1rem 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.input-error {
    border-color: #c0392b !important;
    box-shadow: 0 0 0 3px rgba(192,57,43,0.15) !important;
}
.conf-error-msg {
    color: #c0392b;
    font-size: var(--font-xs);
    font-weight: 600;
    margin-top: 0.2rem;
}

.conf-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.btn-confirmar-danger {
    background: #c0392b;
    color: #fff;
    border-radius: var(--radius-pill);
    border: none;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(192,57,43,0.3);
}
.btn-confirmar-danger:hover:not(:disabled) { filter: brightness(1.12); }

.btn-confirmar-success {
    background: #1e7e34;
    color: #fff;
    border-radius: var(--radius-pill);
    border: none;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(30,126,52,0.3);
}
.btn-confirmar-success:hover:not(:disabled) { filter: brightness(1.12); }

/* ── BLAZOR ERROR UI ── */
#blazor-error-ui {
    background: #fde8e6;
    color: #922b21;
    border-top: 2px solid #e74c3c;
    bottom: 0; left: 0;
    padding: 0.85rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    display: none;
    font-size: var(--font-sm);
    font-weight: 500;
}
#blazor-error-ui .reload { color: var(--accent); font-weight: 700; margin-left: 0.5rem; }
#blazor-error-ui .dismiss {
    position: absolute; right: 1rem; top: 50%;
    transform: translateY(-50%);
    cursor: pointer; font-size: 1.2rem;
    color: var(--text-muted);
}

/* ── BOTÓN PEGAR (dentro del input de inmueble) ── */
.btn-pegar {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.7rem;
    background: var(--surface);
    color: var(--accent);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: var(--font-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    z-index: 2;
}
.btn-pegar:hover {
    background: rgba(21,101,192,0.06);
    border-color: var(--accent);
}
.btn-pegar i { font-size: 0.9rem; }

/* ── ESTADO "PROHIBIDO CIRCULAR" — resaltado de alerta ── */
.estado-prohibido {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #c0392b;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    font-size: calc(1em + 2px);
    line-height: 1.2;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    letter-spacing: 0.3px;
}
.estado-prohibido-icono { font-size: 1.1em; line-height: 1; }

/* ── CELDA CUIT (valor + botón Consultar) — siempre en la misma línea ── */
.celda-cuit {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
}
.celda-cuit > span { white-space: nowrap; }
.celda-cuit .btn { flex-shrink: 0; white-space: nowrap; }

/* ── HISTORIAL DE CONSULTAS RECIENTES ── */
.historial-wrap { position: relative; display: inline-flex; }
.historial-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: var(--radius-pill);
}
.historial-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.35rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
}
.historial-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}
.historial-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 50;
    width: min(340px, 86vw);
    max-height: 60vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    animation: historial-aparecer 0.13s ease-out;
}
@keyframes historial-aparecer {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.historial-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.6rem 0.5rem;
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0.3rem;
}
.historial-limpiar {
    background: none;
    border: none;
    color: var(--accent);
    font-size: var(--font-xs);
    font-weight: 600;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}
.historial-limpiar:hover { text-decoration: underline; }
.historial-vacio {
    padding: 1rem 0.6rem;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-sm);
}
.historial-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.6rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}
.historial-item:hover { background: rgba(21,101,192,0.07); }
.historial-item-icono {
    font-size: 1rem;
    color: var(--accent);
    flex-shrink: 0;
}
.historial-item-tipo {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}
.historial-item-termino {
    flex: 1;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.historial-item-hora {
    font-size: var(--font-xs);
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── BUSCADOR DE USUARIOS (modal Gestión de Usuarios) ── */
.usuarios-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Input con lupa a la izquierda y botón de limpiar a la derecha */
.usuarios-buscador {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 150px;
}
.usuarios-buscador .bi-search {
    position: absolute;
    left: 0.9rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    line-height: 1;
}
.usuarios-buscador .form-control {
    padding-left: 2.5rem;
    padding-right: 2.4rem;
    border-radius: var(--radius-pill);
    border-width: 2px;
    font-size: var(--font-sm);
}
.usuarios-buscador .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.13);
}
.usuarios-buscador-limpiar {
    position: absolute;
    right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.usuarios-buscador-limpiar:hover {
    background: #c0392b;
    color: #fff;
}

/* Contador de resultados cuando hay algo escrito */
.usuarios-contador {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Encabezados de tabla que ordenan al hacer clic */
.result-table th.th-orden {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.result-table th.th-orden:hover { background: var(--primary-light); }

/* Triangulito indicador: azul un poco más claro que el fondo del encabezado */
.th-orden-flecha {
    color: #5c85b5;
    font-size: 0.75em;
    margin-left: 0.3rem;
    vertical-align: middle;
    transition: color 0.15s;
}
.th-orden-flecha.activa { color: #8fbaf0; }
.result-table th.th-orden:hover .th-orden-flecha { color: #8fbaf0; }

/* Tramo del texto que coincide con lo buscado */
.usuarios-match {
    background: #fff3b0;
    color: inherit;
    padding: 0 1px;
    border-radius: 3px;
    font-weight: 700;
}
