:root {
    --primary-red: #cb1f2f;
    --primary-red-dark: #a51524;
    --bg-soft: #f2f4f8;
    --text-main: #202a38;
    --line-soft: #dfe4ec;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--bg-soft);
    color: var(--text-main);
}

.login-page {
    --login-accent: var(--primary-red);
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(203, 31, 47, 0.12), transparent),
        linear-gradient(160deg, #eef1f7 0%, #e4e9f2 45%, #dce2ec 100%);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
    gap: 16px;
}

.login-card {
    width: min(420px, 94vw);
    background: #fff;
    border-radius: 20px;
    box-shadow:
        0 4px 6px rgba(15, 23, 42, 0.04),
        0 24px 48px rgba(15, 23, 42, 0.1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-card-header {
    text-align: center;
    padding: 32px 28px 24px;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    border-bottom: 1px solid var(--line-soft);
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.login-logo {
    max-height: 176px;
    max-width: 440px;
    width: auto;
    object-fit: contain;
}

.login-logo-fallback {
    width: 144px;
    height: 144px;
    border-radius: 20px;
    background: linear-gradient(145deg, var(--login-accent), color-mix(in srgb, var(--login-accent) 75%, #000));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--login-accent) 35%, transparent);
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px;
    line-height: 1.3;
}

.login-subtitle {
    font-size: 0.9rem;
    color: #66758a;
    margin: 0;
}

.login-card-body {
    padding: 28px 28px 32px;
}

.login-hint {
    font-size: 0.9rem;
    color: #66758a;
    margin-bottom: 20px;
    text-align: center;
}

.login-alert {
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5668;
    margin-bottom: 6px;
}

.login-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-group i {
    position: absolute;
    left: 14px;
    color: #8b95a5;
    font-size: 1.05rem;
    pointer-events: none;
    z-index: 1;
}

.login-input-group .form-control {
    padding-left: 42px;
    border-radius: 12px;
    border: 1px solid #d8dee8;
    min-height: 46px;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-input-group .form-control:focus {
    background: #fff;
    border-color: var(--login-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--login-accent) 18%, transparent);
}

.btn-login {
    margin-top: 4px;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    border: 0;
    background: linear-gradient(145deg, var(--login-accent), color-mix(in srgb, var(--login-accent) 85%, #000));
    color: #fff;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--login-accent) 32%, transparent);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-login:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--login-accent) 38%, transparent);
    background: linear-gradient(145deg, color-mix(in srgb, var(--login-accent) 95%, #000), var(--login-accent));
}

.login-footer-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

.login-footer-link a {
    font-size: 0.88rem;
    color: var(--login-accent);
    text-decoration: none;
    font-weight: 500;
}

.login-footer-link a:hover {
    text-decoration: underline;
}

.login-version {
    font-size: 0.75rem;
    color: #8b95a5;
    margin: 0;
    letter-spacing: 0.5px;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 285px;
    background: #fff;
    border-right: 1px solid #d9e0ea;
    box-shadow: 6px 0 24px rgba(15, 23, 42, 0.06);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    background: linear-gradient(145deg, var(--primary-red), #e04553);
    color: #fff;
    padding: 22px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-brand h5 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.sidebar-brand p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.85rem;
}

.sidebar-nav {
    padding: 8px 0 24px;
}

.sidebar-section {
    font-size: 0.75rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #738195;
    font-weight: 700;
    padding: 14px 18px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #243041;
    text-decoration: none;
    font-size: 1.08rem;
    padding: 14px 18px;
    border-top: 1px solid var(--line-soft);
    transition: all .2s ease;
}

.sidebar-link:last-child {
    border-bottom: 1px solid var(--line-soft);
}

.sidebar-link i {
    color: #74839a;
}

.sidebar-link:hover {
    background: #f5f7fb;
    color: var(--primary-red);
}

.sidebar-link.active {
    background: #feecee;
    color: var(--primary-red-dark);
    font-weight: 600;
    border-left: 4px solid var(--primary-red);
    padding-left: 14px;
}

.sidebar-link.active i {
    color: var(--primary-red-dark);
}

.sidebar-group {
    border-top: 1px solid var(--line-soft);
}

.sidebar-group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sidebar-group-chevron {
    font-size: 0.85rem;
    transition: transform .2s ease;
}

.sidebar-group.is-open .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    background: #f8fafc;
    border-bottom: 1px solid var(--line-soft);
}

.sidebar-group.is-open .sidebar-submenu {
    display: block;
}

.sidebar-sublink {
    font-size: 0.98rem;
    padding: 12px 18px 12px 46px;
    border-top: 0;
}

.sidebar-sublink:last-child {
    border-bottom: 0;
}

.content-area {
    flex: 1;
    min-width: 0;
    padding: 18px 24px 28px;
}

.top-header {
    background: #fff;
    border: 1px solid #e3e8f1;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.top-header-title {
    flex: 1;
}

.top-header-profile {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--primary-red), #e44957);
    color: #fff;
    text-decoration: none;
    border: 0;
    box-shadow: 0 8px 16px rgba(203, 31, 47, 0.28);
    transition: transform .18s ease, box-shadow .18s ease;
}

.top-header-profile span {
    font-size: 1.15rem;
    font-weight: 700;
}

.top-header-profile:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(203, 31, 47, 0.36);
}

.profile-popover {
    position: absolute;
    top: 74px;
    right: 24px;
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.profile-popover.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-popover-card {
    width: 320px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dfe5ef;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.2);
}

.profile-popover-head {
    background: linear-gradient(140deg, #d81f38, #c9152d);
    color: #fff;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-popover-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
}

.profile-popover-identification h6 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 800;
}

.profile-popover-identification small {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
}

.profile-popover-crown {
    margin-left: auto;
    font-size: 2rem;
}

.profile-popover-body {
    padding: 12px 14px;
}

.profile-popover-row {
    display: grid;
    grid-template-columns: 16px 84px 1fr;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.97rem;
    color: #2b3340;
}

.profile-popover-row i {
    color: #dc3648;
}

.profile-popover-row span {
    color: #66758a;
}

.profile-popover-row strong {
    justify-self: end;
}

.profile-tag {
    justify-self: end;
    background: #ffca28;
    color: #1e232d !important;
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.profile-popover-actions {
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 0;
}

.profile-popover-actions a,
.profile-popover-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #313d4f;
    text-decoration: none;
    font-size: 1.05rem;
    padding: 9px 14px;
}

.profile-popover-actions a:hover,
.profile-popover-footer a:hover {
    background: #f5f7fb;
}

.profile-popover-footer {
    padding: 8px 10px 12px;
}

.profile-popover-footer a {
    background: #fff2f3;
    color: #d62f45;
    border-radius: 8px;
    font-weight: 700;
}

.content-main .card {
    border: 1px solid #e3e8f1 !important;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05) !important;
}

.stat-card {
    border: 0 !important;
    color: #fff;
}

.row .col-md-3:nth-child(1) .stat-card {
    background: linear-gradient(140deg, #d92f3f, #f35b6a);
}

.row .col-md-3:nth-child(2) .stat-card {
    background: linear-gradient(140deg, #1f7bff, #4c9bff);
}

.row .col-md-3:nth-child(3) .stat-card {
    background: linear-gradient(140deg, #7b46e2, #986df4);
}

.row .col-md-3:nth-child(4) .stat-card {
    background: linear-gradient(140deg, #0fa572, #22c98f);
}

.stat-card h6 {
    opacity: 0.9;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0;
}

.fuel-budget-amount {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.fuel-budget-amount strong {
    font-size: 1.5rem;
    color: #1f2937;
}

.fuel-budget-progress {
    height: 14px;
    border-radius: 999px;
    background: #eef2f7;
}

.table thead th {
    font-weight: 700;
    color: #4a5668;
    border-bottom: 1px solid #dbe2ed;
    background: #f8fafd;
}

.table td,
.table th {
    vertical-align: middle;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
}

.btn-primary {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-red-dark);
    border-color: var(--primary-red-dark);
}

.btn-outline-danger {
    border-color: #cc3140;
    color: #cc3140;
}

.btn-outline-danger:hover {
    background: #cc3140;
    border-color: #cc3140;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: 10px;
    border: 1px solid #d3dbe8;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: #ea7b86;
    box-shadow: 0 0 0 0.24rem rgba(203, 31, 47, 0.14);
}

.badge.text-bg-secondary {
    background: #e9eef7 !important;
    color: #44556d !important;
    font-weight: 600;
}

.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    margin-left: 4px;
}

.form-control.cep-loading {
    background-image: linear-gradient(90deg, #f8fafd 25%, #eef2f7 50%, #f8fafd 75%);
    background-size: 200% 100%;
    animation: cep-loading 1s linear infinite;
}

@keyframes cep-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.profile-info-banner {
    background: linear-gradient(135deg, #1ea39a, #24b7a4);
    border-radius: 12px;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-info-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
}

.alert-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    pointer-events: none;
    padding: 16px;
}

.alert-popup.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.alert-popup-card {
    width: min(480px, 96vw);
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    transform: scale(.96);
    transition: transform .25s ease;
}

.alert-popup.is-visible .alert-popup-card {
    transform: scale(1);
}

.alert-popup-header {
    background: linear-gradient(140deg, #29a94e, #2bc7a2);
    color: #fff;
    text-align: center;
    padding: 34px 20px 26px;
}

.alert-popup-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 18px;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.alert-popup-header h4 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
}

.alert-popup-body {
    text-align: center;
    padding: 20px 20px 18px;
}

.alert-popup-message {
    margin: 0 0 16px;
    font-size: 1.95rem;
    font-weight: 700;
    color: #1d2939;
}

.alert-popup-badge {
    background: #edf7f1;
    color: #256f4d;
    border-radius: 10px;
    padding: 12px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.alert-popup-footer {
    background: #f4f5f7;
    padding: 20px;
}

.alert-popup-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.alert-popup-btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(140deg, #29a94e, #2bc7a2);
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.4px;
    padding: 14px;
    transition: transform .15s ease, filter .15s ease;
}

.alert-popup-btn-secondary {
    background: #e8edf4;
    color: #4a5668;
}

.alert-popup-btn:hover {
    filter: brightness(.95);
    transform: translateY(-1px);
}

.alert-popup-btn i {
    margin-right: 6px;
}

.alert-popup.variant-success .alert-popup-icon {
    color: #ffffff;
}

.alert-popup.variant-info .alert-popup-icon {
    color: #ffffff;
}

.alert-popup.variant-warning .alert-popup-icon {
    color: #ffffff;
}

.alert-popup.variant-danger .alert-popup-icon {
    color: #ffffff;
}

.alert-popup.variant-info .alert-popup-header,
.alert-popup.variant-info .alert-popup-btn {
    background: linear-gradient(140deg, #2f6fed, #4a90ff);
}

.alert-popup.variant-warning .alert-popup-header,
.alert-popup.variant-warning .alert-popup-btn {
    background: linear-gradient(140deg, #d97706, #f59e0b);
}

.alert-popup.variant-danger .alert-popup-header,
.alert-popup.variant-danger .alert-popup-btn {
    background: linear-gradient(140deg, #c81e2f, #ef4444);
}

.alert-popup.variant-danger .alert-popup-badge {
    background: #feecec;
    color: #9f1239;
}

.alert-popup.variant-warning .alert-popup-badge {
    background: #fff4e5;
    color: #92400e;
}

@media (max-width: 576px) {
    .alert-popup-message {
        font-size: 1.5rem;
    }
}

@media (max-width: 991px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .content-area {
        padding: 14px;
    }

    .profile-popover {
        right: 10px;
        top: 66px;
    }
}
