/* Dashboard — page chrome inside .etl-surface__main */

.etl-dash {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.35rem 1.5rem 2.25rem;
}

.etl-dash__hero {
    margin-bottom: 1.35rem;
}

.etl-dash__hero-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.etl-dash__hero-main {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.etl-dash__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 2vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--etl-text);
}

.etl-dash__subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--etl-text-muted);
    max-width: 42rem;
    line-height: 1.5;
}

.etl-dash__toolbar {
    background: var(--etl-card);
    border: 1px solid var(--etl-card-border);
    border-radius: var(--etl-radius-lg);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--etl-shadow-sm);
    margin-bottom: 1.35rem;
}

.etl-dash__toolbar-section {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--etl-text-muted);
    margin-bottom: 0.5rem;
}

.etl-dash__date-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--etl-text-secondary);
    margin-bottom: 0.25rem;
    text-transform: none;
    letter-spacing: normal;
}

.etl-dash__toolbar .form-control {
    border-color: var(--etl-card-border);
    font-size: 0.875rem;
}

/* type=date: không dùng input-group + icon (tránh chồng lên picker native) */
.etl-dash__date-input {
    min-width: 0;
    width: 100%;
    padding: 0.5rem 0.65rem;
    line-height: 1.4;
}

.etl-dash__date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.85;
}

.etl-dash__date-row {
    margin-top: 0;
}

.etl-dash__pills .btn {
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-color: var(--etl-card-border);
    color: var(--etl-text-secondary);
}

.etl-dash__pills .btn-check:checked + .btn {
    background: var(--etl-sidebar-active) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 4px 14px var(--etl-accent-shadow);
}

.etl-dash__refresh.btn-primary {
    background: var(--etl-sidebar-active);
    border: none;
    font-weight: 600;
    border-radius: var(--etl-radius-sm);
    padding: 0.45rem 1rem;
    box-shadow: 0 4px 14px var(--etl-accent-shadow-soft);
}

.etl-dash__refresh.btn-primary:hover {
    filter: brightness(1.06);
    box-shadow: 0 6px 18px var(--etl-accent-shadow);
}

/* Viền dưới header bảng: teal brand (thay vạch xanh design-system) */
.etl-dash .activity-table thead th,
.etl-dash .etl-table thead th {
    border-bottom-color: var(--etl-accent) !important;
}

/* KPI grid */
.etl-dash__kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
}

@media (max-width: 1199.98px) {
    .etl-dash__kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .etl-dash__kpis {
        grid-template-columns: 1fr;
    }
}

.etl-kpi {
    position: relative;
    background: var(--etl-card);
    border: 1px solid var(--etl-card-border);
    border-radius: var(--etl-radius-md);
    padding: 1.1rem 1.15rem 1.05rem;
    box-shadow: var(--etl-shadow-sm);
    overflow: hidden;
    min-width: 0;
}

.etl-kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: var(--etl-radius-md) 0 0 var(--etl-radius-md);
    background: var(--etl-kpi-accent, var(--etl-accent));
}

.etl-kpi--cyan { --etl-kpi-accent: linear-gradient(180deg, var(--etl-accent-mid), var(--etl-accent)); }
.etl-kpi--blue { --etl-kpi-accent: linear-gradient(180deg, #60a5fa, #2563eb); }
.etl-kpi--amber { --etl-kpi-accent: linear-gradient(180deg, #fbbf24, #d97706); }
.etl-kpi--violet { --etl-kpi-accent: linear-gradient(180deg, #a78bfa, #7c3aed); }

.etl-kpi__row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.etl-kpi__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--etl-radius-sm);
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: #fff;
    background: var(--etl-kpi-icon-bg, var(--etl-sidebar-active));
    flex-shrink: 0;
}

.etl-kpi--cyan .etl-kpi__icon { background: linear-gradient(135deg, var(--etl-accent-mid), var(--etl-accent)); }
.etl-kpi--blue .etl-kpi__icon { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.etl-kpi--amber .etl-kpi__icon { background: linear-gradient(135deg, #fbbf24, #d97706); }
.etl-kpi--violet .etl-kpi__icon { background: linear-gradient(135deg, #a78bfa, #7c3aed); }

.etl-kpi__tag {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.12);
    color: var(--etl-text-muted);
}

.etl-kpi__tag--up {
    background: var(--etl-accent-muted);
    color: var(--etl-accent-text);
}

.etl-kpi__value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--etl-text);
    word-break: break-word;
}

.etl-kpi__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--etl-text-secondary);
    margin-top: 0.2rem;
}

.etl-kpi__hint {
    font-size: 0.75rem;
    color: var(--etl-text-muted);
    margin: 0.35rem 0 0;
}

/* Charts */
.etl-dash__charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
}

@media (max-width: 991.98px) {
    .etl-dash__charts {
        grid-template-columns: 1fr;
    }
}

.etl-chart-card {
    background: var(--etl-card);
    border: 1px solid var(--etl-card-border);
    border-radius: var(--etl-radius-md);
    padding: 1.05rem 1.15rem 0.9rem;
    box-shadow: var(--etl-shadow-sm);
    min-width: 0;
}

.etl-chart-card__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.65rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--etl-text);
}

.etl-chart-card__title i {
    font-size: 1.1rem;
    opacity: 0.9;
}

.etl-chart-card canvas {
    max-height: 220px;
}

/* Activity panel */
.etl-dash__activity {
    background: var(--etl-card);
    border: 1px solid var(--etl-card-border);
    border-radius: var(--etl-radius-md);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--etl-shadow-sm);
    min-width: 0;
}

