/* ==========================================================================
   Diwali Crackers Finance Management System - design system
   ========================================================================== */
:root {
    --cs-primary: #2f54eb;
    --cs-primary-600: #2443c9;
    --cs-primary-50: #eef2ff;
    --cs-success: #12a454;
    --cs-success-50: #e7f7ee;
    --cs-warning: #d98b06;
    --cs-warning-50: #fff5e0;
    --cs-danger: #dc3545;
    --cs-danger-50: #fdecee;
    --cs-info: #0e8fb3;
    --cs-info-50: #e4f6fb;
    --cs-ink: #0f172a;
    --cs-ink-2: #334155;
    --cs-muted: #64748b;
    --cs-line: #e5e9f2;
    --cs-bg: #f4f6fb;
    --cs-card: #ffffff;
    --cs-sidebar: #0b1739;
    --cs-sidebar-2: #13245a;
    --cs-radius: 14px;
    --cs-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --sidebar-w: 256px;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-primary: var(--cs-primary);
    --bs-primary-rgb: 47, 84, 235;
    --bs-link-color: var(--cs-primary);
    --bs-border-color: var(--cs-line);
}

html, body { overflow-x: hidden; }
body.app-body { background: var(--cs-bg); color: var(--cs-ink); font-size: .925rem; }
a { text-decoration: none; }
.text-muted { color: var(--cs-muted) !important; }
.fw-600 { font-weight: 600; }
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .86em; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, var(--cs-sidebar) 0%, var(--cs-sidebar-2) 100%);
    color: #c7d2fe; position: fixed; inset: 0 auto 0 0; z-index: 1040;
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
    background: linear-gradient(135deg, #facc15, #f97316); color: #1e1b4b; font-size: 1.2rem;
    box-shadow: 0 6px 18px rgba(249, 115, 22, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { color: #fff; font-weight: 700; font-size: 1.02rem; letter-spacing: .2px; }
.brand-sub { color: #94a3d8; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
.nav-section { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; color: #7d8bc6; margin: 1.1rem .75rem .35rem; }
.nav-item {
    display: flex; align-items: center; gap: .75rem; padding: .58rem .8rem; border-radius: 10px;
    color: #c7d2fe; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav-item i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: rgba(99, 132, 255, .22); color: #fff; box-shadow: inset 3px 0 0 #8ea4ff; }
.nav-item-cta { background: linear-gradient(135deg, #2f54eb, #5b7cfa); color: #fff; margin: .25rem 0 .35rem; box-shadow: 0 6px 16px rgba(47, 84, 235, .35); }
.nav-item-cta:hover { filter: brightness(1.08); }
.nav-item-cta.active { box-shadow: 0 6px 16px rgba(47, 84, 235, .35), inset 0 0 0 2px rgba(255,255,255,.35); }
.nav-badge { margin-left: auto; background: #f97316; color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .45rem; min-width: 1.3rem; text-align: center; }
.nav-badge:empty { display: none; }
.sidebar-footer { padding: .8rem 1.25rem; font-size: .72rem; color: #6e7bb3; border-top: 1px solid rgba(255,255,255,.06); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--cs-line); padding: .7rem 1.5rem; min-height: 64px;
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 1.15rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { color: var(--cs-muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.topbar-toggle { display: none; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--cs-line); background: #fff; }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--cs-line); border-radius: 999px; padding: .2rem .7rem .2rem .25rem; background: #fff; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--cs-primary-50); color: var(--cs-primary); font-weight: 700; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 1.5rem; flex: 1; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-bottom: 1rem; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .app-shell.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1030; }
    .main { margin-left: 0; }
    .topbar-toggle { display: inline-grid; }
    .topbar { padding: .6rem 1rem; }
    .content { padding: 1rem; }
}

/* ---------- cards ---------- */
.card { border: 1px solid var(--cs-line); border-radius: var(--cs-radius); box-shadow: var(--cs-shadow); background: var(--cs-card); }
.card-header { background: transparent; border-bottom: 1px solid var(--cs-line); padding: .9rem 1.15rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-header .card-tools { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.card-body { padding: 1.15rem; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cs-muted); font-weight: 600; margin-bottom: .6rem; }

.kpi { display: flex; flex-direction: row; gap: .9rem; align-items: center; padding: 1.05rem 1.1rem; height: 100%; }
.card.kpi, .card.report-tile { flex-direction: row; }
.kpi > div { min-width: 0; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex: 0 0 46px; }
.kpi-label { color: var(--cs-muted); font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; word-break: break-word; }
.kpi-foot { font-size: .76rem; color: var(--cs-muted); }
.tone-primary { background: var(--cs-primary-50); color: var(--cs-primary); }
.tone-success { background: var(--cs-success-50); color: var(--cs-success); }
.tone-warning { background: var(--cs-warning-50); color: var(--cs-warning); }
.tone-danger { background: var(--cs-danger-50); color: var(--cs-danger); }
.tone-info { background: var(--cs-info-50); color: var(--cs-info); }
.tone-violet { background: #f3e8ff; color: #7e22ce; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 260px; }

/* ---------- badges ---------- */
.badge { font-weight: 600; border-radius: 999px; padding: .35em .7em; font-size: .72rem; letter-spacing: .02em; }
.badge-soft-success { background: var(--cs-success-50); color: #0b7a3e; }
.badge-soft-warning { background: var(--cs-warning-50); color: #a5680a; }
.badge-soft-danger { background: var(--cs-danger-50); color: #b42331; }
.badge-soft-info { background: var(--cs-info-50); color: #0b6f8b; }
.badge-soft-secondary { background: #eef1f6; color: #475569; }
.badge-soft-primary { background: var(--cs-primary-50); color: var(--cs-primary-600); }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .8rem; border-bottom-color: var(--cs-line); vertical-align: middle; }
.table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cs-muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table tbody tr:hover { background: #fafbff; }
.table tfoot td, .table tfoot th { font-weight: 700; background: #f8fafc; }
.table-responsive { border-radius: 0 0 var(--cs-radius) var(--cs-radius); }
th.sortable a { color: inherit; display: inline-flex; gap: .25rem; align-items: center; }
th.sortable a:hover { color: var(--cs-primary); }
.text-end.amount, td.num { text-align: right; }
.row-muted td { color: #94a3b8; }
.row-reversed td { text-decoration: line-through; color: #b42331; }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .9rem 1.15rem; border-bottom: 1px solid var(--cs-line); }
.toolbar .form-control, .toolbar .form-select { max-width: 260px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem 1.15rem; border-top: 1px solid var(--cs-line); font-size: .85rem; }
.pagination { margin: 0; }

/* ---------- forms ---------- */
.form-label { font-weight: 600; font-size: .82rem; color: var(--cs-ink-2); margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; border-color: #d7dde8; padding: .5rem .75rem; }
.form-control:focus, .form-select:focus { border-color: #8ea4ff; box-shadow: 0 0 0 .2rem rgba(47, 84, 235, .15); }
.form-text { font-size: .76rem; }
.field-validation-error, .text-danger.field-validation-error { font-size: .78rem; color: var(--cs-danger); display: block; margin-top: .2rem; }
.input-validation-error { border-color: var(--cs-danger) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.required::after { content: " *"; color: var(--cs-danger); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--cs-primary); border-color: var(--cs-primary); }
.btn-primary:hover { background: var(--cs-primary-600); border-color: var(--cs-primary-600); }
.btn-light { background: #f1f4f9; border-color: #e3e8f1; }
.form-switch .form-check-input { width: 2.3em; }
.option-card { border: 1px solid var(--cs-line); border-radius: 12px; padding: .75rem .9rem; height: 100%; }

/* ---------- detail lists ---------- */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem 1.2rem; margin: 0; }
.dl-grid dt { font-size: .74rem; color: var(--cs-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.dl-grid dd { margin: 0; font-weight: 600; word-break: break-word; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.stat-strip .stat { background: #f8fafc; border: 1px solid var(--cs-line); border-radius: 12px; padding: .7rem .9rem; }
.stat .label { font-size: .72rem; color: var(--cs-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.member-photo { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; background: var(--cs-primary-50); display: grid; place-items: center; font-size: 2rem; color: var(--cs-primary); font-weight: 700; flex: 0 0 84px; }
.progress { height: .5rem; border-radius: 999px; background: #edf1f7; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--cs-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; color: #a5b4fc; }

/* ---------- payment collection ---------- */
.collect-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.collect-grid > * { min-width: 0; }
@media (max-width: 1199.98px) { .collect-grid { grid-template-columns: minmax(0, 1fr); } .summary-card { position: static; } }
@media (max-width: 575.98px) {
    .plan-pay-head .amount-box { margin-left: 0; width: 100%; }
    .plan-pay-head .amount-box input { flex: 1; width: auto; }
    .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-hero .form-control { font-size: .95rem; }
    .receipt { padding: 1rem; }
    .page-actions .btn { flex: 1 1 auto; }
}
.search-hero { position: relative; }
.search-hero .form-control { padding: .85rem 1rem .85rem 2.8rem; font-size: 1.05rem; border-radius: 14px; }
.search-hero > i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--cs-muted); font-size: 1.1rem; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050; background: #fff; border: 1px solid var(--cs-line); border-radius: 12px; box-shadow: var(--cs-shadow); max-height: 340px; overflow-y: auto; }
.search-results .item { padding: .6rem .9rem; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px solid #f1f4f9; }
.search-results .item:last-child { border-bottom: 0; }
.search-results .item.active, .search-results .item:hover { background: var(--cs-primary-50); }
.plan-pay { border: 1px solid var(--cs-line); border-radius: 14px; margin-bottom: 1rem; overflow: hidden; background: #fff; }
.plan-pay.selected { border-color: #8ea4ff; box-shadow: 0 0 0 3px rgba(47, 84, 235, .12); }
.plan-pay-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: .85rem 1rem; background: #fbfcff; border-bottom: 1px solid var(--cs-line); }
.plan-pay-head .title { font-weight: 700; }
.plan-pay-head .meta { font-size: .78rem; color: var(--cs-muted); }
.plan-pay-head .amount-box { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.plan-pay-head .amount-box input { width: 140px; text-align: right; font-weight: 700; }
.quick-btns { display: flex; flex-wrap: wrap; gap: .35rem; padding: .6rem 1rem; border-bottom: 1px solid var(--cs-line); }
.quick-btns .btn { font-size: .78rem; padding: .25rem .6rem; }
.inst-table td, .inst-table th { font-size: .82rem; }
.inst-table tr.will-pay { background: #eefaf3; }
.inst-table tr.will-part { background: #fff8e6; }
.summary-card { position: sticky; top: 80px; }
.summary-line { display: flex; justify-content: space-between; padding: .35rem 0; font-size: .9rem; }
.summary-total { font-size: 1.6rem; font-weight: 800; color: var(--cs-primary); font-variant-numeric: tabular-nums; }
.method-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.method-pills .btn { font-size: .8rem; padding: .45rem .3rem; }
.method-pills .btn-check:checked + .btn { background: var(--cs-primary); color: #fff; border-color: var(--cs-primary); }

/* ---------- report catalogue ---------- */
.report-tile { display: flex; gap: .85rem; padding: 1rem; height: 100%; color: inherit; transition: transform .12s, box-shadow .12s; }
.report-tile:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15, 23, 42, .1); color: inherit; }
.report-letter { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; flex: 0 0 42px; }
.filters .form-label { font-size: .74rem; }

/* ---------- misc ---------- */
.toast { border-radius: 12px; border: 0; box-shadow: var(--cs-shadow); }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.55); display: none; place-items: center; z-index: 2000; }
.loading-overlay.show { display: grid; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 10% 0%, #1e3a8a 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #7c2d12 0%, transparent 55%), #0b1739; }
.auth-card { width: 100%; max-width: 420px; border-radius: 20px; }
.auth-card .card-body { padding: 2rem; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0 .5rem 1.2rem; border-left: 2px solid var(--cs-line); position: relative; font-size: .84rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .85rem; width: 10px; height: 10px; border-radius: 50%; background: #a5b4fc; }

/* ---------- receipt ---------- */
.receipt { overflow: hidden; max-width: 760px; margin: 0 auto; background: #fff; border-radius: 16px; border: 1px solid var(--cs-line); box-shadow: var(--cs-shadow); padding: 2rem; position: relative; }
.receipt-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--cs-primary); padding-bottom: 1rem; margin-bottom: 1rem; }
.receipt-title { background: var(--cs-primary); color: #fff; text-align: center; font-weight: 700; letter-spacing: .12em; padding: .4rem; border-radius: 8px; margin-bottom: 1rem; }
.receipt .sig { margin-top: 3rem; display: flex; justify-content: space-between; gap: 2rem; }
.receipt .sig div { flex: 1; border-top: 1px solid #94a3b8; padding-top: .3rem; font-size: .8rem; color: var(--cs-muted); }
.receipt .sig div:last-child { text-align: right; }
.watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 4rem; font-weight: 800; color: rgba(220, 53, 69, .12); pointer-events: none; white-space: nowrap; }

/* ==========================================================================
   Mobile-first layer (phones are the primary device for collectors)
   ========================================================================== */
.bottom-nav, .collect-bar, .filters-toggle { display: none; }

@media (max-width: 991.98px) {
    /* bottom navigation with role-specific shortcuts */
    .bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; background: #fff;
        border-top: 1px solid var(--cs-line); box-shadow: 0 -6px 20px rgba(15, 23, 42, .08);
        padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    }
    .bottom-nav a, .bottom-nav button {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .1rem;
        color: var(--cs-muted); font-size: .68rem; font-weight: 600; padding: .3rem .1rem; border: 0; background: none; border-radius: 10px;
    }
    .bottom-nav i { font-size: 1.25rem; line-height: 1; }
    .bottom-nav .active { color: var(--cs-primary); }
    .bottom-nav .bn-cta i { width: 46px; height: 46px; margin-top: -1.3rem; border-radius: 50%; display: grid; place-items: center;
        background: linear-gradient(135deg, #2f54eb, #5b7cfa); color: #fff; box-shadow: 0 6px 16px rgba(47, 84, 235, .4); font-size: 1.35rem; }
    .bottom-nav .bn-cta { color: var(--cs-primary); }
    body.has-bottom-nav .content { padding-bottom: 6rem; }
    .toast-container { top: auto !important; bottom: 4.8rem; left: 0; right: 0 !important; }

    /* collection screen: sticky total bar replaces the bottom nav */
    body.page-collect .bottom-nav { display: none; }
    body.page-collect .content { padding-bottom: 6rem; }
    .collect-bar {
        display: flex; align-items: center; gap: .75rem; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
        background: #fff; border-top: 1px solid var(--cs-line); box-shadow: 0 -6px 20px rgba(15, 23, 42, .1);
        padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
    }
    .collect-bar .total { font-size: 1.25rem; font-weight: 800; color: var(--cs-primary); font-variant-numeric: tabular-nums; }
    .collect-bar .lbl { font-size: .7rem; color: var(--cs-muted); text-transform: uppercase; letter-spacing: .05em; }
    .collect-bar .btn { margin-left: auto; padding: .65rem 1.1rem; }
}

@media (max-width: 767.98px) {
    /* collapsible filter panels */
    .filters-toggle { display: flex; width: 100%; align-items: center; gap: .5rem; padding: .8rem 1rem; border: 0; background: none; font-weight: 600; color: var(--cs-ink); }
    .filters-toggle .badge { margin-left: auto; }
    .filters.is-collapsed > .card-body { display: none; }
    .page-actions { justify-content: stretch; }
    .page-actions > .btn, .page-actions > a.btn { flex: 1 1 calc(50% - .5rem); font-size: .82rem; padding: .5rem .5rem; }
    .toolbar .form-control, .toolbar .form-select { max-width: none; flex: 1 1 100%; }
    .toolbar > input[type=search] { flex: 1 1 100%; }
    .toolbar-more { display: grid; gap: .5rem; }
    .toolbar-more.d-none { display: none !important; }
    .toolbar .btn { flex: 1 1 auto; }
    .pager { justify-content: center; }
    .pager > div:first-child { width: 100%; text-align: center; }
}

@media (max-width: 575.98px) {
    body.app-body { font-size: .9rem; }
    .content { padding: .75rem; }
    .topbar { padding: .5rem .75rem; min-height: 56px; }
    .topbar-title h1 { font-size: 1.02rem; }
    .topbar .user-chip .dropdown-toggle::after { display: none; }
    /* 16px inputs stop iOS from zooming; larger touch targets */
    .form-control, .form-select { font-size: 16px; min-height: 44px; }
    .form-control-sm, .form-select-sm { min-height: 38px; }
    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }
    .card-body { padding: .9rem; }
    .card-header { padding: .75rem .9rem; }
    .kpi { padding: .85rem .9rem; }
    .kpi-value { font-size: 1.2rem; }
    .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .member-photo { width: 64px; height: 64px; flex-basis: 64px; font-size: 1.6rem; }
    .chart-box { height: 240px; }
    .chart-box.sm { height: 220px; }
    .modal-dialog { margin: .5rem; }
    .receipt .sig { gap: 1rem; }



    /* collection screen: compact installment list */
    .inst-table .col-opt { display: none; }
    .quick-btns .btn { flex: 1 1 auto; min-height: 38px; }
    .method-pills { grid-template-columns: repeat(2, 1fr); }
}

/* responsive tables become stacked cards on phones, tablets and small laptops (labels from the column headers) */
@media (max-width: 1199.98px) {
    /* responsive tables become stacked cards (labels from the column headers) */
    table.table-cards thead { display: none; }
    table.table-cards, table.table-cards tbody, table.table-cards tfoot, table.table-cards tr, table.table-cards td { display: block; width: 100%; }
    table.table-cards tr { width: auto; margin: .6rem .6rem; border: 1px solid var(--cs-line); border-radius: 12px; background: #fff; padding: .45rem .75rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
    table.table-cards tbody tr:hover { background: #fff; }
    table.table-cards > :not(caption) > * > * { border: 0; padding: .28rem 0; }
    table.table-cards td { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; text-align: right; word-break: break-word; }
    table.table-cards td::before { content: attr(data-label); flex: 0 0 40%; text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--cs-muted); padding-top: .12rem; }
    table.table-cards td[data-label=""]::before { display: none; }
    table.table-cards td[data-label=""] { justify-content: flex-end; }
    table.table-cards td > div, table.table-cards td > span.small { text-align: right; }
    table.table-cards td:first-child { font-weight: 600; }
    table.table-cards tfoot tr { background: var(--cs-primary-50); border-color: #c7d2fe; }
    table.table-cards tfoot td { background: transparent !important; }
    table.table-cards tr.row-muted { opacity: .75; }
    table.table-cards td .empty-state { width: 100%; }
    .table-responsive { border-radius: 0; }
    table.table-cards td.amount, table.table-cards td .amount { white-space: normal; }
    table.table-cards td::before { font-family: var(--bs-body-font-family); }
    table.table-cards td > .cv { text-align: right; min-width: 0; }
    table.table-cards td > .cv > div, table.table-cards td > .cv > span { display: inline; }
    table.table-cards td > .cv > div::before, table.table-cards td > .cv > span.text-muted::before { content: " "; }
    table.table-cards td > * { min-width: 0; max-width: 100%; }
    table.table-cards td form { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; width: 100%; }
    table.table-cards td form .form-control { width: auto !important; flex: 1 1 140px; }
    table.table-cards td .text-nowrap { white-space: normal !important; }
}
/* small laptops: let headers wrap so most tables fit without sideways scrolling */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .table thead th { white-space: normal; }
    .table > :not(caption) > * > * { padding: .55rem .55rem; }
}
/* tablets / small laptops: two cards per row */
@media (min-width: 576px) and (max-width: 1199.98px) {
    table.table-cards tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .3rem; }
    table.table-cards tbody tr { margin: .3rem; }
    table.table-cards tbody tr:only-child { grid-column: 1 / -1; }
}
/* ---------- print ---------- */
.print-only { display: none; }
@media print {
    @page { margin: 12mm; }
    body.app-body { background: #fff; font-size: 11px; }
    .sidebar, .topbar, .page-actions, .no-print, .toolbar, .pager, .toast-container, .btn, .filters, .nav-badge, .bottom-nav, .collect-bar { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    .print-only { display: block !important; }
    .table > :not(caption) > * > * { padding: .25rem .4rem; }
    .table-responsive { overflow: visible !important; }
    .receipt { border: 0; box-shadow: none; padding: 0; max-width: none; }
    a { color: inherit !important; }
    tr { page-break-inside: avoid; }
}

/* ==========================================================================
   Luxury sign-in (3D scene + glass card)
   ========================================================================== */
.lux-body { --lux-gold: #e8c47a; --lux-gold-2: #f5dfa8; background: #05060d; color: #f1e9d8; }
.lux-body .auth-page {
    position: relative; overflow: hidden; perspective: 1400px;
    background: radial-gradient(900px 600px at 50% 40%, #1a1430 0%, transparent 70%), radial-gradient(1200px 700px at 100% 110%, #3a1606 0%, transparent 55%), radial-gradient(900px 600px at -10% -10%, #0e1a40 0%, transparent 60%), #05060d;
}
.lux-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.lux-vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.65) 100%); }
.lux-stage { position: relative; z-index: 2; width: 100%; max-width: 440px; perspective: 1200px; animation: luxRise 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes luxRise { from { opacity: 0; transform: translateY(40px) rotateX(18deg) scale(.96); } to { opacity: 1; transform: none; } }

.lux-card {
    --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 0%;
    position: relative; border-radius: 26px; padding: 1px; transform-style: preserve-3d;
    transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .25s ease-out;
    background: linear-gradient(140deg, rgba(245,223,168,.85), rgba(184,137,58,.25) 30%, rgba(255,255,255,.06) 55%, rgba(232,196,122,.7));
    box-shadow: 0 40px 90px -20px rgba(0,0,0,.85), 0 0 80px -10px rgba(232,180,90,.25);
}
.lux-card-inner {
    position: relative; border-radius: 25px; padding: 2.4rem 2.2rem 1.8rem;
    background: linear-gradient(160deg, rgba(22,20,36,.8), rgba(10,10,20,.88));
    -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}
.lux-card-shine {
    position: absolute; inset: 0; border-radius: 26px; z-index: 3; pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(500px circle at var(--mx) var(--my), rgba(255,226,160,.13), transparent 45%);
}
.lux-emblem {
    position: relative; width: 74px; height: 74px; border-radius: 22px; display: grid; place-items: center;
    background: linear-gradient(145deg, #fbe3a3, #d49b3c 55%, #8a5a1c); color: #1a1206; font-size: 2rem;
    box-shadow: 0 14px 40px -6px rgba(232,170,70,.6), inset 0 1px 0 rgba(255,255,255,.6), inset 0 -6px 12px rgba(90,50,10,.35);
    animation: luxFloat 6s ease-in-out infinite;
}
.lux-emblem-ring { position: absolute; inset: -9px; border-radius: 28px; border: 1px solid rgba(232,196,122,.45); animation: luxSpin 14s linear infinite; }
.lux-emblem-ring::before { content: ""; position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: #ffe7b0; box-shadow: 0 0 10px 2px #f5c66a; }
@keyframes luxFloat { 0%, 100% { transform: translateY(0) rotateY(0); } 50% { transform: translateY(-6px) rotateY(18deg); } }
@keyframes luxSpin { to { transform: rotate(360deg); } }
.lux-eyebrow { font-size: .66rem; letter-spacing: .38em; text-transform: uppercase; color: rgba(232,196,122,.75); margin-bottom: .35rem; }
.lux-title {
    font-family: "Didot", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 600; font-size: 2.1rem; letter-spacing: .02em; margin: 0 0 .25rem;
    background: linear-gradient(100deg, #b8893a 0%, #f8e6b8 30%, #e8c47a 50%, #fff3d1 65%, #b8893a 100%); background-size: 220% auto;
    -webkit-background-clip: text; background-clip: text; color: transparent; animation: luxSheen 6s linear infinite;
}
@keyframes luxSheen { to { background-position: -220% center; } }
.lux-sub { color: rgba(241,233,216,.6); font-size: .84rem; }
.lux-divider { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1.1rem; color: var(--lux-gold); font-size: .5rem; }
.lux-divider span { height: 1px; width: 70px; background: linear-gradient(90deg, transparent, rgba(232,196,122,.7)); }
.lux-divider span:last-child { transform: scaleX(-1); }

.lux-label { display: block; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(232,196,122,.85); margin-bottom: .45rem; }
.lux-input { position: relative; display: flex; align-items: center; }
.lux-input > .bi { position: absolute; left: 1rem; color: rgba(232,196,122,.7); font-size: 1rem; pointer-events: none; z-index: 1; }
.lux-input .form-control {
    height: 52px; padding-left: 2.8rem; padding-right: 2.8rem; border-radius: 14px; color: #fbf4e4;
    background: rgba(255,255,255,.04); border: 1px solid rgba(232,196,122,.22);
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.lux-input .form-control::placeholder { color: rgba(241,233,216,.3); }
.lux-input .form-control:focus { background: rgba(255,255,255,.07); border-color: rgba(245,214,150,.8); box-shadow: 0 0 0 4px rgba(232,196,122,.14), 0 0 24px -4px rgba(232,180,90,.4); color: #fff; }
.lux-input .form-control:-webkit-autofill { -webkit-text-fill-color: #fbf4e4; -webkit-box-shadow: 0 0 0 1000px #15131f inset; caret-color: #fff; }
.lux-eye { position: absolute; right: .55rem; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: rgba(232,196,122,.7); }
.lux-eye:hover { color: var(--lux-gold-2); background: rgba(232,196,122,.08); }
.lux-body .field-validation-error { display: block; color: #fca5a5; font-size: .78rem; margin-top: .35rem; }
.lux-alert { background: rgba(220,53,69,.12); border: 1px solid rgba(248,113,113,.35); color: #fecaca; border-radius: 12px; padding: .55rem .8rem; font-size: .84rem; margin-bottom: 1rem; }
.lux-alert ul { margin: 0; padding-left: 1rem; }
.validation-summary-valid { display: none !important; }

.lux-btn {
    position: relative; overflow: hidden; height: 54px; border: 0; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
    font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .86rem; color: #1a1206;
    background: linear-gradient(135deg, #fbe3a3 0%, #e8c47a 35%, #c8933f 70%, #f5d590 100%);
    box-shadow: 0 14px 34px -10px rgba(232,170,70,.7), inset 0 1px 0 rgba(255,255,255,.7);
    transition: transform .2s, box-shadow .2s;
}
.lux-btn::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; transform: skewX(-20deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: luxSweep 3.6s ease-in-out infinite; }
@keyframes luxSweep { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.lux-btn:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -10px rgba(232,170,70,.85), inset 0 1px 0 rgba(255,255,255,.7); }
.lux-btn:active { transform: translateY(0); }
.lux-btn .bi { transition: transform .2s; }
.lux-btn:hover .bi { transform: translateX(4px); }
.lux-btn.is-busy { pointer-events: none; opacity: .85; }
.lux-btn.is-busy .bi { animation: luxSpin 1s linear infinite; }
.lux-btn.is-busy .bi::before { content: "\F130"; }
.lux-foot { text-align: center; color: rgba(241,233,216,.45); font-size: .78rem; margin: 1.5rem 0 0; }

@media (max-width: 480px) {
    .lux-card-inner { padding: 2rem 1.35rem 1.5rem; }
    .lux-title { font-size: 1.75rem; }
}
@media (prefers-reduced-motion: reduce) {
    .lux-stage, .lux-emblem, .lux-emblem-ring, .lux-title, .lux-btn::after, .prompt-icon, .prompt-icon .bi { animation: none !important; }
}

/* ==========================================================================
   Post-login prompts (notifications + install app)
   ========================================================================== */
.prompt-modal .modal-content { border: 0; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(15,23,42,.45); }
.prompt-hero { position: relative; padding: 2rem 1.5rem 1.4rem; text-align: center; color: #fff; background: radial-gradient(400px 200px at 20% 0%, #2f54eb 0%, transparent 70%), radial-gradient(400px 200px at 100% 100%, #9a3412 0%, transparent 70%), #0b1739; }
.prompt-hero .btn-close { position: absolute; top: .9rem; right: .9rem; }
.prompt-icon { width: 68px; height: 68px; margin: 0 auto .9rem; border-radius: 20px; display: grid; place-items: center; font-size: 1.9rem; color: #1a1206; background: linear-gradient(145deg, #fbe3a3, #d49b3c 60%, #8a5a1c); box-shadow: 0 12px 30px -6px rgba(232,170,70,.6); animation: luxFloat 5s ease-in-out infinite; }
.prompt-icon.ring .bi { display: inline-block; transform-origin: 50% 0; animation: bellRing 2.4s ease-in-out infinite; }
@keyframes bellRing { 0%, 55%, 100% { transform: rotate(0); } 60% { transform: rotate(16deg); } 70% { transform: rotate(-14deg); } 80% { transform: rotate(9deg); } 90% { transform: rotate(-5deg); } }
.prompt-hero h5 { font-weight: 700; margin: 0 0 .3rem; }
.prompt-hero p { color: rgba(255,255,255,.72); font-size: .86rem; margin: 0; }
.prompt-list { list-style: none; padding: 0; margin: 0; }
.prompt-list li { display: flex; gap: .7rem; align-items: flex-start; padding: .45rem 0; font-size: .86rem; color: var(--cs-ink-2); }
.prompt-list li .bi { color: var(--cs-primary); font-size: 1.05rem; }
.prompt-steps { background: var(--cs-primary-50); border-radius: 12px; padding: .75rem .9rem; font-size: .84rem; margin-top: .75rem; }

/* uploaded company logo (Settings > Company logo) */
.brand-mark-logo { background: #fff; padding: 4px; overflow: hidden; }
.brand-mark-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.lux-emblem.has-logo { background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(245,233,205,.92)); padding: 10px; }
.lux-emblem.has-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.logo-preview { width: 96px; height: 96px; border-radius: 18px; border: 1px solid var(--cs-line); background: #fff; display: grid; place-items: center; overflow: hidden; flex: 0 0 96px; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.logo-preview .bi { font-size: 2.2rem; color: var(--cs-warning); }
