/* ============================================================
   KhataLedger — assets/css/style.css
   ============================================================
   This is the ONLY stylesheet the app uses. There is no
   Bootstrap and no other CSS framework loaded from a CDN —
   everything (layout grid, buttons, forms, cards, tables,
   badges, alerts, modal, navbar) is written here in plain CSS.
   That also means colors can never "fail to load" from an
   external library — they are always right here.

   Jump to a section by searching for its heading comment:
   1. COLORS (edit these to change the whole app's look)
   2. BASE / TYPOGRAPHY
   3. LAYOUT GRID (container, row, col-*)
   4. SPACING UTILITIES (margin / padding / gap)
   5. TEXT UTILITIES
   6. DISPLAY / FLEX UTILITIES
   7. BUTTONS
   8. FORMS
   9. CARDS
   10. TABLES
   11. BADGES
   12. ALERTS
   13. MODAL
   14. NAVBAR
   15. LEDGER APP COMPONENTS (avatars, chips, OTP boxes, mobile tab bar...)
   ============================================================ */


/* ============================================================
   1. COLORS
   ============================================================ */
:root {
    --color-primary:       #1B4B3F;   /* deep ledger-ink green — navbar, buttons, links */
    --color-primary-dark:  #103029;   /* darkest green — navbar gradient end, hover */
    --color-primary-soft:  #E7F0EC;   /* faint green wash — hover rows, active nav */
    --color-accent:        #B8863B;   /* antique brass/gold — logo mark, highlights */
    --color-accent-dark:   #8C6528;

    --color-bg:            #F3EFE2;   /* page background (ledger paper) */
    --color-bg-rule:       #E3DBC4;   /* faint ruled-paper lines */
    --color-card:          #FFFDF9;   /* card / panel background */
    --color-border:        #E4DCC6;   /* light border lines */

    --color-text:          #22302A;   /* main text color */
    --color-text-muted:    #66766E;   /* secondary / muted text */
    --color-text-on-dark:  #FFFFFF;   /* text on dark backgrounds (navbar) */

    --color-debit:         #A13D2E;   /* red ink  = "You Gave" / customer owes you */
    --color-debit-bg:      #F7E5E1;
    --color-credit:        #2F7A52;   /* green ink = "You Got" / payment received */
    --color-credit-bg:     #E2F0E7;

    --color-danger-border: #E7B7AC;
    --color-success-border:#A9D2BB;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-card: 0 1px 2px rgba(16, 48, 41, 0.06), 0 8px 20px rgba(16, 48, 41, 0.07);
    --shadow-card-hover: 0 10px 26px rgba(16, 48, 41, 0.14);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}


/* ============================================================
   2. BASE / TYPOGRAPHY
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--color-bg);
    background-image: linear-gradient(var(--color-bg-rule) 1px, transparent 1px);
    background-size: 100% 40px;
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .navbar-brand, .ledger-stamp {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
    font-weight: 700;
    color: var(--color-text);
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }

p { margin: 0 0 1rem; }

.mono, td.num, .summary-value, .chip-amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

a { color: var(--color-primary); text-decoration: underline; }
a:hover { color: var(--color-primary-dark); }


/* ============================================================
   3. LAYOUT GRID
   ============================================================ */
.container-fluid {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.row.g-2 { gap: 0.5rem; }
.row.g-3 { gap: 1rem; }
.row.g-4 { gap: 1.5rem; }
.row.row-cols-auto > * { flex: 0 0 auto; width: auto; }

.col        { flex: 1 1 0; min-width: 0; }
.col-12     { flex: 0 0 auto; width: 100%; }

@media (min-width: 576px) {
    .col-sm-4 { flex: 0 0 auto; width: calc(33.3333% - 0.67rem); }
    .col-sm-6 { flex: 0 0 auto; width: calc(50% - 0.5rem); }
    .col-sm-8 { flex: 0 0 auto; width: calc(66.6667% - 0.33rem); }
}
@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 auto; width: calc(16.6667% - 0.875rem); }
    .col-md-4 { flex: 0 0 auto; width: calc(33.3333% - 0.67rem); }
    .col-md-5 { flex: 0 0 auto; width: calc(41.6667% - 0.6rem); }
    .col-md-6 { flex: 0 0 auto; width: calc(50% - 0.5rem); }
}
@media (min-width: 992px) {
    .col-lg-6 { flex: 0 0 auto; width: calc(50% - 0.5rem); }
}