.etl-dash__activity-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--etl-card-border);
}

.etl-dash__activity-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--etl-text);
}

.etl-dash__activity-head i {
    color: var(--etl-accent);
    font-size: 1.15rem;
}

/* Dark: badge KPI đọc rõ trên nền tối */
html[data-theme="dark"] .etl-kpi__tag {
    background: rgba(255, 255, 255, 0.06);
    color: var(--etl-text-muted);
}

html[data-theme="dark"] .etl-kpi__tag--up {
    background: rgba(46, 179, 152, 0.18);
    color: var(--etl-accent-mid);
}

/* —— Dark template: độ sâu thẻ, mockup #11141d / #1c212c —— */
html[data-theme="dark"] .etl-dash .etl-kpi,
html[data-theme="dark"] .etl-dash .etl-dash__activity {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .etl-dash .etl-kpi__hint,
html[data-theme="dark"] .etl-dash .etl-kpi__label {
    color: rgba(203, 213, 225, 0.78);
}

html[data-theme="dark"] .etl-dash .etl-kpi__value {
    color: #f8fafc;
}

/* Bảng dark: header + viền teal #2eb398 (đồng bộ app-shell-dark) */
html[data-theme="dark"] .etl-dash .activity-table thead th,
html[data-theme="dark"] .etl-dash .etl-table thead th {
    background: #2eb398 !important;
    background-image: none !important;
    color: #fff !important;
    border-bottom: 2px solid #2eb398 !important;
}

html[data-theme="dark"] .etl-dash .activity-table tbody td,
html[data-theme="dark"] .etl-dash .etl-table tbody td {
    color: rgba(248, 250, 252, 0.94) !important;
    border-bottom: 1px solid #2eb398 !important;
}

html:not([data-theme="light"]) .etl-dash .activity-table thead th,
html:not([data-theme="light"]) .etl-dash .etl-table thead th {
    background: #2eb398 !important;
    background-image: none !important;
    color: #fff !important;
    border-bottom: 2px solid #2eb398 !important;
}

html:not([data-theme="light"]) .etl-dash .activity-table tbody td,
html:not([data-theme="light"]) .etl-dash .etl-table tbody td {
    color: rgba(248, 250, 252, 0.94) !important;
    border-bottom: 1px solid #2eb398 !important;
}

html[data-theme="dark"] .etl-dash .activity-table tbody td:first-child,
html[data-theme="dark"] .etl-dash .etl-table tbody td:first-child,
html:not([data-theme="light"]) .etl-dash .activity-table tbody td:first-child,
html:not([data-theme="light"]) .etl-dash .etl-table tbody td:first-child {
    color: rgba(226, 232, 240, 0.92) !important;
}

html[data-theme="dark"] .etl-dash .activity-table tbody tr:hover,
html[data-theme="dark"] .etl-dash .etl-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Pill trạng thái: nền pastel trên dark */
html[data-theme="dark"] .etl-dash .status-badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

html[data-theme="dark"] .etl-dash .status-badge.danger,
html[data-theme="dark"] .etl-dash .status-badge.failed {
    background: rgba(248, 113, 113, 0.18);
    color: #fecaca;
}

html[data-theme="dark"] .etl-dash .status-badge.info,
html[data-theme="dark"] .etl-dash .status-badge.running {
    background: rgba(56, 189, 248, 0.16);
    color: #bae6fd;
}

html[data-theme="dark"] .etl-dash .status-badge.secondary {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
}

/* Empty state */
html[data-theme="dark"] .etl-dash .empty-state h3 {
    color: var(--etl-text);
}

html[data-theme="dark"] .etl-dash .empty-state .text-muted {
    color: var(--etl-text-muted) !important;
}

html[data-theme="dark"] .etl-dash .empty-state-icon {
    color: var(--etl-text-muted);
}

/* Skeleton loading KPI */
html[data-theme="dark"] .etl-dash .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.06) 100%
    );
    background-size: 200% 100%;
}
