/* ============================================================
   KhataBook — Modern Redesign
   Clean, professional design inspired by OKCredit / modern
   fintech apps. Green-primary palette, card-based layout,
   mobile-first.
   ============================================================ */

/* ─────────────────────────────────────── 1. CSS Variables ── */
:root {
    /* Primary palette — deep forest green */
    --clr-primary:       #1B5E3B;
    --clr-primary-dark:  #134430;
    --clr-primary-light: #E8F5EE;
    --clr-primary-mid:   #2E7D52;

    /* Accent */
    --clr-accent:        #00A86B;
    --clr-accent-light:  #D4F5E7;

    /* Semantic */
    --clr-debit:         #DC2626;  /* credit given — red */
    --clr-debit-bg:      #FEF2F2;
    --clr-debit-border:  #FCA5A5;
    --clr-credit:        #16A34A;  /* payment received — green */
    --clr-credit-bg:     #F0FDF4;
    --clr-credit-border: #86EFAC;

    /* Neutrals */
    --clr-bg:            #F5F7FA;
    --clr-bg-card:       #FFFFFF;
    --clr-border:        #E4E9F0;
    --clr-border-focus:  #1B5E3B;
    --clr-text:          #0F1F2E;
    --clr-text-muted:    #6B7A8D;
    --clr-text-light:    #A0AEBB;

    /* Alerts */
    --clr-success-bg:    #F0FDF4;
    --clr-success-text:  #15803D;
    --clr-success-border:#BBF7D0;
    --clr-error-bg:      #FFF1F2;
    --clr-error-text:    #BE123C;
    --clr-error-border:  #FECDD3;

    /* Layout */
    --sidebar-width:     240px;
    --topbar-height:     60px;
    --mobile-tabs-h:     64px;

    /* Tokens */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   20px;
    --radius-full: 999px;
    --shadow-sm:   0 1px 3px rgba(15, 31, 46, 0.08), 0 1px 2px rgba(15, 31, 46, 0.04);
    --shadow-md:   0 4px 12px rgba(15, 31, 46, 0.08), 0 2px 6px rgba(15, 31, 46, 0.06);
    --shadow-lg:   0 12px 32px rgba(15, 31, 46, 0.12), 0 4px 12px rgba(15, 31, 46, 0.08);
    --transition:  all 0.18s ease;

    /* Typography */
    --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Poppins', 'Inter', sans-serif;
}

/* ─────────────────────────────────────── 2. Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--clr-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--clr-primary-dark); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.3;
    color: var(--clr-text);
}

img { max-width: 100%; display: block; }

/* ─────────────────────────────────────── 3. Layout ── */
/* Sidebar layout (desktop) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--clr-primary);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrap {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 32px 28px 40px;
}

.content-inner {
    max-width: 1000px;
    margin: 0 auto;
}

/* ─────────────────────────────────────── 4. Sidebar ── */
.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 17px;
    color: rgba(255,255,255,0.92);
    font-weight: 500;
}

.logo-text strong {
    color: #fff;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.72);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 16px 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info { min-width: 0; }

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-biz {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.65);
    flex-shrink: 0;
    transition: var(--transition);
    text-decoration: none;
}