.h-100 { height: 100%; }
.w-100 { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.border-top { border-top: 1px solid var(--color-border); }


/* ============================================================
   4. SPACING UTILITIES
   ============================================================ */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.me-1 { margin-right: 0.25rem; }
.me-auto { margin-right: auto; }

.p-4 { padding: 1.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-3 { padding-top: 1rem; }

@media (min-width: 768px) {
    .p-md-5 { padding: 3rem; }
}
@media (min-width: 992px) {
    .mb-lg-0 { margin-bottom: 0; }
    .px-lg-4 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .pb-lg-4 { padding-bottom: 1.5rem; }
    .gap-lg-1 { gap: 0.25rem; }
}


/* ============================================================
   5. TEXT UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-debit); }
.text-nowrap { white-space: nowrap; }
.text-decoration-none { text-decoration: none; }
.small { font-size: 0.875rem; }
.fw-semibold { font-weight: 600; }
.h3 { font-size: 1.7rem; }
.h4 { font-size: 1.4rem; }
.h6 { font-size: 1rem; }


/* ============================================================
   6. DISPLAY / FLEX UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-block { display: block; }
.d-none { display: none; }
.vstack { display: flex; flex-direction: column; gap: 0.75rem; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.align-self-start { align-self: flex-start; }

@media (min-width: 768px) {
    .d-md-table-cell { display: table-cell; }
}
@media (min-width: 992px) {
    .d-lg-none { display: none; }
    .d-lg-block { display: block; }
    .d-lg-inline { display: inline; }
    .d-lg-inline-flex { display: inline-flex; }
    .d-lg-table-cell { display: table-cell; }
}
@media (max-width: 991.98px) {
    .d-lg-none.active-mobile { display: block; }
}


/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); box-shadow: none !important; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; border-radius: 8px; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(16, 48, 41, 0.2);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
    box-shadow: 0 8px 18px rgba(16, 48, 41, 0.28);
}
.btn-outline-primary {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(16, 48, 41, 0.2);
}
.btn-outline-secondary {
    background: transparent;
    color: var(--color-text-muted);
    border-color: var(--color-border);
}
.btn-outline-secondary:hover {
    background-color: var(--color-bg);
    color: var(--color-text);
    box-shadow: 0 4px 10px rgba(34,48,42,0.1);
}
.btn-outline-light {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.55);
}
.btn-outline-light:hover {
    background-color: rgba(255,255,255,0.15);
    color: #fff;
    box-shadow: none;
}
.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    text-decoration: underline;
    padding: 0.35rem 0.5rem;
    box-shadow: none;
}
.btn-link:hover { color: var(--color-primary-dark); transform: none; }

.btn-credit { background-color: var(--color-debit); border-color: var(--color-debit); color: #fff; box-shadow: 0 1px 2px rgba(161,61,46,0.25); }
.btn-credit:hover { background-color: #872F23; border-color: #872F23; color: #fff; box-shadow: 0 8px 18px rgba(161,61,46,0.3); }
.btn-payment { background-color: var(--color-credit); border-color: var(--color-credit); color: #fff; box-shadow: 0 1px 2px rgba(47,122,82,0.25); }
.btn-payment:hover { background-color: #245F41; border-color: #245F41; color: #fff; box-shadow: 0 8px 18px rgba(47,122,82,0.3); }

.btn-close {
    width: 28px; height: 28px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.06); color: var(--color-text-muted);
    font-size: 1rem; line-height: 1; cursor: pointer; box-shadow: none;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
}
.btn-close::before { content: "\00d7"; }
.btn-close:hover { background: rgba(0,0,0,0.12); }


/* ============================================================
   8. FORMS
   ============================================================ */
label, .form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    display: block;
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text);
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(27, 75, 63, 0.15);
}
.form-text { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.35rem; }

.form-check { display: flex; align-items: center; gap: 0.6rem; }
.form-check-label { margin: 0; font-weight: 600; color: var(--color-text); font-size: 0.95rem; }
.form-check-input {
    width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer;
}
/* Toggle-switch style checkbox (used for "Enable SMS/Email sending") */
.form-switch .form-check-input {
    appearance: none; -webkit-appearance: none;
    width: 42px; height: 24px; border-radius: 999px;
    background-color: var(--color-border);
    position: relative; cursor: pointer; outline: none;
    transition: background-color .15s ease;
}
.form-switch .form-check-input::before {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    transition: left .15s ease;
}
.form-switch .form-check-input:checked {
    background-color: var(--color-primary);
}
.form-switch .form-check-input:checked::before {
    left: 20px;
}

