/* =========================================================
   BUSSKM - components.css
   Botones, Inputs, Cards, Tables, Alertas
   ========================================================= */

/* --- BOTONES --- */
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.2;
}

button {
    font: inherit;
}

/* TAMAÑOS DE BOTONES */
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 8px;
    gap: 4px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 7px;
    gap: 4px;
    font-weight: 600;
}

/* .btn (Default / Secondary fallback — neutral para Cancelar, Volver, etc.) */
.btn {
    background: var(--btn-bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn:hover {
    border-color: var(--tm-fuchsia);
    color: var(--tm-fuchsia);
}

/* .btn-primary — Acción principal (Guardar / Confirmar).
   Siempre gradiente fucsia→purple en light y dark (brand-forward).
   No depende de --primary para evitar que mute a azul en modo claro. */
.btn-primary {
    border: 1px solid transparent;
    background: linear-gradient(90deg, var(--tm-fuchsia), var(--tm-purple));
    color: #fff;
    box-shadow: 0 4px 14px rgba(230, 0, 126, 0.28);
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(230, 0, 126, 0.36);
}

/* .btn-outline — Acción secundaria pero visible (Editar, Ver, etc.).
   Borde fucsia + texto fucsia, hover: rellena con tinte fucsia. */
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--tm-fuchsia);
    color: var(--tm-fuchsia);
}

.btn-outline:hover {
    background: color-mix(in srgb, var(--tm-fuchsia) 12%, transparent);
    border-color: var(--tm-fuchsia);
    color: var(--tm-fuchsia);
}

/* .btn-secondary */
.btn-secondary {
    background: color-mix(in srgb, var(--surface) 40%, transparent);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: color-mix(in srgb, var(--surface) 60%, transparent);
}

/* .btn-danger */
.btn-danger {
    background: var(--danger);
    border: 1px solid rgba(0,0,0,0.1);
    color: #fff;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

/* New: Table Action Style (Clean & Semantic) */
.btn-action {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 7px;
  font-weight: 700;
}

.btn-action:hover {
  background: var(--surface);
  border-color: var(--tm-fuchsia);
  color: var(--tm-fuchsia);
}

/* Intelligent Table Button Refinement */
.table td .btn,
.table td .btn-primary,
.table td .btn-secondary,
.table td .btn-danger,
.table td .btn-outline {
    padding: 4px 10px;
    font-size: 11.5px;
    border-radius: 7px;
    font-weight: 700;
}

.table td .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

/* Disabled State */
.btn:disabled,
.btn-primary:disabled,
.btn-danger:disabled,
.btn-outline:disabled,
.btn-secondary:disabled,
button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: saturate(0.45);
    background: var(--btn-bg) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}

/* Ghost / Nav link buttons */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text);
    background: transparent;
    font-weight: 700;
}

.btn-ghost:hover {
    border-color: var(--tm-fuchsia);
    color: var(--tm-fuchsia);
}

/* --- FORMS GLOBALES --- */
.form {
    max-width: 980px;
}

.label {
    display: block;
    font-weight: 700;
    color: color-mix(in srgb, var(--text) 86%, transparent);
    margin: 6px 0 2px;
    font-size: 12.5px;
}

/* Normalización de inputs */
.input,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    font: inherit;
    width: 100%;
    max-width: 100%;
    background-color: var(--input-bg) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px;
    padding: 6px 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 13.5px;
}

/* Fix 2026-05-15: icono de calendario garantizado en inputs date.
 * El indicador nativo del browser desaparece o se mezcla con el fondo en
 * algunos themes. Reemplazamos con un SVG inline visible siempre, y el
 * indicador nativo queda transparente PERO clickeable encima (sigue
 * abriendo el date picker al click). */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"] {
    /* SVG calendario inline — cambia color via stroke="currentColor" */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3e%3cline x1='16' y1='2' x2='16' y2='6'/%3e%3cline x1='8' y1='2' x2='8' y2='6'/%3e%3cline x1='3' y1='10' x2='21' y2='10'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px 18px;
    padding-right: 36px !important;
    cursor: pointer;
}

/* Indicador nativo transparente — invisible visualmente pero queda en su
 * posición natural (a la derecha del input) y sigue siendo clickeable, así
 * que al click ABRE el date picker del browser igual.
 * Importante: NO usar position:absolute — eso rompe el área clickeable del
 * indicador en Webkit/Blink. Solo opacity y un ancho generoso. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    cursor: pointer;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    /* Hacer el indicador "transparente" pero ocupando todo su espacio natural */
    background: transparent;
}

