:root {
    --navy: #0f2942;
    --navy-dark: #091b2d;
    --teal: #114b5f;
    --accent: #ea580c;
    --accent-hover: #c2410c;
    --accent-soft: #fff7ed;
    --blue: #1d4ed8;
    --green: #059669;
    --green-soft: #ecfdf5;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 2px 10px rgba(15, 41, 66, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 41, 66, 0.14);
    --sidebar-w: 248px;
    --bottom-nav-h: 66px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100%;
}

.hidden {
    display: none !important;
}

.num {
    font-variant-numeric: tabular-nums;
}

/* ==================== LOGIN ==================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(145deg, var(--navy-dark) 0%, var(--navy) 55%, var(--teal) 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.login-brand h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
}

.login-brand p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.login-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.login-hint code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--navy);
    font-weight: 700;
}

/* ==================== LAYOUT SHELL ==================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    padding: 4px;
}

.brand-text strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
}

.brand-text span {
    display: block;
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    border-radius: 11px;
    background: transparent;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.16s ease;
}

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

.nav-item.active {
    background: linear-gradient(90deg, var(--accent) 0%, #f97316 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}

.nav-icon {
    font-size: 17px;
    width: 22px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.09);
    margin: 8px 6px;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-ghost-sm {
    width: 100%;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-ghost-sm:hover {
    background: rgba(255, 255, 255, 0.1);
}

.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.topbar-logo-mobile {
    display: none;
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.topbar h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--navy);
}

.topbar-sub {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-only {
    display: none;
}

.view-container {
    padding: 20px 22px 40px;
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
}

/* ==================== BOTTOM NAV (MOBILE) ==================== */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 41, 66, 0.07);
    z-index: 40;
    grid-template-columns: repeat(5, 1fr);
}

.bnav-item {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    padding: 6px 2px;
}

.bnav-icon {
    font-size: 19px;
    line-height: 1;
}

.bnav-item.active {
    color: var(--accent);
    font-weight: 800;
}

/* ==================== CARDS & STATS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

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

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: -0.3px;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 4px;
}

.stat-card.income .stat-value {
    color: var(--green);
}

.stat-card.expense .stat-value {
    color: var(--red);
}

.stat-card.profit .stat-value {
    color: var(--navy);
}

.stat-card.unpaid .stat-value {
    color: var(--amber);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.quick-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, border-color 0.15s ease;
    text-align: left;
}

.quick-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.quick-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.qb-orange {
    background: #ffedd5;
}

.qb-blue {
    background: #dbeafe;
}

.qb-green {
    background: #d1fae5;
}

.qb-purple {
    background: #ede9fe;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.card-title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 800;
    color: var(--navy);
}

.dashboard-split {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
}

/* Mini Bar Chart */
.chart-bars {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    align-items: end;
    height: 140px;
    padding-top: 12px;
}

.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 6px;
}

.chart-pair {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 105px;
    width: 100%;
    justify-content: center;
}

.bar {
    width: 14px;
    min-height: 4px;
    border-radius: 5px 5px 2px 2px;
    transition: height 0.25s ease;
}

.bar-in {
    background: var(--green);
}

.bar-out {
    background: #f87171;
}

.chart-lbl {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}

.chart-legend {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--muted);
}

.dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 5px;
}

/* ==================== TOOLBAR & LISTS ==================== */
.section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 180px;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
}

.search-input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(15, 41, 66, 0.08);
}

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.doc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.doc-no {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.2px;
}

.doc-customer {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--navy);
    margin-top: 2px;
}

.doc-meta {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

.doc-amount-box {
    text-align: right;
    flex-shrink: 0;
}

.doc-amount {
    font-size: 16px;
    font-weight: 800;
    color: var(--navy);
}

.doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

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

.badge-green {
    background: var(--green-soft);
    color: var(--green);
}

.badge-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.badge-red {
    background: var(--red-soft);
    color: var(--red);
}

.badge-blue {
    background: #eff6ff;
    color: var(--blue);
}

.badge-gray {
    background: #f1f5f9;
    color: #475569;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.14s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-sm {
    height: 33px;
    padding: 0 11px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn-lg {
    height: 46px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--navy-dark);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--green);
    color: #fff;
}

.btn-success:hover {
    background: #047857;
}

.btn-whatsapp {
    background: #16a34a;
    color: #fff;
}

.btn-whatsapp:hover {
    background: #15803d;
}

.btn-light {
    background: #f8fafc;
    color: var(--navy);
    border-color: var(--border);
}

.btn-light:hover {
    background: #e2e8f0;
}

.btn-danger-outline {
    background: #fff;
    color: var(--red);
    border-color: #fecaca;
}

.btn-danger-outline:hover {
    background: var(--red-soft);
}

