/* ============================================================
   OkLedger — assets/css/style.css
   ============================================================
   The only stylesheet the app uses. No Bootstrap / CDN
   framework — layout grid, buttons, forms, cards, tables,
   badges, alerts, modal, navbar and the mobile app chrome are
   all written here in plain CSS.

   Jump to a section by searching for its heading comment:
   1. COLORS
   2. BASE / TYPOGRAPHY
   3. LAYOUT GRID
   4. SPACING UTILITIES
   5. TEXT UTILITIES
   6. DISPLAY / FLEX UTILITIES
   7. BUTTONS
   8. FORMS
   9. CARDS
   10. TABLES
   11. BADGES
   12. ALERTS
   13. MODAL
   14. NAVBAR / TOP APP BAR
   15. APP COMPONENTS (avatars, stat grid, tab bar, lists...)
   16. DESIGN POLISH
   ============================================================ */


/* ============================================================
   1. COLORS
   ============================================================ */
:root {
    --color-primary:       #17915A;   /* OkLedger green — top bar mark, buttons, links */
    --color-primary-dark:  #0F6E43;
    --color-primary-soft:  #E4F7ED;   /* faint green wash — avatars, active states */

    --color-bg:            #F2F4F2;   /* app background */
    --color-card:          #FFFFFF;   /* card / panel background */
    --color-border:        #E7EAE7;   /* light border lines */

    --color-text:          #1C231F;   /* main text color */
    --color-text-muted:    #7B857E;   /* secondary / muted text */
    --color-text-on-dark:  #FFFFFF;

    --color-debit:         #E14640;   /* "You Gave" / customer owes you */
    --color-debit-bg:      #FCE9E8;
    --color-credit:        #17915A;   /* "You Got" / payment received */
    --color-credit-bg:     #E4F7ED;

    --color-blue:          #3E7BFA;
    --color-blue-bg:       #E7EEFF;

    --color-danger-border: #F3C6C3;
    --color-success-border:#B9E4CC;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 1px 2px rgba(20, 30, 24, 0.04), 0 6px 16px rgba(20, 30, 24, 0.06);
    --shadow-card-hover: 0 10px 24px rgba(20, 30, 24, 0.12);

    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-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);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    margin: 0 0 0.5rem;
    font-weight: 800;
    color: var(--color-text);
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }

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: none; }
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.85rem; }
.fw-semibold { font-weight: 600; }
.h3 { font-size: 1.45rem; }
.h4 { font-size: 1.2rem; }
.h6 { font-size: 0.98rem; }


/* ============================================================
   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: 700;
    font-size: 0.95rem;
    padding: 0.7rem 1.25rem;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, border-color .14s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: none !important; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; border-radius: 9px; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1.05rem; border-radius: 14px; }

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 110, 67, 0.25);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
    box-shadow: 0 8px 16px rgba(15, 110, 67, 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 16px rgba(15, 110, 67, 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(20,30,24,0.08);
}
.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(225,70,64,0.25); }
.btn-credit:hover { background-color: #C93A35; border-color: #C93A35; color: #fff; box-shadow: 0 8px 18px rgba(225,70,64,0.3); }
.btn-payment { background-color: var(--color-credit); border-color: var(--color-credit); color: #fff; box-shadow: 0 1px 2px rgba(23,145,90,0.25); }
.btn-payment:hover { background-color: var(--color-primary-dark); border-color: var(--color-primary-dark); color: #fff; box-shadow: 0 8px 18px rgba(23,145,90,0.3); }

.btn-block-full { width: 100%; padding-top: 0.9rem; padding-bottom: 0.9rem; border-radius: 14px; font-size: 1rem; }

.btn-close {
    width: 30px; height: 30px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.05); 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"; font-size: 1.3rem; }
.btn-close:hover { background: rgba(0,0,0,0.1); }


/* ============================================================
   8. FORMS
   ============================================================ */
label, .form-label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    display: block;
    width: 100%;
    padding: 0.75rem 0.9rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text);
    background-color: var(--color-card);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control::placeholder { color: #A8B0AA; }
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(23, 145, 90, 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;
}
.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.9rem;
    background-color: var(--color-card); border: 1.5px solid var(--color-border); border-right: none;
    color: var(--color-text-muted); font-size: 1rem;
}
.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: 1.5px 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: var(--radius-lg);
    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: var(--radius-lg) var(--radius-lg) 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(-3px); 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); }


