:root {
    --navy: #0b2d49;
    --navy-2: #123e60;
    --ink: #102033;
    --muted: #65758a;
    --line: #e4eaf1;
    --surface: #ffffff;
    --bg: #f5f8fb;
    --soft: #edf4fa;
    --cyan: #31b9d6;
    --green: #18a66a;
    --yellow: #d99b22;
    --red: #d84b4b;
    --shadow: 0 18px 45px rgba(10, 39, 63, .11);
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    background: var(--navy);
    color: #fff;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow: hidden;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 76px;
}

.brand img {
    width: 210px;
    height: auto;
    max-height: 76px;
    object-fit: contain;
}

.nav {
    display: grid;
    gap: 6px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.nav::-webkit-scrollbar {
    width: 6px;
}

.nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.18);
    border-radius: 999px;
}

.nav a {
    padding: 12px 13px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.74);
    font-weight: 650;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav a:hover,
.nav a.active {
    background: rgba(255,255,255,.11);
    color: #fff;
}

.side-profile {
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--radius);
    background: rgba(255,255,255,.06);
    flex-shrink: 0;
}

.side-profile span {
    color: rgba(255,255,255,.72);
    font-size: 12px;
}

.side-profile strong {
    display: block;
    margin: 4px 0 12px;
}

.logout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.11);
    color: #fff;
    font-weight: 750;
}

.main {
    min-width: 0;
}

.topbar {
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    min-height: 84px;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 8;
}

.topbar p {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 12px;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.top-action {
    margin-left: auto;
    background: var(--navy);
    color: #fff;
    padding: 11px 16px;
    border-radius: var(--radius);
    font-weight: 750;
}

.menu-button {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 10px;
}

.menu-button span {
    display: block;
    height: 2px;
    background: var(--navy);
    margin: 5px 0;
}

.content {
    padding: 28px;
}

.hero-panel {
    background: linear-gradient(135deg, var(--navy), var(--navy-2));
    color: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: end;
    overflow: hidden;
    position: relative;
}

.hero-panel::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -100px;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0 0 8px;
    color: #9ce9f8;
    font-weight: 750;
}

.hero-panel h2 {
    max-width: 720px;
    margin: 0;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.06;
}

.hero-panel p:not(.eyebrow) {
    max-width: 660px;
    margin: 14px 0 0;
    color: rgba(255,255,255,.77);
    font-size: 15px;
    line-height: 1.6;
}

.hero-metric {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--radius);
    padding: 18px;
}

.hero-metric span,
.hero-metric small {
    color: rgba(255,255,255,.72);
}

.hero-metric strong {
    display: block;
    font-size: 27px;
    margin: 8px 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0 28px;
}

.stat-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 26px rgba(14, 43, 70, .06);
}

.stat-card {
    padding: 18px;
}

.stat-card span,
.stat-card small {
    display: block;
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin: 8px 0 4px;
    font-size: 24px;
    line-height: 1.2;
}

.stat-card.accent {
    border-color: rgba(49,185,214,.45);
    background: linear-gradient(180deg, #fff, #eefaff);
}

.income-card {
    border-top: 3px solid #31b9d6;
}

.deduction-card {
    border-top: 3px solid #d99b22;
}

.profit-card {
    border-top: 3px solid #18a66a;
}

.trend {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 7px;
    margin-right: 5px;
    font-size: 11px;
    font-weight: 800;
    background: #edf2f7;
    color: #65758a;
}

.trend.up {
    background: #e7f7ef;
    color: #138050;
}

.trend.down {
    background: #fff0f0;
    color: #b93434;
}

.dashboard-filter {
    margin-top: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr);
    gap: 16px;
    margin: 6px 0 28px;
}

.chart-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.chart-head h3,
.breakdown-panel h3 {
    margin: 0;
    font-size: 18px;
}

.chart-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

.chart-head span {
    padding: 7px 10px;
    border-radius: 999px;
    background: #e8f5fa;
    color: var(--navy);
    font-weight: 750;
    white-space: nowrap;
}

.bar-chart {
    display: grid;
    gap: 14px;
}

.bar-row {
    display: grid;
    grid-template-columns: 150px minmax(120px, 1fr) 150px;
    gap: 14px;
    align-items: center;
}

.bar-row span {
    color: #506176;
    font-weight: 750;
}

.bar-row strong {
    text-align: right;
}

.bar-track {
    height: 12px;
    background: #eef3f8;
    border-radius: 999px;
    overflow: hidden;
}

.bar-track i {
    display: block;
    height: 100%;
    min-width: 2%;
    border-radius: inherit;
}

.bar-track i.income {
    background: #31b9d6;
}

.bar-track i.deduction {
    background: #d99b22;
}

