:root {
    --alw-blue: #0b2e59;
    --alw-blue-light: #123d72;
    --alw-bg: #f4f6f9;
    --alw-white: #ffffff;
    --alw-border: #e5e7eb;
    --alw-text: #1f2937;
    --alw-muted: #6b7280;
    --alw-accent: #2dd4bf;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--alw-bg);
    color: var(--alw-text);
}

/* LOGIN */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(
            135deg,
            rgba(11, 46, 89, 0.95),
            rgba(18, 61, 114, 0.90)
        ),
        #0b2e59;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--alw-white);
    padding: 36px;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.login-logo {
    max-width: 240px;
    width: 100%;
    height: auto;
    margin-bottom: 16px;
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--alw-blue);
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--alw-muted);
    margin-bottom: 0;
}

/* BOTÕES */

.btn-primary {
    background: var(--alw-blue);
    border-color: var(--alw-blue);
}

.btn-primary:hover {
    background: var(--alw-blue-light);
    border-color: var(--alw-blue-light);
}

/* LAYOUT */

.app-layout {
    min-height: 100vh;
    display: flex;
}

/* SIDEBAR */

.sidebar {
    width: 260px;
    background: var(--alw-blue);
    color: var(--alw-white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;

    /* A barra acompanha a rolagem da pagina em telas altas. */
    position: sticky;
    top: 0;
    height: 100vh;

    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.22);
    border-radius: 4px;
}

.sidebar-logo {
    padding: 15px;
    background: #ffffff;
    text-align: center;

    /* Fica visivel mesmo com o menu rolado. */
    position: sticky;
    top: 0;
    z-index: 2;
}

.sidebar-logo img {
    max-width: 180px;
    height: auto;
}

.sidebar-menu {
    padding: 12px;
}

/* LINKS PRINCIPAIS */

.sidebar-link,
.sidebar-group summary {
    display: flex;
    justify-content: space-between;
    align-items: center;

    width: 100%;

    padding: 10px 12px;

    color: #ffffff;
    text-decoration: none;

    border-radius: 8px;

    cursor: pointer;

    font-size: 14px;
    font-weight: 500;

    transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-group summary:hover {
    background: rgba(255,255,255,0.12);
}

.sidebar-link i,
.sidebar-group summary i {
    margin-right: 8px;
}

.sidebar-group summary {
    list-style: none;
}

.sidebar-group summary::-webkit-details-marker {
    display: none;
}

/* MENU ABERTO */

.sidebar-group[open] summary {
    background: rgba(255,255,255,0.10);
}

/* SUBMENU */

.sidebar-submenu {
    display: block;

    margin-top: 4px;
    margin-bottom: 8px;

    padding-left: 16px;

    border-left: 1px solid rgba(255,255,255,0.15);
}

.sidebar-submenu a {
    display: block;

    width: 100%;

    padding: 8px 12px;

    margin: 2px 0;

    color: rgba(255,255,255,0.90);

    text-decoration: none;

    border-radius: 6px;

    font-size: 13px;

    transition: all 0.2s ease;
}

.sidebar-submenu a:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff;
}

/* ROTA ATIVA */

.sidebar-submenu a.active,
.sidebar-link.active {
    background: rgba(255,255,255,0.18);
    font-weight: 600;
}

/* Item de submenu atual: barra de destaque a esquerda, alinhada com a
   guia vertical do submenu. */
.sidebar-submenu a.active {
    position: relative;
    background: rgba(255,255,255,0.16);
    color: #ffffff;
    font-weight: 700;
}

.sidebar-submenu a.active::before {
    content: "";
    position: absolute;
    left: -17px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--alw-accent);
}

/* Grupo que contem a pagina atual. */
.sidebar-group[open] > summary .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar-group summary .bi-chevron-down {
    font-size: 12px;
    transition: transform 0.2s ease;
}

/* Foco visivel para navegacao por teclado. */
.sidebar-link:focus-visible,
.sidebar-group summary:focus-visible,
.sidebar-submenu a:focus-visible {
    outline: 2px solid var(--alw-accent);
    outline-offset: -2px;
}

/* TOPBAR */

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

.topbar {
    height: 68px;

    background: #ffffff;

    border-bottom: 1px solid var(--alw-border);

    padding: 0 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-content {
    padding: 28px;
}

/* TÍTULOS */

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--alw-blue);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--alw-muted);
}