/* ============================================================
   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-border);
    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: var(--color-blue-bg); color: #2851B8; }
.badge-channel-email { background-color: #F1E7F7; color: #6A3B8C; }
.badge-status-sent   { background-color: var(--color-credit-bg); color: #0F6E43; }
.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: #0F6E43; border-color: var(--color-success-border); }
.alert-danger  { background-color: var(--color-debit-bg); color: var(--color-debit); border-color: var(--color-danger-border); }
.alert-warning { background-color: #FDF3DA; color: #8A6416; border-color: #F1DFA7; }


/* ============================================================
   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(20, 30, 24, 0.5);
}
.modal.show { display: flex; }
.modal-dialog { width: 100%; max-width: 420px; }
.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: center; position: relative;
    padding: 1.25rem 1.25rem 0.5rem;
    border-bottom: none;
}
.modal-title { margin: 0; font-size: 1.15rem; font-weight: 800; text-align: center; }
.modal-header .btn-close { position: absolute; top: 1rem; right: 1rem; }
.modal-body { padding: 0.5rem 1.4rem 1.4rem; }
.modal-footer {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    padding: 0 1.4rem 1.4rem; border-top: none;
}
.modal-footer .btn { width: 100%; }
.modal-footer .btn-cancel-link {
    background: none; border: none; color: var(--color-text-muted);
    font-weight: 600; padding: 0.4rem; cursor: pointer; box-shadow: none; text-decoration: none;
}
.modal-footer .btn-cancel-link:hover { color: var(--color-text); transform: none; }
body.modal-open { overflow: hidden; }


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

:root { --navbar-height: 60px; }
.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 {
    position: sticky;
    top: var(--navbar-height);
    z-index: 1010;
    background-color: rgba(242, 244, 242, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.app-navbar {
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 0 rgba(20,30,24,0.02);
}
.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 { color: rgba(255,255,255,0.78); }
.admin-navbar .nav-link.active, .admin-navbar .nav-link:hover { color: #fff; border-bottom-color: #7FA8C9; }
.admin-navbar .brand-mark { background-color: #7FA8C9; color: #1F2A3A; }
.admin-navbar .brand-name, .admin-navbar .navbar-biz-name { color: #fff; }
.admin-navbar .brand-accent { color: #7FA8C9 !important; }

.navbar-brand {
    display: flex; align-items: center; gap: 0.55rem;
    font-size: 1.1rem; text-decoration: none;
    color: var(--color-text) !important;
    font-weight: 800;
}
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    background-color: var(--color-primary);
    color: #fff;
    font-weight: 700;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { color: var(--color-text); }
.brand-accent { color: var(--color-primary) !important; }

.navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 0.4rem;
    cursor: pointer;
    color: var(--color-text);
}
.navbar-toggler-icon {
    display: block; width: 20px; height: 2px; background: var(--color-text); position: relative;
}
.navbar-toggler-icon::before, .navbar-toggler-icon::after {
    content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--color-text);
}
.navbar-toggler-icon::before { top: -6px; }
.navbar-toggler-icon::after { top: 6px; }
.admin-navbar .navbar-toggler, .admin-navbar .navbar-toggler-icon,
.admin-navbar .navbar-toggler-icon::before, .admin-navbar .navbar-toggler-icon::after { color: #fff; background: #fff; }
.admin-navbar .navbar-toggler { background: transparent; }

.navbar-collapse {
    display: none;
    flex-basis: 100%;
    width: 100%;
}
.navbar-collapse.show {
    display: block;
    position: absolute;
    top: var(--navbar-height);
    left: 0; right: 0;
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-card-hover);
    padding: 0.5rem 1rem 1rem;
}
.admin-navbar .navbar-collapse.show { background: #263447; }

.navbar-nav {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.nav-item { display: block; }
.nav-link {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 0.5rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 600;
    border-radius: 10px;
}
.nav-link:hover { background: var(--color-primary-soft); color: var(--color-primary); }
.nav-link.active { background: var(--color-primary-soft); color: var(--color-primary); }
.navbar-biz-name { color: var(--color-text-muted); }

@media (min-width: 992px) {
    .navbar-nav { flex-direction: column; }
}


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

.cust-avatar {
    width: 42px; height: 42px; border-radius: 12px;
    background-color: var(--color-primary-soft); color: var(--color-primary-dark);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem; flex-shrink: 0;
}
.cust-avatar.lg { width: 64px; height: 64px; font-size: 1.6rem; border-radius: 16px; }

.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; background: var(--color-bg); }
.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: 5px;
    background: var(--color-primary);
}
.ledger-stamp {
    display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 800; color: var(--color-text);
    margin-bottom: 14px; font-size: 1.2rem;
}
.ledger-stamp::before {
    content: "";
    width: 30px; height: 30px; border-radius: 9px;
    background-color: var(--color-primary);
    display: inline-block;
}
.ledger-stamp span { color: var(--color-primary); }

.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: 1.5px 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(23, 145, 90, 0.16);
}

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

/* ---- Mobile bottom tab bar (Dashboard / Customers / Settings) ---- */
.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: 8px 4px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 14px rgba(20, 30, 24, 0.06);
}
.tab-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 0.72rem; color: var(--color-text-muted); text-decoration: none;
    padding: 4px 6px; flex: 1; font-weight: 600;
}
.tab-item .icon { margin: 0; }
.tab-item .icon svg { width: 22px; height: 22px; stroke: currentColor; }
.tab-item.active { color: var(--color-primary); }

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

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