/* En tema dark, usar el color primario más claro para que el icono se vea bien. */
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="month"],
html[data-theme="dark"] input[type="week"] {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3e%3cline x1='16' y1='2' x2='16' y2='6'/%3e%3cline x1='8' y1='2' x2='8' y2='6'/%3e%3cline x1='3' y1='10' x2='21' y2='10'/%3e%3c/svg%3e");
}

input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="time"]:hover,
input[type="month"]:hover,
input[type="week"]:hover {
    background-color: rgba(124, 58, 237, 0.04);
}

.input-sm,
select.input-sm,
input.input-sm {
    padding: 4px 10px !important;
    font-size: 12.5px !important;
    border-radius: 7px !important;
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
    color: color-mix(in srgb, var(--text-muted) 85%, transparent);
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: color-mix(in srgb, var(--primary-2) 75%, white 25%) !important;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23b0b9c8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
}

html[data-theme="light"] select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23405066%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
}

/* 2026-05-16: forzar legibilidad de <option> y <optgroup> dentro de selects.
   Los dropdowns abiertos heredaban color oscuro sobre fondo oscuro → texto
   invisible. Forzamos colores explícitos para que se vean en modo dark y light. */
select option {
    color: #f1f5f9 !important;
    background-color: #1e293b !important;
    padding: 6px 8px;
}
select optgroup {
    color: #a5b4fc !important;
    background-color: #0f172a !important;
    font-weight: 800;
    font-style: normal;
    padding: 4px 0;
}
html[data-theme="light"] select option {
    color: #1e293b !important;
    background-color: #ffffff !important;
}
html[data-theme="light"] select optgroup {
    color: #6366f1 !important;
    background-color: #f1f5f9 !important;
}


textarea {
    min-height: 110px;
    resize: vertical;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

/* Wrapper Form Action */
.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form>.actions {
    width: 100%;
    justify-content: center;
    margin-top: 16px;
}

.form>.actions .btn,
.form>.actions button {
    min-width: 140px;
}

/* --- CARDS & GRID --- */
.grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.card {
    grid-column: span 4;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    padding: 14px 14px;
    overflow-x: auto;
}

.card h3 {
    margin: 0 0 6px;
    font-size: 14px;
}

.card .kpi {
    font-size: 26px;
    font-weight: 900;
    margin-top: 8px;
}

.card small {
    color: var(--text-muted);
}

.card.wide {
    grid-column: span 12;
}

/* PILLS & TAGS */
.pill, .tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(0,0,0,0.04);
    color: var(--text-muted);
}

.pill.ok, .tag.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); background: color-mix(in srgb, var(--success) 5%, transparent); }
.pill.bad, .tag.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 5%, transparent); }
.pill.warn, .tag.warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); background: color-mix(in srgb, var(--warning) 5%, transparent); }

/* --- TABLES --- */
.table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 12px;
    color: var(--text);
}

.table th {
    color: var(--text-muted);
    font-weight: 800;
    background: color-mix(in srgb, var(--text) 20%, transparent);
    /* adaptively transparent depending on light/dark mode */
}

.table tr:hover td {
    background: rgba(198, 60, 255, 0.06);
}

/* Empty data state for tables (custom util class commonly needed) */
.table-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}


/* --- ALERTS --- */
.alert {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 13.5px;
}

.alert-info {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.28);
}

.alert-warn {
    background: color-mix(in srgb, var(--warning) 16%, transparent);
    border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.alert-success {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    border-color: color-mix(in srgb, var(--success) 28%, transparent);
}


/* --- BADGES / PILLS --- */
.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    background: color-mix(in srgb, var(--surface) 75%, transparent);
    color: var(--text);
}

.pill-ok {
    border-color: color-mix(in srgb, var(--success) 35%, var(--border));
    background: color-mix(in srgb, var(--success) 14%, transparent);
}

.pill-warn {
    border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
    background: color-mix(in srgb, var(--warning) 14%, transparent);
}

.pill-bad {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
    background: color-mix(in srgb, var(--danger) 14%, transparent);
}