.bar-track i.profit {
    background: #18a66a;
}

.breakdown-list {
    display: grid;
    gap: 12px;
    margin-top: 15px;
}

.breakdown-list div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fbfd;
}

.breakdown-list span,
.breakdown-list small {
    display: block;
    color: var(--muted);
}

.breakdown-list strong {
    display: block;
    margin: 6px 0 3px;
    font-size: 22px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 26px 0 14px;
}

.section-head h2,
.panel h3 {
    margin: 0;
    font-size: 20px;
}

.section-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

.button {
    border: 0;
    border-radius: var(--radius);
    padding: 11px 15px;
    font-weight: 750;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
}

.button.primary {
    background: var(--navy);
    color: #fff;
}

.button.secondary {
    background: #e8f5fa;
    color: var(--navy);
}

.button.ghost {
    background: #fff;
    color: var(--navy);
    border: 1px solid var(--line);
}

.button.tiny {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 12px;
}

.inline-actions {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: end;
    margin: 0 0 14px;
    flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
    min-width: 210px;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

th,
td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: #506176;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
    background: #f8fafc;
}

td small,
.muted {
    color: var(--muted);
}

tfoot th {
    background: #eef4f9;
    color: var(--ink);
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 30px;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-weight: 750;
    font-size: 12px;
    background: #edf2f7;
    color: #526173;
    white-space: nowrap;
}

.status.completed,
.status.active,
.status.topup,
.status.approved {
    background: #e7f7ef;
    color: #138050;
}

.status.paid,
.status.processed,
.status.adjustment {
    background: #e8f5fa;
    color: #0d7991;
}

.status.pending {
    background: #fff4df;
    color: #9a6713;
}

.status.cancelled,
.status.inactive,
.status.spend,
.status.rejected {
    background: #ffecec;
    color: #b93434;
}

.link {
    color: #0b7891;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.proof-preview {
    display: inline-grid;
    gap: 6px;
    color: #0b7891;
    font-weight: 750;
}

.proof-preview img {
    width: 74px;
    height: 54px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.panel {
    padding: 20px;
}

.split-layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.balance-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-stack,
.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-form {
    align-items: end;
    margin-bottom: 18px;
}

.full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    color: #3d4d60;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d8e1ea;
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    padding: 11px 12px;
    outline: none;
    min-height: 42px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(49,185,214,.14);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
}

.alert.success {
    background: #eaf8f1;
    color: #116b45;
    border-color: #bde8d1;
}

.alert.danger {
    background: #fff0f0;
    color: #aa3030;
    border-color: #ffd0d0;
}

.alert.warning {
    background: #fff6e5;
    color: #8b5b0d;
    border-color: #f1d494;
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 12%, rgba(49,185,214,.22), transparent 26%),
        linear-gradient(135deg, #092742, #0b2d49 58%, #103b5c);
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(980px, calc(100vw - 48px));
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 26px 90px rgba(0,0,0,.22);
}

.login-hero {
    background: var(--navy);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.login-hero img {
    width: 310px;
    max-width: 100%;
    margin-bottom: 28px;
}

.login-hero h1 {
    margin: 0;
    font-size: 40px;
    line-height: 1;
}

.login-hero p {
    color: rgba(255,255,255,.74);
    line-height: 1.65;
    max-width: 420px;
}

.login-card {
    padding: 48px;
    align-self: center;
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.login-card > p {
    color: var(--muted);
    margin: 0 0 20px;
    line-height: 1.55;
}

@media (max-width: 1100px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .split-layout,
    .hero-panel {
        grid-template-columns: 1fr;
    }

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

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 290px;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 18px 0 42px rgba(0,0,0,.22);
    }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .menu-button {
        display: block;
        flex: 0 0 auto;
    }

    .topbar {
        padding: 14px 16px;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .top-action {
        display: none;
    }

    .content {
        padding: 18px 14px 28px;
    }

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .stat-grid,
    .balance-list,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .hero-panel {
        padding: 22px;
    }

    .hero-metric strong {
        font-size: 23px;
    }

    .toolbar {
        display: grid;
    }

    .toolbar input,
    .toolbar select {
        min-width: 0;
    }

    .login-page {
        padding: 16px;
    }

    .login-shell {
        grid-template-columns: 1fr;
        width: min(320px, calc(100vw - 32px));
        max-width: 100%;
    }

    .login-hero,
    .login-card {
        padding: 24px;
    }

    .login-hero {
        align-items: center;
        text-align: center;
    }

    .login-hero img {
        width: 235px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 20px;
    }

    .login-hero h1 {
        font-size: 28px;
    }

    .login-hero p {
        margin-bottom: 0;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .bar-row strong {
        text-align: left;
    }
}