.input-group { display: flex; align-items: stretch; }
.input-group .form-control { border-radius: 0; border-right: none; }
.input-group-text {
    display: flex; align-items: center; padding: 0 0.8rem;
    background-color: var(--color-bg); border: 1px solid var(--color-border);
    color: var(--color-text-muted); font-size: 0.95rem;
}
.input-group > :first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.input-group > :last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); border-right: 1px solid var(--color-border); }
.input-group > .btn { border-radius: 0; border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }


/* ============================================================
   9. CARDS
   ============================================================ */
.card {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card.shadow-sm { box-shadow: var(--shadow-card); }
.card.border-0 { border: none; }
.card-body { padding: 1.25rem; }
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    border-radius: 16px 16px 0 0;
}
.card-header.bg-transparent { background: transparent; }
.card.hoverable { transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease; }
.card.hoverable:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }

.bg-white { background-color: var(--color-card); }
.rounded-pill { border-radius: 999px !important; }

.summary-card .summary-label { font-size: 0.78rem; letter-spacing: 0.02em; color: var(--color-text-muted); text-transform: uppercase; }
.summary-card .summary-value { font-size: 1.6rem; font-weight: 700; color: var(--color-text); }
.summary-card.summary-collect { border-left: 4px solid var(--color-accent); }


/* ============================================================
   10. TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.85rem 1.25rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table.align-middle td, .table.align-middle th { vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }

.ledger-table thead th {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-primary);
    font-weight: 700;
}
.ledger-table tbody tr:hover { background-color: var(--color-primary-soft); }

.ink-red   { color: var(--color-debit) !important; }
.ink-green { color: var(--color-credit) !important; }


/* ============================================================
   11. BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.3em 0.7em;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 6px;
}
.badge-channel-sms   { background-color: #E4EEF7; color: #2B5F8A; }
.badge-channel-email { background-color: #F1E7F7; color: #6A3B8C; }
.badge-status-sent   { background-color: var(--color-credit-bg); color: #1E5A3C; }
.badge-status-failed { background-color: var(--color-debit-bg); color: var(--color-debit); }


/* ============================================================
   12. ALERTS
   ============================================================ */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    margin-bottom: 1rem;
}
.alert-dismissible { padding-right: 2.75rem; position: relative; }
.alert-dismissible .btn-close { position: absolute; top: 0.6rem; right: 0.6rem; }
.alert-success { background-color: var(--color-credit-bg); color: #1E5A3C; border-color: var(--color-success-border); }
.alert-danger  { background-color: var(--color-debit-bg); color: var(--color-debit); border-color: var(--color-danger-border); }


/* ============================================================
   13. MODAL (pure CSS/JS, no framework)
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(16, 48, 41, 0.55);
}
.modal.show { display: flex; }
.modal-dialog { width: 100%; max-width: 520px; }
.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 2rem); }
.modal-content {
    width: 100%;
    background-color: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card-hover);
    overflow: hidden;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.modal-title { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 1.25rem; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 0.6rem;
    padding: 1rem 1.25rem; border-top: 1px solid var(--color-border);
}
body.modal-open { overflow: hidden; }


/* ============================================================
   14. NAVBAR
   ============================================================ */
.navbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.7rem 1rem;
}
.sticky-top { position: sticky; top: 0; z-index: 1020; }

/* Fixed header: pinned to the top of the viewport at all times (not just
   "sticky" within its container). The body gets top padding so content
   never slides underneath it. */
:root { --navbar-height: 68px; }
.app-navbar-fixed {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    z-index: 1040;
}
body.has-fixed-nav { padding-top: var(--navbar-height); }

/* Page toolbar: a fixed "options" strip (title + primary action) that
   sticks just under the navbar while the page content scrolls beneath it. */
.page-toolbar {
    position: sticky;
    top: var(--navbar-height);
    z-index: 1010;
    background-color: rgba(243, 239, 226, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--color-border);
}