/* Variantes "fuertes" — texto en color semántico + bg tintado.
   Reemplazan los hardcodes inline tipo `style="background:#dcfce7; color:#166534"`
   que el equipo venía pegando per-página. Funcionan en ambos temas porque
   los tokens (--success/--warning/--danger/--primary) ya cambian con
   html[data-theme]. Compatibles con .pill-mini (definido en algunas páginas
   solo para tamaño): se combinan como class="pill-mini pill-success". */
.pill-success {
    background: color-mix(in srgb, var(--success) 18%, transparent);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 35%, transparent);
}
.pill-warning {
    background: color-mix(in srgb, var(--warning) 18%, transparent);
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}
.pill-danger {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.pill-info {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 35%, transparent);
}
.pill-neutral {
    background: color-mix(in srgb, var(--text-muted) 18%, transparent);
    color: var(--text-muted);
    border-color: color-mix(in srgb, var(--text-muted) 30%, transparent);
}


/* --- FORM GRID HELPERS --- */
.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {

    .grid2,
    .grid3 {
        grid-template-columns: 1fr;
    }
}

/* --- RE-USABLE LEGACY FORMS (Personas y Vehiculos) --- */
.vehicle-form,
.assign-form,
.person-form {
    display: grid;
    gap: 8px;
    align-items: end;
}

.assign-form {
    grid-template-columns: 1fr 180px 1fr 220px auto;
    gap: 12px;
}

.vehicle-form {
    grid-template-columns: repeat(6, 1fr);
}

.field,
.vehicle-form .field,
.assign-form .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vehicle-notes {
    grid-column: 4 / span 2;
}