.btn-logout:hover { background: rgba(255,255,255,0.16); color: #fff; }
.btn-logout svg { width: 16px; height: 16px; }

/* ─────────────────────────────────────── 5. Topbar (mobile) ── */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--clr-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.menu-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.menu-toggle:hover { background: rgba(255,255,255,0.1); }
.menu-toggle svg { width: 20px; height: 20px; }

.topbar-logo {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.topbar-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
}

.topbar-action:hover { background: rgba(255,255,255,0.25); color: #fff; }
.topbar-action svg { width: 20px; height: 20px; }

/* ─────────────────────────────────────── 6. Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ─────────────────────────────────────── 7. Mobile bottom tabs ── */
.mobile-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-tabs-h);
    background: #fff;
    border-top: 1px solid var(--clr-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 80;
    box-shadow: 0 -4px 12px rgba(15, 31, 46, 0.06);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--clr-text-muted);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.tab svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tab.active { color: var(--clr-primary); }
.tab.active svg { stroke-width: 2.3; }

.tab-fab {
    width: 52px;
    height: 52px;
    background: var(--clr-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
    margin-top: -16px;
    box-shadow: 0 4px 14px rgba(27, 94, 59, 0.45);
}

.tab-fab svg { width: 24px; height: 24px; }

/* ─────────────────────────────────────── 8. Page structure ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.page-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--clr-accent);
    margin-bottom: 4px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--clr-text);
    margin: 0 0 2px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--clr-text-muted);
    margin: 0;
}

/* ─────────────────────────────────────── 9. Cards ── */
.card {
    background: var(--clr-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--clr-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--clr-border);
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--clr-text);
    margin: 0;
    font-family: var(--font-heading);
}

.card-subtitle {
    font-size: 13px;
    color: var(--clr-text-muted);
    margin: 2px 0 0;
}

.card-body { padding: 20px; }

/* ─────────────────────────────────────── 10. Stats grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
    background: var(--clr-bg-card);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card-primary {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-mid));
    border-color: transparent;
    color: #fff;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--clr-text-muted);
    margin-bottom: 8px;
}

.stat-card-primary .stat-label { color: rgba(255,255,255,0.72); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--clr-text);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card-primary .stat-value { color: #fff; }
.stat-value.stat-debit  { color: var(--clr-debit); }
.stat-value.stat-credit { color: var(--clr-credit); }

.stat-meta {
    font-size: 12px;
    color: var(--clr-text-muted);
}

.stat-card-primary .stat-meta { color: rgba(255,255,255,0.65); }

/* ─────────────────────────────────────── 11. Tables ── */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead tr {
    border-bottom: 2px solid var(--clr-border);
}

.data-table th {
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    white-space: nowrap;
    background: var(--clr-bg);
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--clr-border);
    color: var(--clr-text);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background 0.12s ease;
}

.data-table tbody tr:hover { background: #F9FAFB; }

.text-right { text-align: right !important; }
.text-muted { color: var(--clr-text-muted) !important; }

/* ─────────────────────────────────────── 12. Customer cell ── */
.customer-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--clr-primary-light);
    color: var(--clr-primary);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

.customer-name { font-weight: 600; color: var(--clr-text); }
.customer-meta { font-size: 12px; color: var(--clr-text-muted); }

/* ─────────────────────────────────────── 13. Amount badges ── */
.badge-amount {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.badge-debit { color: var(--clr-debit); }
.badge-credit { color: var(--clr-credit); }

.amount-debit {
    color: var(--clr-debit);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.amount-credit {
    color: var(--clr-credit);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.amount-label {
    font-size: 11px;
    color: var(--clr-text-muted);
    margin-top: 1px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-neutral { background: #F3F4F6; color: #6B7280; }
.badge-success { background: var(--clr-credit-bg); color: var(--clr-credit); }
.badge-danger  { background: var(--clr-debit-bg); color: var(--clr-debit); }
.badge-sms     { background: #EFF6FF; color: #1D4ED8; }
.badge-email   { background: #F5F3FF; color: #6D28D9; }

/* ─────────────────────────────────────── 14. Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
    font-family: var(--font-body);
}

.btn:focus-visible {
    outline: 3px solid var(--clr-accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--clr-primary);
    color: #fff;
    border-color: var(--clr-primary);
}

.btn-primary:hover {
    background: var(--clr-primary-dark);
    border-color: var(--clr-primary-dark);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--clr-primary);
    border-color: var(--clr-primary);
}

.btn-outline:hover {
    background: var(--clr-primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--clr-text-muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--clr-bg);
    color: var(--clr-text);
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { gap: 8px; }

.btn-link {
    background: none;
    border: none;
    color: var(--clr-primary);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-family: var(--font-body);
    transition: var(--transition);
}

.btn-link:hover { color: var(--clr-primary-dark); }

/* ─────────────────────────────────────── 15. Forms ── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 6px;
}

.form-label-sm {
    font-size: 12px;
    font-weight: 600;
    color: var(--clr-text-muted);
    display: block;
    margin-bottom: 5px;
}

.form-label-link {
    font-size: 12px;
    font-weight: 500;
    color: var(--clr-primary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--clr-text);
    background: #fff;
    transition: var(--transition);
    appearance: none;
    outline: none;
}

.form-control:focus {
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(27, 94, 59, 0.12);
}

.form-control::placeholder { color: var(--clr-text-light); }
.form-control:disabled { background: var(--clr-bg); cursor: not-allowed; }

.form-control.form-control-sm { padding: 7px 10px; font-size: 13px; }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7A8D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--clr-text-muted);
    margin-top: 5px;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.5;
}

.optional {
    font-size: 11px;
    font-weight: 400;
    color: var(--clr-text-muted);
}

.required { color: var(--clr-debit); }

/* Input with icon prefix */
.input-wrap { position: relative; }
.input-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--clr-text-muted);
    pointer-events: none;
}

.input-wrap .form-control { padding-left: 36px; }

.input-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 600;
    color: var(--clr-text-muted);
    pointer-events: none;
}

.input-with-prefix { padding-left: 28px; }

/* Checkbox */
.form-check-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-check {
    width: 18px;
    height: 18px;
    accent-color: var(--clr-primary);
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.form-check-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--clr-text);
    cursor: pointer;
}

/* ─────────────────────────────────────── 16. Search bar ── */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar .input-wrap { flex: 1; min-width: 200px; }

/* ─────────────────────────────────────── 17. Alerts ── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 14px;
    margin-bottom: 16px;
    position: relative;
}

.alert-success {
    background: var(--clr-success-bg);
    border-color: var(--clr-success-border);
    color: var(--clr-success-text);
}

.alert-error {
    background: var(--clr-error-bg);
    border-color: var(--clr-error-border);
    color: var(--clr-error-text);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
    padding: 0 2px;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.alert-close:hover { opacity: 1; }

.error-list { margin: 4px 0 0 14px; padding: 0; }
.error-list li { margin-bottom: 3px; }

/* ─────────────────────────────────────── 18. Modal ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 31, 46, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal.show { display: flex; }

.modal-dialog {
    background: var(--clr-bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--clr-border);
    flex-shrink: 0;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--clr-text);
    font-family: var(--font-heading);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--clr-bg);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-text-muted);
    transition: var(--transition);
    line-height: 1;
}

.modal-close:hover { background: var(--clr-border); color: var(--clr-text); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--clr-border);
    flex-shrink: 0;
    background: var(--clr-bg);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ─────────────────────────────────────── 19. Entry modal tabs ── */
.entry-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--clr-bg);
    border-radius: var(--radius-md);
}

.entry-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--clr-text-muted);
    transition: var(--transition);
}