/* CARDS */

.info-card {
    background: #ffffff;

    border: 1px solid var(--alw-border);

    border-radius: 16px;

    padding: 24px;

    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.info-card span {
    display: block;
    color: var(--alw-muted);
    margin-bottom: 10px;
}

.info-card strong {
    display: block;
    font-size: 30px;
    color: var(--alw-blue);
}

.content-card {
    background: #ffffff;

    border: 1px solid var(--alw-border);

    border-radius: 16px;

    padding: 24px;

    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.card-section-title {
    color: var(--alw-blue);
    font-weight: 700;
    margin-bottom: 20px;
}

/* TABELAS */

.table th {
    color: var(--alw-blue);
    font-size: 14px;
}

.table td {
    vertical-align: middle;
}

/* Linha sob o cursor: ajuda a nao se perder em tabela larga. */
.table tbody tr:hover {
    background: #f9fafb;
}

/* Cabecalho fixo ao rolar tabelas longas. */
.table-responsive {
    max-height: 70vh;
    overflow-y: auto;
}

.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--alw-white);
    box-shadow: inset 0 -1px 0 var(--alw-border);
}

/* PERMISSÕES */

.permissions-grid {
    display: grid;
    gap: 12px;
}

.permission-item {
    padding: 10px 12px;
    border: 1px solid var(--alw-border);
    border-radius: 10px;
    background: #f9fafb;
}

/* ACESSIBILIDADE */

.pular-para-conteudo {
    position: absolute;
    left: -9999px;
    z-index: 1100;
    padding: 12px 18px;
    background: var(--alw-white);
    color: var(--alw-blue);
    font-weight: 700;
    border-radius: 0 0 8px 0;
}

.pular-para-conteudo:focus {
    left: 0;
    top: 0;
}

/* MENU EM TELAS PEQUENAS */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1050;

    width: 42px;
    height: 42px;

    align-items: center;
    justify-content: center;

    font-size: 20px;
    color: var(--alw-blue);

    background: var(--alw-white);
    border: 1px solid var(--alw-border);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);

    cursor: pointer;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.45);
}

/* RESPONSIVO */

@media (max-width: 992px) {

    .sidebar {
        width: 220px;
    }

    .page-content {
        padding: 15px;
    }
}

