/*
 * Zavia Hub — Design System v4
 *
 * Paleta:
 *   bg-base:    #0B0B0F   (body)
 *   bg-sidebar: #0F1117   (sidebar/topbar)
 *   bg-card:    #1A1C23   (widgets/cards)
 *   border:     #2A2D36
 *   brand:      #09B6EE   (primary cyan)
 *   brand-lt:   #4ADEFF   (accent cyan)
 *   text-hi:    #E5E7EB
 *   text-mid:   #9CA3AF
 *   text-lo:    #6B7280
 */

/* ─────────────────────────────────────────────────────────────────────────────
   BASE — forzar fondos sobre cualquier override de Filament
───────────────────────────────────────────────────────────────────────────── */

body,
.fi-body,
.dark .fi-body {
    background: #0B0B0F !important;
}

.dark .fi-main,
.fi-main {
    background: #0B0B0F !important;
}

.dark .fi-main-ctn {
    background: #0B0B0F !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-sidebar {
    background-color: #0F1117 !important;
    border-right: 1px solid #2A2D36;
}

.dark .fi-topbar,
.dark .fi-topbar-ctn {
    background-color: #0F1117 !important;
    border-bottom: 1px solid #2A2D36 !important;
    box-shadow: none;
}

.dark .fi-header {
    border-bottom: 1px solid #2A2D36;
}

/* Nav items */
.dark .fi-sidebar-item-button.fi-active {
    background: rgba(9, 182, 238, 0.1) !important;
    border-left: 2px solid #09B6EE;
    padding-left: calc(0.5rem - 2px);
}

.dark .fi-sidebar-item-button.fi-active .fi-icon,
.dark .fi-sidebar-item-button.fi-active .fi-sidebar-item-label {
    color: #09B6EE !important;
    font-weight: 600;
}

