:root {
    --brand: #1a4d8f;
    --brand-dark: #123566;
    --brand-light: #e8f0fb;
    --ink: #1f2937;
    --muted: #6b7280;
    --bg: #f4f6f9;
    --border: #e5e9f0;
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--brand-dark), var(--brand));
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.25rem 1.25rem;
    font-weight: 700;
    font-size: 1.05rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-brand i { font-size: 1.3rem; }

.sidebar-nav {
    padding: .75rem;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255,255,255,.8);
    padding: .65rem .85rem;
    border-radius: .5rem;
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: .15rem;
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; opacity: .9; }

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: #fff;
    color: var(--brand-dark);
}

/* ---------- Main area ---------- */
.main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: .9rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content {
    padding: 1.75rem;
    flex: 1;
}

/* ---------- Cards / widgets ---------- */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: 1.25rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: .65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--brand-light);
    color: var(--brand);
    flex-shrink: 0;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .label {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
}

.card-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: 1.5rem;
}

.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--muted);
    border-bottom-width: 1px;
    font-weight: 600;
}

/* ---------- Accounts / Finance module ---------- */
.acc-tabs .nav-link {
    color: var(--muted);
    font-weight: 600;
    font-size: .88rem;
    border-radius: .6rem;
    padding: .5rem 1rem;
    margin-right: .35rem;
}
.acc-tabs .nav-link.active {
    background: var(--brand);
    color: #fff;
}
.acc-tabs .nav-link:hover:not(.active) {
    background: var(--brand-light);
    color: var(--brand-dark);
}
.stat-card.stat-income .icon { background: #e8f5e9; color: #16a34a; }
.stat-card.stat-expense .icon { background: #fdecea; color: #dc2626; }
.stat-card.stat-debit .icon { background: #e3f2fd; color: #1565c0; }
.stat-card.stat-credit .icon { background: #fff3e0; color: #d97706; }
.stat-card.stat-profit .icon { background: var(--brand-light); color: var(--brand); }
.stat-card.stat-balance .icon { background: #ede9fe; color: #6d28d9; }
.text-debit { color: #16a34a; font-weight: 600; }
.text-credit { color: #dc2626; font-weight: 600; }
.badge-txn-income { background: #16a34a; }
.badge-txn-expense { background: #dc2626; }
.badge-txn-refund { background: #d97706; }
.badge-auto { background: #e5e9f0; color: var(--muted); font-weight: 500; }

.badge-status-Definite { background: #16a34a; }
.badge-status-Tentative { background: #d97706; }
.badge-status-Confirmed { background: #1a4d8f; }
.badge-status-Cancelled { background: #dc2626; }

.btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.btn-outline-brand {
    color: var(--brand);
    border-color: var(--brand);
    background: transparent;
}
.btn-outline-brand:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Login page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

.login-card .brand-icon {
    width: 56px;
    height: 56px;
    border-radius: .85rem;
    background: var(--brand-light);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-area {
        margin-left: 0;
    }
    .content {
        padding: 1rem;
    }
    .topbar {
        padding: .75rem 1rem;
    }
}

/* ---------- Print-friendly styling (used by Reports / Arrivals Report) ---------- */
@media print {
    .sidebar, .topbar, .no-print, .pagination {
        display: none !important;
    }
    .main-area {
        margin-left: 0 !important;
    }
    .content {
        padding: 0 !important;
    }
    .card-panel {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    a[href]:after {
        content: "";
    }
}
