:root {
    --sidebar-width: 260px;
    --bottom-nav-height: 65px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Bootstrap overrides using theme config */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-accent {
    background-color: var(--secondary);
    border-color: var(--secondary);
    color: var(--text-light);
}
.btn-accent:hover, .btn-accent:focus {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
    color: var(--text-light);
}
.bg-primary, .mobile-nav, .offcanvas-header {
    background-color: var(--primary) !important;
}
.text-primary { color: var(--secondary) !important; }
.border-primary { border-color: var(--secondary) !important; }
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}
/* Invoice number / Ref values in reports & lists */
.report-invoice-no {
    color: #0d6efd;
    text-decoration: underline;
}
a.report-invoice-no:hover {
    color: #0a58ca;
}

.table-header-branded {
    background-color: var(--secondary);
    color: var(--text-light);
}
.table-header-branded th {
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
}
.customers-list-table.table-bordered > :not(caption) > * > *,
.invoices-list-table.table-bordered > :not(caption) > * > *,
.quotations-list-table.table-bordered > :not(caption) > * > * {
    border-width: 1px;
    border-color: #dee2e6;
}
.customers-list-table.table-bordered thead th,
.invoices-list-table.table-bordered thead th,
.quotations-list-table.table-bordered thead th {
    border-color: rgba(255, 255, 255, 0.25);
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--app-bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

@media (min-width: 992px) {
    body {
        padding-bottom: 0;
    }
}

/* Brand logo — transparent PNG, same asset as invoice, any background */
.brand-logo {
    object-fit: contain;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: block;
    flex-shrink: 0;
    padding: 0;
}

.brand-logo--nav {
    width: 36px;
    height: 36px;
    max-width: 36px;
    max-height: 36px;
}

.brand-logo--drawer {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
}

.brand-logo--sidebar {
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
    margin: 0 auto;
}

.brand-logo--login {
    width: auto;
    height: auto;
    max-width: 140px;
    max-height: 90px;
    margin: 0 auto 1.25rem;
}

.brand-logo--app {
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    margin: 0 auto;
}

.brand-logo--invoice {
    width: 68px;
    height: 68px;
    max-width: 68px;
    max-height: 68px;
}

.brand-logo--statement {
    width: 52px;
    height: 52px;
    max-width: 52px;
    max-height: 52px;
}

/* Legacy aliases */
.app-logo,
.nav-logo,
.sidebar-logo,
.login-logo,
.invoice-logo {
    object-fit: contain;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Login Page - Golden Textiles branded */
.login-page {
    background: var(--app-bg);
    min-height: 100vh;
    padding-bottom: 0;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-header {
    background: var(--primary);
    color: var(--text-light);
    text-align: center;
    padding: 2.75rem 1.5rem 2rem;
    position: relative;
}

.login-header-inner {
    max-width: 360px;
    margin: 0 auto;
}

.login-logo,
.brand-logo--login {
    width: auto;
    height: auto;
    max-width: 140px;
    max-height: 90px;
    margin: 0 auto 1.25rem;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    object-fit: contain;
}

.login-company-name {
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.login-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    margin-top: -1px;
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(16, 29, 53, 0.12);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 400px;
    border-top: 4px solid var(--secondary);
}

.login-card-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-card-header i {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
    display: block;
}

.login-card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-card-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.login-form .form-floating > .form-control {
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    height: calc(3.5rem + 2px);
}

.login-form .form-floating > .form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(248, 158, 27, 0.15);
}

.login-form .form-floating > label {
    color: var(--text-muted);
}

.btn-login {
    background: var(--secondary);
    color: var(--text-light);
    border: none;
    border-radius: 10px;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-login:hover {
    background: var(--secondary-dark);
    color: var(--text-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(248, 158, 27, 0.35);
}

/* Install Page */
.install-page {
    background: var(--app-bg);
    min-height: 100vh;
    padding-bottom: 0;
}

.install-page .card {
    border-radius: 16px;
    border-top: 4px solid var(--secondary);
}

.install-steps {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.install-steps .step {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.75rem;
    background: #e9ecef;
    border-radius: 8px;
    color: #6c757d;
}

.install-steps .step.active {
    background: var(--secondary);
    color: white;
}

.success-icon {
    font-size: 4rem;
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.82);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-nav .nav-link-icon {
    width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link-icon i {
    font-size: 1.05rem;
}

.sidebar-nav .nav-link-text {
    flex: 1;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--secondary);
    box-shadow: 0 4px 14px rgba(247, 148, 29, 0.35);
}

.sidebar-nav-divider {
    margin: 0.85rem 1rem 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar-nav .nav-link-quick {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
}

.sidebar-nav .nav-link-quick:hover,
.sidebar-nav .nav-link-quick:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.8);
}

.main-content {
    flex: 1;
    margin-left: 0;
    min-height: 100vh;
}

@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

.top-bar {
    background: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-area {
    padding: 1rem;
}

@media (min-width: 768px) {
    .content-area {
        padding: 1.5rem;
    }
}

/* Mobile Nav */
.mobile-nav {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--primary);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1050;
    box-shadow: 0 -4px 18px rgba(10, 31, 48, 0.25);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.65rem;
    padding: 6px 8px;
    flex: 1;
    transition: color 0.2s;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--secondary);
}

.mobile-bottom-nav .nav-fab {
    background: var(--secondary);
    color: #fff !important;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-top: -20px;
    box-shadow: 0 4px 14px rgba(247, 148, 29, 0.45);
    flex: none;
}

.mobile-bottom-nav .nav-fab i {
    font-size: 1.5rem;
    margin-bottom: 0;
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.15;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 4px;
}

@media (max-width: 576px) {
    .stat-card {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.1rem;
    }
    .stat-card .stat-icon {
        font-size: 1.75rem;
    }
}

.stat-primary { border-left: 4px solid var(--primary); }
.stat-info { border-left: 4px solid var(--secondary); }
.stat-secondary { border-left: 4px solid #94a3b8; }

.dashboard-stat-main .stat-value {
    font-size: 1.35rem;
}

.stat-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    text-align: inherit;
    cursor: pointer;
}

.stat-card-link:hover .stat-card {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(10, 31, 48, 0.12);
}

.stat-card-link .stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    height: 100%;
}

/* Report company header (sales / receipts) */
.report-company-card {
    overflow: hidden;
    border-radius: 12px;
    border: 2px solid #0A1F30 !important;
    box-sizing: border-box;
}

.report-company-header {
    background: var(--primary);
    color: var(--text-light);
    padding: 16px 20px;
}

.brand-logo--report {
    width: auto;
    height: auto;
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
    flex-shrink: 0;
}

.report-company-name {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0;
}

.report-company-tagline {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0;
}

.report-company-contact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
}

.report-company-contact span {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.report-company-contact i {
    color: var(--secondary);
    margin-top: 2px;
    flex-shrink: 0;
}

.report-header-meta h6 {
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.report-detail-modal .modal-body {
    padding-top: 0.5rem;
}

.report-detail-modal .report-toolbar {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .report-company-contact {
        flex-direction: row;
        flex-wrap: wrap;
        column-gap: 1.25rem;
    }
}

@media (min-width: 768px) {
    .dashboard-stat-main .stat-value {
        font-size: 1.65rem;
    }
}
.stat-success { border-left: 4px solid #198754; }
.stat-warning { border-left: 4px solid var(--secondary-light); }

/* Status Badges */
.badge.status-pending { background: #fff3cd; color: #856404; }
.badge.status-partial { background: #cff4fc; color: #055160; }
.badge.status-paid { background: #d1e7dd; color: #0f5132; }
.badge.status-cancelled { background: #f8d7da; color: #842029; }

/* Cards */
.card {
    border-radius: 12px;
}

.customer-card {
    transition: transform 0.2s;
}

.report-toolbar {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.report-toolbar .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.cust-export-row,
.inv-export-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.45rem;
}

.customers-mobile-header .report-toolbar .btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
}

.inv-mobile-head .report-toolbar {
    margin-top: 0.35rem;
    justify-content: flex-end;
}

.inv-mobile-head .report-toolbar .btn {
    font-size: 0.72rem;
    padding: 0.22rem 0.5rem;
}

/* Language switcher */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0.15rem;
    flex-shrink: 0;
}

.lang-switcher-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.2;
}

.lang-switcher-btn.active {
    background: var(--secondary);
    color: #fff;
}

.top-bar .lang-switcher {
    background: #eef1f5;
}

.top-bar .lang-switcher-btn {
    color: #64748b;
}

.top-bar .lang-switcher-btn.active {
    background: var(--primary);
    color: #fff;
}

.login-lang-wrap {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.login-lang-wrap .lang-switcher {
    background: rgba(255, 255, 255, 0.12);
}

.mobile-nav .lang-switcher {
    margin-left: 0.35rem;
}

/* Mobile Customer List */
.customers-mobile-header {
    background: var(--primary);
    margin: -1rem -1rem 1rem;
    padding: 0.85rem 1rem 1rem;
    border-radius: 0 0 16px 16px;
}

.cust-mobile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.55rem;
}

.cust-add-btn {
    font-weight: 600;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
}

.cust-total-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.55rem;
}

.cust-total-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.2;
}

.cust-total-value {
    display: block;
    font-size: 1.15rem;
    color: #fff;
    line-height: 1.2;
}

.cust-total-meta {
    text-align: right;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

.customers-search-wrap {
    position: relative;
}

.customer-list-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 1050;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(10, 31, 48, 0.15);
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
}

.customer-list-result-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.customer-list-result-item:last-child {
    border-bottom: none;
}

.customer-list-result-item:active,
.customer-list-result-item:hover {
    background: #f8fafc;
}

.customer-list-result-name {
    font-weight: 600;
    color: var(--primary);
    flex: 1;
    min-width: 0;
}

.customer-list-result-phone {
    font-size: 0.78rem;
    color: #94a3b8;
}

.customer-list-result-balance {
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.customer-list-result-empty {
    padding: 0.75rem;
    font-size: 0.82rem;
    color: #94a3b8;
    text-align: center;
}

.search-form.customers-search-wrap {
    position: relative;
}

.customers-search-mobile .input-group {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.customers-search-mobile .form-control {
    font-size: 16px;
    padding: 0.65rem 0.75rem;
}

.customers-search-mobile {
    margin-bottom: 0.55rem;
}

.cust-filter-scroll {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.cust-filter-scroll::-webkit-scrollbar {
    display: none;
}

.cust-filter-chip {
    flex-shrink: 0;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.cust-filter-chip.active {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

.cust-mobile-filters {
    margin-bottom: 0.55rem;
}

.cust-mobile-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.cust-mobile-filter-select {
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    background: #fff;
    color: var(--primary);
}

.customer-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.customer-type-gudaha {
    background: #e8f4fd;
    color: #0a5a8a;
}

.customer-type-bananka {
    background: #fff3e6;
    color: #b35a00;
}

.customer-mobile-info .customer-type-badge {
    margin-top: 0.35rem;
}

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

.customer-mobile-item {
    background: var(--surface);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(16, 29, 53, 0.08);
    border-left: 4px solid var(--secondary);
}

.customer-mobile-main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 14px 10px;
    border: none;
    background: transparent;
    text-decoration: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.customer-mobile-main:active,
.customer-mobile-item.is-open .customer-mobile-main {
    background: rgba(16, 29, 53, 0.03);
}

.customer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.customer-mobile-info {
    flex: 1;
    min-width: 0;
}

.customer-mobile-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-mobile-phone {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.customer-mobile-phone i {
    color: var(--secondary);
    font-size: 0.7rem;
}

.customer-mobile-balance {
    text-align: right;
    flex-shrink: 0;
}

.balance-due {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #dc3545;
}

.balance-credit {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #198754;
}

.balance-paid {
    display: block;
    font-size: 1.25rem;
    color: #198754;
}

.balance-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.customer-mobile-toggle {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.customer-mobile-item.is-open .customer-mobile-toggle {
    transform: rotate(180deg);
    color: var(--secondary);
}

.customer-mobile-details[hidden] {
    display: none;
}

.customer-mobile-details {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.customer-mobile-stats {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
}

.stat-chip {
    flex: 1;
    background: var(--app-bg);
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
}

.stat-chip-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.stat-chip-value {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.customer-mobile-actions {
    display: flex;
    border-top: 1px solid var(--border);
}

.mobile-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    gap: 3px;
    transition: background 0.15s;
}

.mobile-action-btn i {
    font-size: 1.1rem;
    color: var(--primary);
}

.mobile-action-btn:active {
    background: var(--app-bg);
}

.mobile-action-btn.action-collect i {
    color: var(--secondary);
}

.mobile-action-btn.action-collect {
    color: var(--secondary);
    font-weight: 600;
}

.mobile-action-btn + .mobile-action-btn {
    border-left: 1px solid var(--border);
}

/* Forms - Mobile Friendly */
.form-control,
.form-select {
    border-radius: 8px;
}

.form-control-lg,
.form-select-lg {
    font-size: 16px; /* Prevents iOS zoom on focus */
}

.btn {
    border-radius: 8px;
}

.btn-lg {
    padding: 0.75rem 1.25rem;
}

.invoice-preview {
    font-size: 0.95rem;
}

.invoice-summary {
    border: 1px solid #dee2e6;
}

/* Tables on mobile */
@media (max-width: 767px) {
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Definition lists */
dl dt {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 2px;
}

dl dd {
    margin-bottom: 1rem;
}

/* Touch-friendly links */
a, button {
    touch-action: manipulation;
}

/* Mobile drawer (left side) */
.mobile-drawer {
    width: min(300px, 88vw);
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    color: #fff;
    border: none;
}

.mobile-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 1rem 1rem 0.85rem;
    background: var(--primary);
}

.mobile-drawer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mobile-drawer-brand-text {
    min-width: 0;
}

.mobile-drawer-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.mobile-drawer-subtitle {
    display: block;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 2px;
    line-height: 1.3;
}

.mobile-drawer-accent {
    height: 4px;
    background: var(--secondary);
}

.mobile-drawer-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.85rem 0.85rem 0.35rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.92);
}

.mobile-drawer-user i {
    font-size: 1.15rem;
    color: var(--secondary);
}

.mobile-drawer .sidebar-nav {
    padding: 0.35rem 0.75rem 0.75rem;
}

.mobile-drawer .sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.88);
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    margin-bottom: 4px;
    border-bottom: none;
}

.mobile-drawer .sidebar-nav .nav-link:hover,
.mobile-drawer .sidebar-nav .nav-link:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.mobile-drawer .sidebar-nav .nav-link.active {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(247, 148, 29, 0.35);
}

.mobile-drawer .sidebar-nav .nav-link-quick {
    color: rgba(255, 255, 255, 0.78);
}

.mobile-drawer .sidebar-nav-divider {
    margin-left: 0.9rem;
    margin-right: 0.9rem;
    color: rgba(255, 255, 255, 0.42);
    border-top-color: rgba(255, 255, 255, 0.12);
}

.mobile-drawer-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
}

/* Print invoice */
@media print {
    .sidebar, .mobile-nav, .mobile-bottom-nav, .top-bar, .btn {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    body {
        padding-bottom: 0;
        background: white;
    }
}

/* iOS safe areas */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(var(--safe-area-bottom), 8px);
    }
    .content-area {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Android / small phones */
@media (max-width: 360px) {
    .mobile-bottom-nav .nav-item span {
        display: none;
    }
    .mobile-bottom-nav .nav-item i {
        font-size: 1.4rem;
    }
}

/* Customer search on invoice create */
.customer-search-wrap {
    position: relative;
}

.customer-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
}

.customer-result-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: white;
    text-align: left;
    cursor: pointer;
}

.customer-result-item:hover {
    background: var(--app-bg);
}

.customer-result-create {
    color: var(--secondary);
    font-weight: 500;
}

.new-customer-panel {
    background: #fff8ee;
    border: 1px dashed var(--secondary);
    border-radius: 10px;
    padding: 14px;
}

.partial-payment-box {
    background: #f0faf0;
    border: 1px solid #c3e6cb;
}

/* Invoice list — mobile */
.content-area:has(.invoice-list-page) {
    padding: 0.35rem 0.65rem 0.5rem;
}

.inv-mobile-head {
    margin-bottom: 0.4rem;
}

.inv-mobile-toolbar {
    margin: 0;
}

.inv-mobile-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.inv-mobile-search {
    position: relative;
    flex: 1;
    min-width: 0;
    margin: 0;
}

.inv-mobile-search i {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

.inv-mobile-search .form-control,
.inv-mobile-date-input {
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.82rem;
    min-height: 2.1rem;
    background: #fff;
    box-shadow: none;
}

.inv-mobile-search .form-control {
    padding-left: 1.85rem;
}

.inv-mobile-dates {
    margin-bottom: 0.35rem;
}

.inv-mobile-date-input {
    flex: 1;
    min-width: 0;
    color: #64748b;
}

.inv-date-sep {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1;
}

.inv-mobile-search .form-control:focus,
.inv-mobile-date-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(247, 148, 29, 0.12);
}

.inv-filter-scroll {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    padding-bottom: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.inv-filter-scroll::-webkit-scrollbar {
    display: none;
}

.inv-filter-chip {
    flex-shrink: 0;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: all 0.15s;
}

.inv-filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.inv-mobile-filter-select {
    width: 100%;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.45rem 0.65rem;
    background: #fff;
    color: var(--primary);
}

.inv-mobile-filter-select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(247, 148, 29, 0.12);
}

.inv-filter-chip.inv-filter-pending.active {
    background: #ffc107;
    border-color: #ffc107;
    color: #1a1a1a;
}

.inv-filter-chip.inv-filter-partial.active {
    background: #0dcaf0;
    border-color: #0dcaf0;
    color: #1a1a1a;
}

.inv-filter-chip.inv-filter-paid.active {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.invoice-mobile-list {
    margin-bottom: 0.25rem;
}

.inv-card {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 0.35rem;
    box-shadow: 0 1px 4px rgba(10, 31, 48, 0.05);
    border: 1px solid #eef1f5;
    overflow: hidden;
    border-left: 3px solid #cbd5e1;
}

.inv-card.status-border-pending { border-left-color: #ffc107; }
.inv-card.status-border-partial { border-left-color: #0dcaf0; }
.inv-card.status-border-paid { border-left-color: #198754; }

.inv-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
}

.inv-card-left {
    min-width: 0;
    flex: 1;
}

.inv-card-line1 {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-card-sep {
    color: #cbd5e1;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.inv-card-right {
    text-align: right;
    flex-shrink: 0;
    line-height: 1.15;
}

.inv-card-right .badge {
    display: inline-block;
    margin-bottom: 0.1rem;
    font-size: 0.58rem;
    padding: 0.15em 0.4em;
}

.invoice-mobile-item {
    overflow: hidden;
}

.invoice-mobile-main {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.invoice-mobile-info {
    flex: 1;
    min-width: 0;
}

.invoice-mobile-no {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--primary);
    line-height: 1.15;
    flex-shrink: 0;
}

.invoice-mobile-customer {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-mobile-date {
    font-size: 0.72rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-mobile-amount {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--primary);
    line-height: 1.15;
}

.invoice-mobile-rest {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: #dc3545;
    margin-top: 0.05rem;
}

.invoice-mobile-toggle {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #cbd5e1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.invoice-mobile-item.is-open .invoice-mobile-toggle {
    transform: rotate(180deg);
    color: var(--secondary);
}

.invoice-mobile-details {
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.invoice-mobile-details[hidden] {
    display: none;
}

.invoice-mobile-details .btn {
    min-height: 2.35rem;
    font-weight: 600;
    border-radius: 10px;
}

.invoice-mobile-details .invoice-share-row {
    border-top: none;
    padding-top: 0;
    gap: 0.5rem;
}

.invoice-mobile-details .share-icon-btn {
    border-radius: 10px;
    padding: 0.65rem;
    font-size: 1.15rem;
}

.invoice-share-row {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.share-icon-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    background: var(--app-bg);
    color: var(--primary);
    border: none;
    text-decoration: none;
    font-size: 1.1rem;
    cursor: pointer;
}

.share-icon-btn:hover {
    background: var(--primary);
    color: white;
}

.share-icon-btn.share-wa:hover {
    background: #25D366;
    color: white;
}

.invoice-share-row form {
    flex: 1;
    display: flex;
    margin: 0;
}

.invoice-share-row form .share-icon-btn {
    width: 100%;
}

.share-icon-btn.share-danger:hover {
    background: #dc3545;
    color: #fff;
}

.invoice-view-share-mobile {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--bottom-nav-height, 65px) + var(--safe-area-bottom, 0px));
    z-index: 90;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border-top: 1px solid var(--border, #e8ecf0);
    box-shadow: 0 -4px 16px rgba(10, 31, 48, 0.08);
}

.invoice-view-share-mobile .invoice-share-row {
    border-top: none;
    padding-top: 0;
    margin: 0;
}

.invoice-view-share-mobile .share-icon-btn.share-collect {
    color: #198754;
}

.invoice-mobile-item > .invoice-share-row {
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

@media (max-width: 767px) {
    .invoice-view-content {
        margin-bottom: 4.5rem;
    }
}

/* PWA install banner */
.pwa-install-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    z-index: 1040;
    padding: 0.5rem 0.75rem;
    background: rgba(10, 31, 48, 0.97);
    border-top: 2px solid var(--secondary);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.pwa-install-inner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 640px;
    margin: 0 auto;
}

.pwa-install-icon {
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: cover;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.35;
}

.pwa-install-text strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 0.1rem;
}

.pwa-install-dismiss {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.pwa-ios-hint {
    display: none;
}

body.pwa-banner-visible {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 72px);
}

@media (min-width: 992px) {
    .pwa-install-banner {
        bottom: 0;
        max-width: 420px;
        left: auto;
        right: 1rem;
        border-radius: 12px 12px 0 0;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-bottom: none;
    }

    body.pwa-banner-visible {
        padding-bottom: 0;
    }
}

@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }

    body {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
        padding-top: env(safe-area-inset-top, 0px);
    }

    .mobile-nav {
        padding-top: env(safe-area-inset-top, 0px);
    }
}

/* iOS install guide modal */
.pwa-ios-modal .modal-content {
    border-radius: 16px;
    overflow: hidden;
}

.pwa-ios-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pwa-ios-steps li {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.pwa-ios-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--secondary);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-ios-steps p {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pwa-ios-share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: 0.35rem;
    border-radius: 8px;
    background: #007aff;
    color: #fff;
    font-size: 1.1rem;
}

.pwa-menu-install {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Bananka collect — single card, full width mobile */
.collect-bananka-page {
    margin-left: calc(-1 * var(--collect-pad-x, 1rem));
    margin-right: calc(-1 * var(--collect-pad-x, 1rem));
    width: calc(100% + 2 * var(--collect-pad-x, 1rem));
}
.collect-bananka-card {
    border-radius: 0;
}
.collect-bananka-body {
    padding: 0.65rem 0.5rem 1rem;
}
.collect-pending-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}
.collect-pending-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8896a6;
    margin-bottom: 0.5rem;
}
.collect-pending-list .list-group-item {
    padding-left: 0;
    padding-right: 0;
    border-left: none;
    border-right: none;
}
@media (min-width: 768px) {
    .collect-bananka-page {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    .collect-bananka-card {
        border-radius: 0.375rem;
    }
    .collect-bananka-body {
        padding: 1.25rem 1.5rem 1.5rem;
    }
}

/* Bananka multi-payment — one row per line */
.collect-type-tabs .nav-link { border-radius: 999px; padding: 0.45rem 0.85rem; font-size: 0.85rem; }
.collect-type-tabs .nav-link.active { background: var(--primary, #0a1f30); }
.multi-pay-table {
    background: var(--app-bg, #f4f6f9);
    border: 1px solid rgba(10, 31, 48, 0.08);
    border-radius: 8px;
    overflow: hidden;
    margin-left: 0;
    margin-right: 0;
}
.multi-pay-table-head,
.multi-pay-row {
    display: grid;
    grid-template-columns: 1.25rem minmax(3.5rem, 1fr) minmax(6.5rem, 1.1fr) minmax(2.5rem, 0.85fr) 1.5rem;
    gap: 0.25rem;
    align-items: center;
    padding: 0.4rem 0.35rem;
}
.multi-pay-table-head span:nth-child(4) { font-size: 0; }
.multi-pay-table-head span:nth-child(4)::after {
    content: 'Note';
    font-size: 0.65rem;
}
.multi-pay-table-head span:nth-child(2) { font-size: 0; }
.multi-pay-table-head span:nth-child(2)::after {
    content: 'Amt';
    font-size: 0.65rem;
}
.multi-pay-table-head span:nth-child(3) { font-size: 0; }
.multi-pay-table-head span:nth-child(3)::after {
    content: 'Date';
    font-size: 0.65rem;
}
.multi-pay-table-head {
    background: rgba(10, 31, 48, 0.06);
    border-bottom: 1px solid rgba(10, 31, 48, 0.08);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #8896a6;
}
.multi-pay-row {
    border-bottom: 1px solid rgba(10, 31, 48, 0.06);
}
.multi-pay-row:last-child { border-bottom: none; }
.multi-pay-row .row-num {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary, #0a1f30);
    text-align: center;
}
.multi-pay-cell { min-width: 0; }
.multi-pay-row .input-group-text {
    padding: 0.2rem 0.35rem;
    font-size: 0.75rem;
}
.multi-pay-row .form-control {
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
    min-width: 0;
}
.multi-pay-row .form-control[type="date"] {
    padding: 0.25rem 0.2rem;
}
.multi-pay-row .remove-pay-row {
    padding: 0.15rem 0.35rem;
    line-height: 1;
}
.multi-pay-summary {
    background: #fff;
    border: 2px solid var(--secondary, #f7941d);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
}
@media (min-width: 768px) {
    .collect-type-tabs .nav-link { padding: 0.45rem 1rem; font-size: 1rem; }
    .multi-pay-table-head span:nth-child(2),
    .multi-pay-table-head span:nth-child(3),
    .multi-pay-table-head span:nth-child(4) { font-size: 0.72rem; }
    .multi-pay-table-head span:nth-child(2)::after,
    .multi-pay-table-head span:nth-child(3)::after,
    .multi-pay-table-head span:nth-child(4)::after { content: none; }
    .multi-pay-table-head,
    .multi-pay-row {
        grid-template-columns: 2rem minmax(6rem, 1.2fr) minmax(9rem, 1.2fr) minmax(5rem, 1.5fr) 2rem;
        gap: 0.5rem;
        padding: 0.55rem 0.75rem;
    }
    .multi-pay-table-head { font-size: 0.72rem; }
    .multi-pay-row .form-control { font-size: 0.875rem; padding: 0.375rem 0.5rem; }
    .multi-pay-summary { padding: 0.85rem 1rem; border-radius: 12px; }
}
@media (max-width: 767px) {
    .content-area:has(.collect-bananka-page) {
        --collect-pad-x: 0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .content-area:has(.page-header-mobile) {
        padding-top: 0.65rem;
    }
}
@media (max-width: 575px) {
    .collect-type-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem; }
    .collect-type-tabs .nav-item { flex-shrink: 0; }
}
