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

/* ═══════════════════ TOKENS ═══════════════════ */
:root,
:root[data-theme="dark"] {
    --brand: #2563eb;
    --brand-2: #3b82f6;
    --brand-deep: #1d4ed8;
    --brand-soft: rgba(37, 99, 235, 0.12);
    --brand-ring: rgba(37, 99, 235, 0.35);

    --bg: #0c0c0e;
    --surface: #151518;
    --surface-2: #1c1c20;
    --surface-3: #242429;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.11);

    --text: #f4f4f5;
    --text-2: #b4b4bb;
    --muted: #7a7a84;

    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);
    --danger: #ff5a5f;
    --danger-soft: rgba(255, 90, 95, 0.12);
    --warning: #f5b33b;
    --warning-soft: rgba(245, 179, 59, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

    --chart-grid: rgba(255, 255, 255, 0.05);
    --chart-tick: #7a7a84;

    color-scheme: dark;
}

:root[data-theme="light"] {
    --brand-soft: rgba(37, 99, 235, 0.08);
    --brand-ring: rgba(37, 99, 235, 0.25);

    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #f7f7f9;
    --surface-3: #efeff2;
    --border: #ebebef;
    --border-strong: #dcdce2;

    --text: #111114;
    --text-2: #4b4b55;
    --muted: #8b8b96;

    --success: #16a34a;
    --success-soft: rgba(22, 163, 74, 0.1);
    --danger: #e11d48;
    --danger-soft: rgba(225, 29, 72, 0.08);
    --warning: #d97706;
    --warning-soft: rgba(217, 119, 6, 0.1);

    --shadow-sm: 0 1px 2px rgba(16, 16, 24, 0.04);
    --shadow-md: 0 8px 24px rgba(16, 16, 24, 0.06);
    --shadow-lg: 0 24px 60px rgba(16, 16, 24, 0.14);

    --chart-grid: rgba(17, 17, 20, 0.06);
    --chart-tick: #8b8b96;

    color-scheme: light;
}

:root {
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --t: 0.18s var(--ease);
    --sidebar-w: 256px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { background: var(--bg); }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

a { color: var(--brand); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--brand-2); }

::selection { background: var(--brand); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ═══════════════════ LAYOUT ═══════════════════ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    transition: transform 0.25s var(--ease), background-color 0.25s var(--ease);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 20px;
    color: var(--text);
}
.sidebar-brand:hover { color: var(--text); }

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--brand-2), var(--brand) 55%, var(--brand-deep));
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; display: block; }

.brand-text strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.brand-text small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }

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

.nav-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 16px 12px 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: background-color var(--t), color var(--t);
}
.sidebar-nav a .icon { color: var(--muted); transition: color var(--t); }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a:hover .icon { color: var(--text); }

.sidebar-nav a.active {
    background: var(--surface-3);
    color: var(--text);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--border);
}
.sidebar-nav a.active .icon { color: var(--brand); }


.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 8px 2px;
    border-top: 1px solid var(--border);
}

.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-meta strong { display: block; font-size: 13px; font-weight: 600; text-transform: capitalize; }
.user-meta small { display: block; font-size: 11.5px; color: var(--muted); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--brand-2), var(--brand));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: all var(--t);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.sidebar-footer .icon-btn:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 36px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.breadcrumb svg { width: 14px; height: 14px; }
.breadcrumb strong { color: var(--text); font-weight: 600; }

.menu-btn { display: none; }

.live-dot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    padding: 7px 12px;
    border-radius: var(--radius-full);
    background: var(--surface);
    border: 1px solid var(--border);
}
.live-dot i {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.content {
    padding: 28px 36px 48px;
    max-width: 1480px;
    animation: fadeUp 0.35s var(--ease);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ═══════════════════ PAGE HEADER ═══════════════════ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.2;
}
.page-header h1 + p,
.page-header .subtitle { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ═══════════════════ FILTER BAR ═══════════════════ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 22px;
}

.filter-bar:not(form) {
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: fit-content;
    max-width: 100%;
    box-shadow: var(--shadow-sm);
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-2);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all var(--t);
    display: inline-block;
    white-space: nowrap;
}
.filter-btn:hover { color: var(--text); background: var(--surface-2); }

