
/* =========================================
   DASHBOARD ANALYTICS - AW TECHNOLOGY
   Identidade visual profissional
========================================= */

:root {
    --bg: #0b1120;
    --sidebar: #101827;
    --surface: #151f30;
    --surface-hover: #1b2940;
    --border: #263449;

    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --green: #10b981;
    --purple: #a78bfa;
    --orange: #f59e0b;
    --red: #f87171;

    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --sidebar-width: 250px;
    --radius: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

button,
select {
    font: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================
   ESTRUTURA PRINCIPAL
========================================= */

.dashboard {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 18px 20px;
    z-index: 10;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 34px;
    max-width: 1800px;
}

/* =========================================
   MARCA
========================================= */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    margin-bottom: 52px;
}

.brand-icon {
    width: 43px;
    height: 43px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: white;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -1px;
    box-shadow: 0 5px 20px rgba(37, 99, 235, .25);
}

.brand-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-info strong {
    font-size: 12px;
    letter-spacing: .7px;
}

.brand-info span {
    color: var(--text-muted);
    font-size: 10px;
}

/* =========================================
   MENU LATERAL
========================================= */

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    padding: 0 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 14px;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: .2s ease;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: rgba(59, 130, 246, .15);
    color: var(--primary-light);
    border: 1px solid rgba(59, 130, 246, .15);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-bottom {
    margin-top: auto;
}

.demo-status {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(16, 185, 129, .08);
    border: 1px solid rgba(16, 185, 129, .15);
    border-radius: 9px;
    padding: 11px;
    color: #6ee7b7;
    font-size: 10px;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(16, 185, 129, .5);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 22px;
    padding: 15px 8px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
}

.sidebar-footer strong {
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: .5px;
}

/* =========================================
   CABEÇALHO
========================================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.eyebrow {
    color: var(--primary-light);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.page-heading h1 {
    font-size: 27px;
    font-weight: 800;
    margin: 7px 0;
    letter-spacing: -.8px;
}

.page-heading p {
    color: var(--text-secondary);
    font-size: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 17px;
}

.demo-badge {
    padding: 8px 11px;
    border-radius: 6px;
    background: rgba(59, 130, 246, .1);
    color: var(--primary-light);
    border: 1px solid rgba(59, 130, 246, .2);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .6px;
}

.theme-toggle {
    width: 37px;
    height: 37px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 19px;
    transition: .2s;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 39px;
    height: 39px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #60a5fa);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info strong {
    font-size: 11px;
}

.user-info span {
    color: var(--text-muted);
    font-size: 10px;
}

/* =========================================
   BARRA DE FILTROS
========================================= */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
}

.toolbar-description {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
    font-size: 11px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    color: var(--text-secondary);
    font-size: 11px;
}

.filter-group select {
    min-width: 150px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    cursor: pointer;
    font-size: 11px;
}

.filter-group select:focus {
    border-color: var(--primary);
}

/* =========================================
   CARTÕES DE INDICADORES
========================================= */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 22px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 21px;
    min-width: 0;
    transition: transform .2s, border-color .2s;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: #3b82f6;
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
}

.kpi-icon {
    width: 35px;
    height: 35px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
}

.kpi-icon.blue {
    background: rgba(59, 130, 246, .13);
    color: #60a5fa;
}

.kpi-icon.purple {
    background: rgba(167, 139, 250, .13);
    color: var(--purple);
}

.kpi-icon.green {
    background: rgba(16, 185, 129, .13);
    color: #34d399;
}

.kpi-icon.orange {
    background: rgba(245, 158, 11, .13);
    color: var(--orange);
}

.kpi-card h2 {
    font-size: clamp(19px, 2vw, 25px);
    font-weight: 800;
    letter-spacing: -.7px;
    margin: 19px 0 13px;
    white-space: nowrap;
}

.kpi-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--text-muted);
    font-size: 9px;
}

.kpi-trend {
    font-size: 10px;
    font-weight: 700;
}

.kpi-trend.positive {
    color: #34d399;
}

.kpi-trend.negative {
    color: #f87171;
}

/* =========================================
   PAINÉIS E GRÁFICOS
========================================= */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 0;
}

.chart-panel {
    padding: 21px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 7px;
}

.panel-header p {
    color: var(--text-muted);
    font-size: 10px;
}

.panel-tag {
    padding: 6px 9px;
    border-radius: 6px;
    background: rgba(148, 163, 184, .08);
    color: var(--text-secondary);
    font-size: 9px;
    white-space: nowrap;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 265px;
}

.chart-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* =========================================
   TABELA DE ATIVIDADES
========================================= */

.activity-panel {
    padding: 21px;
    margin-bottom: 25px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead th {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    color: var(--text-secondary);
    font-size: 11px;
    padding: 15px 12px;
    border-bottom: 1px solid rgba(38, 52, 73, .6);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(148, 163, 184, .04);
}

.table-status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 600;
}

.table-status.completed {
    color: #34d399;
    background: rgba(16, 185, 129, .1);
}

.table-status.pending {
    color: #fbbf24;
    background: rgba(245, 158, 11, .1);
}

/* =========================================
   RODAPÉ
========================================= */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
    font-size: 10px;
    padding: 12px 2px;
}

/* =========================================
   TEMA CLARO
========================================= */

body.light-theme {
    --bg: #f1f5f9;
    --sidebar: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;

    --text: #172033;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
}

body.light-theme .nav-item.active {
    background: #eff6ff;
    color: #2563eb;
}

body.light-theme .demo-status {
    background: #ecfdf5;
}

body.light-theme .demo-status {
    color: #047857;
}

body.light-theme tbody tr:hover {
    background: #f8fafc;
}

/* =========================================
   RESPONSIVIDADE
========================================= */

@media (max-width: 1200px) {
    .main-content {
        padding: 26px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 205px;
    }

    .sidebar {
        padding: 22px 12px;
    }

    .main-content {
        padding: 23px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
    }
}

@media (max-width: 650px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 14px 17px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .brand {
        margin-bottom: 15px;
    }

    .sidebar-section {
        gap: 10px;
    }

    .sidebar-label,
    .sidebar-bottom {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .nav-item {
        flex-shrink: 0;
        padding: 10px 12px;
        font-size: 10px;
    }

    .nav-icon {
        font-size: 15px;
        width: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 22px 15px;
    }

    .topbar {
        flex-direction: column;
        gap: 18px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .user-profile {
        margin-left: auto;
    }

    .page-heading h1 {
        font-size: 23px;
    }

    .toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        justify-content: space-between;
    }

    .filter-group select {
        flex: 1;
        max-width: 210px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .kpi-card {
        padding: 14px;
    }

    .kpi-label {
        font-size: 10px;
    }

    .kpi-card h2 {
        font-size: 18px;
    }

    .kpi-footer {
        font-size: 8px;
    }

    .kpi-icon {
        width: 29px;
        height: 29px;
        font-size: 11px;
    }

    .chart-panel,
    .activity-panel {
        padding: 15px;
    }

    .chart-container {
        height: 240px;
    }

    .panel-header h3 {
        font-size: 12px;
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
        font-size: 9px;
    }
}

@media (max-width: 360px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .demo-badge {
        font-size: 8px;
    }

    .user-info {
        display: none;
    }
}
