:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --primary: #4f8ff7;
    --primary-soft: #e8f1ff;
    --primary-dark: #2f6fda;
    --text: #334155;
    --muted: #94a3b8;
    --border: #e5edf5;
    --sidebar-bg-1: #031a33;
    --sidebar-bg-2: #05213f;
    --sidebar-text: rgba(255,255,255,.88);
    --shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f8fbff 0%, #eef3f9 100%);
    color: var(--text);
}

a {
    text-decoration: none;
}

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

.sidebar {
    width: 285px;
    background: linear-gradient(180deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 100%);
    color: #fff;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    left: 14px;
    top: 14px;
    bottom: 14px;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(2, 8, 23, .28);
}

.main-content {
    margin-left: 315px;
    width: calc(100% - 315px);
    padding: 26px 26px 26px 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 6px 18px 6px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #58a4ff 0%, #3f82f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}

.brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .2px;
}

.brand small {
    color: rgba(255,255,255,.7);
    font-size: .82rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: .2s ease;
    min-height: 46px;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.sidebar .nav-link.active {
    background: linear-gradient(180deg, #f4f8ff 0%, #deebff 100%);
    color: #2563eb;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.sidebar .nav-link.active i {
    color: #2563eb;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.theme-box {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: .92rem;
}

.theme-box .toggle-badge {
    margin-left: auto;
    background: #4ea1ff;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 4px 10px;
}

.sidebar-user {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 14px;
}

.sidebar-user-label {
    color: rgba(255,255,255,.65) !important;
    margin-bottom: 4px;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-user-email {
    color: rgba(255,255,255,.75);
    font-size: .88rem;
    word-break: break-word;
}

.btn-logout {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.1);
    color: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 600;
}

.btn-logout:hover {
    background: rgba(255,255,255,.2);
    color: #fff;
}

.topbar {
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: var(--radius-xl);
    padding: 18px 22px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.page-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.55rem;
    color: #425a75;
}

.page-subtitle {
    color: #94a3b8;
}

.topbar-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: .92rem;
    background: #f8fbff;
    border: 1px solid #e8eef6;
    padding: 10px 14px;
    border-radius: 999px;
}

.metric-card,
.card-clean {
    background: rgba(255,255,255,.92);
    border: 1px solid #edf2f7;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.metric-card .icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #eaf3ff 0%, #dcecff 100%);
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
}

.metric-card .display-6 {
    font-size: 2.15rem;
    color: #0f172a;
}

.text-muted {
    color: #8a97a8 !important;
}

.btn-primary {
    background: linear-gradient(135deg, #4f8ff7 0%, #377ef5 100%);
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(59,130,246,.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #357df6 0%, #266cea 100%);
}

.btn-outline-secondary {
    border-radius: 12px;
    padding: 11px 16px;
}

ul {
    padding-left: 18px;
}

@media (max-width: 991px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        left: auto;
        top: auto;
        bottom: auto;
        width: calc(100% - 20px);
        margin: 10px;
        border-radius: 18px;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 12px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.table thead th {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    border-bottom-width: 1px;
    border-color: #e9eef5;
}

.table tbody td {
    border-color: #eef2f7;
    vertical-align: middle;
}

.form-control,
.form-select {
    border-radius: 12px;
    border: 1px solid #dbe4ee;
    min-height: 46px;
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #8db8ff;
}

textarea.form-control {
    min-height: 120px;
}

.alert {
    border-radius: 14px;
}

.form-control-color {
    width: 100%;
    height: 46px;
    padding: 6px;
    border-radius: 12px;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 320px;
}

.chart-box.chart-sm {
    height: 280px;
}

.chart-box.chart-lg {
    height: 360px;
}

.autocomplete-box {
    position: absolute;
    z-index: 1050;
    width: 100%;
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #eef2f7;
    transition: background-color .15s ease, color .15s ease, font-weight .15s ease;
}

.autocomplete-item:last-child {
    border-bottom: 0;
}

.autocomplete-item:hover,
.autocomplete-item:focus {
    background: linear-gradient(135deg, #e8f1ff 0%, #dbeafe 100%);
    color: #1d4ed8;
    font-weight: 500;
    cursor: pointer;
}

.anexo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e8eef6;
    border-radius: 14px;
    background: #f9fbff;
}

.anexo-item + .anexo-item {
    margin-top: 10px;
}

.pagination {
    flex-wrap: wrap;
    gap: 6px;
}

.pagination .page-link {
    border-radius: 10px;
    border: 1px solid #dbe4ee;
    color: #334155;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #4f8ff7 0%, #377ef5 100%);
    border-color: #377ef5;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid #dbe4ee;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    background: #f8fbff;
}

.editor-toolbar button {
    border: 1px solid #dbe4ee;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.editor-area {
    min-height: 180px;
    border: 1px solid #dbe4ee;
    border-radius: 0 0 12px 12px;
    padding: 14px;
    background: #fff;
    outline: none;
}

.atividade-card {
    border: 1px solid #e8eef6;
    border-radius: 16px;
    padding: 16px;
    background: #f9fbff;
}

.atividade-card + .atividade-card {
    margin-top: 14px;
}

.despesa-card {
    border: 1px solid #e8eef6;
    border-radius: 16px;
    padding: 16px;
    background: #f9fbff;
}

.despesa-card + .despesa-card {
    margin-top: 12px;
}

/* =========================
   LOGIN MODERNO
========================= */

.login-page-body {
    min-height: 100vh;
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(120, 170, 255, 0.35), transparent 30%),
        radial-gradient(circle at bottom right, rgba(123, 240, 226, 0.35), transparent 28%),
        linear-gradient(135deg, #4b63f0 0%, #5d8dff 45%, #8be2d8 100%);
    overflow-x: hidden;
    position: relative;
}

.login-page-bg-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.16;
    pointer-events: none;
    filter: blur(0.5px);
}

.login-page-bg-shape.shape-1 {
    width: 420px;
    height: 420px;
    border: 28px solid rgba(255,255,255,.22);
    top: -80px;
    left: -80px;
}

.login-page-bg-shape.shape-2 {
    width: 280px;
    height: 280px;
    background: rgba(255,255,255,.16);
    top: 70px;
    right: 90px;
}

.login-page-bg-shape.shape-3 {
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,.16);
    bottom: -40px;
    left: 80px;
}

.login-page-bg-shape.shape-4 {
    width: 160px;
    height: 160px;
    border: 18px solid rgba(255,255,255,.18);
    bottom: 30px;
    right: 40px;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    position: relative;
    z-index: 2;
}

.login-shell {
    width: 100%;
    max-width: 1120px;
    min-height: 640px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    background: rgba(255,255,255,.14);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.22);
    backdrop-filter: blur(10px);
}

.login-left-panel {
    position: relative;
    background:
        linear-gradient(135deg, rgba(57, 87, 241, 0.92), rgba(62, 112, 255, 0.88)),
        linear-gradient(180deg, #4164f5 0%, #5a84ff 100%);
    color: #fff;
    overflow: hidden;
}

.login-left-panel::before,
.login-left-panel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    opacity: .15;
}

.login-left-panel::before {
    width: 360px;
    height: 360px;
    background: #fff;
    top: -120px;
    right: -80px;
}

.login-left-panel::after {
    width: 280px;
    height: 280px;
    background: #9fe8dc;
    bottom: -90px;
    left: -60px;
}

.login-left-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.16), transparent 18%),
        radial-gradient(circle at 70% 65%, rgba(255,255,255,.1), transparent 16%);
    pointer-events: none;
}