.filter-btn.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.filter-btn.active:hover { color: #fff; background: var(--brand); }

.filter-select {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 34px 8px 14px;
    margin-left: 4px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238b8b96' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.filter-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.filter-select option { background: var(--surface); color: var(--text); }

.date-inputs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.date-inputs input[type="date"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    transition: all var(--t);
}
.date-inputs input[type="date"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ═══════════════════ BUTTONS ═══════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    transition: all var(--t);
    white-space: nowrap;
    line-height: 1.2;
}
.btn svg { width: 16px; height: 16px; }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }

.btn-primary {
    background: linear-gradient(180deg, var(--brand-2) -40%, var(--brand) 60%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { color: #fff; filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, 0.34); }
.btn-primary:active { transform: translateY(0); }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-outline:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }

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

/* ═══════════════════ CARDS ═══════════════════ */
.kpi-card, .chart-card, .table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.25s var(--ease), border-color var(--t), box-shadow var(--t), transform var(--t);
}

/* KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid.cols-5 .value { font-size: clamp(18px, 1.55vw, 24px); }

.kpi-card {
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.kpi-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }

.kpi-card .label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 14px;
    font-weight: 500;
}

.kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-2);
    flex-shrink: 0;
}
.kpi-icon svg { width: 17px; height: 17px; }

.kpi-card .value {
    font-size: 25px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-card .value.negative { color: var(--danger); }

.kpi-card .hint { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* Hero KPI — destaque em azul */
.kpi-card.is-hero {
    background:
        radial-gradient(130% 120% at 100% 0%, rgba(255, 255, 255, 0.18), transparent 50%),
        linear-gradient(140deg, #3b82f6 0%, #2563eb 45%, #1e3a8a 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.3);
}
.kpi-card.is-hero .label { color: rgba(255, 255, 255, 0.85); }
.kpi-card.is-hero .kpi-icon { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.kpi-card.is-hero .value, .kpi-card.is-hero .value.negative { color: #fff; }
.kpi-card.is-hero .hint { color: rgba(255, 255, 255, 0.75); }

/* Charts */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.chart-grid .chart-card { margin-bottom: 0; }

.chart-card { padding: 22px 24px; margin-bottom: 20px; }
.chart-card canvas { max-height: 340px; }

.chart-card h3, .table-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chart-card h3::before, .table-card h3::before {
    content: '';
    width: 4px;
    height: 16px;
    border-radius: 4px;
    background: var(--brand);
}

/* Tables */
.table-card { padding: 22px 24px; margin-bottom: 20px; overflow-x: auto; }

table { width: 100%; border-collapse: separate; border-spacing: 0; }

table th {
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    padding: 10px 14px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table th:first-child { border-left: 1px solid var(--border); border-radius: 10px 0 0 10px; }
table th:last-child { border-right: 1px solid var(--border); border-radius: 0 10px 10px 0; }

table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table td strong { color: var(--text); font-weight: 600; }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr { transition: background-color var(--t); }
table tbody tr:hover td { background: var(--surface-2); }

.tr-total td {
    font-weight: 700;
    color: var(--text);
    background: var(--brand-soft) !important;
    border-bottom: none;
}
.tr-total td:first-child { border-radius: 10px 0 0 10px; }
.tr-total td:last-child { border-radius: 0 10px 10px 0; }

.text-green { color: var(--success) !important; font-weight: 600; }
.text-red { color: var(--danger) !important; font-weight: 600; }
.text-muted { color: var(--muted) !important; }
.text-right { text-align: right; }

/* ═══════════════════ BADGES ═══════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-error   { background: var(--danger-soft);  color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted   { background: var(--surface-3);    color: var(--text-2); }

/* ═══════════════════ FORMS ═══════════════════ */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--t);
}
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.form-control::placeholder { color: var(--muted); }

.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* ═══════════════════ MODAL ═══════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 10, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.25s var(--ease);
}
.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 22px; letter-spacing: -0.02em; }

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* ═══════════════════ LOGIN PAGE ═══════════════════ */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--bg);
}

