:root {
    --brand: #0f766e;
    --ink: #17212b;
    --muted: #6b7280;
    --paper: #f6f8fb;
}

body {
    background: var(--paper);
    color: var(--ink);
    padding-bottom: 88px;
}

.guest-body {
    min-height: 100vh;
    background: linear-gradient(160deg, #e6fffb 0%, #f7fafc 48%, #fff 100%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--ink);
    font-weight: 700;
}

.brand-mark {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
}

.main-shell {
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}

.login-panel {
    max-width: 420px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.metric-card,
.operation-item,
.form-card,
.chart-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: .82rem;
}

.metric-card strong {
    display: block;
    font-size: 1.1rem;
    margin-top: .25rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
    margin-bottom: 1rem;
}

.segmented-field {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.segmented-field legend {
    margin-bottom: .3rem;
    color: var(--muted);
    font-size: .78rem;
}

.segmented-control {
    position: relative;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    min-height: 42px;
    overflow: hidden;
    border: 1px solid #d8dee8;
    border-radius: 8px;
    background: #fff;
}

.segmented-control label {
    min-width: 0;
    margin: 0;
}

.segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    position: relative;
    z-index: 1;
    display: grid;
    height: 100%;
    min-height: 40px;
    place-items: center;
    padding: .45rem .65rem;
    color: #475569;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    border-right: 1px solid #e5e7eb;
}

.segmented-control label:last-child span {
    border-right: 0;
}

.segmented-control input:checked + span {
    background: var(--brand);
    color: #fff;
}

.sliding-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 6px;
    background: var(--brand);
    transition: transform .18s ease;
}

.sliding-toggle:has(label:nth-child(2) input:checked)::before {
    transform: translateX(100%);
}

.sliding-toggle input:checked + span {
    background: transparent;
}

.filter-status,
.filter-submit {
    min-height: 42px;
    align-self: end;
}

.filter-submit {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .4rem;
}

.operation-list,
.chart-stack {
    display: grid;
    gap: .75rem;
}

.chart-panel {
    min-width: 0;
}

.chart-frame {
    position: relative;
    height: 280px;
    min-height: 280px;
    max-height: 280px;
}

.chart-frame canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}

.inline-form .form-control {
    min-width: 150px;
    flex: 1 1 160px;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.compare-grid > div {
    background: #f8fafc;
    border-radius: 8px;
    padding: .75rem;
}

.mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    z-index: 10;
}

.mobile-nav a {
    min-height: 64px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .1rem;
    color: #334155;
    text-decoration: none;
    font-size: .72rem;
}

.mobile-nav i {
    font-size: 1.2rem;
}

.mobile-nav .nav-primary i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    transform: translateY(-8px);
}

.status-pending,
.status-pending_approval,
.status-modification_pending {
    background: #fff3cd;
    color: #8a5b00;
}

.status-confirmed,
.status-received,
.status-approved {
    background: #d1e7dd;
    color: #0f5132;
}

.status-disbursed {
    background: #cff4fc;
    color: #055160;
}

.status-rejected,
.status-cancelled {
    background: #f8d7da;
    color: #842029;
}

.status-corrected {
    background: #e2e3e5;
    color: #41464b;
}

.notification-unread {
    border-left: 4px solid var(--brand);
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: .5rem;
}

.topbar {
    backdrop-filter: saturate(180%) blur(12px);
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.brand-logo-lg {
    width: 72px;
    height: 72px;
    border-radius: 16px;
}

.dashboard-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .85rem;
}

.dashboard-logo {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 26px rgba(15, 23, 42, .10);
}

.dashboard-identity h1,
.brand span {
    overflow-wrap: anywhere;
}

.metric-card,
.operation-item,
.form-card,
.chart-panel,
.list-group-item {
    box-shadow: 0 10px 28px rgba(15, 23, 42, .045);
}

.metric-card,
.chart-panel {
    min-width: 0;
}

.metric-card {
    display: grid;
    align-content: start;
    min-height: 92px;
}

.operation-item {
    overflow: hidden;
}

.operation-item .text-end {
    flex: 0 0 auto;
}

.list-group {
    border-radius: 8px;
    overflow: hidden;
}

.filter-bar {
    padding: .75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
}

.chart-stack {
    align-items: start;
}

.chart-panel h2 {
    margin-bottom: .75rem;
}

.push-enable {
    position: fixed;
    right: 1rem;
    bottom: 5.25rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border-radius: 8px;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .page-head {
        align-items: flex-start;
    }

    .dashboard-identity {
        align-items: flex-start;
    }

    .dashboard-logo {
        width: 50px;
        height: 50px;
        border-radius: 12px;
    }

    .filter-submit span {
        display: none;
    }

    .chart-frame {
        height: 240px;
        min-height: 240px;
        max-height: 240px;
    }

    .push-enable {
        right: .75rem;
        bottom: 5rem;
        max-width: calc(100vw - 1.5rem);
    }
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
    .main-shell {
        max-width: 1120px;
    }
    .metric-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    .filter-bar {
        grid-template-columns: 1.35fr 1fr 1fr 1fr auto;
        align-items: end;
    }
    .chart-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .chart-stack .chart-panel:last-child {
        grid-column: 1 / -1;
    }
    .mobile-nav {
        max-width: 980px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 8px 8px 0 0;
    }
    .push-enable {
        bottom: 1rem;
    }
}