.dark .fi-sidebar-item-button:not(.fi-active):hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.dark .fi-sidebar-group-label {
    color: #6B7280 !important;
    font-size: 0.625rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CARDS / WIDGETS / SECCIONES
───────────────────────────────────────────────────────────────────────────── */

/* Base widget container */
.dark .fi-wi {
    border-radius: 1rem !important;
}

/* Stats Overview */
.dark .fi-wi-stats-overview {
    background: transparent;
    gap: 1rem;
}

.dark .fi-wi-stats-overview-stat,
.fi-wi-stats-overview-stat {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    border-left: 3px solid #09B6EE !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.dark .fi-wi-stats-overview-stat:hover,
.fi-wi-stats-overview-stat:hover {
    border-color: #2A2D36 !important;
    border-left-color: #4ADEFF !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(9,182,238,0.1) !important;
    transform: translateY(-1px);
}

.dark .fi-wi-stats-overview-stat-value,
.fi-wi-stats-overview-stat-value {
    font-size: 28px !important;
    font-weight: 600 !important;
    color: #E5E7EB !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.dark .fi-wi-stats-overview-stat-label,
.fi-wi-stats-overview-stat-label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #9CA3AF !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dark .fi-wi-stats-overview-stat-description,
.fi-wi-stats-overview-stat-description {
    font-size: 12px !important;
    color: #6B7280 !important;
}

/* Chart widgets — catch all Filament widget containers */
.dark .fi-wi-chart,
.dark [class*="fi-wi-apex"],
.dark .fi-widget,
[class*="fi-wi-apex"],
.fi-wi-chart {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    border-radius: 1rem !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.dark .fi-wi-chart:hover,
.dark [class*="fi-wi-apex"]:hover,
.dark .fi-widget:hover {
    border-color: rgba(9, 182, 238, 0.3) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(9,182,238,0.1) !important;
}

/* Chart heading */
.dark .fi-wi-chart-header,
.dark .apex-chart-widget-header {
    color: #E5E7EB !important;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Section */
.dark .fi-section,
.fi-section {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    border-radius: 1rem !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.dark .fi-section:hover,
.fi-section:hover {
    border-color: rgba(9, 182, 238, 0.3) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(9,182,238,0.1) !important;
}

.dark .fi-section-header {
    border-bottom: 1px solid #2A2D36;
}

.dark .fi-section-header-heading {
    color: #E5E7EB !important;
    font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────────────────────
   DASHBOARD FILTER WIDGET — layout responsive via CSS (no Alpine)
───────────────────────────────────────────────────────────────────────────── */

/* Mobile: ocultar toggle en sm+ */
@media (min-width: 640px) {
    .zv-filter-toggle { display: none !important; }
}

/* Mobile: controles colapsables — por defecto ocultos en mobile */
.zv-filter-controls {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}

/* Mobile open state */
.zv-filter-controls.is-open {
    display: flex;
}

/* Desktop: siempre visible, en fila */
@media (min-width: 640px) {
    .zv-filter-controls,
    .zv-filter-controls.is-open {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: flex-end !important;
        gap: 1rem !important;
    }
}

/* Divider — solo visible cuando controles visibles */
.zv-filter-divider {
    display: none;
    height: 1px;
    background: #2A2D36;
    margin-bottom: 1rem;
}

.zv-filter-divider.is-open,
@media (min-width: 640px) {
    .zv-filter-divider {
        display: block;
    }
}

@media (min-width: 640px) {
    .zv-filter-divider { display: block; }
}

/* Separator vertical entre grupos (solo desktop) */
.zv-filter-sep {
    display: none;
}
@media (min-width: 640px) {
    .zv-filter-sep {
        display: block;
        width: 1px;
        background: #2A2D36;
        align-self: stretch;
        margin: 0 0.25rem;
    }
}

/* Select groups: ancho fijo en desktop para no ocupar fila completa */
@media (min-width: 640px) {
    .zv-filter-select-group {
        flex-shrink: 0;
    }
    .zv-filter-select-group select,
    .zv-filter-select-group [class*="fi-select"],
    .zv-filter-select-group [class*="fi-input"] {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   TABLAS
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-ta-ctn {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    border-radius: 1rem !important;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
}

.dark .fi-ta-header-ctn {
    background-color: #1A1C23;
    border-bottom: 1px solid #2A2D36;
}

.dark .fi-ta-row:hover td {
    background-color: rgba(9, 182, 238, 0.04) !important;
}

.dark table thead tr th {
    background-color: #161820 !important;
    color: #6B7280 !important;
    font-size: 0.625rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 1px solid #2A2D36 !important;
}

.dark table tbody tr td {
    border-bottom: 1px solid #1E2128 !important;
    color: #E5E7EB;
}

/* ─────────────────────────────────────────────────────────────────────────────
   INPUTS / FORMS
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-input,
.dark .fi-select-input {
    background-color: #0F1117 !important;
    border-color: #2A2D36 !important;
    color: #E5E7EB !important;
    border-radius: 0.5rem;
}

.dark .fi-input:focus,
.dark .fi-select-input:focus {
    border-color: #09B6EE !important;
    box-shadow: 0 0 0 3px rgba(9, 182, 238, 0.12) !important;
    outline: none;
}

.dark .fi-input-wrp {
    border-color: #2A2D36 !important;
    background-color: #0F1117 !important;
    border-radius: 0.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BOTONES
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-btn-color-primary {
    background-color: #09B6EE !important;
    border-color: #09B6EE !important;
    box-shadow: 0 0 14px rgba(9, 182, 238, 0.2);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.dark .fi-btn-color-primary:hover {
    background-color: #4ADEFF !important;
    border-color: #4ADEFF !important;
    box-shadow: 0 0 22px rgba(9, 182, 238, 0.4) !important;
    transform: translateY(-1px);
}

.dark .fi-btn-color-gray {
    background-color: #1A1C23 !important;
    border-color: #2A2D36 !important;
    color: #9CA3AF !important;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.dark .fi-btn-color-gray:hover {
    border-color: rgba(9, 182, 238, 0.4) !important;
    color: #E5E7EB !important;
    background-color: #1E2029 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BADGES
───────────────────────────────────────────────────────────────────────────── */

.fi-badge-color-success {
    background-color: rgba(34, 197, 94, 0.12) !important;
    color: #22C55E !important;
    border: 1px solid rgba(34, 197, 94, 0.2) !important;
}

.fi-badge-color-danger {
    background-color: rgba(239, 68, 68, 0.12) !important;
    color: #EF4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.fi-badge-color-warning {
    background-color: rgba(245, 158, 11, 0.12) !important;
    color: #F59E0B !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
}

.fi-badge-color-primary,
.fi-badge-color-info {
    background-color: rgba(9, 182, 238, 0.12) !important;
    color: #09B6EE !important;
    border: 1px solid rgba(9, 182, 238, 0.2) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   DROPDOWN MENUS
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-dropdown-list {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}

.dark .fi-dropdown-list-item-label {
    color: #E5E7EB !important;
}

.dark .fi-dropdown-list-item-button:hover {
    background-color: rgba(9, 182, 238, 0.06) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-simple-layout {
    background-color: #0B0B0F;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(9, 182, 238, 0.1), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(74, 222, 255, 0.05), transparent);
}

.dark .fi-simple-main {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    box-shadow: 0 0 0 1px rgba(9,182,238,0.06), 0 24px 48px rgba(0,0,0,0.5) !important;
    border-radius: 1rem !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PAGINATION
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-ta-pagination {
    border-top: 1px solid #2A2D36;
    background-color: #1A1C23;
}

/* ─────────────────────────────────────────────────────────────────────────────
   NOTIFICACIONES
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-no-notification {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BRANDING
───────────────────────────────────────────────────────────────────────────── */

.dark .fi-logo {
    color: #09B6EE !important;
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SPOTLIGHT (Cmd+K)
───────────────────────────────────────────────────────────────────────────── */

.dark .spotlight-container {
    background-color: #1A1C23 !important;
    border: 1px solid #2A2D36 !important;
    box-shadow: 0 0 0 1px rgba(9,182,238,0.1), 0 24px 64px rgba(0,0,0,0.6) !important;
    border-radius: 0.75rem !important;
}

.dark .spotlight-input {
    background-color: transparent !important;
    color: #E5E7EB !important;
    border-bottom: 1px solid #2A2D36 !important;
}

.dark .spotlight-result-item.active {
    background-color: rgba(9, 182, 238, 0.08) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SCROLLBAR
───────────────────────────────────────────────────────────────────────────── */

.dark ::-webkit-scrollbar { width: 5px; height: 5px; }
.dark ::-webkit-scrollbar-track { background: #0B0B0F; }
.dark ::-webkit-scrollbar-thumb { background: #2A2D36; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb:hover { background: rgba(9,182,238,0.4); }

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY POLYFILL — clases usadas en custom blade views
   (Filament solo compila sus propias clases; las nuestras van aquí)
───────────────────────────────────────────────────────────────────────────── */

/* Typography */
.text-lg        { font-size: 1.125rem; line-height: 1.75rem; }
.tracking-wider { letter-spacing: 0.05em; }

/* Spacing */
.mb-6 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pr-4 { padding-right: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Flexbox */
.flex-col        { flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.items-end       { align-items: flex-end; }
.items-center    { align-items: center; }
.justify-center  { justify-content: center; }

/* Sizing */
.w-8 { width:  2rem; }
.h-8 { height: 2rem; }

/* Arbitrary widths */
.min-w-\[160px\] { min-width: 160px; }
.min-w-\[180px\] { min-width: 180px; }

/* Grid */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Responsive — sm (≥640px) */
@media (min-width: 640px) {
    .sm\:hidden      { display: none !important; }
    .sm\:flex        { display: flex !important; }
    .sm\:flex-row    { flex-direction: row; }
    .sm\:flex-wrap   { flex-wrap: wrap; }
    .sm\:items-end   { align-items: flex-end; }
    .sm\:gap-4       { gap: 1rem; }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Responsive — lg (≥1024px) */
@media (min-width: 1024px) {
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   COBRANZA AGING — bucket grid responsive
───────────────────────────────────────────────────────────────────────────── */

.zv-buckets-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
    .zv-buckets-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .zv-buckets-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   COBRANZA AGING — bucket cards custom
───────────────────────────────────────────────────────────────────────────── */

.zv-bucket-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid #2A2D36;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: border-color 0.2s ease;
}

.zv-bucket-card:hover {
    border-color: rgba(9, 182, 238, 0.25);
}

.zv-bucket-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.zv-bucket-amount {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #E5E7EB;
}

.zv-bucket-amount.success { color: #22C55E; }
.zv-bucket-amount.warning { color: #F59E0B; }
.zv-bucket-amount.danger  { color: #EF4444; }

.zv-bucket-count {
    font-size: 0.75rem;
    color: #6B7280;
}

/* Overdue table */
.zv-overdue-table { width: 100%; font-size: 0.8125rem; border-collapse: collapse; }

.zv-overdue-table thead tr {
    border-bottom: 1px solid #2A2D36;
}

.zv-overdue-table thead th {
    padding: 0 1rem 0.5rem 0;
    font-size: 0.625rem;
    font-weight: 700;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
}

.zv-overdue-table tbody tr {
    border-bottom: 1px solid #1E2128;
    transition: background-color 0.15s ease;
}

.zv-overdue-table tbody tr:hover {
    background-color: rgba(9, 182, 238, 0.04);
}

.zv-overdue-table tbody td {
    padding: 0.625rem 1rem 0.625rem 0;
    color: #E5E7EB;
    vertical-align: middle;
}

.zv-source-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: rgba(9,182,238,0.1);
    border: 1px solid rgba(9,182,238,0.2);
    padding: 0.125rem 0.625rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #09B6EE;
    white-space: nowrap;
}

/* Filter & column dropdown panels: detach from table container via fixed positioning.
 * x-float computes coordinates with transforms which work in fixed too (vs viewport). */
.fi-ta-filters-dropdown .fi-dropdown-panel,
.fi-ta-col-manager-dropdown .fi-dropdown-panel {
    position: fixed !important;
    z-index: 50;
    max-height: 65vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}
