/* Dashboard v2: filtros globales + cards */

.main { overflow-y: auto; padding: 24px 32px; }

.home-header h1 { margin: 0 0 4px; font-size: 22px; }
.home-sub { margin: 0 0 16px; color: #6b7280; font-size: 13px; }

/* ---------- panel de filtros ---------- */
.filters-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 12px;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-field label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-field select,
.filter-field input {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #1f2937;
    font-family: inherit;
    width: 100%;
}

.filter-field select:focus,
.filter-field input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-field.dirty select,
.filter-field.dirty input {
    border-color: #f59e0b;
    background: #fffbeb;
}

/* ---------- botones de acción ---------- */
.filters-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-apply,
.btn-reset {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s;
}

.btn-apply { background: #2563eb; color: white; }
.btn-apply:hover:not(:disabled) { background: #1d4ed8; }
.btn-apply:disabled { background: #9ca3af; cursor: not-allowed; opacity: 0.6; }

.btn-reset {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}
.btn-reset:hover:not(:disabled) { background: #f3f4f6; }
.btn-reset:disabled { opacity: 0.5; cursor: not-allowed; }

.apply-hint {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

/* ---------- grid de cards ---------- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
}

/* Cards de tipo "chart" ocupan media fila (2 de 4 cols) y son más altas */
.card-chart {
    grid-column: span 2;
    min-height: 360px;
}

/* Cards de tipo "kpi" ocupan 1 columna y son cortas */
.card-kpi {
    grid-column: span 1;
    min-height: 110px;
    justify-content: center;
}

/* Cards de tipo "table" — ancho completo, alto se ajusta al contenido. */
.card-table {
    grid-column: span 4;
    min-height: 200px;
}

.kpi-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.card-loading-small {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

@media (max-width: 1100px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .card-chart { grid-column: span 2; }
    .card-kpi   { grid-column: span 1; }
    .card-table { grid-column: span 2; }
}
@media (max-width: 700px) {
    .cards-grid { grid-template-columns: 1fr; }
    .card-chart, .card-kpi, .card-table { grid-column: span 1; }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.card-title { font-size: 14px; font-weight: 600; color: #1f2937; }
.card-meta { font-size: 11px; color: #9ca3af; }

.card-body {
    flex: 1;
    position: relative;
    min-height: 280px;
}

.card-error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
}

.card-loading {
    color: #6b7280;
    font-size: 13px;
    padding: 20px;
}

.loading {
    color: #6b7280;
    font-size: 13px;
    padding: 16px;
}

/* ---------- Tablas dentro de cards (card-table) ---------- */

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.data-table thead th {
    background: #f9fafb;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 11px;
    border-bottom: 1px solid #d1d5db;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table tfoot td {
    background: #f9fafb;
    border-top: 2px solid #d1d5db;
    border-bottom: none;
}

.data-table .align-left   { text-align: left;   }
.data-table .align-right  { text-align: right;  }
.data-table .align-center { text-align: center; }