/* ==================== FORMS & MODALS ==================== */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
}

.field textarea {
    resize: vertical;
    min-height: 76px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(15, 41, 66, 0.08);
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.checkbox-inline input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.sub-section {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px;
}

.sub-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sub-section-head strong {
    font-size: 13px;
    color: var(--navy);
}

.client-picker-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 11px 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-picker-box label {
    font-size: 12px;
    font-weight: 800;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.client-picker-box select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
}

.repeater-row {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.repeater-inline {
    display: grid;
    grid-template-columns: 1fr 1.5fr auto;
    gap: 8px;
    align-items: center;
}

.btn-remove-row {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: var(--red);
    font-weight: 800;
    cursor: pointer;
}

.summary-box {
    background: #0f2942;
    color: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #cbd5e1;
}

.summary-row.grand {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.stamp-preview-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
}

.stamp-preview-box img {
    height: 54px;
    width: auto;
    max-width: 110px;
    object-fit: contain;
}

/* Full-page inline form (no accidental dismiss) */
.form-page-wrap {
    max-width: 820px;
    margin: 0 auto;
}

.form-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.form-page-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
}

.form-page-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* PO Upload & Comparison UI */
.po-upload-zone {
    border: 2px dashed #93c5fd;
    background: #f0f9ff;
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.po-upload-zone input[type="file"] {
    max-width: 100%;
    font-size: 13px;
}
.po-file-preview {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
}
.po-file-preview img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #0f172a;
}
.po-file-preview iframe {
    display: block;
    width: 100%;
    height: 360px;
    border: 0;
}
.po-scan-box {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12.5px;
    color: #713f12;
}
.po-compare-row {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.po-compare-row.is-match { border-color: #6ee7b7; background: #f0fdf4; }
.po-compare-row.is-diff { border-color: #fca5a5; background: #fef2f2; }
.po-compare-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}
.po-verdict {
    border-radius: 14px;
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.po-verdict.ok { background: #ecfdf5; border: 2px solid #10b981; color: #065f46; }
.po-verdict.diff { background: #fef2f2; border: 2px solid #ef4444; color: #991b1b; }
.po-verdict-title { font-size: 16px; font-weight: 800; }

/* Modal Sheet */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 27, 45, 0.58);
    backdrop-filter: blur(3px);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-sheet {
    background: var(--surface);
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 16.5px;
    font-weight: 800;
    color: var(--navy);
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: none;
    background: #f1f5f9;
    font-size: 22px;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
}

.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 13px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

/* ==================== PDF PREVIEW OVERLAY ==================== */
.pdf-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #1e293b;
    display: flex;
    flex-direction: column;
}

.pdf-toolbar {
    background: var(--navy-dark);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.pdf-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-doc-label {
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
}

.pdf-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf-stage {
    flex: 1;
    overflow: auto;
    padding: 18px 12px 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.pdf-scale-wrap {
    transform-origin: top center;
}

.pdf-a4-root {
    width: 794px;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* ==================== TRANSACTIONS TABLE ==================== */
.trx-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.trx-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.trx-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.trx-icon.in {
    background: var(--green-soft);
    color: var(--green);
}

.trx-icon.out {
    background: var(--red-soft);
    color: var(--red);
}

.trx-desc {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--navy);
}

.trx-sub {
    font-size: 12px;
    color: var(--muted);
}

.trx-right {
    text-align: right;
    flex-shrink: 0;
}

.trx-amt {
    font-weight: 800;
    font-size: 14.5px;
}

.trx-amt.in {
    color: var(--green);
}

.trx-amt.out {
    color: var(--red);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
}

.loading-box {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
    font-weight: 600;
}

.alert-error {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid #fecaca;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%);
    background: var(--navy-dark);
    color: #fff;
    padding: 11px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-width: 90vw;
    text-align: center;
}

/* ==================== RESPONSIVE MOBILE ==================== */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main-wrap {
        margin-left: 0;
        padding-bottom: calc(var(--bottom-nav-h) + 16px);
    }

    .bottom-nav {
        display: grid;
    }

    .topbar {
        padding: 10px 14px;
    }

    .topbar-logo-mobile {
        display: block;
    }

    .topbar h2 {
        font-size: 16px;
    }

    .mobile-only {
        display: inline-flex;
    }

    .view-container {
        padding: 14px 12px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 13px;
    }

    .stat-value {
        font-size: 16.5px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 9px;
    }

    .dashboard-split {
        grid-template-columns: 1fr;
    }

    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .repeater-inline {
        grid-template-columns: 1fr;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-sheet {
        max-height: 94vh;
        border-radius: 20px 20px 0 0;
    }

    .pdf-toolbar {
        padding: 8px 10px;
    }

    .pdf-doc-label {
        display: none;
    }
}