/* ═══════════════════════════════════════════════════════════════════════════
   PNCP CNAE — Design System
   Premium dark theme with glassmorphism
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --bg-primary: #0B1121;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(15, 23, 42, 0.6);

    --border: rgba(71, 85, 105, 0.3);
    --border-hover: rgba(99, 102, 241, 0.4);
    --border-active: rgba(99, 102, 241, 0.6);

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: #818CF8;

    --accent: #6366F1;
    --accent-hover: #818CF8;
    --accent-glow: rgba(99, 102, 241, 0.15);

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #06B6D4;

    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #06B6D4 100%);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(6, 182, 212, 0.04) 100%);
    --gradient-hero: linear-gradient(135deg, #0B1121 0%, #1E1B4B 50%, #0B1121 100%);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ──────────────────────────────────────────────────────────────── */
html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── App Shell (sidebar + conteúdo) ───────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    min-width: 0;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    padding: 0 0.5rem;
    margin-bottom: 2rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    transition: var(--transition);
    text-align: left;
}

.sidebar-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-btn-active {
    background: var(--accent-glow);
    color: var(--text-accent);
    border-color: var(--border-active);
}

.sidebar-btn-active:hover {
    color: var(--text-accent);
}

.sidebar-group-toggle {
    justify-content: flex-start;
}

.sidebar-caret {
    margin-left: auto;
    font-size: 0.7rem;
    transition: var(--transition);
}

.sidebar-caret.open {
    transform: rotate(90deg);
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 1.6rem;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}

.sidebar-submenu.open {
    max-height: 220px;
}

.sidebar-btn-sub {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
}

/* ── View Toolbar ──────────────────────────────────────────────────────── */
.view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.view-toolbar h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.view-toolbar-actions {
    display: flex;
    gap: 10px;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.sidebar-usuario {
    padding: 0 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 2rem 0;
}

/* ── Header (legado, mantido por compatibilidade) ─────────────────────── */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.header-logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-logo span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.last-update-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

.last-update-pill strong {
    color: var(--text-accent);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.status-dot.green {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* ── Main Layout ───────────────────────────────────────────────────────── */
.main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

/* ── Stats Dashboard (painéis Geral / Com Interesse) ──────────────────── */
.stats-dashboard {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stats-panel {
    flex: 1;
    min-width: 0;
}

.stats-panel-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

.stats-panel-divider {
    width: 1px;
    background: var(--border);
    flex-shrink: 0;
}

/* ── Stats Cards ───────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-card-value.accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Charts Section ────────────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.chart-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Filters Bar ───────────────────────────────────────────────────────── */
.filters-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group > label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.filter-group > select,
.filter-group > input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
    min-width: 140px;
}

.filter-group > select:focus,
.filter-group > input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-group > input[type="text"] {
    min-width: 200px;
}

.filters-bar .filter-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* ── Multiselect (ex: filtro de Município) ────────────────────────────── */
.multiselect {
    position: relative;
}

.multiselect-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    min-width: 180px;
    transition: var(--transition);
}

.multiselect-toggle:hover {
    border-color: var(--border-hover);
}

.multiselect.open .multiselect-toggle {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.multiselect-caret {
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: var(--transition);
}

.multiselect.open .multiselect-caret {
    transform: rotate(180deg);
}

.multiselect-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 260px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.6rem;
    z-index: 200;
}

.multiselect.open .multiselect-panel {
    display: block;
}

.multiselect-search {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    margin-bottom: 0.5rem;
}

.multiselect-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.4rem;
}

.multiselect-actions a {
    font-size: 0.72rem;
    color: var(--text-accent);
    text-decoration: none;
    cursor: pointer;
}

.multiselect-actions a:hover {
    text-decoration: underline;
}

.multiselect-options {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.35rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary);
    cursor: pointer;
}

.multiselect-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.multiselect-option input[type="checkbox"] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    min-width: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.multiselect-empty {
    padding: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    padding: 0.45rem;
    min-width: 36px;
    justify-content: center;
}

/* ── Table ─────────────────────────────────────────────────────────────── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    /* Sem overflow:hidden aqui de propósito — ele cria um contexto de scroll
       que "prende" o position:sticky do cabeçalho antes de chegar na janela. */
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.table-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-header .table-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.82rem;
}

.busca-cadastro {
    flex: 1;
    min-width: 220px;
    max-width: 380px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}

.busca-cadastro:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

thead {
    background: rgba(30, 41, 59, 0.5);
}

/* Cabeçalho fixo ao rolar — vale pra qualquer tabela da aplicação (Editais,
   Usuários, Planejamento etc.), já que a regra não é escopada a um container. */
th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

th:hover {
    color: var(--text-accent);
}

td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    color: var(--text-secondary);
    vertical-align: top;
}

tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

td.objeto {
    max-width: 350px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

td.valor {
    font-weight: 600;
    color: var(--success);
    white-space: nowrap;
    text-align: right;
}

td.data {
    white-space: nowrap;
    font-size: 0.78rem;
}

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-grupo {
    background: var(--accent-glow);
    color: var(--text-accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-score {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-modalidade {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.pagination-controls button {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.pagination-controls button:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.pagination-controls button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 2rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .detail-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.2);
}

.detail-row .detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 120px;
    flex-shrink: 0;
}

.detail-row .detail-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* ── Coleta Modal ──────────────────────────────────────────────────────── */
.coleta-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.coleta-form .form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.coleta-form .form-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.coleta-form .form-group input,
.coleta-form .form-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}

.coleta-form .form-group input:focus,
.coleta-form .form-group select:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.coleta-form .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ── Progress Bar ──────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.5s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Console de Coleta ─────────────────────────────────────────────────── */
#coleta-console {
    margin-top: 0.75rem;
    background: #05070d;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    max-height: 160px;
    overflow-y: auto;
    color: var(--text-secondary);
}

#coleta-console div:last-child {
    color: var(--text-accent);
}

/* ── Loading Spinner ───────────────────────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Toast Notifications ───────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    font-size: 0.85rem;
    min-width: 300px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .stats-dashboard { flex-direction: column; }
    .stats-panel-divider { display: none; }
}

@media (max-width: 768px) {
    .header { padding: 0 1rem; }
    .main { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filters-bar { flex-direction: column; }
    .filter-group select,
    .filter-group input { min-width: 100%; }
    .filters-bar .filter-actions { margin-left: 0; width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card-value { font-size: 1.4rem; }
}
