:root {
    --sidebar-width: 248px;
    --header-height: 56px;
    --sidebar-bg: #1b2838;
    --sidebar-text: #c5d0dc;
    --sidebar-muted: #8b9aab;
    --sidebar-active: #24364c;
    --accent: #2b6de0;
    --accent-hover: #1f5bc9;
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #14804a;
    --success-bg: #e8f7ee;
    --warning: #b54708;
    --warning-bg: #fef4e6;
    --danger: #b42318;
    --danger-bg: #fdecea;
    --info: #175cd3;
    --info-bg: #e8f1fc;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.app-shell {
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: #fff;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}

.brand-name { font-weight: 650; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); }

.nav-section {
    padding: 14px 14px 6px;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    padding: 8px 18px;
    margin: 1px 8px;
    border-radius: 6px;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--sidebar-active);
    color: #fff;
}

.nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--accent);
}

.nav-link i { width: 18px; text-align: center; }

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

.topbar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.page-wrap { padding: 20px 24px 32px; }

.page-title {
    font-size: 20px;
    font-weight: 650;
    margin: 0;
}

.breadcrumb {
    margin: 0;
    background: transparent;
    padding: 0;
    font-size: 12px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    font-weight: 600;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #fff;
    flex-shrink: 0;
}

.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }

.table {
    margin-bottom: 0;
    font-size: 13px;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td, .table th { vertical-align: middle; padding: .7rem .85rem; }

.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
}

.badge-paid { background: var(--success-bg); color: var(--success); }
.badge-partial { background: var(--warning-bg); color: var(--warning); }
.badge-pending { background: var(--danger-bg); color: var(--danger); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: #eef2f6; color: #667085; }
.badge-admin { background: var(--info-bg); color: var(--info); }
.badge-staff { background: #f3e8ff; color: #6941c6; }

.btn { border-radius: 6px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-soft {
    background: #eef4ff;
    color: var(--accent);
    border: 1px solid #d7e6ff;
}
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filters {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}

.form-control, .form-select {
    font-size: 13px;
    border-color: #d0d5dd;
    border-radius: 6px;
}

.form-label { font-weight: 600; font-size: 13px; color: #344054; }

.alert { border-radius: 8px; font-size: 13px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e8f1fc;
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16,24,40,.45);
    z-index: 1030;
}

.menu-toggle { display: none; }

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #eef3f8 0%, #f7f8fa 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16,24,40,.06);
    padding: 28px;
}

.demo-box {
    background: #f8fafc;
    border: 1px dashed #d0d5dd;
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    color: #475569;
}

.receipt-paper {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
}

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

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .sidebar-backdrop.show { display: block; }
    .page-wrap { padding: 16px; }
}

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main { margin: 0; }
    .page-wrap { padding: 0; }
    .card, .receipt-paper { border: 0; box-shadow: none; }
}
