:root {
    --sidebar-width: 260px;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --bottom-nav-height: 64px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.app-body {
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    font-family: "Noto Sans", "Noto Sans Bengali", "Segoe UI", system-ui, sans-serif;
}

body.auth-hero {
    font-family: "Noto Sans", "Noto Sans Bengali", "Segoe UI", system-ui, sans-serif;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #134e4a 100%);
    min-height: 100vh;
    min-height: 100dvh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar .brand {
    color: #fff;
    font-weight: 700;
    letter-spacing: .02em;
    padding: 1.25rem 1.25rem .5rem;
}

.sidebar .brand small {
    display: block;
    font-weight: 400;
    opacity: .7;
    font-size: .75rem;
}

.sidebar .nav-link {
    color: rgba(255,255,255,.78);
    border-radius: .6rem;
    margin: .1rem .75rem;
    padding: .7rem .85rem;
    font-size: .95rem;
}

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

.sidebar .nav-section {
    color: rgba(255,255,255,.45);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 1rem 1.25rem .25rem;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 1035;
}

.content-wrap {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar .page-title {
    font-size: 1rem;
    line-height: 1.2;
}

.stat-card {
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.stat-card .label {
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1.3;
}

.stat-card .value {
    font-size: 1.35rem;
    font-weight: 700;
    word-break: break-word;
}

.stat-card.cash { border-left: 4px solid #0ea5e9; }
.stat-card.bank { border-left: 4px solid #6366f1; }
.stat-card.liquid { border-left: 4px solid #14b8a6; }
.stat-card.invest { border-left: 4px solid #8b5cf6; }
.stat-card.sales { border-left: 4px solid #22c55e; }
.stat-card.other { border-left: 4px solid #84cc16; }
.stat-card.expense { border-left: 4px solid #f97316; }
.stat-card.profit { border-left: 4px solid #0f766e; }
.stat-card.draw { border-left: 4px solid #ef4444; }
.stat-card.loan { border-left: 4px solid #eab308; }

.card-soft {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    white-space: nowrap;
}

.auth-hero {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #0f172a, #0f766e);
}

.auth-card {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

.mobile-nav {
    display: none;
}

.txn-mobile-list {
    display: none;
}

.txn-card {
    background: #fff;
    border-radius: .9rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    padding: .9rem 1rem;
}

.txn-card + .txn-card {
    margin-top: .75rem;
}

.txn-card .txn-meta {
    color: var(--muted);
    font-size: .8rem;
}

.txn-card .txn-amount-income {
    color: #15803d;
    font-weight: 700;
}

.txn-card .txn-amount-expense {
    color: #b91c1c;
    font-weight: 700;
}

.form-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }

    .sidebar.show {
        transform: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .content-wrap {
        margin-left: 0;
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + .5rem);
    }

    .mobile-nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -8px 24px rgba(15, 23, 42, .08);
    }

    .mobile-nav a,
    .mobile-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .15rem;
        border: 0;
        background: #f1f5f9;
        color: var(--muted);
        text-decoration: none;
        font-size: .68rem;
        font-weight: 600;
        min-height: 48px;
        margin: 0 .15rem;
        border-radius: .85rem;
        transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
    }

    .mobile-nav a.active,
    .mobile-nav button.active {
        color: #fff;
        background: var(--brand);
        font-weight: 700;
        box-shadow: 0 6px 14px rgba(15, 118, 110, .28);
    }

    .mobile-nav .nav-new {
        color: #fff;
        background: #94a3b8;
    }

    .mobile-nav .nav-new.active {
        color: #fff;
        background: var(--brand-dark);
        box-shadow: 0 6px 14px rgba(15, 94, 89, .35);
    }

    .mobile-nav i {
        font-size: 1.15rem;
        line-height: 1;
    }

    .stat-card .value {
        font-size: 1.05rem;
    }

    .stat-card .card-body {
        padding: .85rem;
    }

    .form-control,
    .form-select,
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
    }

    .form-label {
        font-weight: 600;
        margin-bottom: .35rem;
    }

    .txn-desktop-table {
        display: none !important;
    }

    .txn-mobile-list {
        display: block;
    }

    .form-actions-bar {
        position: sticky;
        bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + .5rem);
        z-index: 10;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 1rem;
        padding: .75rem;
        box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
        margin-top: 1rem;
    }

    .form-actions-bar .btn {
        flex: 1 1 calc(50% - .25rem);
    }

    .topbar .user-chip {
        display: none;
    }

    main.page-main {
        padding-left: .85rem !important;
        padding-right: .85rem !important;
    }
}

@media (max-width: 575.98px) {
    .stat-card .label {
        font-size: .65rem;
    }

    .stat-card .value {
        font-size: .98rem;
    }
}