.login-hero {
    position: relative;
    overflow: hidden;
    margin: 16px;
    border-radius: 24px;
    padding: 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(90% 70% at 85% 10%, rgba(255, 255, 255, 0.2), transparent 60%),
        radial-gradient(80% 80% at 0% 100%, rgba(0, 0, 0, 0.35), transparent 60%),
        linear-gradient(145deg, #3b82f6 0%, #2563eb 45%, #1e3a8a 100%);
}
.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 75%);
}
.login-hero > * { position: relative; }
.login-hero .hero-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; }
.login-hero .hero-brand .brand-mark { background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 440px; margin: 32px 0; }
.hero-stat {
    padding: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.hero-stat small { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.75); margin-bottom: 6px; }
.hero-stat strong { font-size: 20px; letter-spacing: -0.02em; }
.hero-stat.wide { grid-column: 1 / -1; }
.hero-bars { display: flex; align-items: flex-end; gap: 6px; height: 56px; margin-top: 10px; }
.hero-bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: rgba(255, 255, 255, 0.85); }
.hero-bars i:nth-child(odd) { background: rgba(255, 255, 255, 0.45); }
.login-hero h2 { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; max-width: 420px; }
.login-hero p { margin-top: 10px; color: rgba(255, 255, 255, 0.8); max-width: 400px; }

.login-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
}
.login-side .theme-toggle { position: absolute; top: 24px; right: 24px; }

.login-box { width: 100%; max-width: 380px; }
.login-box .login-mark { margin-bottom: 26px; width: 48px; height: 48px; border-radius: 14px; }
.login-box .login-mark svg { width: 26px; height: 26px; }
.login-box h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 6px; }
.login-box > p { color: var(--muted); margin-bottom: 28px; }
.login-box .btn { width: 100%; padding: 13px; font-size: 14.5px; margin-top: 6px; }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }

/* ═══════════════════ ALERTS ═══════════════════ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }

/* ═══════════════════ MISC ═══════════════════ */
.log-status { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.sidebar-backdrop { display: none; }

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 1280px) {
    .kpi-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpi-grid.cols-5 .value { font-size: 22px; }
}

@media (max-width: 1100px) {
    .chart-grid { grid-template-columns: 1fr; }
    .kpi-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-grid.cols-3 .is-hero { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 90;
    }
    .main { margin-left: 0; }
    .menu-btn { display: inline-grid; }
    .topbar { padding: 12px 16px; }
    .content { padding: 20px 16px 40px; }
    .live-dot { display: none; }

    .login-page { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

@media (max-width: 640px) {
    .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
    .kpi-card { padding: 16px; }
    .kpi-card .value, .kpi-grid.cols-5 .value { font-size: 19px; }
    .kpi-icon { display: none; }
    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { max-width: none !important; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h1 { font-size: 22px; }
    .filter-bar:not(form) { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .filter-bar:not(form)::-webkit-scrollbar { display: none; }
    .filter-select { margin-left: 0; }
    .chart-card, .table-card { padding: 16px; }
    .breadcrumb span, .breadcrumb svg { display: none; }
}

@media (max-width: 380px) {
    .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-5 { grid-template-columns: 1fr !important; }
}

/* Action buttons inside table cells */
td .btn + .btn, td .btn + form, td form + form { margin-left: 4px; }
:root[data-theme="light"] .form-control { background: #fff; border-color: var(--border-strong); }
