:root {
    --bg: #f4f7fb;
    --sidebar: #0f172a;
    --sidebar-soft: #1e293b;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e5e7eb;
    --blue: #2563eb;
    --green: #10b981;
    --purple: #7c3aed;
    --orange: #f59e0b;
    --red: #ef4444;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a, #111827);
    color: #fff;
    padding: 24px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
}

.logo-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--blue);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.logo h2 {
    margin: 0;
    font-size: 20px;
}

.logo span {
    font-size: 12px;
    color: #94a3b8;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 14px;
    transition: 0.2s;
}

.menu a:hover,
.menu a.active {
    background: var(--sidebar-soft);
    color: #fff;
}

.main {
    margin-left: 280px;
    width: calc(100% - 280px);
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
}

.filters {
    display: flex;
    gap: 10px;
    background: var(--card);
    padding: 12px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.filters input,
.filters button {
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
}

.filters button {
    background: var(--blue);
    color: white;
    border: none;
    cursor: pointer;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.kpi {
    background: var(--card);
    border-radius: 20px;
    padding: 22px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--blue);
}

.kpi span {
    color: var(--muted);
    font-size: 13px;
}

.kpi h2 {
    margin: 12px 0 8px;
    font-size: 24px;
}

.kpi p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.kpi.green { border-color: var(--green); }
.kpi.purple { border-color: var(--purple); }
.kpi.orange { border-color: var(--orange); }
.kpi.red { border-color: var(--red); }
.kpi.dark { border-color: var(--sidebar); }

.grid.two {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    margin-bottom: 24px;
}

.panel {
    background: var(--card);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.panel-head h3 {
    margin: 0;
    font-size: 18px;
}

.panel-head span {
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--muted);
    font-size: 13px;
    padding: 13px;
    background: #f8fafc;
}

td {
    padding: 14px 13px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tbody tr:hover {
    background: #f8fafc;
}

.insights ul {
    margin: 0;
    padding-left: 20px;
}

.insights li {
    margin-bottom: 12px;
    color: #334155;
}

canvas {
    max-height: 360px;
}

@media (max-width: 1200px) {
    .kpis {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid.two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .app {
        flex-direction: column;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .filters {
        width: 100%;
        flex-wrap: wrap;
    }

    .kpis {
        grid-template-columns: 1fr;
    }
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f172a, #2563eb);
}

.login-box {
    width: 360px;
    background: white;
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    text-align: center;
}

.login-box h2 {
    margin: 0;
    font-size: 28px;
}

.login-box p {
    color: var(--muted);
    margin-bottom: 24px;
}

.login-box input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 18px;
    text-align: center;
    margin-bottom: 14px;
}

.login-box button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: var(--blue);
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 15px;
}