.app-navbar {
    background: linear-gradient(120deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    box-shadow: 0 2px 0 var(--color-accent), 0 6px 18px rgba(16, 48, 41, 0.25);
}
.admin-navbar {
    background: linear-gradient(120deg, #1F2A3A 0%, #34495E 100%);
    box-shadow: 0 2px 0 #7FA8C9, 0 6px 18px rgba(31, 42, 58, 0.3);
}
.admin-navbar .nav-link.active { border-bottom-color: #7FA8C9; }
.admin-navbar .brand-mark { background-color: #7FA8C9; color: #1F2A3A; }
.admin-navbar .brand-accent { color: #7FA8C9 !important; }
.navbar-brand {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 1.2rem; text-decoration: none;
    color: var(--color-text-on-dark) !important;
}
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background-color: var(--color-accent);
    color: var(--color-primary-dark);
    font-family: var(--font-mono); font-weight: 700;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35);
}
.brand-accent { color: var(--color-accent) !important; }

.navbar-toggler {
    display: inline-flex;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    margin-left: auto;
}
.navbar-toggler-icon {
    display: block; width: 20px; height: 2px; background: #fff; position: relative;
}
.navbar-toggler-icon::before, .navbar-toggler-icon::after {
    content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: #fff;
}
.navbar-toggler-icon::before { top: -6px; }
.navbar-toggler-icon::after { top: 6px; }

.navbar-collapse {
    display: none;
    flex-basis: 100%;
    width: 100%;
}
.navbar-collapse.show { display: block; }

.navbar-nav {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.nav-item { display: block; }
.nav-link {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 0.4rem;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-weight: 500;
    position: relative;
}
.nav-link::after {
    content: "";
    position: absolute; left: 0.4rem; right: 0.4rem; bottom: 0;
    height: 2px; background: var(--color-accent);
    transform: scaleX(0); transform-origin: left;
    transition: transform .2s ease;
}
.admin-navbar .nav-link::after { background: #7FA8C9; }
.nav-link:hover, .nav-link.active { color: #fff; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }
.navbar-biz-name { color: rgba(255, 255, 255, 0.78); }

@media (min-width: 992px) {
    .navbar-toggler { display: none; }
    .navbar-collapse {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: auto;
        flex-basis: auto;
    }
    .navbar-nav {
        flex-direction: row;
        margin: 0;
        gap: 0.9rem;
    }
    .nav-link { padding: 0.4rem 0.1rem; }
}


/* ============================================================
   15. LEDGER APP COMPONENTS
   ============================================================ */
.icon { display: inline-block; margin-right: 0.3rem; }

.cust-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background-color: var(--color-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; flex-shrink: 0;
}
.cust-avatar.lg { width: 58px; height: 58px; font-size: 1.4rem; }

.balance-chip { border-radius: var(--radius-sm); padding: 10px 18px; text-align: right; }
.balance-chip .chip-label  { display: block; font-size: 0.75rem; }
.balance-chip .chip-amount { display: block; font-size: 1.3rem; font-weight: 700; }
.chip-red     { background-color: var(--color-debit-bg);  color: var(--color-debit); }
.chip-green   { background-color: var(--color-credit-bg); color: var(--color-credit); }
.chip-neutral { background-color: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
    width: 100%; max-width: 440px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card-hover);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 6px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}
.ledger-stamp {
    display: inline-block; font-weight: 700; color: var(--color-primary);
    border: 2px solid var(--color-accent); border-radius: var(--radius-sm); padding: 4px 12px;
    transform: rotate(-3deg); margin-bottom: 14px; font-size: 0.95rem;
}
.ledger-stamp span { color: var(--color-accent); }

.otp-boxes { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.otp-box {
    width: 46px; height: 56px; text-align: center; font-family: var(--font-mono);
    font-size: 1.5rem; font-weight: 600; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    background-color: var(--color-card); color: var(--color-text);
}
.otp-box:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(27, 75, 63, 0.18);
}

.entry-credit  { border-left: 4px solid var(--color-debit); }
.entry-payment { border-left: 4px solid var(--color-credit); }

.mobile-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
    display: flex; align-items: center; justify-content: space-around;
    background-color: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 14px rgba(34, 48, 42, 0.08);
}
.tab-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 0.68rem; color: var(--color-text-muted); text-decoration: none;
    padding: 4px 6px; flex: 1;
}
.tab-item .icon { margin: 0; font-size: 1.2rem; }
.tab-item.active { color: var(--color-primary); font-weight: 600; }
.tab-item-fab { flex: 0 0 auto; margin-top: -22px; }
.tab-item-fab .fab {
    width: 48px; height: 48px; border-radius: 50%;
    background-color: var(--color-accent); color: var(--color-primary-dark);
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700;
    box-shadow: 0 4px 10px rgba(184, 134, 59, 0.5);
}

.app-content { min-height: 60vh; }
.app-footer { border-top: 1px solid var(--color-border); }

@media (max-width: 991.98px) {
    body { padding-bottom: 0; }
}


/* ============================================================
   16. DESIGN POLISH
   ============================================================ */

/* Eyebrow — small label-above-heading, like a ledger page's running head */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-accent-dark);
    margin-bottom: 0.5rem;
}
.eyebrow::before {
    content: "";
    width: 14px; height: 2px;
    background: var(--color-accent);
    display: inline-block;
}
.eyebrow-on-dark { color: rgba(255, 255, 255, 0.75); }
.eyebrow-on-dark::before { background: var(--color-accent); }

/* Ledger hero band — the day's closing balance, styled like the ruled
   "total" line at the bottom of a real account book: one bold number,
   double-underlined in brass, with the smaller running figures beside it. */
.ledger-hero {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    border-radius: var(--radius-lg);
    color: #fff;
    padding: 1.75rem 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card-hover);
}
.ledger-hero-main { flex: 1 1 260px; }
.ledger-hero-amount {
    position: relative;
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3rem);
    padding-bottom: 16px;
    color: #fff;
    line-height: 1.1;
}
.ledger-hero-amount::before, .ledger-hero-amount::after {
    content: "";
    position: absolute; left: 0; right: 0; height: 2px;
    background: var(--color-accent);
}
.ledger-hero-amount::before { bottom: 7px; }
.ledger-hero-amount::after { bottom: 0; opacity: 0.55; }
.ledger-hero-note { display: block; margin-top: 0.6rem; color: rgba(255,255,255,0.7); font-size: 0.88rem; }