.login-left-content {
    position: relative;
    z-index: 2;
    height: 100%;
    padding: 42px 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-left-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-left-brand-icon {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: rgba(255,255,255,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}

.login-left-brand-title {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}

.login-left-brand-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,.78);
    margin-top: 4px;
}

.login-left-text {
    max-width: 420px;
}

.login-left-text h1 {
    font-size: 3.15rem;
    line-height: 1.02;
    margin: 0 0 20px 0;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-left-text p {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.7;
    color: rgba(255,255,255,.86);
}

.login-left-footer {
    font-size: .95rem;
    color: rgba(255,255,255,.72);
}

.login-right-panel {
    background: rgba(255,255,255,.96);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 42px 34px;
}

.login-form-box {
    width: 100%;
    max-width: 390px;
}

.login-logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.login-logo-img {
    max-width: 190px;
    max-height: 90px;
    object-fit: contain;
    display: block;
}

.login-logo-fallback {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: linear-gradient(135deg, #4f8ff7 0%, #377ef5 100%);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
}

.login-form-title h2 {
    margin: 0 0 6px 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #334155;
}

.login-form-title p {
    margin: 0;
    color: #8da0b6;
    font-size: .96rem;
}

.login-label {
    font-weight: 600;
    color: #5b6d84;
    margin-bottom: 8px;
}

.login-input {
    min-height: 52px;
    border-radius: 14px;
    border: 1px solid #cfdcf0;
    padding: 12px 16px;
    font-size: .98rem;
    transition: .18s ease;
}

.login-input:focus {
    border-color: #5d8dff;
    box-shadow: 0 0 0 0.2rem rgba(79, 143, 247, 0.12) !important;
}

.login-submit-btn {
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #4f8ff7 0%, #377ef5 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 12px 26px rgba(59,130,246,.25);
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, #357df6 0%, #266cea 100%);
    color: #fff;
}

.login-alert {
    border-radius: 14px;
    margin-bottom: 18px;
}

.login-bottom-note {
    margin-top: 22px;
    text-align: center;
    font-size: .9rem;
    color: #97a7ba;
}

@media (max-width: 991px) {
    .login-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-left-panel {
        min-height: 280px;
    }

    .login-left-content {
        padding: 28px;
        gap: 24px;
    }

    .login-left-text h1 {
        font-size: 2.4rem;
    }

    .login-right-panel {
        padding: 30px 22px;
    }
}

@media (max-width: 575px) {
    .login-wrapper {
        padding: 14px;
    }

    .login-left-text h1 {
        font-size: 2rem;
    }

    .login-left-brand-title {
        font-size: 1.45rem;
    }

    .login-form-box {
        max-width: 100%;
    }
}
