:root {
    --ces-blue-950: #09233d;
    --ces-blue-900: #103454;
    --ces-blue-800: #17466f;
    --ces-blue-700: #205b8c;
    --ces-blue-600: #2d70a8;
    --ces-blue-500: #4087bc;
    --ces-blue-100: #e8f1f8;
    --ces-blue-50: #f3f8fc;

    --ces-white: #ffffff;
    --ces-background: #f4f7fa;
    --ces-surface: #ffffff;
    --ces-border: #dfe7ee;
    --ces-text: #173047;
    --ces-muted: #6a7c8c;

    --ces-danger: #b42318;
    --ces-danger-background: #fef3f2;

    --ces-sidebar-width: 278px;
    --ces-topbar-height: 78px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ces-text);
    background: var(--ces-background);
    font-family:
        Inter,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* =========================================================
   LOGIN
   ========================================================= */

.auth-body {
    background: var(--ces-background);
}

.auth-content {
    min-height: 100vh;
}

/* =========================================================
   ESTRUTURA PRINCIPAL
   ========================================================= */

.app-body {
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: var(--ces-sidebar-width);
    min-height: 100vh;
    color: rgba(255, 255, 255, 0.84);
    background:
        radial-gradient(
            circle at 15% 0%,
            rgba(64, 135, 188, 0.32),
            transparent 31%
        ),
        linear-gradient(
            180deg,
            var(--ces-blue-900) 0%,
            var(--ces-blue-950) 100%
        );
    box-shadow: 14px 0 38px rgba(9, 35, 61, 0.12);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 92px;
    padding: 19px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    text-decoration: none;
}

.sidebar-brand img {
    width: 62px;
    height: 48px;
    object-fit: contain;
    padding: 4px;
    border-radius: 10px;
    background: white;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-text strong {
    color: white;
    font-size: 19px;
    line-height: 1.1;
}

.sidebar-brand-text span {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
}

.sidebar-close {
    display: none;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: white;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.sidebar-context {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 22px 18px 14px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.055);
}

.sidebar-context-label {
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.sidebar-context strong {
    color: rgba(255, 255, 255, 0.92);
    font-size: 13px;
    line-height: 1.45;
}

.sidebar-navigation {
    flex: 1;
    padding: 14px 14px 24px;
}

.sidebar-section-title {
    display: block;
    margin: 0 12px 10px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 50px;
    margin-bottom: 5px;
    padding: 11px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.71);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    transition:
        color 150ms ease,
        background 150ms ease,
        transform 150ms ease;
}

.sidebar-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.09);
    transform: translateX(2px);
}

.sidebar-link.active {
    color: var(--ces-blue-950);
    background: white;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.13);
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: -14px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--ces-blue-500);
}

.sidebar-link-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 25px;
    height: 25px;
}

.sidebar-footer {
    padding: 15px 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 5px 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar,
.topbar-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 39px;
    height: 39px;
    border-radius: 12px;
    color: var(--ces-blue-900);
    background: white;
    font-size: 14px;
    font-weight: 800;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-details strong {
    overflow: hidden;
    color: white;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-details span {
    overflow: hidden;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    color: rgba(255, 255, 255, 0.68);
}

.sidebar-logout:hover {
    color: white;
    background: rgba(255, 255, 255, 0.09);
}

.app-main {
    min-height: 100vh;
    margin-left: var(--ces-sidebar-width);
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--ces-topbar-height);
    padding: 12px 30px;
    border-bottom: 1px solid var(--ces-border);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 18px rgba(19, 52, 84, 0.035);
    backdrop-filter: blur(14px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--ces-border);
    border-radius: 11px;
    color: var(--ces-blue-900);
    background: white;
    cursor: pointer;
}

.topbar-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.topbar-title span {
    color: var(--ces-muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar-title strong {
    color: var(--ces-blue-950);
    font-size: 20px;
    line-height: 1.2;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.topbar-user-copy strong {
    color: var(--ces-blue-950);
    font-size: 13px;
}

.topbar-user-copy span {
    margin-top: 3px;
    color: var(--ces-muted);
    font-size: 11px;
}

.topbar-avatar {
    color: white;
    background: var(--ces-blue-800);
}

.app-content {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 30px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    visibility: hidden;
    background: rgba(9, 35, 61, 0.56);
    opacity: 0;
    transition:
        visibility 180ms ease,
        opacity 180ms ease;
}

/* =========================================================
   ELEMENTOS COMUNS DOS DASHBOARDS
   ========================================================= */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.page-header h1 {
    margin: 0;
    color: var(--ces-blue-950);
    font-size: clamp(27px, 3vw, 36px);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.page-header p {
    max-width: 720px;
    margin: 8px 0 0;
    color: var(--ces-muted);
    font-size: 15px;
    line-height: 1.6;
}

.card {
    border: 1px solid var(--ces-border);
    border-radius: 18px;
    background: var(--ces-surface);
    box-shadow: 0 12px 32px rgba(16, 52, 84, 0.055);
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: white;
    background: var(--ces-blue-800);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 150ms ease,
        transform 150ms ease,
        box-shadow 150ms ease;
}

.button:hover,
button.button:hover {
    background: var(--ces-blue-900);
    box-shadow: 0 10px 20px rgba(16, 52, 84, 0.17);
    transform: translateY(-1px);
}

.button-secondary {
    border-color: var(--ces-border);
    color: var(--ces-blue-900);
    background: white;
}

.button-secondary:hover {
    background: var(--ces-blue-50);
}

/* =========================================================
   RESPONSIVIDADE
   ========================================================= */

@media (max-width: 1050px) {
    .app-sidebar {
        transform: translateX(-105%);
        transition: transform 190ms ease;
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .menu-toggle,
    .sidebar-close {
        display: grid;
    }

    .sidebar-overlay.is-visible {
        visibility: visible;
        opacity: 1;
    }

    body.menu-open {
        overflow: hidden;
    }
}

@media (max-width: 700px) {
    .app-topbar {
        min-height: 68px;
        padding: 10px 16px;
    }

    .topbar-title span,
    .topbar-user-copy {
        display: none;
    }

    .topbar-title strong {
        font-size: 17px;
    }

    .app-content {
        padding: 22px 16px;
    }

    .page-header {
        flex-direction: column;
    }
}