.ledger-hero-side {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
    border-left: 1px solid rgba(255,255,255,0.18);
    padding-left: 1.75rem;
}
@media (max-width: 767.98px) {
    .ledger-hero-side { border-left: none; padding-left: 0; border-top: 1px solid rgba(255,255,255,0.18); padding-top: 1.25rem; width: 100%; }
}
.hero-mini-stat { display: flex; flex-direction: column; gap: 0.2rem; }
.hero-mini-label { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.6); }
.hero-mini-value { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 600; color: #fff; }
.hero-mini-value.ink-red   { color: #F0A092 !important; }
.hero-mini-value.ink-green { color: #8FD6AF !important; }

/* Empty states — a small line-art mark instead of bare text */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-icon { color: var(--color-text-muted); opacity: 0.55; margin-bottom: 0.75rem; }
.empty-icon svg { width: 46px; height: 46px; }

/* Visible keyboard focus everywhere (accessibility) */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-control:focus-visible, .form-select:focus-visible,
.nav-link:focus-visible, .tab-item:focus-visible, .otp-box:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Gentle entrance for cards and the modal — respects reduced-motion */
@media (prefers-reduced-motion: no-preference) {
    .card, .ledger-hero, .auth-card { animation: ledgerFadeIn 0.35s ease both; }
    .modal-content { transition: transform 0.18s ease, opacity 0.18s ease; transform: scale(0.97); opacity: 0; }
    .modal.show .modal-content { transform: scale(1); opacity: 1; }

    /* Table rows sweep in one after another instead of popping in together */
    .ledger-table tbody tr {
        animation: ledgerFadeIn 0.3s ease both;
    }
    .ledger-table tbody tr:nth-child(1) { animation-delay: .02s; }
    .ledger-table tbody tr:nth-child(2) { animation-delay: .05s; }
    .ledger-table tbody tr:nth-child(3) { animation-delay: .08s; }
    .ledger-table tbody tr:nth-child(4) { animation-delay: .11s; }
    .ledger-table tbody tr:nth-child(5) { animation-delay: .14s; }
    .ledger-table tbody tr:nth-child(n+6) { animation-delay: .16s; }

    /* Alerts slide down from the toolbar instead of just appearing */
    .alert { animation: ledgerSlideDown 0.25s ease both; }

    /* A soft, slow pulse on the mobile "+" button so it reads as the
       primary action without being distracting */
    .tab-item-fab .fab { animation: fabPulse 2.6s ease-in-out infinite; }
}
@keyframes ledgerFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ledgerSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fabPulse {
    0%, 100% { box-shadow: 0 4px 10px rgba(184, 134, 59, 0.5); }
    50%      { box-shadow: 0 4px 10px rgba(184, 134, 59, 0.5), 0 0 0 8px rgba(184, 134, 59, 0.12); }
}