.vehicle-actions {
    grid-column: 6 / span 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.vehicle-actions .btn-primary {
    width: 140px;
    height: 42px;
    font-weight: 700;
    font-size: 15px;
}

/* Personas form mappings */
.person-fname {
    grid-column: 1 / span 2;
}

.person-lname {
    grid-column: 3 / span 2;
}

.person-ced {
    grid-column: 5 / span 1;
}

.person-phone {
    grid-column: 6 / span 1;
}

.person-sex {
    grid-column: 1 / span 1;
}

.person-rif {
    grid-column: 2 / span 2;
}

.person-birth {
    grid-column: 4 / span 1;
}

.person-addr {
    grid-column: 5 / span 2;
}

.person-role {
    grid-column: 1 / span 4;
    font-weight: 800;
    font-size: 15px;
}

.person-actions {
    grid-column: 5 / span 2;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: flex-end;
}

.person-actions .btn-primary {
    width: 140px;
    height: 42px;
    font-weight: 700;
    font-size: 15px;
}

/* Login Form specific */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-panel {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.login-hero-side {
    width: 550px;
    flex-shrink: 0;
    line-height: 0;
}

.login-hero-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.login-form-side {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(15, 23, 42, 0.3);
}

.login-form label {
    display: block;
    text-align: left;
    color: #fff;
    margin-top: 10px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .login-panel {
        flex-direction: column;
        max-width: 450px;
    }
    .login-hero-side {
        width: 100%;
        height: 200px;
    }
}

.login-form input {
    width: 100%;
    max-width: 100%;
    background: #fff !important;
    color: #000 !important;
}

.login-form button {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(90deg, var(--tm-fuchsia), var(--tm-purple));
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.login-form button:hover {
    filter: brightness(1.05);
}

/* --- RESPONSIVE FIXES (Small screens) --- */
@media (max-width: 1100px) {
    .card {
        grid-column: span 12;
    }

    .assign-form {
        grid-template-columns: 1fr 1fr;
    }

    .vehicle-form,
    .person-form {
        grid-template-columns: repeat(2, 1fr);
    }

    .vehicle-notes,
    .vehicle-actions {
        grid-column: span 2;
    }

    .vehicle-actions {
        justify-content: stretch;
    }

    .vehicle-actions .btn-primary {
        width: 100%;
    }

    .person-fname,
    .person-lname,
    .person-ced,
    .person-phone,
    .person-sex,
    .person-rif,
    .person-birth,
    .person-addr,
    .person-role,
    .person-actions {
        grid-column: 1 / span 2 !important;
    }
}

@media (max-width: 640px) {
    .actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn,
    .btn-secondary,
    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    table.table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    thead,
    tbody,
    tr,
    th,
    td {
        white-space: nowrap;
    }
}

/* --- MODALES --- */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.is-active {
    display: flex !important;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: var(--surface);
    padding: 24px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.modal-close {
    cursor: pointer;
    font-size: 24px;
    opacity: 0.6;
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
}

.modal-close:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- MODERN KPI CARDS --- */
.kcard-modern {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  transition: all 0.2s ease;
  min-height: 80px;
}

.kcard-modern:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.kcard-modern .icon {
  width: 44px;
  height: 44px;
  background: var(--btn-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.kcard-modern h3 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 2px 0;
  font-weight: 800;
}

.kcard-modern .v {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- TOP BAR & NAVIGATION --- */
.top-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 24px !important;
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  margin: -86px -20px 24px -20px !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
}

.top-bar .brand {
  font-weight: 900 !important;
  font-size: 19px !important;
  color: var(--text) !important;
  letter-spacing: -0.5px !important;
}

.search-wrap {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 8px 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 320px !important;
}

.search-wrap input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  font-size: 14px !important;
  color: var(--text) !important;
  width: 100% !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.search-wrap svg { color: var(--text-muted) !important; }

/* REZULTADOS BUSQUEDA DINAMICA */
.t-center { position: relative; }
.search-results-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    display: none;
    z-index: 2100;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
    animation: slideUp 0.15s ease-out;
}

.search-results-menu.active { display: block; }

.s-res-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.s-res-item:hover { background: var(--btn-bg); }
.s-res-item:last-child { border-bottom: none; }
.s-res-item .s-icon { font-size: 16px; opacity: 0.8; }
.s-res-item .s-content { display: flex; flex-direction: column; }
.s-res-item .s-title { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.s-res-item .s-type { font-size: 11.5px; color: var(--text); opacity: 0.75; text-transform: uppercase; font-weight: 700; margin-top: 1px; }
.s-res-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

.t-right {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
}

.t-icon-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted) !important;
  position: relative !important;
  cursor: pointer !important;
  display: flex !important;
  padding: 6px !important;
  border-radius: 10px !important;
  transition: background 0.2s !important;
}

.t-icon-btn:hover { background: var(--btn-bg) !important; color: var(--text) !important; }

.t-icon-btn .dot {
  position: absolute !important;
  top: 6px !important;
  right: 6px !important;
  width: 9px !important;
  height: 9px !important;
  background: var(--danger) !important;
  border-radius: 50% !important;
  border: 2px solid var(--surface) !important;
}

.t-user {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  padding: 6px 10px !important;
  border-radius: 12px !important;
  transition: background 0.2s !important;
}

.t-user:hover { background: var(--btn-bg) !important; }

.u-info { text-align: right !important; }
.u-name {
  display: block !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  color: var(--text) !important;
  line-height: 1.2 !important;
}
.u-role {
  display: block !important;
  font-size: 10px !important;
  color: var(--text-muted) !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
}

.u-avatar {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  background: var(--btn-bg) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Dropdowns */
.t-dropdown-wrap { position: relative !important; }
.t-dropdown {
  position: absolute !important;
  top: calc(100% + 12px) !important;
  right: 0 !important;
  background: var(--surface) !important;
  border-radius: 14px !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15) !important;
  min-width: 240px !important;
  display: none !important;
  z-index: 2000 !important;
  overflow: hidden !important;
  animation: slideUp 0.2s ease-out !important;
}

.t-dropdown.active { display: block !important; }

.d-header { padding: 12px 16px !important; font-weight: 800 !important; font-size: 12px !important; color: var(--text-muted) !important; background: var(--btn-bg) !important; border-bottom: 1px solid var(--border) !important; text-transform: uppercase !important; }

.d-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  text-decoration: none !important;
  color: var(--text) !important;
  font-size: 13.5px !important;
  transition: background 0.2s !important;
  cursor: pointer !important;
  border: none !important; width: 100% !important; text-align: left !important; background: none !important;
}

.d-item:hover { background: var(--btn-bg) !important; }
.d-item.logout { color: var(--danger) !important; font-weight: 700 !important; }
.d-item.logout:hover { background: color-mix(in srgb, var(--danger) 10%, transparent) !important; }
.d-item hr { border: none !important; border-top: 1px solid var(--border) !important; margin: 6px 0 !important; }

.d-empty { padding: 30px 20px !important; text-align: center !important; color: var(--text-muted) !important; font-size: 13px !important; }
.d-footer { padding: 10px !important; text-align: center !important; border-top: 1px solid var(--border) !important; }
.d-footer a { font-size: 12px !important; color: var(--primary) !important; text-decoration: none !important; font-weight: 700 !important; }

.notif-menu { width: 320px !important; }
.notif-menu .d-item { padding: 14px 16px !important; align-items: flex-start !important; border-bottom: 1px solid var(--border) !important; }
.notif-menu .icon { font-size: 18px !important; margin-top: 2px !important; }
.notif-menu .txt { line-height: 1.4 !important; font-size: 13px !important; }

/* Dashboard Titles */
.page-title-section {
  padding: 16px 8px 0 !important;
}


/* --- SHORTCUT GRID (Acceso Rápido) --- */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.s-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  gap: 8px;
}

.s-tile span {
  font-size: 24px;
  transition: transform 0.2s;
}

.s-tile:hover {
  background: var(--btn-bg);
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.s-tile:hover span {
  transform: scale(1.1);
}
/* --- VIEW CARDS (Structured Data Display) --- */
.view-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}

.view-section {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 24px;
}

.view-section:last-child {
  border-bottom: none;
}

.view-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-item label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.info-item span {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.route-item {
  background: var(--btn-bg);
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.route-item b {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.route-item p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.file-preview {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.2s;
}

.file-preview:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.file-preview img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: pointer;
}

.file-no-img {
  width: 100%;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 5%, transparent);
}

.file-info {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.file-info b { font-size: 12px; }

/* --- FINANCE & SAAS DASHBOARD HELPERS --- */
.finance-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.f-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.f-box:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.f-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.f-val {
    font-size: 26px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.1;
}

.f-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.8;
}

.hero-card {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.05;
    pointer-events: none;
}

.movement-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.mv-card {
    flex: 1;
    min-width: 160px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
    transition: all 0.2s;
}

.mv-card:hover { background: var(--btn-bg); }

.mv-card .lbl {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.4px;
}

.mv-card .val {
    font-size: 20px;
    font-weight: 800;
}

.positive { color: #10b981 !important; }
.negative { color: #ef4444 !important; }

/* Cashflow Specifics */
.cf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cf-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.cf-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cf-val-usd {
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    color: var(--text);
}

.cf-val-ves {
    font-size: 15px;
    font-weight: 700;
    color: var(--tm-fuchsia);
    margin-top: 6px;
}

.cat-pill {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--btn-bg);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media (max-width: 1100px) {
    .finance-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .finance-grid { grid-template-columns: 1fr; }
    .hero-card { padding: 24px; }
}

/* ============================================================================
   SweetAlert2 — theme-aware modal (2026-05-22)
   Aplicar con: Swal.fire({ customClass: { popup: 'busskm-swal-dark' }, ... })
   El nombre dice "dark" pero respeta light/dark via CSS tokens.
   ============================================================================ */
.busskm-swal-dark {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: 12px !important;
}
.busskm-swal-dark .swal2-html-container { overflow: visible !important; }
.busskm-swal-dark .swal2-title,
.busskm-swal-dark .swal2-html-container,
.busskm-swal-dark .swal2-label { color: var(--text) !important; }
.busskm-swal-dark .swal2-input,
.busskm-swal-dark .swal2-textarea,
.busskm-swal-dark .swal2-select,
.busskm-swal-dark .swal2-file {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 !important;
    box-sizing: border-box !important;
}
.busskm-swal-dark .swal2-input::placeholder,
.busskm-swal-dark .swal2-textarea::placeholder {
    color: color-mix(in srgb, var(--text) 45%, transparent);
}
.busskm-swal-dark .swal2-input:focus,
.busskm-swal-dark .swal2-textarea:focus,
.busskm-swal-dark .swal2-select:focus { border-color: var(--primary) !important; }
.busskm-swal-dark .swal2-validation-message {
    background: color-mix(in srgb, var(--danger) 18%, transparent) !important;
    color: var(--danger) !important;
}
.busskm-swal-dark .swal2-confirm {
    background: var(--primary) !important; color: #fff !important; border: none !important;
}
.busskm-swal-dark .swal2-cancel {
    background: var(--surface-2) !important; color: var(--text) !important;
    border: 1px solid var(--border) !important;
}