.entry-tab-active {
    background: #fff;
    color: var(--clr-text);
    box-shadow: var(--shadow-sm);
}

.entry-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-debit  { background: var(--clr-debit); }
.dot-credit { background: var(--clr-credit); }

/* ─────────────────────────────────────── 20. Customer detail ── */
.cust-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.cust-header-left { display: flex; align-items: flex-start; gap: 16px; }

.cust-meta {
    font-size: 13px;
    color: var(--clr-text-muted);
    margin: 0;
}

.balance-chip {
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    text-align: right;
    flex-shrink: 0;
    min-width: 130px;
}

.chip-debit   { background: var(--clr-debit-bg); border: 1px solid var(--clr-debit-border); }
.chip-credit  { background: var(--clr-credit-bg); border: 1px solid var(--clr-credit-border); }
.chip-settled { background: var(--clr-bg); border: 1px solid var(--clr-border); }

.chip-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--clr-text-muted);
    margin-bottom: 4px;
}

.chip-debit  .chip-label { color: var(--clr-debit); }
.chip-credit .chip-label { color: var(--clr-credit); }

.chip-amount {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.chip-debit  .chip-amount { color: var(--clr-debit); }
.chip-credit .chip-amount { color: var(--clr-credit); }
.chip-settled .chip-amount { color: var(--clr-text-muted); }

/* Entry action buttons */
.entry-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-entry {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 700;
    border: 2px solid;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-body);
}

.btn-credit-entry {
    background: var(--clr-debit-bg);
    border-color: var(--clr-debit-border);
    color: var(--clr-debit);
}

.btn-credit-entry:hover {
    background: #FEE2E2;
    border-color: var(--clr-debit);
}

.btn-payment-entry {
    background: var(--clr-credit-bg);
    border-color: var(--clr-credit-border);
    color: var(--clr-credit);
}

.btn-payment-entry:hover {
    background: #DCFCE7;
    border-color: var(--clr-credit);
}

/* Inline delete form */
.inline-form { display: inline; }

.btn-delete-entry {
    background: none;
    border: 1px solid transparent;
    padding: 5px 7px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--clr-text-light);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.btn-delete-entry:hover {
    color: var(--clr-debit);
    background: var(--clr-debit-bg);
    border-color: var(--clr-debit-border);
}

/* ─────────────────────────────────────── 21. Breadcrumb ── */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 20px;
}

.breadcrumb-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--clr-text-muted);
    text-decoration: none;
}

.breadcrumb-link:hover { color: var(--clr-primary); }
.breadcrumb-sep { color: var(--clr-text-light); }

/* ─────────────────────────────────────── 22. Filter bar (reports) ── */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background: var(--clr-bg-card);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.filter-group { display: flex; flex-direction: column; }