@media (max-width: 768px) {

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-backdrop:not([hidden]) {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1045;

        width: 260px;

        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.aberta {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
    }

    .topbar {
        padding-left: 68px;
    }

    .topbar-user-name {
        display: none;
    }
}


/* DASHBOARD PRINCIPAL */

.topbar {
    height: 64px;

    /* Continua visivel ao rolar paginas longas. */
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-context {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-context span {
    color: var(--alw-muted);
    font-size: 12px;
}

.topbar-context strong {
    color: var(--alw-blue);
    font-size: 15px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user-name {
    color: var(--alw-text);
    font-weight: 600;
}

.sidebar-link.active {
    background: #ffffff;
    color: var(--alw-blue);
    box-shadow: inset 4px 0 0 #2dd4bf;
}

.sidebar-link.active:hover {
    background: #ffffff;
    color: var(--alw-blue);
}

.dashboard-page {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 156px;
    padding: 28px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background:
        linear-gradient(135deg, #0b2e59 0%, #0f766e 100%);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.dashboard-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.dashboard-hero h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

.dashboard-hero p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.82);
}

.dashboard-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.dashboard-hero-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border-radius: 8px;
    font-weight: 700;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    padding: 18px;
    color: var(--alw-text);
    text-decoration: none;
    border: 1px solid var(--alw-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-kpi-card:hover {
    color: var(--alw-text);
    border-color: rgba(11, 46, 89, 0.22);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.10);
    transform: translateY(-2px);
}

.dashboard-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-bottom: 16px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 18px;
}

.dashboard-kpi-label {
    color: var(--alw-muted);
    font-size: 14px;
    font-weight: 700;
}

.dashboard-kpi-card strong {
    margin-top: 6px;
    color: var(--alw-blue);
    font-size: 32px;
    line-height: 1;
}

.dashboard-kpi-caption {
    margin-top: auto;
    color: var(--alw-muted);
    font-size: 13px;
}

.dashboard-kpi-primary .dashboard-kpi-icon {
    background: #2563eb;
}

.dashboard-kpi-success .dashboard-kpi-icon {
    background: #16a34a;
}

.dashboard-kpi-warning .dashboard-kpi-icon {
    background: #d97706;
}

.dashboard-kpi-info .dashboard-kpi-icon {
    background: #0891b2;
}

.dashboard-kpi-violet .dashboard-kpi-icon {
    background: #7c3aed;
}

.dashboard-kpi-teal .dashboard-kpi-icon {
    background: #0f766e;
}

.dashboard-kpi-danger .dashboard-kpi-icon {
    background: #dc2626;
}

.dashboard-kpi-dark .dashboard-kpi-icon {
    background: #334155;
}

.dashboard-money-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-money-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 104px;
    padding: 18px;
    color: var(--alw-text);
    text-decoration: none;
    border: 1px solid var(--alw-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.dashboard-money-card:hover {
    color: var(--alw-text);
    border-color: rgba(15, 118, 110, 0.30);
}

.dashboard-money-card span,
.dashboard-money-card small {
    color: var(--alw-muted);
}

.dashboard-money-card strong {
    color: var(--alw-blue);
    font-size: 22px;
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.dashboard-main-grid-wide {
    align-items: start;
}

.dashboard-panel {
    border-radius: 8px;
}

.dashboard-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.dashboard-panel-header span {
    display: block;
    margin-top: 3px;
    color: var(--alw-muted);
    font-size: 13px;
}

.dashboard-panel-header > i {
    color: var(--alw-muted);
    font-size: 22px;
}

.dashboard-link {
    color: var(--alw-blue);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-alert-list,
.dashboard-feed,
.dashboard-action-grid {
    display: grid;
    gap: 10px;
}

.dashboard-alert,
.dashboard-feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 12px;
    color: var(--alw-text);
    text-decoration: none;
    border: 1px solid var(--alw-border);
    border-radius: 8px;
    background: #f9fafb;
}

.dashboard-alert:hover,
.dashboard-feed-item:hover {
    color: var(--alw-text);
    border-color: rgba(11, 46, 89, 0.22);
    background: #ffffff;
}

.dashboard-alert-icon,
.dashboard-feed-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 8px;
    color: #ffffff;
    background: var(--alw-blue);
}

.dashboard-alert strong,
.dashboard-feed-item strong {
    display: block;
    font-size: 14px;
}

.dashboard-alert small,
.dashboard-feed-item small {
    display: block;
    color: var(--alw-muted);
}

.dashboard-alert-warning .dashboard-alert-icon {
    background: #d97706;
}

.dashboard-alert-danger .dashboard-alert-icon {
    background: #dc2626;
}

.dashboard-alert-info .dashboard-alert-icon {
    background: #0891b2;
}

.dashboard-alert-primary .dashboard-alert-icon {
    background: #2563eb;
}

.dashboard-alert-violet .dashboard-alert-icon {
    background: #7c3aed;
}

.dashboard-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-action-grid a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 12px;
    color: var(--alw-text);
    text-decoration: none;
    border: 1px solid var(--alw-border);
    border-radius: 8px;
    background: #f9fafb;
    font-weight: 700;
}

.dashboard-action-grid a:hover {
    color: var(--alw-blue);
    background: #ffffff;
    border-color: rgba(11, 46, 89, 0.22);
}

.dashboard-action-grid i {
    color: var(--alw-blue);
    font-size: 18px;
}

.dashboard-empty-state {
    display: flex;
    min-height: 158px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    color: var(--alw-muted);
    text-align: center;
    border: 1px dashed var(--alw-border);
    border-radius: 8px;
    background: #f9fafb;
}

.dashboard-empty-state i {
    color: #16a34a;
    font-size: 30px;
}

.dashboard-empty-state strong {
    color: var(--alw-blue);
}

.dashboard-empty-state.compact {
    min-height: 172px;
}

@media (max-width: 1200px) {
    .dashboard-kpi-grid,
    .dashboard-money-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .dashboard-hero,
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-hero-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .dashboard-kpi-grid,
    .dashboard-money-row,
    .dashboard-action-grid {
        grid-template-columns: 1fr;
    }
}