/* ---- Stat grid (dashboard) ---- */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.15rem 1.15rem 1.3rem;
    position: relative;
}
.stat-card-label { color: var(--color-text-muted); font-size: 0.85rem; font-weight: 600; margin-bottom: 1.6rem; display: block; max-width: 75%; }
.stat-card-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.01em; }
.stat-card-icon {
    position: absolute; top: 1.1rem; right: 1.1rem;
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.stat-card-icon svg { width: 18px; height: 18px; }
.icon-soft-red   { background: var(--color-debit-bg);  color: var(--color-debit); }
.icon-soft-green { background: var(--color-credit-bg); color: var(--color-credit); }
.icon-soft-blue  { background: var(--color-blue-bg);   color: var(--color-blue); }

/* ---- Generic list-card (customers, transactions) ---- */
.list-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.75rem;
}
.list-card:last-child { margin-bottom: 0; }
.list-card:hover { box-shadow: var(--shadow-card-hover); color: inherit; }
.list-card-body { flex: 1; min-width: 0; }
.list-card-title { font-weight: 700; color: var(--color-text); }
.list-card-sub { color: var(--color-text-muted); font-size: 0.85rem; display: flex; align-items: center; gap: 0.3rem; }
.list-card-sub svg { width: 14px; height: 14px; }
.list-card-end { text-align: right; flex-shrink: 0; }
.list-card-chevron { color: var(--color-text-muted); flex-shrink: 0; }

.status-pill { font-weight: 700; font-size: 0.9rem; }
.status-settled { color: var(--color-text-muted); }

/* ---- Transaction history item ---- */
.txn-item {
    display: flex; align-items: center; gap: 0.85rem;
    background: var(--color-card); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 0.85rem 1.1rem; margin-bottom: 0.7rem;
    box-shadow: var(--shadow-card);
}
.txn-item:last-child { margin-bottom: 0; }
.txn-icon {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.txn-icon svg { width: 18px; height: 18px; }
.txn-icon.credit  { background: var(--color-debit-bg);  color: var(--color-debit); }
.txn-icon.payment { background: var(--color-credit-bg); color: var(--color-credit); }
.txn-body { flex: 1; min-width: 0; }
.txn-label { font-weight: 700; color: var(--color-text); }
.txn-date { color: var(--color-text-muted); font-size: 0.82rem; }
.txn-amount { font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.txn-amount.credit  { color: var(--color-debit); }
.txn-amount.payment { color: var(--color-credit); }
.txn-delete { margin-left: 0.6rem; }

/* ---- Add-Transaction type toggle ---- */
.txn-type-toggle { display: flex; gap: 0.75rem; margin-bottom: 1.1rem; }
.txn-type-btn {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
    padding: 0.9rem 0.5rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card);
    color: var(--color-text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: all .14s ease;
}
.txn-type-btn svg { width: 18px; height: 18px; }
.txn-type-btn.active.type-credit  { border-color: var(--color-debit);  background: var(--color-debit-bg);  color: var(--color-debit); }
.txn-type-btn.active.type-payment { border-color: var(--color-credit); background: var(--color-credit-bg); color: var(--color-credit); }

/* ---- Empty states ---- */
.empty-state { text-align: center; padding: 2.75rem 1.5rem; }
.empty-icon { color: var(--color-text-muted); opacity: 0.45; margin-bottom: 0.85rem; display: flex; align-items: center; justify-content: center; }
.empty-icon-circle {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--color-bg); display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem; color: var(--color-text-muted);
}
.empty-icon svg { width: 44px; height: 44px; }
.empty-icon-circle svg { width: 26px; height: 26px; }

/* 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-primary);
    outline-offset: 2px;
}


/* ---- Legacy hero band (still used by the admin dashboard) ---- */
.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 {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3rem);
    color: #fff;
    line-height: 1.1;
}
.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; }


/* ============================================================
   16. DESIGN POLISH
   ============================================================ */
.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.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}
.eyebrow-on-dark { color: rgba(255, 255, 255, 0.75); }

/* Gentle entrance for cards and the modal — respects reduced-motion */
@media (prefers-reduced-motion: no-preference) {
    .card, .auth-card, .stat-card, .list-card, .txn-item { animation: appFadeIn 0.3s 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; }

    .ledger-table tbody tr {
        animation: appFadeIn 0.28s 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; }

    .alert { animation: appSlideDown 0.25s ease both; }
}
@keyframes appFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes appSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