.table-link {
    color: var(--clr-text);
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover { color: var(--clr-primary); text-decoration: underline; }

/* ─────────────────────────────────────── 23. Empty state ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 56px 24px;
    gap: 10px;
}

.empty-state-sm { padding: 28px 24px; }

.empty-icon {
    width: 56px;
    height: 56px;
    color: var(--clr-text-light);
    margin-bottom: 4px;
}

.empty-icon svg { width: 100%; height: 100%; }

.empty-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--clr-text);
    font-family: var(--font-heading);
}

.empty-desc {
    font-size: 14px;
    color: var(--clr-text-muted);
    max-width: 340px;
    line-height: 1.6;
}

/* ─────────────────────────────────────── 24. Settings page ── */
.settings-card { margin-bottom: 20px; }

.settings-form { }

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--clr-border);
}

.settings-test {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--clr-border);
}

.settings-test-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--clr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.test-form {
    display: flex;
    gap: 10px;
}

.test-form .form-control { flex: 1; }

/* ─────────────────────────────────────── 25. Auth pages ── */
.auth-main {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--clr-primary) 0%, #0D4228 50%, #0A2D1C 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    background: var(--clr-bg-card);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.3);
    animation: authIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-card-wide { max-width: 640px; }

@keyframes authIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-brand-icon {
    width: 42px;
    height: 42px;
    background: var(--clr-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.auth-brand-name {
    font-family: var(--font-heading);
    font-size: 20px;
    color: var(--clr-primary);
    font-weight: 500;
}

.auth-brand-name strong { font-weight: 800; color: var(--clr-primary-dark); }

.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--clr-text);
    margin-bottom: 6px;
    font-family: var(--font-heading);
}

.auth-subtitle {
    font-size: 14px;
    color: var(--clr-text-muted);
    margin-bottom: 28px;
    line-height: 1.5;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-footer-link {
    text-align: center;
    font-size: 14px;
    color: var(--clr-text-muted);
    margin-top: 20px;
    margin-bottom: 0;
}

/* ─────────────────────────────────────── 26. OTP boxes ── */
.otp-boxes {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.otp-box {
    width: 52px;
    height: 58px;
    border: 2px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: var(--clr-text);
    background: var(--clr-bg);
    transition: var(--transition);
    outline: none;
    font-variant-numeric: tabular-nums;
}

.otp-box:focus {
    border-color: var(--clr-primary);
    background: var(--clr-primary-light);
    box-shadow: 0 0 0 3px rgba(27, 94, 59, 0.15);
}

.otp-box:not(:placeholder-shown) {
    background: var(--clr-primary-light);
    border-color: var(--clr-primary);
}

.otp-resend-form { text-align: center; margin-top: 12px; }

/* ─────────────────────────────────────── 27. Responsive utilities ── */
.d-none        { display: none !important; }
.d-flex        { display: flex !important; }
.d-lg-none     { display: none; }
.d-lg-flex     { display: flex; }
.d-md-table-cell { display: table-cell; }

/* ─────────────────────────────────────── 28. Mobile breakpoints ── */
@media (max-width: 991px) {
    /* Switch to mobile layout */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        z-index: 110;
    }

    .main-wrap {
        margin-left: 0;
        padding-top: var(--topbar-height);
        padding-bottom: var(--mobile-tabs-h);
    }

    .main-content { padding: 20px 16px 24px; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid-3 { grid-template-columns: 1fr 1fr; }

    /* Show/hide */
    .d-lg-none { display: flex !important; }
    .d-lg-flex { display: none !important; }

    .entry-actions { grid-template-columns: 1fr 1fr; }
    .cust-header { flex-direction: column; }
    .balance-chip { align-self: flex-start; }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid-3 { grid-template-columns: 1fr; }

    .form-row { grid-template-columns: 1fr; }

    .auth-card { padding: 28px 20px; }

    .page-title { font-size: 22px; }

    .otp-box { width: 44px; height: 52px; font-size: 20px; }

    .entry-actions { grid-template-columns: 1fr; }

    .filter-bar { flex-direction: column; align-items: stretch; }

    .test-form { flex-direction: column; }

    .modal-dialog { border-radius: var(--radius-lg); }

    .d-md-table-cell { display: none !important; }

    .settings-actions { flex-direction: column; }
}

/* ─────────────────────────────────────── 29. Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ─────────────────────────────────────── 30. Focus ring ── */
:focus-visible {
    outline: 3px solid var(--clr-accent);
    outline-offset: 2px;
    border-radius: 4px;
}
