        /* ═══ FOCUS-VISIBLE (Accessibility) ═══ */
        *:focus-visible {
            outline: 2px solid var(--primary) !important;
            outline-offset: 2px !important;
        }

        /* ═══ TOKENS ═══ */
        :root {
            /* Stitch: Coffeine AP Outstanding Redesign */
            --primary: #005c55;
            --primary-lt: #0f766e;
            --primary-dk: #004843;
            --bg: #f8f9ff;
            --surface: #ffffff;
            --surface-lt: #eff4ff;
            --surface-2: #e5eeff;
            --text: #0b1c30;
            --muted: #3e4947;
            --border: #bdc9c6;
            --success: #059669;
            --danger: #ba1a1a;
            --warning: #d97706;
            --st-avatar: #dce9ff;
            --st-chip: #e5eeff;
            --r-sm: 8px;
            --r-md: 12px;
            --r-lg: 16px;
            --r-xl: 20px;
            --sh-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
            --sh-md: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
            --sh-lg: 0 20px 40px rgba(15, 23, 42, 0.10);
            --sidebar-w: 260px;
            --header-h: 56px;
            --subheader-h: 36px;
            --bottom-nav-h: 64px;
        }

        /* ═══ RESET ═══ */
        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Outfit', sans-serif;
            font-size: 14px;
            background: var(--bg);
            color: var(--text);
            -webkit-font-smoothing: antialiased;
            overflow: hidden;
            margin: 0;
        }

        * {
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        *::-webkit-scrollbar {
            width: 0;
            height: 0;
            display: none;
        }

        /* ═══ SHELL ═══ */
        .app-wrapper {
            width: 100%;
            max-width: none;
            margin: 0;
            height: 100vh;
            height: 100dvh;
            position: relative;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .header-inner,
        .sub-inner,
        .content-area {
            width: 100%;
            max-width: none;
        }


        /* ═══ VIEW SYSTEM ═══ */
        .app-view {
            position: absolute;
            inset: 0;
            transition: transform .28s cubic-bezier(.4, 0, .2, 1), opacity .28s;
            background: var(--bg);
            z-index: 10;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .view-hidden {
            transform: translateX(100%);
            opacity: 0;
            pointer-events: none;
            z-index: 5;
        }

        #loginView {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            transform: translateX(0);
            opacity: 1;
        }

        #loginView.view-hidden {
            transform: translateX(-100%);
            opacity: 0;
            pointer-events: none;
        }

        /* ═══ LOGIN ═══ */
        .login-wrap {
            width: 100%;
            max-width: 360px;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 16px;
        }

        @keyframes logo-spin {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        .login-header {
            text-align: center;
            margin-bottom: 24px;
            width: 100%;
        }

        .icon-box {
            position: relative;
            width: 80px;
            height: 80px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 1.5rem auto;
        }

        .icon-box::before {
            content: '';
            position: absolute;
            inset: 0;
            background-color: var(--primary);
            border-radius: 24px;
            box-shadow: none;
            animation: logo-spin 20s linear infinite;
        }

        .icon-box i {
            position: relative;
            color: white;
            font-size: 2.5rem;
            z-index: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .app-abbr {
            font-size: 2.2rem;
            font-weight: 900;
            color: var(--primary);
            letter-spacing: 4px;
            margin-bottom: 4px;
            line-height: 1;
        }

        .app-full-name {
            font-size: 0.7rem;
            color: var(--muted);
            font-weight: 700;
            letter-spacing: 1.5px;
            text-transform: uppercase;
        }

        .login-card {
            width: 100%;
            background: var(--surface);
            border-radius: var(--r-lg);
            border: 1px solid var(--border);
            padding: 18px;
            box-shadow: var(--sh-sm);
        }

        .iw {
            position: relative;
            margin-bottom: 12px;
        }

        .iw i.icon {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted);
            font-size: .88rem;
            z-index: 2;
        }

        .iw input {
            width: 100%;
            padding: 10px 12px 10px 36px;
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            font-size: .9rem;
            background: var(--surface-lt);
            color: var(--text);
            outline: none;
            font-family: inherit;
            transition: border-color .2s;
        }

        .iw input:focus {
            border-color: var(--primary);
        }

        .login-btn {
            width: 100%;
            height: 44px;
            background: var(--primary);
            color: #fff;
            border: none;
            border-radius: var(--r-sm);
            font-size: .9rem;
            font-weight: 800;
            font-family: inherit;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-top: 4px;
            transition: filter .2s, transform .15s;
        }

        .login-btn:hover {
            filter: brightness(1.08);
        }

        .login-btn:active {
            transform: scale(.97);
        }

        /* ═══ BUTTONS ═══ */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            border: none;
            border-radius: var(--r-sm);
            font-family: inherit;
            font-size: .82rem;
            font-weight: 600;
            cursor: pointer;
            transition: filter .18s, transform .13s;
            padding: 9px 14px;
        }

        .btn:active {
            transform: scale(.96);
        }

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

        .btn-primary:hover {
            filter: brightness(1.08);
        }

        .btn-ghost {
            background: var(--surface-lt);
            color: var(--text);
            border: 1.5px solid var(--border);
        }

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

        .btn-warning {
            background: #d97706;
            color: #fff;
        }

        .btn-warning:hover {
            filter: brightness(1.06);
        }

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

        .btn-danger:hover {
            filter: brightness(1.06);
        }

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

        .btn-full {
            width: 100%;
        }

        /* ═══ UTILITY: TEXT SIZES ═══ */
        .text-xs {
            font-size: 0.7rem;
        }

        .text-sm {
            font-size: 0.82rem;
        }

        .text-base {
            font-size: 0.88rem;
        }

        /* ═══ UTILITY: BUTTON HEIGHTS ═══ */
        .btn-sm {
            height: 28px;
            padding: 4px 10px;
            font-size: 0.72rem;
        }

        .btn-md {
            height: 36px;
        }

        .btn-lg {
            height: 44px;
        }

        /* ═══ HEADER ═══ */
        .header {
            position: sticky;
            top: 0;
            z-index: 20;
            background-color: rgba(255, 255, 255, 0.88);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-bottom: 1px solid var(--border);
            height: var(--header-h);
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-shrink: 0;
        }

        .header-inner {
            width: 100%;
            max-width: none;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 0 20px;
            height: var(--header-h);
        }

        .h-left {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex: 1;
        }

        .h-brand {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .h-brand-title {
            display: flex;
            align-items: center;
            gap: 7px;
            font-size: 1.28rem;
            font-weight: 900;
            color: var(--primary);
            letter-spacing: -0.5px;
            margin: 0;
            line-height: 1;
        }

        .h-brand-title i {
            font-size: 1.15em;
        }

        .h-brand-sub {
            font-size: 0.58rem;
            color: var(--muted);
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.35px;
            opacity: 0.85;
        }

        @media (min-width: 1024px) {
            .h-brand {
                display: none;
            }
        }

        .h-actions {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-left: auto;
            flex-shrink: 0;
        }

        .h-btn {
            background: var(--surface-lt);
            border: 1px solid var(--border);
            color: var(--primary);
            font-size: 1rem;
            cursor: pointer;
            width: 38px;
            height: 38px;
            border-radius: 10px;
            transition: background 0.15s, opacity 0.2s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .h-btn:hover {
            background: var(--surface-2);
        }

        .h-btn:active {
            opacity: 0.7;
        }

        .h-btn.danger {
            color: var(--danger);
        }

        #global-header-back-btn {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
            width: 40px;
            height: 40px;
            box-shadow: 0 4px 12px rgba(0, 92, 85, 0.28);
        }

        #global-header-back-btn:hover {
            background: var(--primary-lt);
            border-color: var(--primary-lt);
            color: #fff;
        }

        #global-header-back-btn.hidden {
            display: none !important;
        }

        .sub-header {
            background: var(--primary);
            color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            height: var(--subheader-h);
            width: 100%;
            flex-shrink: 0;
        }

        .sub-inner {
            width: 100%;
            max-width: none;
            padding: 0 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            height: var(--subheader-h);
        }

        .sub-page-title {
            margin: 0;
            min-width: 0;
            flex: 1 1 auto;
            font-size: 0.82rem;
            font-weight: 800;
            letter-spacing: 0.02em;
            line-height: 1.1;
            color: #fff;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        @media (min-width: 1024px) {
            .sub-page-title {
                font-size: 0.9rem;
            }

            .sub-inner {
                padding: 0 28px;
            }
        }

        /* ═══ CONTENT AREA ═══ */
        .content-area {
            padding: 14px 16px 10px;
            margin: 0 auto;
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            max-width: none;
            width: 100%;
            box-sizing: border-box;
        }

        /* ═══ HERO CARD ═══ */
        .hero-card {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
            color: #fff;
            padding: 16px 16px 14px;
            border-radius: var(--r-lg);
            margin-bottom: 12px;
            box-shadow: var(--sh-md);
            position: relative;
            overflow: hidden;
            text-align: center;
        }

        .hero-card::after {
            content: '';
            position: absolute;
            right: -14px;
            top: -14px;
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: rgba(255, 255, 255, .06);
        }

        .dash-credit-toggle {
            position: absolute;
            top: 12px;
            right: 12px;
            z-index: 10;
            padding: 6px;
            border: none;
            background: none;
            color: #fff;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.88rem;
            opacity: 0.55;
            outline: none;
            transition: opacity 0.15s ease;
        }

        .dash-credit-toggle.active {
            opacity: 0.95;
        }

        .hero-label {
            font-size: .62rem;
            font-weight: 600;
            opacity: .78;
            text-transform: uppercase;
            letter-spacing: .5px;
            margin-bottom: 3px;
        }

        .hero-amount {
            font-size: 1.65rem;
            font-weight: 800;
            letter-spacing: -1px;
            line-height: 1.1;
            color: #f4ad8f;
        }

        .hero-stats {
            display: flex;
            border-top: 1px dashed rgba(255, 255, 255, .2);
            margin-top: 10px;
            padding-top: 10px;
        }

        .hero-stat {
            flex: 1;
            text-align: center;
        }

        .hero-stat:not(:last-child) {
            border-right: 1px dashed rgba(255, 255, 255, .2);
        }

        .hero-stat-label {
            font-size: .58rem;
            opacity: .72;
            text-transform: uppercase;
            font-weight: 600;
            display: block;
        }

        .hero-stat-val {
            font-size: .88rem;
            font-weight: 700;
            display: block;
            margin-top: 2px;
        }

        /* ═══ DASHBOARD NAV GRID ═══ */
        .dash-nav {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 9px;
            margin-bottom: 0;
        }

        .nav-card {
            background: var(--surface);
            padding: 14px 10px 12px;
            border-radius: var(--r-md);
            text-align: center;
            cursor: pointer;
            border: 1.5px solid var(--border);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
            position: relative;
        }

        .nav-card i {
            font-size: 1.3rem;
            color: var(--primary);
        }

        .nav-card h5 {
            font-size: .82rem;
            font-weight: 700;
            color: var(--text);
            margin: 0;
        }

        .nav-card p {
            font-size: .64rem;
            color: var(--muted);
            margin: 0;
            line-height: 1.3;
        }

        .nav-badge {
            position: absolute;
            top: 7px;
            right: 7px;
            background: var(--danger);
            color: #fff;
            font-size: .62rem;
            font-weight: 800;
            width: 17px;
            height: 17px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: none;
            animation: badge-pulse-glow 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
        }

        @keyframes badge-pulse-glow {
            0% {
                transform: scale(0.95);
                box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35);
            }

            70% {
                transform: scale(1.05);
                box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
            }

            100% {
                transform: scale(0.95);
                box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
            }
        }

        .form-section-header {
            font-size: 0.72rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
            border-bottom: 1px solid var(--border);
            padding-bottom: 8px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .empty .empty-cta {
            margin-top: 10px;
        }

        .wa-preview-text,
        #waMsgPreview {
            font-size: 0.76rem !important;
            line-height: 1.45 !important;
        }

        .hero-stat-label,
        .card-section-label,
        .sup-meta,
        .stag,
        .dtable th {
            font-size: 0.68rem !important;
        }

        .fab {
            box-shadow: 0 4px 12px rgba(10, 68, 74, 0.3) !important;
        }

        button.h-btn {
            background: none;
            border: none;
            cursor: pointer;
            padding: 4px;
            color: var(--primary);
            font-size: 1.2rem;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        button.h-btn.danger {
            color: var(--danger);
        }

        button.h-btn i {
            font-size: inherit;
            line-height: 1;
            width: 1em;
            text-align: center;
        }

        .hero-month-btn {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            padding: 4px 8px;
            font-size: 0.82rem;
            opacity: 0.85;
        }

        .hero-month-btn:hover,
        .hero-month-btn:focus-visible {
            opacity: 1;
            outline: 2px solid rgba(255, 255, 255, 0.5);
            outline-offset: 2px;
        }

        textarea[dir="auto"],
        input[dir="auto"] {
            unicode-bidi: plaintext;
        }

        .nav-card.span-2 {
            grid-column: 1 / -1;
            flex-direction: row;
            gap: 12px;
            padding: 12px 16px;
            text-align: left;
            justify-content: flex-start;
        }

        .nav-card.span-2 i {
            font-size: 1.15rem;
        }

        /* ═══ SECTION TITLE ═══ */
        .sec-title {
            font-size: .78rem;
            font-weight: 700;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 5px;
            color: var(--muted);
        }

        /* ═══ SUB-TABS ═══ */
        .sub-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            border-bottom: 1.5px solid var(--border);
            padding-bottom: 0;
        }

        .sub-tab-btn {
            flex: 1;
            padding: 10px 8px;
            border: none;
            background: transparent;
            color: var(--muted);
            font-weight: 500;
            font-family: inherit;
            cursor: pointer;
            text-align: center;
            font-size: 0.86rem;
            border-bottom: 3px solid transparent;
            border-radius: var(--r-sm) var(--r-sm) 0 0;
            outline: none;
            transition: background .15s, color .15s, border-color .15s;
            line-height: 1.25;
            white-space: normal;
        }

        .sub-tab-btn.sub-tab-active,
        .sub-tab-btn[aria-current="true"] {
            color: var(--primary);
            font-weight: 700;
            border-bottom-color: var(--primary);
            background: rgba(10, 68, 74, 0.06);
        }

        body.dark .sub-tab-btn.sub-tab-active,
        body.dark .sub-tab-btn[aria-current="true"] {
            background: rgba(183, 191, 192, 0.1);
        }

        /* ═══ SUPPLIER BALANCE CARDS ═══ */
        .sup-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 9px;
        }

        .sup-card {
            background: var(--surface);
            border: 1.5px solid var(--border);
            border-radius: var(--r-md);
            padding: 10px 11px;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            min-height: 88px;
        }

        .sup-name {
            font-size: .76rem;
            font-weight: 700;
            color: var(--text);
            line-height: 1.3;
            margin-bottom: 6px;
            word-break: break-word;
        }

        .sup-amount {
            font-size: .88rem;
            font-weight: 800;
            color: var(--danger);
        }

        .sup-meta {
            font-size: .6rem;
            color: var(--muted);
            font-weight: 500;
            margin-top: 2px;
            display: flex;
            align-items: center;
            gap: 3px;
        }

        /* ═══ ITEM CARDS ═══ */
        .item-card {
            background: var(--surface);
            padding: 10px 12px;
            border-radius: var(--r-md);
            margin-bottom: 7px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border: 1.5px solid var(--border);
            cursor: pointer;
            border-left: 3px solid var(--primary);
        }

        .item-card.unpaid {
            border-left-color: var(--warning);
        }

        .item-card.unpaid-interactive {
            cursor: pointer;
        }

        .item-card.paid {
            border-left-color: var(--success);
        }

        .card-left h4 {
            font-size: .84rem;
            font-weight: 700;
            margin-bottom: 2px;
        }

        .card-left p {
            font-size: .7rem;
            color: var(--muted);
            margin-bottom: 1px;
        }

        .card-left .lbl {
            font-size: .64rem;
            color: var(--primary);
            font-weight: 600;
            margin-top: 1px;
        }

        .card-right {
            text-align: right;
            flex-shrink: 0;
            margin-left: 8px;
        }

        .card-right .amount {
            font-weight: 700;
            color: var(--primary);
            font-size: .9rem;
        }

        .stag {
            display: inline-block;
            padding: 2px 6px;
            font-size: .6rem;
            font-weight: 700;
            border-radius: 4px;
            margin-top: 3px;
            text-transform: uppercase;
        }

        .stag.paid {
            background: #d1fae5;
            color: #065f46;
        }

        .stag.unpaid {
            background: #fef3c7;
            color: #92400e;
        }

        .stag.partial {
            background: #dbeafe;
            color: #1e40af;
        }

        .stag.success {
            background: #d1fae5;
            color: #065f46;
        }

        .stag.warning {
            background: #fef3c7;
            color: #92400e;
        }

        .item-card.partial {
            border-left-color: #3b82f6;
        }

        /* ═══ SUPPLIER PAYMENT PAGE ═══ */
        .pay-profile {
            background: var(--surface);
            border-radius: var(--r-md);
            padding: 13px 14px;
            margin-bottom: 10px;
            box-shadow: var(--sh-sm);
            border: 1px solid var(--border);
        }

        .pay-name {
            font-size: 1rem;
            font-weight: 800;
            color: var(--primary);
            margin-bottom: 3px;
        }

        .pay-info {
            font-size: .7rem;
            color: var(--muted);
            font-weight: 500;
            line-height: 1.6;
        }

        .pay-total-btn {
            width: 100%;
            padding: 10px 14px;
            background: var(--danger);
            color: #fff;
            border: none;
            border-radius: var(--r-md);
            font-family: inherit;
            font-size: .86rem;
            font-weight: 800;
            cursor: pointer;
            margin-top: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: filter .2s;
        }

        .pay-total-btn:hover {
            filter: brightness(1.06);
        }

        /* Bank Card Design Styles */
        .supplier-bank-card {
            background: linear-gradient(145deg, #004843 0%, #005c55 48%, #0f766e 100%);
            color: #ffffff;
            border-radius: 16px;
            padding: 18px 18px 16px;
            margin-bottom: 12px;
            border: 1px solid rgba(255, 255, 255, 0.12);
            position: relative;
            overflow: hidden;
            box-shadow: var(--sh-md);
        }

        .supplier-bank-card::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
            pointer-events: none;
        }

        .card-inner {
            display: flex;
            flex-direction: column;
            gap: 10px;
            position: relative;
            z-index: 1;
        }

        .sp-card-tools {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .sp-card-icon {
            background: rgba(255, 255, 255, 0.15);
            border: none;
            color: #fff;
            width: 28px;
            height: 28px;
            border-radius: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 0.75rem;
        }

        .sp-card-icon:hover {
            background: rgba(255, 255, 255, 0.28);
        }

        .sp-card-icon.ghost {
            background: transparent;
            color: rgba(255, 255, 255, 0.75);
            width: auto;
            height: auto;
            padding: 2px;
        }

        .sp-card-number-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .sp-layout {
            display: grid;
            grid-template-columns: 1fr;
            gap: 18px;
            align-items: start;
        }

        .sp-main {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .sp-aside {
            min-width: 0;
        }

        .sp-invoice-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        #payUnpaidInvoicesList.sp-invoice-list {
            gap: 10px;
        }

        #payUnpaidInvoicesList.sp-invoice-list>.sp-invoice-card {
            margin: 0;
        }

        .sp-invoice-card {
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 11px 14px 9px;
            border: 1px solid var(--border);
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.92);
            box-shadow: var(--sh-sm);
            cursor: pointer;
            transition: box-shadow 0.15s, opacity 0.15s, filter 0.15s, background 0.15s, border-color 0.15s;
            opacity: 0.58;
            filter: grayscale(0.7);
            border-color: rgba(0, 0, 0, 0.08);
            background: rgba(248, 249, 250, 0.95);
        }

        .sp-invoice-card.is-selected {
            opacity: 1;
            filter: none;
            border-color: var(--border);
            background: rgba(255, 255, 255, 0.92);
            box-shadow: var(--sh-sm);
        }

        .sp-invoice-card:hover {
            box-shadow: var(--sh-md);
        }

        .sp-invoice-card.is-selected:hover {
            box-shadow: var(--sh-md);
        }

        .sp-invoice-card.is-partial {
            border-left: 4px solid #94a3b8;
        }

        .sp-invoice-card.is-partial.is-selected {
            border-left: 4px solid #2563eb;
        }

        .sp-invoice-top {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 8px;
        }

        .sp-invoice-ident {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            min-width: 0;
        }

        .sp-invoice-check {
            margin-top: 8px;
            flex-shrink: 0;
        }

        .sp-invoice-check input {
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: var(--primary);
        }

        .sp-invoice-name {
            font-size: 0.92rem;
            font-weight: 600;
            color: var(--text);
            letter-spacing: -0.01em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 48vw;
        }

        .sp-invoice-sub {
            margin-top: 2px;
            font-size: 0.74rem;
            color: var(--muted);
            font-weight: 400;
        }

        .sp-invoice-money {
            text-align: right;
            flex-shrink: 0;
        }

        .sp-invoice-amt {
            font-size: 1.02rem;
            font-weight: 700;
            color: var(--text);
            white-space: nowrap;
        }

        .sp-invoice-due {
            margin-top: 2px;
            font-size: 0.68rem;
            font-weight: 600;
            color: var(--muted);
            display: inline-flex;
            align-items: center;
            justify-content: flex-end;
            gap: 4px;
        }

        .sp-invoice-due.is-urgent {
            color: var(--danger);
        }

        .sp-invoice-foot {
            border-top: 1px solid var(--border);
            padding-top: 8px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            flex-wrap: wrap;
        }

        .sp-invoice-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }

        .sp-invoice-tag {
            padding: 2px 7px;
            border-radius: 4px;
            background: var(--st-chip);
            color: var(--muted);
            font-size: 0.64rem;
            font-weight: 600;
        }

        .sp-invoice-tag.status-unpaid {
            background: #fee2e2;
            color: #b91c1c;
        }

        .sp-invoice-tag.status-partial {
            background: #dbeafe;
            color: #1d4ed8;
        }

        #payUnpaidInvoicesList .sp-invoice-card .st-review {
            height: 30px;
            padding: 0 12px;
            font-size: 0.75rem;
        }

        #payUnpaidInvoicesList .sp-invoice-card .st-avatar {
            width: 40px;
            height: 40px;
            font-size: 0.82rem;
        }

        .sp-select-all {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 14px;
            background: var(--surface-lt);
            border: 1px solid var(--border);
            border-radius: 12px;
            font-weight: 700;
            font-size: 0.8rem;
        }

        #tab-supplier-payment .pay-total-btn {
            margin: 0;
            width: 100%;
            height: 48px;
            border-radius: 12px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 16px;
            box-sizing: border-box;
        }

        @media (min-width: 1100px) {
            .sp-layout {
                grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
                gap: 22px;
            }

            .sp-aside {
                position: sticky;
                top: 8px;
            }
        }

        @media (max-width: 1099px) {
            .sp-aside {
                order: -1;
            }
        }

        .card-chip-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .card-chip {
            width: 36px;
            height: 26px;
            background: linear-gradient(135deg, #e5c158 0%, #c39a2d 100%);
            border-radius: 5px;
            position: relative;
            overflow: hidden;
            box-shadow: none;
        }

        .card-chip::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border: 1px dashed rgba(0, 0, 0, 0.15);
            margin: 2.5px;
            border-radius: 3.5px;
        }

        .card-logo {
            font-size: 0.8rem;
            font-weight: 800;
            letter-spacing: 1.2px;
            color: rgba(255, 255, 255, 0.95);
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .card-balance-section {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .card-balance-label {
            font-size: 0.6rem;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.65);
            letter-spacing: 0.8px;
            text-transform: uppercase;
        }

        .card-balance-amount {
            font-size: 1.4rem;
            font-weight: 800;
            letter-spacing: 0.5px;
            text-shadow: none;
        }

        .card-number-section {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .card-section-label {
            font-size: 0.55rem;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.55);
            letter-spacing: 0.8px;
            text-transform: uppercase;
        }

        .card-number {
            font-family: 'Share Tech Mono', monospace, Courier;
            font-size: 1.1rem;
            font-weight: 700;
            letter-spacing: 2px;
            color: #ffffff;
            text-shadow: none;
            word-break: break-all;
        }

        .card-bottom-row {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            gap: 10px;
        }

        .card-holder-name {
            font-size: 0.88rem;
            font-weight: 700;
            color: #ffffff;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .card-invoice-count {
            font-size: 0.78rem;
            font-weight: 700;
            background: rgba(255, 255, 255, 0.18);
            padding: 2.5px 7px;
            border-radius: 20px;
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .card-details-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 4px 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.15);
            padding-top: 8px;
            font-size: 0.68rem;
        }

        .card-detail-item {
            display: flex;
            flex-direction: column;
            gap: 1px;
        }

        .card-detail-val {
            font-weight: 700;
            color: rgba(255, 255, 255, 0.95);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .pay-total-btn:active {
            transform: scale(.97);
        }

        .pay-total-btn:disabled {
            opacity: .5;
            cursor: not-allowed;
        }

        /* ═══ FORM CARD ═══ */
        .form-card {
            background: var(--surface);
            padding: 13px 14px;
            border-radius: var(--r-md);
            box-shadow: var(--sh-sm);
            border: 1px solid var(--border);
            margin-bottom: 10px;
        }

        .form-label {
            font-size: .72rem;
            font-weight: 700;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: .5px;
            padding-bottom: 7px;
            margin-bottom: 11px;
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .field {
            margin-bottom: 10px;
        }

        .field:last-child {
            margin-bottom: 0;
        }

        .field-label {
            font-size: .66rem;
            font-weight: 700;
            color: var(--muted);
            display: block;
            margin-bottom: 4px;
            text-transform: uppercase;
            letter-spacing: .3px;
        }

        .field input,
        .field select {
            width: 100%;
            height: 38px;
            padding: 0 10px;
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            font-size: .86rem;
            background: var(--surface-lt);
            color: var(--text);
            outline: none;
            font-family: inherit;
            transition: border-color .2s;
        }

        .field textarea {
            width: 100%;
            padding: 8px 10px;
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            font-size: .86rem;
            background: var(--surface-lt);
            color: var(--text);
            outline: none;
            font-family: inherit;
            transition: border-color .2s;
            resize: none;
            height: 64px;
        }

        .field input:focus,
        .field select:focus,
        .field textarea:focus {
            border-color: var(--primary);
        }

        .field input.amount-input {
            font-size: 1.25rem !important;
            font-weight: 700 !important;
            color: var(--primary) !important;
            text-align: center;
        }

        .field-readonly {
            background: var(--bg) !important;
            color: var(--muted) !important;
            font-weight: 600;
        }

        .page-acts {
            display: flex;
            gap: 8px;
            margin: 6px 0 14px;
        }

        /* ═══ SETTINGS ═══ */
        .settings-card {
            background: var(--surface);
            padding: 12px 14px;
            border-radius: var(--r-md);
            box-shadow: var(--sh-sm);
            border: 1px solid var(--border);
            margin-bottom: 10px;
        }

        .settings-card h3 {
            font-size: .84rem;
            font-weight: 700;
            color: var(--primary);
            margin-bottom: 9px;
        }

        .tag-row {
            display: flex;
            gap: 7px;
            margin-bottom: 7px;
        }

        .tag-row input {
            flex: 1;
            height: 36px;
            padding: 0 10px;
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            outline: none;
            font-family: inherit;
            background: var(--surface-lt);
            font-size: .86rem;
            color: var(--text);
        }

        .tag-row input:focus {
            border-color: var(--primary);
        }

        .tag-add {
            background: var(--primary);
            color: #fff;
            border: none;
            padding: 0 13px;
            border-radius: var(--r-sm);
            cursor: pointer;
            font-size: .96rem;
            height: 36px;
        }

        .tags-wrap {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            padding: 4px 0 8px;
            max-height: 110px;
            overflow-y: auto;
        }

        .tag {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            background: var(--surface-lt);
            border: 1.5px solid var(--border);
            padding: 3px 9px;
            border-radius: 99px;
            font-size: .74rem;
            font-weight: 500;
        }

        .tag i {
            color: var(--danger);
            cursor: pointer;
            font-size: .7rem;
        }

        /* ═══ REPORTS ═══ */
        .filter-row {
            display: flex;
            gap: 8px;
            margin-bottom: 8px;
        }

        .filter-item {
            flex: 1;
        }

        .filter-item label {
            display: block;
            font-size: .64rem;
            font-weight: 700;
            color: var(--muted);
            margin-bottom: 3px;
            text-transform: uppercase;
        }

        .filter-item input {
            width: 100%;
            height: 36px;
            padding: 0 9px;
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            outline: none;
            background: var(--surface-lt);
            font-family: inherit;
            font-size: .84rem;
            color: var(--text);
        }

        .filter-item input:focus {
            border-color: var(--primary);
        }

        .reports-filter-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            margin-bottom: 8px;
        }

        .reports-filter-grid .filter-item {
            min-width: 0;
        }

        .reports-filter-grid .filter-item input,
        .reports-filter-grid .filter-item select {
            min-width: 0;
        }

        .reports-filter-full {
            width: 100%;
            margin-top: 10px;
        }

        .rpt-invoices-table-wrap {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            width: 100%;
        }

        .rpt-invoices-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.74rem;
            table-layout: fixed;
            min-width: 680px;
        }

        .rpt-invoices-table th,
        .rpt-invoices-table td {
            padding: 8px 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            vertical-align: middle;
            box-sizing: border-box;
        }

        .rpt-invoices-table th {
            border-bottom: 1.5px solid var(--border);
            color: var(--muted);
            font-size: 0.64rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 700;
        }

        .rpt-invoices-table .col-date {
            width: 9%;
        }

        .rpt-invoices-table .col-ref {
            width: 10%;
        }

        .rpt-invoices-table .col-supplier {
            width: 22%;
        }

        .rpt-invoices-table .col-location {
            width: 12%;
        }

        .rpt-invoices-table .col-category {
            width: 12%;
        }

        .rpt-invoices-table .col-method {
            width: 11%;
        }

        .rpt-invoices-table .col-amount {
            width: 14%;
        }

        .rpt-invoices-table .col-status {
            width: 6%;
        }

        @media (min-width: 700px) {
            .reports-filter-grid {
                grid-template-columns: repeat(4, minmax(0, 1fr));
            }
        }

        .export-row {
            display: flex;
            gap: 8px;
            margin-bottom: 0;
        }

        .btn-export {
            flex: 1;
            background: var(--surface-lt);
            border: 1.5px solid var(--border);
            padding: 8px;
            border-radius: var(--r-sm);
            cursor: pointer;
            font-weight: 600;
            font-family: inherit;
            color: var(--text);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 6px;
            transition: background .18s;
            font-size: .8rem;
        }

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

        .report-filter-actions {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .report-filter-action-btn,
        .report-cat-toggle {
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--muted);
            border-radius: 999px;
            font-family: inherit;
            font-weight: 700;
            cursor: pointer;
            transition: all .18s ease;
        }

        .report-filter-action-btn {
            padding: 6px 10px;
            font-size: .68rem;
        }

        .report-cat-toggle {
            padding: 7px 12px;
            font-size: .72rem;
            line-height: 1;
        }

        .report-filter-action-btn:hover,
        .report-cat-toggle:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .report-cat-toggle.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }

        /* ── Reports page redesign ── */
        .rpt-tabs-wrap {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 14px;
        }

        .rpt-tab {
            display: flex;
            align-items: center;
            gap: 10px;
            text-align: left;
            padding: 10px 12px;
            border-radius: 14px;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            cursor: pointer;
            font-family: inherit;
            min-width: 0;
            transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
        }

        .rpt-tab:hover {
            border-color: rgba(0, 92, 85, 0.35);
        }

        .rpt-tab.active,
        .rpt-tab.sub-tab-active {
            border-color: var(--primary);
            background: linear-gradient(180deg, rgba(0, 92, 85, 0.08), rgba(0, 92, 85, 0.02));
            box-shadow: 0 0 0 3px rgba(0, 92, 85, 0.1);
        }

        .rpt-tab-icon {
            width: 38px;
            height: 38px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: var(--surface-lt);
            color: var(--muted);
            flex: 0 0 auto;
        }

        .rpt-tab.active .rpt-tab-icon,
        .rpt-tab.sub-tab-active .rpt-tab-icon {
            background: var(--primary);
            color: #fff;
        }

        .rpt-tab-text {
            display: flex;
            flex-direction: column;
            gap: 1px;
            min-width: 0;
        }

        .rpt-tab-text strong {
            font-size: 0.84rem;
            font-weight: 700;
            line-height: 1.2;
        }

        .rpt-tab-text small {
            font-size: 0.68rem;
            color: var(--muted);
            font-weight: 500;
        }

        @media (max-width: 480px) {
            .rpt-tab {
                padding: 8px 10px;
                gap: 8px;
                border-radius: 12px;
            }

            .rpt-tab-icon {
                width: 32px;
                height: 32px;
                border-radius: 10px;
                font-size: 0.85rem;
            }

            .rpt-tab-text strong {
                font-size: 0.74rem;
            }

            .rpt-tab-text small {
                font-size: 0.6rem;
            }
        }

        /* Outstanding / Paid History filters — 2 compact rows on wide screens */
        @media (min-width: 1024px) {

            #outFilterPanel.open,
            #phFilterPanel.open {
                gap: 10px;
            }

            #outFilterPanel .st-filter-top,
            #phFilterPanel .st-filter-top {
                display: flex;
                flex-wrap: nowrap;
                align-items: center;
                gap: 10px;
            }

            #outFilterPanel .st-filter-top .st-chips,
            #phFilterPanel .st-filter-top .st-chips {
                flex: 1 1 auto;
                justify-content: flex-end;
                min-width: 0;
                flex-wrap: nowrap;
            }

            #outFilterPanel .st-filter-bottom,
            #phFilterPanel .st-filter-bottom {
                display: flex;
                flex-wrap: nowrap;
                align-items: center;
                gap: 10px;
            }

            #outFilterPanel .st-filter-bottom .st-search,
            #phFilterPanel .st-filter-bottom .st-search {
                flex: 1 1 auto;
                min-width: 0;
            }
        }

        @media (max-width: 1023px) {

            #outFilterPanel .st-filter-top,
            #phFilterPanel .st-filter-top,
            #outFilterPanel .st-filter-bottom,
            #phFilterPanel .st-filter-bottom {
                display: flex;
                flex-wrap: wrap;
                align-items: center;
                gap: 10px;
            }
        }

        .rpt-kpi-strip {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 12px 14px;
            margin-bottom: 14px;
            box-shadow: var(--sh-sm);
        }

        .rpt-kpi-strip-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 10px;
        }

        .rpt-kpi-strip-top #rptDateRangeLabel {
            margin: 0;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--muted);
        }

        .rpt-kpi-inline {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
        }

        @media (min-width: 700px) {
            .rpt-kpi-inline {
                grid-template-columns: 1.2fr 1fr 1fr;
            }
        }

        .rpt-kpi-cell {
            padding: 10px 12px;
            border-radius: 10px;
            background: var(--surface-lt);
            border: 1px solid transparent;
            min-width: 0;
        }

        .rpt-kpi-cell.is-total {
            background: rgba(0, 92, 85, 0.08);
            border-color: rgba(0, 92, 85, 0.12);
        }

        .rpt-kpi-cell .dash-kpi-label {
            font-size: 0.64rem;
            margin-bottom: 2px;
        }

        .rpt-kpi-cell .hero-amount,
        .rpt-kpi-cell .hero-stat-val {
            font-size: 1.05rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            line-height: 1.15;
            color: var(--text);
            display: block;
        }

        .rpt-kpi-cell.is-total .hero-amount {
            color: var(--primary);
        }

        .rpt-kpi-cell.is-paid .hero-stat-val {
            color: var(--success);
        }

        .rpt-kpi-cell.is-remain .hero-stat-val {
            color: var(--danger);
        }

        .rpt-kpi-cell .dash-kpi-count {
            font-size: 0.68rem;
            margin-top: 2px;
        }

        .rpt-filters {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 14px;
            padding: 14px;
            background: rgba(255, 255, 255, 0.72);
            border: 1px solid var(--border);
            border-radius: 14px;
            box-shadow: var(--sh-sm);
        }

        body.dark .rpt-filters,
        body.dark .rpt-kpi-strip,
        body.dark .rpt-tab {
            background: var(--surface);
        }

        .rpt-filters-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .rpt-filters-grid.cols-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        @media (min-width: 900px) {
            .rpt-filters-grid.cols-4 {
                grid-template-columns: repeat(4, minmax(0, 1fr));
            }
        }

        .rpt-field {
            display: flex;
            flex-direction: column;
            gap: 5px;
            min-width: 0;
        }

        .rpt-field .modal-input,
        .rpt-field .st-select {
            width: 100%;
            border-radius: 12px;
            box-sizing: border-box;
        }

        .rpt-field .st-select {
            min-width: 0;
        }

        .rpt-cat-block {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .rpt-cat-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }

        .rpt-cat-head .modal-field-label {
            margin: 0;
        }

        .rpt-cat-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 10px;
            background: var(--surface-lt);
            border: 1px solid var(--border);
            border-radius: 12px;
            max-height: 140px;
            overflow-y: auto;
        }

        .rpt-sec-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin: 4px 0 10px;
        }

        .rpt-sec-head h3 {
            margin: 0;
            font-size: 1rem;
            font-weight: 700;
            color: var(--text);
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .rpt-sec-head h3 i {
            color: var(--primary);
            font-size: 0.9rem;
        }

        .tracker-results {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 4px;
        }

        .tracker-card {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid var(--border);
            background: var(--surface);
            cursor: pointer;
            box-shadow: var(--sh-sm);
            transition: border-color .15s, box-shadow .15s;
        }

        .tracker-card:hover {
            border-color: rgba(0, 92, 85, 0.35);
            box-shadow: var(--sh-md);
        }

        .tracker-card.is-paid {
            border-left: 3px solid var(--success);
        }

        .tracker-card.is-partial {
            border-left: 3px solid #d97706;
        }

        .tracker-card.is-open {
            border-left: 3px solid var(--danger);
        }

        .tracker-card-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
        }

        .tracker-card-name {
            font-size: 0.84rem;
            font-weight: 700;
            color: var(--primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 0;
        }

        .tracker-badge {
            font-size: 0.58rem;
            font-weight: 800;
            padding: 3px 7px;
            border-radius: 999px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            flex-shrink: 0;
        }

        .tracker-badge.paid {
            background: rgba(16, 185, 129, 0.14);
            color: #047857;
        }

        .tracker-badge.partial {
            background: rgba(59, 130, 246, 0.14);
            color: #1d4ed8;
        }

        .tracker-badge.open {
            background: rgba(245, 158, 11, 0.16);
            color: #92400e;
        }

        .tracker-card-body {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            gap: 10px;
        }

        .tracker-ref {
            font-size: 0.74rem;
            font-weight: 700;
            color: var(--text);
        }

        .tracker-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 4px 10px;
            margin-top: 3px;
            font-size: 0.64rem;
            color: var(--muted);
            font-weight: 600;
        }

        .tracker-amt {
            font-size: 0.88rem;
            font-weight: 800;
            flex-shrink: 0;
        }

        .tracker-amt.paid {
            color: var(--success);
        }

        .tracker-amt.open {
            color: var(--danger);
        }

        .tracker-pager {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
            margin-top: 8px;
            padding-top: 10px;
            border-top: 1px solid var(--border);
        }

        .tracker-pager button {
            padding: 6px 10px;
            font-size: 0.72rem;
            font-weight: 700;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            color: var(--primary);
            cursor: pointer;
            font-family: inherit;
        }

        .tracker-pager button:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .tracker-empty {
            text-align: center;
            color: var(--danger);
            font-size: 0.78rem;
            font-weight: 600;
            padding: 18px 10px;
        }

        .sum-box {
            background: var(--surface);
            padding: 12px;
            border-radius: var(--r-md);
            text-align: center;
            margin-bottom: 8px;
            box-shadow: var(--sh-sm);
        }

        .sum-box h3 {
            font-size: .68rem;
            color: var(--muted);
            font-weight: 500;
            margin-bottom: 2px;
        }

        .sum-box .total {
            font-size: 1.4rem;
            color: var(--primary);
            font-weight: 700;
        }

        .cat-row {
            display: flex;
            justify-content: space-between;
            padding: 8px 11px;
            background: var(--surface);
            border-radius: var(--r-sm);
            font-size: .8rem;
            box-shadow: var(--sh-sm);
            border: 1px solid var(--border);
            margin-bottom: 5px;
        }

        /* ═══ SEARCH ═══ */
        .search-bar {
            margin-bottom: 10px;
        }

        .search-bar .iw {
            margin-bottom: 0;
        }

        /* ═══ LOADER ═══ */
        .loader-overlay {
            position: fixed;
            inset: 0;
            background: rgba(238, 242, 245, .88);
            backdrop-filter: blur(4px);
            z-index: 100;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity .2s;
        }

        .loader-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        html.preload .loader-overlay,
        html.preload body.dark .loader-overlay {
            opacity: 1;
            pointer-events: auto;
            background: var(--bg) !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }

        html.preload .app-view {
            transition: none !important;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 3px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin .75s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        /* ═══ TOAST ═══ */
        .toast {
            position: fixed;
            bottom: 22px;
            left: 50%;
            transform: translateX(-50%) translateY(70px);
            background: var(--text);
            color: #fff;
            padding: 9px 16px;
            border-radius: var(--r-md);
            font-size: .8rem;
            z-index: 99999 !important;
            transition: transform .28s cubic-bezier(.175, .885, .32, 1.275), opacity .28s;
            opacity: 0;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 7px;
            width: calc(100% - 24px);
            max-width: 400px;
            justify-content: center;
        }

        .toast.show {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }

        .toast.success {
            background: var(--success);
        }

        .toast.danger {
            background: var(--danger);
        }

        .toast.warning {
            background: var(--warning);
            color: var(--text);
        }

        /* ═══ MODALS — Stitch-aligned ═══ */
        .modal-overlay {
            position: absolute;
            inset: 0;
            z-index: 1200;
            background: rgba(11, 28, 48, 0.55);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px;
            margin: 0;
            box-sizing: border-box;
            opacity: 0;
            pointer-events: none;
        }

        .modal-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        #confirmModal {
            z-index: 4000 !important;
        }

        #erp-scan-preview-modal {
            z-index: 1500 !important;
            position: fixed;
        }

        #erp-scan-preview-modal .modal-card {
            max-width: min(920px, 96vw);
            width: 96vw;
            max-height: 92vh;
            display: flex;
            flex-direction: column;
            padding: 0;
            border: 1px solid var(--border);
        }

        .erp-scan-preview-frame {
            width: 100%;
            min-height: 62vh;
            max-height: 72vh;
            border: 1.5px solid var(--border);
            border-radius: var(--r-md);
            background: #111;
            object-fit: contain;
        }

        #tab-entry,
        #tab-vendor-entry {
            position: absolute;
            inset: 0;
            z-index: 1300;
            background: rgba(11, 28, 48, 0.55);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px;
            margin: 0;
            box-sizing: border-box;
            opacity: 0;
            pointer-events: none;
        }

        #tab-entry:not(.hidden),
        #tab-vendor-entry:not(.hidden) {
            display: flex !important;
            opacity: 1 !important;
            pointer-events: auto !important;
        }

        .modal-card {
            width: 100% !important;
            min-width: 0;
            max-width: 560px !important;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: 0 20px 48px rgba(11, 28, 48, 0.18);
            padding: 0;
            box-sizing: border-box;
            max-height: 84vh !important;
            max-height: 84dvh !important;
            display: flex !important;
            flex-direction: column !important;
            overflow: hidden !important;
            margin: 0 auto;
        }

        @media (min-width: 520px) {
            .modal-card {
                width: min(560px, 92vw) !important;
                min-width: 400px;
            }

            .modal-card.modal-wide {
                max-width: 720px !important;
                width: min(720px, 94vw) !important;
            }
        }

        @keyframes scaleUp {
            from {
                opacity: 0;
                transform: scale(.96) translateY(6px);
            }

            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            margin: 0;
            padding: 16px 18px 14px;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
            background: #fff;
        }

        .modal-title {
            font-size: 1.05rem;
            font-weight: 600;
            letter-spacing: -0.02em;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .modal-title i {
            color: var(--primary);
            font-size: 0.95rem;
        }

        .modal-close {
            width: 34px;
            height: 34px;
            border-radius: 10px;
            background: var(--surface-lt);
            border: 1px solid var(--border);
            cursor: pointer;
            color: var(--muted);
            font-size: 0.9rem;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s, color 0.15s;
        }

        .modal-close:hover {
            background: #fff;
            color: var(--text);
        }

        .modal-body {
            display: flex;
            flex-direction: column;
            gap: 12px;
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 16px 18px;
            background: var(--bg);
        }

        .modal-field-label {
            font-size: 0.68rem;
            font-weight: 700;
            color: var(--muted);
            text-transform: uppercase;
            display: block;
            margin-bottom: 5px;
            letter-spacing: 0.04em;
        }

        .modal-val {
            font-size: 0.92rem;
            font-weight: 600;
            color: var(--text);
            word-break: break-word;
        }

        .modal-info-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        @media (max-width: 520px) {

            .modal-info-grid,
            .modal-2col {
                grid-template-columns: 1fr;
                flex-direction: column;
            }
        }

        .modal-info-tile {
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px 12px 10px;
        }

        .modal-input,
        .modal-select {
            width: 100%;
            height: 42px;
            padding: 0 12px;
            border: 1px solid var(--border);
            border-radius: 12px;
            font-size: 0.88rem;
            font-family: inherit;
            font-weight: 500;
            outline: none;
            background: #fff;
            color: var(--text);
            transition: border-color .15s, box-shadow .15s;
            box-sizing: border-box;
        }

        select.modal-select,
        #vendorMgmtUpdateModal .st-select,
        #tab-vendor-mgmt .st-select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            padding-right: 36px;
            cursor: pointer;
            background-color: #fff;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.6'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 14px 14px;
            border-radius: 12px;
        }

        body.dark select.modal-select,
        body.dark #vendorMgmtUpdateModal .st-select,
        body.dark #tab-vendor-mgmt .st-select {
            background-color: #171717;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%94a3b8' stroke-width='2.6'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 14px 14px;
        }

        .modal-input:focus,
        .modal-select:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(0, 92, 85, 0.12);
        }

        .modal-input.big {
            height: 52px;
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--primary);
            text-align: center;
            letter-spacing: -0.02em;
        }

        .modal-hint {
            font-size: 0.72rem;
            color: var(--muted);
            margin-top: 6px;
            line-height: 1.4;
        }

        .align-payee-row {
            padding: 12px 14px;
            border-bottom: 1px solid var(--border);
        }

        .align-payee-row:last-child {
            border-bottom: none;
        }

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

        .align-payee-meta {
            font-size: 0.68rem;
            color: var(--muted);
            margin-top: 3px;
        }

        .align-payee-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 10px;
        }

        .align-link-picker {
            display: none;
            gap: 8px;
            margin-top: 8px;
            align-items: center;
        }

        .align-link-picker.open {
            display: flex;
        }

        .modal-actions {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 10px;
            margin: 0;
            padding: 14px 18px;
            border-top: 1px solid var(--border);
            background: #fff;
            flex-shrink: 0;
            flex-wrap: nowrap;
        }

        .modal-actions>.btn,
        .modal-actions>.st-btn,
        .modal-actions>button {
            flex: 1 1 0;
            width: auto;
            min-width: 0;
            height: 42px !important;
            min-height: 42px !important;
            max-height: 42px !important;
            padding: 0 12px !important;
            margin: 0;
            border-radius: 10px !important;
            font-size: 0.8125rem !important;
            font-weight: 600 !important;
            line-height: 1 !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            text-align: center !important;
            box-sizing: border-box;
            white-space: nowrap;
        }

        .modal-actions>.btn.hidden,
        .modal-actions>.st-btn.hidden,
        .modal-actions>button.hidden {
            display: none !important;
        }

        .modal-actions>.btn i,
        .modal-actions>.st-btn i,
        .modal-actions>button i,
        .modal-actions .modal-actions-btns>.btn i,
        .modal-actions .modal-actions-btns>.st-btn i {
            line-height: 1;
        }

        .modal-actions>.modal-footer-meta,
        .modal-actions>.modal-actions-meta {
            flex: 1 1 auto;
            min-width: 0;
        }

        .modal-actions>.modal-actions-btns {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1 1 auto;
            justify-content: flex-end;
            min-width: 0;
        }

        #invoiceItemsModal .inv-items-action-btns {
            gap: 6px;
            flex-wrap: nowrap;
        }

        #invoiceItemsModal .inv-items-action-btns>.btn,
        #invoiceItemsModal .inv-items-action-btns>.st-btn {
            height: 32px !important;
            min-height: 32px !important;
            padding: 0 10px !important;
            font-size: 0.72rem !important;
            border-radius: 8px !important;
            flex: 0 0 auto;
            gap: 5px;
        }

        #invoiceItemsModal .inv-items-action-btns>.btn i,
        #invoiceItemsModal .inv-items-action-btns>.st-btn i {
            font-size: 0.7rem;
        }

        @media (max-width: 640px) {

            #invoiceItemsModal .modal-actions {
                flex-direction: column;
                align-items: stretch;
                justify-content: flex-start;
                flex-wrap: nowrap;
                gap: 10px;
            }

            #invoiceItemsModal .modal-actions>.modal-footer-meta {
                flex: 0 0 auto;
                width: 100%;
                min-width: 0;
            }

            #invoiceItemsModal .modal-actions>.inv-items-action-btns {
                flex: 0 0 auto;
                width: 100%;
                justify-content: stretch;
                gap: 8px;
                min-width: 0;
            }

            #invoiceItemsModal .inv-items-action-btns>.btn,
            #invoiceItemsModal .inv-items-action-btns>.st-btn {
                flex: 1 1 0 !important;
                width: 0 !important;
                min-width: 0 !important;
                max-width: none !important;
                height: 40px !important;
                min-height: 40px !important;
                max-height: 40px !important;
                padding: 0 6px !important;
                font-size: 0.7rem !important;
            }

            #invoiceItemsModal .inv-items-action-btns>.btn.hidden,
            #invoiceItemsModal .inv-items-action-btns>.st-btn.hidden {
                display: none !important;
            }
        }

        @media (max-width: 420px) {

            #invoiceItemsModal .inv-items-action-btns>.btn,
            #invoiceItemsModal .inv-items-action-btns>.st-btn {
                padding: 0 8px !important;
                font-size: 0.68rem !important;
            }
        }

        .modal-actions>.modal-actions-btns>.btn,
        .modal-actions>.modal-actions-btns>.st-btn,
        .modal-actions>.modal-actions-btns>button {
            flex: 1 1 0;
            min-width: 96px;
            max-width: 160px;
            height: 42px !important;
            min-height: 42px !important;
            max-height: 42px !important;
            padding: 0 12px !important;
            border-radius: 10px !important;
            font-size: 0.8125rem !important;
            font-weight: 600 !important;
            line-height: 1 !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            text-align: center !important;
            box-sizing: border-box;
            white-space: nowrap;
        }

        .modal-2col {
            display: flex;
            gap: 12px;
        }

        .modal-2col>div {
            flex: 1;
            min-width: 0;
        }

        .confirm-msg {
            font-size: 0.9rem;
            color: var(--text);
            line-height: 1.55;
            padding: 4px 2px 2px;
            flex-shrink: 0;
        }

        #confirmModal .modal-card {
            max-width: 420px !important;
        }

        #confirmModal .modal-body {
            display: none;
        }

        #confirmModal .confirm-msg {
            padding: 16px 18px 4px;
            background: var(--bg);
        }

        #confirmModal .modal-actions {
            border-top: none;
            padding-top: 10px;
        }

        .pay-confirm-box {
            margin-top: 2px;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid rgba(0, 92, 85, 0.2);
            background: rgba(0, 92, 85, 0.06);
            color: var(--muted);
            font-size: 0.78rem;
            line-height: 1.45;
            font-weight: 500;
        }

        .modal-footer-meta {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text);
        }

        .modal-footer-meta strong {
            color: var(--primary);
            font-size: 0.95rem;
        }

        body.dark .modal-card,
        body.dark .modal-header,
        body.dark .modal-actions,
        body.dark .modal-info-tile,
        body.dark .modal-input,
        body.dark .modal-select {
            background: var(--surface);
        }

        body.dark .modal-body,
        body.dark #confirmModal .confirm-msg {
            background: var(--bg);
        }

        /* Shared medium list — Outstanding + Paid History (not dense, not cardy) */
        #tab-paid-history .st-sec,
        #tab-outstanding .st-sec {
            margin-bottom: 14px;
        }

        #tab-paid-history .st-sec-head,
        #tab-outstanding .st-sec-head {
            margin-bottom: 8px;
        }

        #tab-paid-history .st-sec-head h3,
        #tab-outstanding .st-sec-head h3 {
            font-size: 0.95rem;
        }

        .st-row-list,
        .ph-dense-list {
            display: flex;
            flex-direction: column;
            gap: 0;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 14px;
            overflow: hidden;
            box-shadow: var(--sh-sm);
        }

        .st-row,
        .ph-dense-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
            gap: 12px 16px;
            min-height: 66px;
            padding: 13px 16px;
            border-bottom: 1px solid rgba(189, 201, 198, 0.42);
            cursor: pointer;
            background: #fff;
            transition: background 0.12s;
        }

        .st-row:last-child,
        .ph-dense-row:last-child {
            border-bottom: none;
        }

        .st-row:hover,
        .ph-dense-row:hover {
            background: var(--surface-lt);
        }

        .st-row.is-urgent {
            box-shadow: inset 3px 0 0 var(--danger);
        }

        .st-row-ident {
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 0;
        }

        .st-row-avatar {
            width: 40px;
            height: 40px;
            border-radius: 999px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--st-avatar);
            border: 1px solid rgba(189, 201, 198, 0.5);
            color: var(--primary);
            font-size: 0.8rem;
            font-weight: 650;
        }

        .st-row-avatar.branch {
            color: #006b5f;
        }

        .st-row-avatar.misc {
            color: #495167;
        }

        .st-row-left,
        .ph-dense-left {
            min-width: 0;
        }

        .st-row-name,
        .ph-dense-name {
            font-size: 0.92rem;
            font-weight: 650;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            letter-spacing: -0.01em;
        }

        .st-row-meta,
        .ph-dense-meta {
            margin-top: 3px;
            font-size: 0.74rem;
            color: var(--muted);
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .st-row-facts {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 3px 10px;
            margin-top: 5px;
        }

        .st-row-fact {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            max-width: 100%;
            font-size: 0.66rem;
            font-weight: 600;
            color: var(--muted);
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
        }

        .st-row-fact i {
            font-size: 0.58rem;
            opacity: 0.72;
            flex-shrink: 0;
        }

        .st-row-fact.loc {
            color: var(--primary);
            font-weight: 700;
        }

        .st-row-fact.due {
            color: var(--primary);
            font-weight: 700;
        }

        .st-row-fact.due.is-overdue {
            color: var(--danger);
        }

        .st-row-fact.due-empty {
            color: var(--muted);
            font-weight: 600;
        }

        .inv-due-editor {
            padding: 6px 10px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .inv-due-editor .inv-due-label-row {
            display: flex;
            align-items: baseline;
            gap: 8px;
            min-width: 0;
            white-space: nowrap;
        }

        .inv-due-editor .inv-due-kicker {
            color: var(--muted);
            font-size: 0.64rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: .04em;
            flex-shrink: 0;
        }

        .inv-due-editor .inv-due-status {
            font-weight: 700;
            font-size: 0.78rem;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .inv-due-editor .inv-due-controls {
            display: flex;
            align-items: center;
            gap: 6px;
            flex: 0 0 auto;
        }

        .inv-due-editor input[type="date"] {
            height: 30px;
            box-sizing: border-box;
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0 8px;
            font-size: 0.75rem;
            line-height: 1;
            background: var(--bg);
            color: var(--text);
        }

        .inv-due-editor .inv-due-clear.st-btn {
            height: 30px !important;
            min-height: 30px !important;
            max-height: 30px !important;
            padding: 0 10px !important;
            font-size: 0.72rem !important;
            border-radius: 8px !important;
            box-sizing: border-box;
        }

        .entry-vendor-row {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .entry-vendor-row select {
            flex: 1 1 auto;
            width: 100% !important;
            min-width: 0;
        }

        .entry-invoice-photo-btn {
            flex: 0 0 auto;
            height: 38px;
            min-height: 38px;
            min-width: 92px;
            padding: 0 12px;
            border-radius: var(--r-sm);
            border: 1.5px solid var(--border);
            background: var(--surface);
            color: var(--primary);
            font-family: inherit;
            font-size: 0.68rem;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            cursor: pointer;
            white-space: nowrap;
            line-height: 1;
            box-sizing: border-box;
        }

        .entry-invoice-photo-btn i {
            font-size: 0.78rem;
        }

        .entry-invoice-photo-btn:hover {
            background: var(--surface-lt);
        }

        .entry-invoice-photo-btn:disabled {
            opacity: 0.65;
            cursor: wait;
        }

        .entry-invoice-photo-btn.has-photo {
            border-color: rgba(10, 68, 74, 0.28);
        }

        .st-row-right,
        .ph-dense-right {
            text-align: right;
            flex-shrink: 0;
        }

        .st-row-amt,
        .ph-dense-amt {
            font-size: 0.98rem;
            font-weight: 650;
            color: var(--text);
            white-space: nowrap;
            letter-spacing: -0.02em;
        }

        .st-row.is-settled .st-row-amt,
        .ph-dense-list .ph-dense-amt {
            color: var(--success);
        }

        .st-row-due,
        .st-row-count,
        .ph-dense-count {
            margin-top: 3px;
            font-size: 0.7rem;
            color: var(--muted);
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: flex-end;
            gap: 4px;
        }

        .st-row-due.is-urgent {
            color: var(--danger);
        }

        .st-row-actions {
            display: flex;
            gap: 6px;
            margin-top: 8px;
            justify-content: flex-end;
        }

        .st-row-actions .st-btn {
            height: 30px;
            padding: 0 10px;
            font-size: 0.72rem;
        }

        .st-summary-inline {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 12px;
            padding: 12px 14px;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 12px;
            box-shadow: var(--sh-sm);
        }

        .st-summary-inline.show {
            display: flex;
        }

        .st-summary-inline #pbSummaryCount {
            font-weight: 650;
            font-size: 0.86rem;
            color: var(--text);
        }

        .st-summary-inline #pbSummaryTotal {
            font-weight: 700;
            font-size: 0.95rem;
            color: var(--primary);
        }

        body.dark .st-row-list,
        body.dark .ph-dense-list,
        body.dark .st-row,
        body.dark .ph-dense-row,
        body.dark .st-summary-inline {
            background: var(--surface);
        }

        body.dark .st-row:hover,
        body.dark .ph-dense-row:hover {
            background: var(--surface-lt);
        }

        body.dark .st-row,
        body.dark .ph-dense-row {
            border-bottom-color: var(--border);
        }

        body.dark .entry-invoice-photo-btn {
            background: var(--surface);
            border-color: var(--border);
            color: var(--primary);
        }

        /* ═══ PAID HISTORY ACCORDION ═══ */
        .acc-card {
            background: var(--surface);
            border: none;
            border-radius: var(--r-md);
            margin-bottom: 7px;
            overflow: hidden;
            box-shadow: var(--sh-sm);
        }

        .acc-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 13px;
            cursor: pointer;
        }

        .acc-header h4 {
            font-size: .82rem;
            font-weight: 700;
            color: var(--text);
        }

        .acc-header .sub {
            font-size: .62rem;
            color: var(--success);
            font-weight: 600;
            margin-top: 1px;
        }

        .acc-header .amt {
            font-size: .86rem;
            font-weight: 800;
            color: var(--success);
        }

        .acc-body {
            display: none;
            padding: 9px 13px 11px;
            border-top: none;
            animation: slideDown .22s;
        }

        .acc-card.open .acc-body {
            display: block;
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-5px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .dtable {
            width: 100%;
            border-collapse: collapse;
            font-size: .62rem;
        }

        .dtable th {
            text-align: left;
            color: var(--muted);
            padding: 4px 2px;
            border-bottom: none;
            font-weight: 700;
            text-transform: uppercase;
            font-size: .52rem;
            letter-spacing: .4px;
        }

        .dtable td {
            padding: 5px 2px;
            border-bottom: none;
            color: var(--text);
            font-weight: 500;
            white-space: nowrap;
        }

        .dtable tr:last-child td {
            border-bottom: none;
        }

        .dtotal {
            display: flex;
            justify-content: space-between;
            padding: 6px 9px;
            background: #f0fdf4;
            border-radius: var(--r-sm);
            font-weight: 700;
            font-size: .68rem;
            color: var(--success);
            margin-top: 7px;
            border: none;
        }

        /* ═══ PAYMENT HISTORY LIST ═══ */
        .ph-search-wrap {
            position: relative;
            margin-bottom: 10px;
        }

        .ph-search-wrap i.ph-search-icon {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted);
            font-size: .82rem;
            pointer-events: none;
        }

        .ph-search-input {
            width: 100%;
            height: 40px;
            padding: 0 36px 0 36px;
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            font-size: .86rem;
            background: var(--surface);
            color: var(--text);
            outline: none;
            font-family: inherit;
            transition: border-color .2s, box-shadow .2s;
        }

        .ph-search-input:focus {
            border-color: var(--primary);
            box-shadow: none;
        }

        .ph-list {
            display: flex;
            flex-direction: column;
            gap: 0;
            background: var(--surface);
            border: 1.5px solid var(--border);
            border-radius: var(--r-md);
            overflow: hidden;
            box-shadow: var(--sh-sm);
        }

        .ph-row {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 13px 14px;
            cursor: pointer;
            border-bottom: 1px solid var(--border);
            transition: background .15s;
            text-decoration: none;
            background: transparent;
        }

        .ph-row:hover {
            background: var(--surface-lt);
        }

        .ph-row:last-child {
            border-bottom: none;
        }

        .ph-row:active {
            background: var(--bg);
        }

        .ph-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: .78rem;
            font-weight: 800;
            color: #fff;
            letter-spacing: -.5px;
            line-height: 1;
        }

        .ph-avatar.misc {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        }

        .ph-avatar.branch {
            background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
        }

        .ph-avatar.ph-count-lg {
            font-size: .64rem;
        }

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

        .ph-name {
            font-size: .84rem;
            font-weight: 700;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.2;
        }

        .ph-meta {
            font-size: .66rem;
            color: var(--muted);
            margin-top: 2px;
            font-weight: 500;
        }

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

        .ph-amount {
            font-size: .88rem;
            font-weight: 800;
            color: var(--success);
            display: block;
        }

        .ph-chevron {
            color: var(--border);
            font-size: .7rem;
            margin-left: 6px;
            flex-shrink: 0;
        }

        /* ═══ MONTH NAVIGATOR ═══ */
        .month-nav {
            display: flex;
            align-items: center;
            gap: 0;
            background: var(--surface);
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            overflow: hidden;
            margin-bottom: 12px;
            box-shadow: var(--sh-sm);
        }

        .month-nav-btn {
            background: none;
            border: none;
            width: 38px;
            height: 38px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--primary);
            font-size: .82rem;
            flex-shrink: 0;
            transition: background .15s;
        }

        .month-nav-btn:active {
            background: var(--bg);
        }

        .month-nav-label {
            flex: 1;
            text-align: center;
            font-size: .8rem;
            font-weight: 700;
            color: var(--primary);
            letter-spacing: .3px;
            padding: 0 4px;
        }

        .month-nav-all {
            background: none;
            border: none;
            border-left: 1px solid var(--border);
            height: 38px;
            padding: 0 10px;
            font-size: .68rem;
            font-weight: 700;
            color: var(--muted);
            cursor: pointer;
            font-family: inherit;
            transition: background .15s, color .15s;
            flex-shrink: 0;
        }

        .month-nav-all.active,
        .month-nav-all:hover {
            background: var(--primary);
            color: #fff;
        }

        /* ═══ BACK BTN ═══ */
        .back-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            height: 38px;
            padding: 0 14px;
            background: var(--surface);
            border: 1.5px solid var(--border);
            border-radius: var(--r-sm);
            font-size: .8rem;
            font-weight: 700;
            color: var(--primary);
            cursor: pointer;
            margin-bottom: 12px;
            font-family: inherit;
            box-shadow: var(--sh-sm);
            box-sizing: border-box;
            transition: all .15s;
        }

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

        /* Form Row for compact 2-column layout */
        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 10px;
        }

        .entry-split-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            gap: 8px;
            width: 100%;
        }

        .entry-split-row>.field {
            min-width: 0;
            margin-bottom: 0;
        }

        .entry-split-row select,
        .entry-split-row input {
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }

        .entry-split-row:has(> .hidden) {
            grid-template-columns: minmax(0, 1fr);
        }

        /* Expense classification wizard: 1 col mobile, 2 col tablet, 3 col desktop */
        .exp-wizard-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            width: 100%;
        }

        .exp-wizard-grid .field {
            min-width: 0;
            margin-bottom: 0;
        }

        @media (min-width: 520px) {
            .exp-wizard-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (min-width: 700px) {
            .exp-wizard-grid {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }
        }

        #tab-entry .modal-card.exp-form-card,
        #tab-vendor-entry .modal-card.exp-form-card {
            width: 100% !important;
            max-width: 720px !important;
            max-height: 80vh !important;
            max-height: 80dvh !important;
            padding: 0 !important;
        }

        @media (min-width: 520px) {

            #tab-entry .modal-card.exp-form-card,
            #tab-vendor-entry .modal-card.exp-form-card {
                width: min(720px, 92vw) !important;
                min-width: 420px;
            }
        }

        /* Confirm stays a bit tighter */
        #confirmModal .modal-card {
            max-width: 420px !important;
            min-width: 0;
        }

        @media (min-width: 520px) {
            #confirmModal .modal-card {
                min-width: 360px;
                max-width: 420px !important;
                width: min(420px, 92vw) !important;
            }
        }

        #wmsSyncModal .modal-card,
        #shortcutsModal .modal-card {
            max-width: 720px !important;
        }

        @media (max-width: 380px) {
            .form-row {
                grid-template-columns: 1fr;
                gap: 0;
                margin-bottom: 0;
            }

            .form-row .field {
                margin-bottom: 10px !important;
            }

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

        @media (max-width: 520px) {
            .entry-split-row,
            .entry-split-row:has(> .hidden) {
                grid-template-columns: 1fr;
                gap: 10px;
            }
        }

        .fc-form-top-row {
            display: grid;
            grid-template-columns: 1.25fr 1fr 0.8fr;
            gap: 10px;
            margin-bottom: 0;
        }

        .fc-form-top-row .field {
            min-width: 0;
            margin-bottom: 0;
        }

        /* ═══ FAB ═══ */
        .fab {
            position: absolute;
            bottom: 20px;
            right: 14px;
            width: 48px;
            height: 48px;
            background: var(--primary);
            color: #fff;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 1.25rem;
            box-shadow: none;
            cursor: pointer;
            z-index: 40;
            border: none;
            transition: transform .18s, box-shadow .18s;
        }

        .fab:hover {
            box-shadow: none;
        }

        .fab:active {
            transform: scale(.9);
        }

        @media (min-width: 768px) {
            .fab {
                right: 24px;
                bottom: 24px;
            }
        }

        /* Vendors on a phone: three actions in one row, form stays above the keyboard */
        @media (max-width: 1023px) {
            #mainView .fab {
                right: 16px;
                bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom, 0px));
            }

            #tab-list {
                padding-bottom: calc(var(--bottom-nav-h) + 76px + env(safe-area-inset-bottom, 0px)) !important;
            }

            #tab-vendors {
                padding-top: 8px;
            }

            #tab-vendors .st-head {
                margin-bottom: 8px;
            }

            #tab-vendors .st-actions {
                width: 100%;
                min-width: 0;
                display: flex;
                flex-wrap: nowrap;
                gap: 6px;
            }

            #tab-vendors .st-actions .st-btn {
                flex: 1 1 0;
                width: auto;
                min-width: 0;
                padding: 0 8px;
            }

            #tab-vendor-entry {
                align-items: stretch;
                justify-content: stretch;
                padding: 0;
            }

            #tab-vendor-entry .modal-card.exp-form-card {
                width: 100% !important;
                max-width: none !important;
                min-width: 0 !important;
                height: 100% !important;
                max-height: none !important;
                border-radius: 0 !important;
                box-shadow: none !important;
                margin: 0;
            }

            #tab-vendor-entry .modal-body {
                overscroll-behavior: contain;
                padding-bottom: 20px;
            }

            #tab-vendor-entry .modal-2col {
                flex-direction: column;
                gap: 12px;
            }

            #tab-vendor-entry .field,
            #tab-vendor-entry .modal-2col>div {
                min-width: 0;
                scroll-margin: 12px 0 28px;
            }

            #tab-vendor-entry .field-label,
            #tab-vendor-entry p,
            #tab-vendor-entry .modal-title {
                overflow-wrap: anywhere;
            }

            #tab-vendor-entry input,
            #tab-vendor-entry select,
            #tab-vendor-entry textarea {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                box-sizing: border-box;
                font-size: 16px;
            }

            #tab-vendor-entry .modal-actions {
                flex-wrap: wrap;
                padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
            }
        }

        /* ═══ UTILITY ═══ */
        .hidden {
            display: none !important;
        }

        .empty {
            text-align: center;
            color: var(--muted);
            padding: 24px 0;
            font-size: .82rem;
        }

        .empty i {
            font-size: 1.6rem;
            margin-bottom: 7px;
            display: block;
        }

        /* =========================================================================
           UI ENHANCEMENT SUITE
           ========================================================================= */

        /* Hover states */
        .nav-card {
            transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
        }

        .nav-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(10, 68, 74, 0.12);
            border-color: var(--primary);
        }

        .sup-card {
            transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
        }

        .sup-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(10, 68, 74, 0.12);
            border-color: var(--primary);
        }

        .item-card {
            transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s ease, background 0.15s ease;
        }

        .item-card:hover {
            transform: translateX(3px);
            box-shadow: 0 4px 16px rgba(10, 68, 74, 0.10);
            background: var(--surface-lt);
        }

        /* Stagger entrance animations */
        @keyframes erp-slideUp {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .nav-card {
            animation: erp-slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
        }

        .nav-card:nth-child(1) {
            animation-delay: 0.00s;
        }

        .nav-card:nth-child(2) {
            animation-delay: 0.05s;
        }

        .nav-card:nth-child(3) {
            animation-delay: 0.10s;
        }

        .nav-card:nth-child(4) {
            animation-delay: 0.15s;
        }

        .nav-card:nth-child(5) {
            animation-delay: 0.20s;
        }

        .nav-card:nth-child(6) {
            animation-delay: 0.25s;
        }

        .nav-card:nth-child(7) {
            animation-delay: 0.30s;
        }

        .nav-card:nth-child(8) {
            animation-delay: 0.35s;
        }

        .sup-card {
            animation: erp-slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
        }

        .sup-card:nth-child(1) {
            animation-delay: 0.00s;
        }

        .sup-card:nth-child(2) {
            animation-delay: 0.05s;
        }

        .sup-card:nth-child(3) {
            animation-delay: 0.10s;
        }

        .sup-card:nth-child(4) {
            animation-delay: 0.15s;
        }

        /* Coming back to the app must not replay the home entrance. */
        #tab-home.erp-entered .nav-card,
        #tab-home.erp-entered .sup-card {
            animation: none;
            opacity: 1;
            transform: none;
        }

        /* Skeleton loading */
        .skeleton {
            background: linear-gradient(90deg, var(--border) 25%, var(--surface-lt) 50%, var(--border) 75%);
            background-size: 200% 100%;
            animation: erp-shimmer 1.4s ease infinite;
            border-radius: 8px;
        }

        @keyframes erp-shimmer {
            from {
                background-position: 200% 0;
            }

            to {
                background-position: -200% 0;
            }
        }

        .skeleton-card {
            height: 80px;
            margin-bottom: 8px;
            border-radius: 12px;
        }

        /* Ripple */
        .ripple-wave {
            position: absolute;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.3);
            transform: scale(0);
            animation: erp-ripple 0.6s ease-out forwards;
            pointer-events: none;
        }

        @keyframes erp-ripple {
            to {
                transform: scale(4);
                opacity: 0;
            }
        }

        /* Scroll-aware header */
        .header {
            transition: box-shadow 0.25s ease;
        }

        .header.scrolled {
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        }

        /* Table row hover */
        table tbody tr {
            transition: background 0.15s ease;
        }

        table tbody tr:hover {
            background: rgba(10, 68, 74, 0.03);
        }

        /* Better focus rings */
        input:focus,
        select:focus,
        textarea:focus {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* Dark mode toggle */
        .dm-toggle {
            position: fixed;
            bottom: 80px;
            right: 16px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--primary);
            color: #fff;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            z-index: 50;
            transition: transform 0.2s ease;
        }

        body.modal-open .dm-toggle {
            display: none;
        }

        .dm-toggle:hover {
            transform: scale(1.1);
        }

        .dm-toggle:active {
            transform: scale(0.9);
        }

        /* Dark mode */
        body.dark {
            --primary: #b7bfc0;
            --primary-lt: #d0d5d6;
            --primary-dk: #9aa6a8;
            --bg: #121212;
            --surface: #1e1e1e;
            --surface-lt: #292929;
            --surface-2: #313131;
            --text: #ededed;
            --muted: #a1a1a1;
            --border: #3e3e3e;
        }

        body.dark .header {
            background-color: rgba(23, 23, 23, 0.9) !important;
            border-bottom-color: #414141 !important;
        }

        body.dark .sub-header {
            background: #323939 !important;
        }

        body.dark .login-card,
        body.dark .nav-card,
        body.dark .sup-card,
        body.dark .item-card,
        body.dark .pay-profile {
            background: var(--surface) !important;
            border-color: var(--border) !important;
        }

        body.dark .hero-card {
            background:
                radial-gradient(circle at top right, rgba(119, 186, 216, 0.18), transparent 34%),
                linear-gradient(135deg, #272c2d 0%, #384040 52%, #1f1f1f 100%) !important;
            border: 1px solid rgba(183, 191, 192, 0.16);
            box-shadow: 0 14px 32px rgba(11, 11, 11, 0.38);
        }

        body.dark .hero-card::after {
            background: rgba(163, 207, 228, 0.08);
        }

        body.dark .hero-label,
        body.dark .hero-stat-label {
            color: rgba(232, 232, 232, 0.72);
            opacity: 1;
        }

        body.dark .hero-amount {
            color: #ebcbb8;
            text-shadow: 0 2px 10px rgba(221, 198, 139, 0.12);
        }

        body.dark .hero-stats,
        body.dark .hero-stat:not(:last-child) {
            border-color: rgba(161, 161, 161, 0.2);
        }

        body.dark .hero-stat-val {
            color: #f9f9f9;
        }

        body.dark .report-filter-action-btn,
        body.dark .report-cat-toggle {
            background: #212121;
            border-color: #414141;
            color: #a1a1a1;
        }

        body.dark .report-filter-action-btn:hover,
        body.dark .report-cat-toggle:hover {
            background: rgba(183, 191, 192, 0.12);
            border-color: rgba(183, 191, 192, 0.45);
            color: #d4d4d4;
        }

        body.dark .report-cat-toggle.active {
            background: linear-gradient(135deg, #9aa6a8 0%, #5e6c6d 100%);
            border-color: rgba(183, 191, 192, 0.65);
            color: #fafbfb;
            box-shadow: 0 10px 24px rgba(94, 108, 109, 0.28);
        }

        body.dark .loader-overlay {
            background: rgba(6, 6, 6, 0.72);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }

        body.dark .spinner {
            border-color: rgba(161, 161, 161, 0.2);
            border-top-color: var(--primary);
        }

        body.dark #loaderText {
            color: #d4d4d4 !important;
        }

        body.dark input,
        body.dark select,
        body.dark textarea {
            background: #292929 !important;
            border-color: #414141 !important;
            color: var(--text) !important;
        }

        /* ── Dynamic Components Dark Mode ── */
        body.dark .modal-box {
            background: #292929 !important;
            border: 1px solid #414141 !important;
            color: var(--text) !important;
        }

        body.dark .modal-actions {
            border-top-color: #414141 !important;
        }

        body.dark .notice-box {
            background: #323232 !important;
            border-color: #414141 !important;
            color: var(--muted) !important;
        }

        body.dark .notice-error {
            border-left-color: #d16060 !important;
            color: #e8aeae !important;
        }

        body.dark .notice-error i {
            color: #db8484 !important;
        }

        body.dark .notice-warning {
            border-left-color: #d3ab67 !important;
            color: #e5d7a6 !important;
        }

        body.dark .notice-warning i {
            color: #ddc68b !important;
        }

        body.dark .notice-info {
            border-left-color: #77bad8 !important;
            color: #a3cfe4 !important;
        }

        body.dark .notice-info i {
            color: #77bad8 !important;
        }

        body.dark .notice-success {
            background: #0d2e1b !important;
            color: #ccd2d3 !important;
            border-color: #4b5656 !important;
        }

        body.dark .bottom-actions {
            background-color: rgba(23, 23, 23, 0.92) !important;
            border-top-color: #414141 !important;
        }

        body.dark .tab-btn {
            background: #323232 !important;
            border-color: #414141 !important;
            color: var(--muted) !important;
        }

        body.dark .tab-btn.active {
            background: var(--primary) !important;
            color: #171717 !important;
            border-color: var(--primary) !important;
        }

        body.dark .btn-outline {
            background: transparent !important;
            border-color: #414141 !important;
            color: var(--muted) !important;
        }

        body.dark .list-row,
        body.dark .pay-row,
        body.dark .inv-row {
            border-color: #414141 !important;
            background: #292929 !important;
        }

        /* Toast progress bar */
        .toast-progress {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 3px;
            background: rgba(255, 255, 255, 0.5);
            border-radius: 0 0 8px 8px;
            animation: erp-toast-shrink 3s linear forwards;
        }

        @keyframes erp-toast-shrink {
            from {
                width: 100%;
            }

            to {
                width: 0%;
            }
        }

        /* Tablet layout (700px+) */
        @media (min-width: 700px) {
            .sup-grid {
                grid-template-columns: repeat(2, 1fr) !important;
            }

            .content-area {
                padding: 20px 24px 28px !important;
            }
        }

        /* ═══ ERP V2 — FULL LAYOUT (Desktop + Mobile) ═══ */
        #mainView {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .erp-app-shell {
            display: flex;
            flex: 1;
            min-height: 0;
            width: 100%;
        }

        .erp-main-panel {
            display: flex;
            flex-direction: column;
            flex: 1;
            min-width: 0;
            min-height: 0;
            overflow: hidden;
        }

        /* Sidebar — desktop */
        .erp-sidebar {
            display: none;
            width: var(--sidebar-w);
            flex-shrink: 0;
            background: var(--surface);
            border-right: 1px solid var(--border);
            flex-direction: column;
            padding: 16px 12px;
            gap: 4px;
            overflow-y: auto;
            z-index: 15;
        }

        .erp-sidebar-brand {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px 20px;
            margin-bottom: 8px;
            border-bottom: 1px solid var(--border);
        }

        .erp-sidebar-brand-icon {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            flex-shrink: 0;
        }

        .erp-sidebar-brand-text {
            min-width: 0;
        }

        .erp-sidebar-brand-text strong {
            display: block;
            font-size: 1rem;
            font-weight: 800;
            color: var(--primary);
            letter-spacing: -0.3px;
            line-height: 1.1;
        }

        .erp-sidebar-brand-text span {
            display: block;
            font-size: 0.62rem;
            color: var(--muted);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            margin-top: 2px;
        }

        .erp-nav-section {
            font-size: 0.62rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            color: var(--muted);
            padding: 12px 12px 6px;
            opacity: 0.85;
        }

        .erp-nav-item {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
            padding: 11px 14px;
            border: none;
            border-radius: var(--r-md);
            background: transparent;
            color: var(--muted);
            font-family: inherit;
            font-size: 0.88rem;
            font-weight: 600;
            cursor: pointer;
            text-align: left;
            transition: background 0.15s, color 0.15s;
        }

        .erp-nav-item i {
            width: 20px;
            text-align: center;
            font-size: 0.95rem;
            flex-shrink: 0;
        }

        .erp-nav-item:hover {
            background: var(--surface-lt);
            color: var(--text);
        }

        .erp-nav-item.active {
            background: linear-gradient(135deg, rgba(15, 118, 110, 0.12) 0%, rgba(20, 184, 166, 0.08) 100%);
            color: var(--primary);
            font-weight: 700;
        }

        .erp-nav-item.active i {
            color: var(--primary);
        }

        .erp-nav-badge {
            margin-left: auto;
            background: var(--danger);
            color: #fff;
            font-size: 0.65rem;
            font-weight: 800;
            padding: 2px 7px;
            border-radius: 99px;
            min-width: 18px;
            text-align: center;
        }

        .erp-nav-badge.hidden {
            display: none;
        }

        /* Bottom nav — mobile */
        .erp-bottom-nav {
            display: flex;
            align-items: stretch;
            justify-content: space-around;
            height: var(--bottom-nav-h);
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-top: 1px solid var(--border);
            flex-shrink: 0;
            z-index: 30;
            padding-bottom: env(safe-area-inset-bottom, 0);
        }

        .erp-bottom-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 3px;
            border: none;
            background: none;
            color: var(--muted);
            font-family: inherit;
            font-size: 0.62rem;
            font-weight: 700;
            cursor: pointer;
            padding: 6px 4px;
            transition: color 0.15s;
            position: relative;
        }

        .erp-bottom-item i {
            font-size: 1.15rem;
        }

        .erp-bottom-item.active {
            color: var(--primary);
        }

        .erp-bottom-item.erp-bottom-primary {
            color: var(--primary);
        }

        .erp-bottom-item.erp-bottom-primary i {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            margin-top: -18px;
            box-shadow: var(--sh-md);
        }

        /* Mobile more menu */
        .erp-mobile-menu {
            position: fixed;
            inset: 0;
            z-index: 100;
            display: none;
            align-items: flex-end;
            justify-content: center;
        }

        .erp-mobile-menu.open {
            display: flex;
        }

        .erp-mobile-menu-backdrop {
            position: absolute;
            inset: 0;
            background: rgba(15, 23, 42, 0.55);
        }

        .erp-mobile-menu-sheet {
            position: relative;
            z-index: 1;
            width: 100%;
            max-width: 480px;
            background: var(--surface);
            border-radius: var(--r-xl) var(--r-xl) 0 0;
            padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0));
            box-shadow: var(--sh-lg);
        }

        body.erp-menu-open .erp-bottom-nav {
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .erp-mobile-menu-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin-top: 12px;
        }

        .erp-mobile-menu-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            padding: 14px 8px;
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            background: var(--surface-lt);
            color: var(--text);
            font-family: inherit;
            font-size: 0.72rem;
            font-weight: 700;
            cursor: pointer;
        }

        .erp-mobile-menu-item i {
            font-size: 1.2rem;
            color: var(--primary);
        }

        .erp-mobile-menu-handle {
            width: 40px;
            height: 4px;
            background: var(--border);
            border-radius: 99px;
            margin: 0 auto 8px;
        }

        #loginView {
            background: radial-gradient(circle at top, rgba(20, 184, 166, 0.08), transparent 50%), var(--bg);
        }

        .login-card {
            box-shadow: var(--sh-md);
        }

        .sub-header {
            height: var(--subheader-h);
            flex-shrink: 0;
            background: linear-gradient(90deg, var(--primary-dk) 0%, var(--primary) 50%, var(--primary-lt) 100%);
        }

        /* ── Unified dashboard ── */
        .dash-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
        }

        .dash-month-ctrl {
            display: flex;
            align-items: center;
            gap: 10px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 999px;
            padding: 4px 8px;
            box-shadow: var(--sh-sm);
        }

        .dash-month-ctrl .hero-label {
            margin: 0;
            min-width: 110px;
            text-align: center;
            color: var(--text);
            opacity: 1;
            font-size: 0.78rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.4px;
        }

        .dash-month-ctrl .hero-month-btn {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            border: none;
            background: var(--surface-lt);
            color: var(--primary);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .dash-toolbar-actions {
            display: flex;
            gap: 8px;
        }

        .dash-tool-btn {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            border: 1.5px solid var(--border);
            background: var(--surface);
            color: var(--muted);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--sh-sm);
            transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
            opacity: 1;
        }

        .dash-tool-btn:hover {
            color: var(--primary);
            border-color: rgba(15, 118, 110, 0.35);
        }

        .dash-tool-btn.active,
        .dash-tool-btn[aria-pressed="true"] {
            background: var(--primary);
            border-color: var(--primary);
            color: #ffffff;
            box-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
        }

        /* Explicit OFF state for toggles */
        .dash-tool-btn[aria-pressed="false"] {
            background: var(--surface);
            border-color: var(--border);
            color: var(--muted);
            box-shadow: none;
        }

        .dash-kpi-board.hero-card {
            background: var(--surface);
            color: var(--text);
            text-align: left;
            padding: 16px;
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: var(--sh-sm);
            margin-bottom: 18px;
        }

        .dash-kpi-board.hero-card::after {
            display: none;
        }

        .dash-kpi-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
        }

        .dash-kpi {
            background: var(--surface-lt);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 16px;
            min-height: 96px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 4px;
        }

        .dash-kpi-total {
            background: linear-gradient(145deg, var(--primary) 0%, var(--primary-lt) 100%);
            border: none;
            color: #fff;
        }

        .dash-kpi-label {
            font-size: 0.68rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--muted);
        }

        .dash-kpi-total .dash-kpi-label {
            color: rgba(255, 255, 255, 0.78);
        }

        .dash-kpi-board .hero-amount {
            font-size: 1.45rem;
            color: #ffffff;
            letter-spacing: -0.5px;
            font-weight: 700;
        }

        .dash-kpi-paid .hero-stat-val {
            color: var(--success);
            font-size: 1.15rem;
            font-weight: 800;
        }

        .dash-kpi-unpaid .hero-stat-val {
            color: var(--danger);
            font-size: 1.15rem;
            font-weight: 800;
        }

        .dash-kpi-count {
            font-size: 0.72rem;
            color: var(--muted);
            font-weight: 600;
        }

        .dash-kpi-total .dash-kpi-count {
            color: rgba(255, 255, 255, 0.8);
        }

        .dash-kpi-hint {
            margin-top: 12px;
            font-size: 0.68rem;
            color: var(--muted);
            line-height: 1.4;
        }

        #dashCreditToggle[aria-pressed="true"] {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }

        /* ── Unified cards & lists (all pages) ── */
        .dash-nav {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .nav-card {
            background: var(--surface);
            padding: 18px 14px 16px;
            border-radius: var(--r-md);
            text-align: center;
            cursor: pointer;
            border: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            position: relative;
            min-height: 118px;
            box-shadow: var(--sh-sm);
            transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
        }

        .nav-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--sh-md);
            border-color: rgba(15, 118, 110, 0.28);
        }

        .nav-card i {
            font-size: 1.35rem;
            color: var(--primary);
            width: 42px;
            height: 42px;
            border-radius: 12px;
            background: rgba(15, 118, 110, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .nav-card h5 {
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--text);
            margin: 0;
        }

        .nav-card p {
            font-size: 0.68rem;
            color: var(--muted);
            margin: 0;
            line-height: 1.3;
        }

        .ph-list,
        #vendorsContainer,
        #payUnpaidInvoicesList,
        #fixedCostsList,
        #pbList {
            display: flex;
            flex-direction: column;
            gap: 0;
            width: 100%;
        }

        #outstandingList,
        #paidHistoryList {
            display: flex;
            flex-direction: column;
            gap: 0;
            width: 100%;
        }

        .ph-list {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            overflow: hidden;
            box-shadow: var(--sh-sm);
            margin-bottom: 12px;
        }

        .ph-row,
        .item-card,
        .acc-header {
            min-height: 72px;
            padding: 14px 16px;
            box-sizing: border-box;
        }

        .ph-row {
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            border-bottom: 1px solid var(--border);
            background: transparent;
            transition: background 0.15s;
        }

        .ph-row:last-child {
            border-bottom: none;
        }

        .ph-row:hover {
            background: var(--surface-lt);
        }

        .ph-avatar {
            width: 40px;
            height: 40px;
            font-size: 0.8rem;
        }

        .ph-name,
        .card-left h4,
        .acc-header h4 {
            font-size: 0.9rem;
            font-weight: 700;
        }

        .ph-meta,
        .card-left p,
        .acc-header .sub {
            font-size: 0.72rem;
        }

        .ph-amount,
        .card-right .amount,
        .acc-header .amt,
        .sup-amount {
            font-size: 0.95rem;
            font-weight: 800;
        }

        .item-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            margin-bottom: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            border-left: 3px solid var(--primary);
            box-shadow: var(--sh-sm);
            width: 100%;
        }

        .item-card:hover {
            border-color: rgba(15, 118, 110, 0.35);
            box-shadow: var(--sh-md);
        }

        .acc-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            margin-bottom: 10px;
            overflow: hidden;
            box-shadow: var(--sh-sm);
        }

        .sup-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
        }

        .sup-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            padding: 14px 16px;
            cursor: pointer;
            min-height: 88px;
            box-shadow: var(--sh-sm);
        }

        .vendor-card {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 10px 14px;
            align-items: center;
            width: 100%;
            min-height: 88px;
            padding: 14px 16px;
            margin-bottom: 10px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            border-left: 4px solid var(--primary);
            box-shadow: var(--sh-sm);
            box-sizing: border-box;
            transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
        }

        .vendor-card:hover {
            box-shadow: var(--sh-md);
            border-color: rgba(15, 118, 110, 0.35);
        }

        .vendor-card.has-balance {
            border-left-color: var(--danger);
        }

        .vendor-card.is-overdue {
            border-left-color: #dc2626;
            background: linear-gradient(90deg, rgba(220, 38, 38, 0.05), var(--surface) 36%);
        }

        .vendor-card.is-due-soon {
            border-left-color: var(--warning);
        }

        .vendor-card-main {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .vendor-card-top {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .vendor-avatar {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lt) 100%);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.78rem;
            font-weight: 800;
            flex-shrink: 0;
        }

        .vendor-card-name {
            font-weight: 800;
            font-size: 0.92rem;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.2;
        }

        .vendor-card-sub {
            font-size: 0.7rem;
            color: var(--muted);
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .vendor-card-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            align-items: center;
        }

        .vendor-card-side {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 8px;
            flex-shrink: 0;
        }

        .vendor-balance {
            text-align: right;
        }

        .vendor-balance-amt {
            display: block;
            font-size: 1rem;
            font-weight: 800;
            color: var(--danger);
            line-height: 1.1;
        }

        .vendor-balance-amt.is-zero {
            color: var(--muted);
            font-size: 0.88rem;
        }

        .vendor-balance-count {
            display: block;
            font-size: 0.66rem;
            color: var(--muted);
            font-weight: 600;
            margin-top: 2px;
        }

        .vendor-card-actions {
            display: flex;
            gap: 6px;
        }

        .vendor-act-btn {
            height: 32px;
            padding: 0 10px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--surface-lt);
            color: var(--text);
            font-family: inherit;
            font-size: 0.72rem;
            font-weight: 800;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            white-space: nowrap;
        }

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

        .vendor-act-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .vendor-warn {
            font-size: 0.62rem;
            font-weight: 800;
            padding: 2px 7px;
            border-radius: 99px;
            letter-spacing: 0.2px;
        }

        .vendor-warn.overdue {
            background: #fee2e2;
            color: #b91c1c;
        }

        .vendor-warn.due {
            background: #fef3c7;
            color: #b45309;
        }

        .vendor-pill {
            font-size: 0.62rem;
            font-weight: 800;
            padding: 3px 8px;
            border-radius: 99px;
            letter-spacing: 0.3px;
            white-space: nowrap;
        }

        .vendor-status-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 10px;
        }

        .vendor-chip {
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--muted);
            border-radius: 999px;
            padding: 6px 11px;
            font-family: inherit;
            font-size: 0.72rem;
            font-weight: 800;
            cursor: pointer;
        }

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

        .vendors-summary {
            display: none;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 12px;
            padding: 10px 14px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-sm);
            box-shadow: var(--sh-sm);
            font-size: 0.82rem;
            font-weight: 700;
            color: var(--text);
        }

        .vendors-summary.show {
            display: flex;
        }

        .vendors-summary b {
            color: var(--danger);
        }

        #vendorsContainer {
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        @media (min-width: 900px) {
            #vendorsContainer {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
                gap: 12px;
            }

            .vendor-card {
                margin-bottom: 0;
                height: 100%;
            }
        }

        body.dark .vendor-card.is-overdue {
            background: linear-gradient(90deg, rgba(201, 67, 67, 0.12), var(--surface) 40%);
        }

        body.dark .vendor-warn.overdue {
            background: rgba(219, 132, 132, 0.16);
            color: #e8aeae;
        }

        body.dark .vendor-warn.due {
            background: rgba(211, 171, 103, 0.16);
            color: #ddc68b;
        }

        body.dark .vendor-chip:not(.active),
        body.dark .vendor-act-btn:not(.primary) {
            background: #171717;
            border-color: #414141;
            color: #a1a1a1;
        }

        body.density-compact .vendor-card {
            min-height: 72px;
            padding: 10px 12px;
        }

        /* ═══ Stitch Outstanding / Paid list UI ═══ */
        .st-page {
            max-width: 1440px;
        }

        /* Vendor Management — left controls, right invoice list */
        .vm-layout {
            display: grid;
            grid-template-columns: minmax(240px, 300px) 1fr;
            gap: 14px;
            align-items: start;
            min-height: 420px;
        }

        .vm-side {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 12px;
            position: sticky;
            top: 8px;
        }

        .vm-side .field {
            margin-bottom: 10px;
        }

        .vm-side .field:last-child {
            margin-bottom: 0;
        }

        .vm-side-actions {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 12px;
        }

        .vm-side-actions .st-btn {
            width: 100%;
            justify-content: center;
        }

        .vm-main {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .vm-issue {
            display: inline-block;
            font-size: 0.62rem;
            font-weight: 600;
            padding: 1px 6px;
            border-radius: 4px;
            margin-left: 4px;
            background: rgba(217, 119, 6, 0.15);
            color: #b45309;
            vertical-align: middle;
        }

        body.dark .vm-side {
            background: var(--surface);
        }

        @media (max-width: 820px) {
            .vm-layout {
                grid-template-columns: 1fr;
            }

            .vm-side {
                position: static;
            }
        }

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

        .st-head>div:first-child:not(.st-actions) {
            min-width: 0;
            flex: 1 1 160px;
        }

        .st-sub {
            margin: 0;
            font-size: 0.82rem;
            font-weight: 400;
            color: var(--muted);
            line-height: 1.35;
        }

        .st-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .dash-toolbar-bar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
        }

        .dash-toolbar-tools {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .st-btn {
            height: 40px;
            padding: 0 16px;
            border-radius: 8px;
            font-family: inherit;
            font-size: 0.8125rem;
            font-weight: 500;
            letter-spacing: 0.01em;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            gap: 8px;
            cursor: pointer;
            line-height: 1;
            box-sizing: border-box;
            white-space: nowrap;
            transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
        }

        .st-btn-outline {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--primary);
        }

        .st-btn-outline:hover {
            background: var(--surface-lt);
        }

        .st-btn-primary {
            background: var(--primary);
            border: 1px solid var(--primary);
            color: #fff;
            box-shadow: var(--sh-sm);
        }

        .st-btn-primary:hover {
            background: var(--primary-lt);
            border-color: var(--primary-lt);
        }

        .st-filter-panel {
            display: none;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 18px;
            padding: 14px 16px;
            background: rgba(255, 255, 255, 0.72);
            border: 1px solid var(--border);
            border-radius: 12px;
            box-shadow: var(--sh-sm);
        }

        .st-filter-panel.open {
            display: flex;
        }

        .ai-scan-panel {
            margin-bottom: 14px;
            padding: 18px 16px;
            text-align: center;
            background: linear-gradient(180deg, rgba(0, 92, 85, 0.06) 0%, rgba(255, 255, 255, 0.92) 55%);
            border: 1.5px dashed rgba(0, 92, 85, 0.35);
            border-radius: 14px;
            box-shadow: var(--sh-sm);
        }

        .ai-scan-title {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 0 0 8px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--primary);
        }

        .ai-scan-title i {
            font-size: 0.95rem;
            animation: pulse 2.4s infinite ease-in-out;
        }

        .ai-scan-copy {
            margin: 0 0 14px;
            font-size: 0.78rem;
            line-height: 1.45;
            color: var(--muted);
        }

        .ai-scan-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
        }

        .ai-scan-actions .st-btn {
            flex: 1 1 120px;
            min-width: 0;
        }

        .ai-scan-hint,
        .ai-scan-panel textarea {
            width: 100%;
            box-sizing: border-box;
            margin-top: 10px;
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 0 12px;
            font-family: inherit;
            font-size: 0.78rem;
            font-weight: 500;
            color: var(--text);
            background: #fff;
            outline: none;
        }

        .ai-scan-hint {
            height: 38px;
        }

        .ai-scan-panel textarea {
            height: 72px;
            padding: 10px 12px;
            resize: none;
        }

        .ai-scan-status {
            margin-top: 12px;
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid var(--border);
            background: var(--surface-lt);
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--primary);
        }

        .st-form-sec {
            margin-bottom: 12px;
            padding: 14px 14px 12px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            background: rgba(255, 255, 255, 0.92);
            border: 1px solid var(--border);
            border-radius: 14px;
            box-shadow: var(--sh-sm);
        }

        .st-form-sec-title {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0;
            padding-bottom: 8px;
            border-bottom: 1px solid var(--border);
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: var(--primary);
        }

        #tab-entry .modal-card.exp-form-card,
        #tab-vendor-entry .modal-card.exp-form-card {
            border: 1px solid var(--border);
            border-radius: 16px;
            overflow: hidden;
            box-shadow: var(--sh-md);
            background: #fff;
        }

        #tab-entry .modal-actions,
        #tab-vendor-entry .modal-actions {
            padding: 12px 16px;
            margin-top: 0;
            border-top: 1px solid var(--border);
            background: #fff;
        }

        .st-filter-row {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
        }

        .st-month {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            height: 40px;
            padding: 4px 8px 4px 4px;
            background: var(--surface-lt);
            border: 1px solid var(--border);
            border-radius: 999px;
        }

        .st-month .month-nav-btn {
            width: 32px;
            height: 32px;
            border: none;
            border-radius: 999px;
            background: transparent;
            color: var(--muted);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .st-month .month-nav-btn:hover:not(:disabled) {
            color: var(--primary);
            background: #fff;
        }

        .st-month-label {
            min-width: 104px;
            text-align: center;
            font-size: 0.8125rem;
            font-weight: 500;
            color: var(--text);
            white-space: nowrap;
        }

        .st-month-all {
            height: 30px;
            padding: 0 12px;
            border: none;
            border-radius: 999px;
            background: transparent;
            color: var(--muted);
            font-family: inherit;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
        }

        .st-month-all.active {
            background: var(--primary);
            color: #fff;
        }

        .st-select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            height: 40px;
            padding: 0 34px 0 14px;
            border: 1px solid var(--border);
            border-radius: 999px;
            background-color: var(--surface-lt);
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e7977' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 12px 12px;
            color: var(--text);
            font-family: inherit;
            font-size: 0.8125rem;
            font-weight: 500;
            cursor: pointer;
            outline: none;
            min-width: 140px;
        }

        .st-search {
            flex: 1 1 220px;
            display: flex;
            align-items: center;
            gap: 10px;
            min-height: 40px;
            padding: 0 16px;
            background: var(--surface-lt);
            border: 1px solid var(--border);
            border-radius: 999px;
        }

        .st-search:focus-within {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(0, 92, 85, 0.12);
            background: #fff;
        }

        .st-search i {
            color: #6e7977;
            font-size: 0.9rem;
        }

        .st-search input {
            flex: 1;
            border: none;
            outline: none;
            background: transparent;
            font-family: inherit;
            font-size: 0.875rem;
            color: var(--text);
            min-width: 0;
        }

        .st-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .st-chip {
            border: 1px solid transparent;
            background: transparent;
            color: var(--muted);
            border-radius: 999px;
            padding: 7px 14px;
            font-family: inherit;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
        }

        .st-chip:hover {
            background: #fff;
            border-color: var(--border);
        }

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

        .st-layout {
            display: grid;
            grid-template-columns: 1fr;
            gap: 16px;
            align-items: start;
        }

        @media (min-width: 1100px) {
            .st-layout {
                grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
                gap: 24px;
            }
        }

        @media (max-width: 1099px) {

            #tab-outstanding .st-aside,
            #tab-paid-history .st-aside {
                order: -1;
            }

            #tab-outstanding .st-summary-pad,
            #tab-paid-history .st-summary-pad {
                padding: 14px 16px;
            }

            #tab-outstanding .st-summary-label,
            #tab-paid-history .st-summary-label {
                margin-bottom: 6px;
            }

            #tab-outstanding .st-summary-total,
            #tab-paid-history .st-summary-total {
                font-size: 1.55rem;
            }

            #tab-outstanding .st-summary-note,
            #tab-paid-history .st-summary-note {
                margin-top: 4px;
            }
        }

        .st-main {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .st-sec {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .st-sec-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            cursor: pointer;
            user-select: none;
        }

        .st-sec-head h3 {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text);
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .st-sec-head h3 i {
            color: var(--primary);
            font-size: 0.95rem;
        }

        .st-list {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .st-card {
            background: rgba(255, 255, 255, 0.92);
            border: 1px solid var(--border);
            border-radius: 12px;
            box-shadow: var(--sh-sm);
            padding: 22px 22px 18px;
            cursor: pointer;
            transition: box-shadow 0.18s ease;
        }

        .st-card:hover {
            box-shadow: var(--sh-md);
        }

        .st-card-top {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 16px;
            margin-bottom: 16px;
        }

        .st-card-ident {
            display: flex;
            align-items: center;
            gap: 14px;
            min-width: 0;
        }

        .st-avatar {
            width: 48px;
            height: 48px;
            border-radius: 999px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--st-avatar);
            border: 1px solid rgba(189, 201, 198, 0.5);
            color: var(--primary);
            font-size: 0.95rem;
            font-weight: 600;
        }

        .st-avatar.branch {
            color: #006b5f;
        }

        .st-avatar.misc {
            color: #495167;
        }

        .st-card-name {
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--text);
            letter-spacing: -0.01em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 42vw;
        }

        .st-card-sub {
            margin-top: 3px;
            font-size: 0.875rem;
            font-weight: 400;
            color: var(--muted);
        }

        .st-card-money {
            text-align: right;
            flex-shrink: 0;
        }

        .st-card-amt {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text);
            letter-spacing: -0.02em;
            white-space: nowrap;
        }

        .st-card.is-settled .st-card-amt {
            color: var(--success);
        }

        .st-card-due {
            margin-top: 4px;
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--muted);
            display: inline-flex;
            align-items: center;
            justify-content: flex-end;
            gap: 4px;
        }

        .st-card-due.is-urgent {
            color: var(--danger);
        }

        .st-card-foot {
            border-top: 1px solid var(--border);
            padding-top: 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }

        .st-inv-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            min-width: 0;
        }

        .st-inv-chip {
            display: inline-flex;
            align-items: center;
            padding: 4px 8px;
            border-radius: 4px;
            background: var(--st-chip);
            color: var(--muted);
            font-size: 0.7rem;
            font-weight: 600;
            white-space: nowrap;
        }

        .st-pay {
            height: 36px;
            padding: 0 16px;
            border-radius: 8px;
            border: none;
            background: var(--primary);
            color: #fff;
            font-family: inherit;
            font-size: 0.8125rem;
            font-weight: 500;
            cursor: pointer;
            box-shadow: var(--sh-sm);
            white-space: nowrap;
        }

        .st-pay:hover {
            background: var(--primary-lt);
        }

        .st-review {
            height: 36px;
            padding: 0 16px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--primary);
            font-family: inherit;
            font-size: 0.8125rem;
            font-weight: 500;
            cursor: pointer;
            white-space: nowrap;
        }

        .st-review:hover {
            background: var(--surface-lt);
        }

        .st-aside {
            position: sticky;
            top: 8px;
        }

        .st-summary-card {
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 12px;
            box-shadow: var(--sh-sm);
            overflow: hidden;
        }

        .st-summary-pad {
            padding: 22px;
        }

        .st-summary-label {
            font-size: 0.8125rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 18px;
        }

        .st-summary-total {
            font-size: 2rem;
            font-weight: 600;
            letter-spacing: -0.03em;
            color: var(--primary);
            line-height: 1.1;
        }

        .st-summary-total span {
            font-size: 1.1rem;
            font-weight: 500;
            color: var(--muted);
        }

        .st-summary-note {
            margin-top: 8px;
            font-size: 0.75rem;
            font-weight: 500;
            color: var(--muted);
        }

        .st-summary-rows {
            border-top: 1px solid var(--border);
        }

        .st-summary-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 14px 18px;
            border-bottom: 1px solid rgba(189, 201, 198, 0.45);
        }

        .st-summary-row:last-child {
            border-bottom: none;
        }

        .st-summary-row-left {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .st-summary-icon {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            background: rgba(0, 92, 85, 0.1);
            color: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.65rem;
            font-weight: 800;
            flex-shrink: 0;
        }

        .st-summary-row-name {
            font-size: 0.8125rem;
            font-weight: 500;
            color: var(--text);
        }

        .st-summary-row-meta {
            font-size: 0.7rem;
            color: var(--muted);
            margin-top: 2px;
        }

        .st-summary-row-amt {
            font-size: 0.8125rem;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
        }

        .st-summary-row>span {
            font-size: 0.78rem;
            font-weight: 500;
            color: var(--muted);
        }

        .st-summary-row>strong {
            font-size: 0.84rem;
            font-weight: 650;
            color: var(--text);
            text-align: right;
            word-break: break-word;
        }

        .psd-aside-name {
            font-size: 1.05rem;
            font-weight: 650;
            color: var(--text);
            letter-spacing: -0.01em;
            line-height: 1.3;
        }

        /* WhatsApp / Share modal */
        .wa-share-overlay {
            z-index: 10000 !important;
        }

        #waModalCard.wa-share-card {
            max-width: 420px !important;
            width: min(420px, 92vw) !important;
            text-align: left;
        }

        .wa-share-sub {
            margin: 0 0 10px;
            font-size: 0.8rem;
            color: var(--muted);
            line-height: 1.4;
        }

        .wa-share-preview {
            width: 100%;
            text-align: left;
            font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            font-size: 0.74rem;
            white-space: pre-wrap;
            max-height: 200px;
            overflow: auto;
            line-height: 1.45;
            padding: 12px 14px;
            border-radius: 12px;
            border: 1px solid var(--border);
            background: var(--surface-lt);
            color: var(--text);
            box-sizing: border-box;
        }

        .wa-share-card.is-paid .wa-share-preview {
            border-left: 4px solid var(--success);
            background: rgba(16, 185, 129, 0.07);
        }

        .wa-share-card.is-unpaid .wa-share-preview {
            border-left: 4px solid var(--danger);
            background: rgba(239, 68, 68, 0.07);
        }

        .wa-share-card.is-remind .wa-share-preview {
            border-left: 4px solid #d97706;
            background: rgba(245, 158, 11, 0.08);
        }

        .wa-share-card.is-info .wa-share-preview {
            border-left: 4px solid var(--primary);
            background: rgba(0, 92, 85, 0.06);
        }

        #waModalCard .modal-actions {
            flex-wrap: nowrap;
        }

        body.dark .st-filter-panel,
        body.dark .st-card,
        body.dark .st-summary-card {
            background: var(--surface);
        }

        body.dark .st-search,
        body.dark .st-month,
        body.dark .st-select {
            background-color: #171717;
            border-color: #414141;
        }

        body.dark .st-select {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%94a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
            background-size: 12px 12px;
        }

        body.dark .st-avatar {
            background: rgba(224, 233, 246, 0.12);
            border-color: #414141;
        }

        body.dark .st-inv-chip {
            background: #292929;
            color: #a1a1a1;
        }

        @media (max-width: 700px) {
            .st-card-top {
                flex-direction: column;
            }

            .st-card-money {
                text-align: left;
                width: 100%;
            }

            .st-card-due {
                justify-content: flex-start;
            }

            .st-card-name {
                max-width: 70vw;
            }

            .st-aside {
                position: static;
            }
        }

        /* Desktop breakpoint */
        @media (min-width: 1024px) {
            .erp-sidebar {
                display: flex;
            }

            .erp-bottom-nav {
                display: none;
            }

            .erp-main-panel .content-area {
                padding: 18px 28px 14px !important;
            }

            #mainView .fab {
                right: 28px;
                bottom: 28px;
            }

            .dash-kpi-grid {
                grid-template-columns: 1.3fr 1fr 1fr;
            }

            .dash-nav {
                grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
                gap: 14px !important;
            }

            .nav-card {
                min-height: 128px;
            }

            .sup-grid {
                grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
            }
        }

        @media (max-width: 1023px) {
            .erp-main-panel .content-area {
                padding-bottom: calc(var(--bottom-nav-h) + 6px) !important;
            }

            .dash-nav {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }

            /* Dashboard: toolbar spans full content width */
            #tab-home .dash-head {
                flex-direction: column;
                align-items: stretch;
                gap: 8px;
                margin-bottom: 12px;
            }

            #tab-home .dash-head>.st-sub {
                margin: 0;
                font-size: 0.74rem;
            }

            #tab-home .dash-toolbar-bar {
                width: 100%;
                display: grid;
                grid-template-columns: minmax(0, 1fr) auto;
                align-items: center;
                gap: 8px;
            }

            #tab-home .st-month {
                width: 100%;
                min-width: 0;
                justify-content: space-between;
                box-sizing: border-box;
            }

            #tab-home .st-month-label {
                flex: 1 1 auto;
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            #tab-home .dash-toolbar-tools {
                display: flex;
                align-items: center;
                gap: 8px;
                flex: 0 0 auto;
            }

            #tab-home .dash-toolbar-tools .st-btn {
                flex: 0 0 auto;
                height: 40px;
            }

            #tab-home .dash-credit-label {
                display: none;
            }

            #dashCreditToggle {
                width: 40px;
                padding: 0;
            }

            #tab-home .dash-kpi-grid {
                grid-template-columns: 1fr 1fr;
                gap: 8px;
            }

            #tab-home .dash-kpi-total {
                grid-column: 1 / -1;
            }

            #tab-home .dash-kpi {
                min-height: 84px;
                padding: 12px;
            }

            #tab-home .dash-kpi-board.hero-card {
                padding: 12px;
                margin-bottom: 12px;
            }

            #tab-home .dash-kpi-board .hero-amount {
                font-size: 1.28rem;
            }

            #tab-home .dash-nav {
                gap: 10px;
            }

            #tab-home .nav-card {
                min-height: 108px;
            }

            #sub-tab-tracker-content .st-filter-row {
                flex-direction: column;
                align-items: stretch;
            }

            #sub-tab-tracker-content .st-search {
                width: 100%;
                flex: 1 1 auto;
            }

            #sub-tab-tracker-content .st-select,
            #sub-tab-tracker-content .st-btn {
                width: 100%;
            }

            #sub-tab-tracker-content .st-select {
                min-width: 0;
            }
        }

        @media (min-width: 700px) and (max-width: 1023px) {
            .dash-kpi-grid {
                grid-template-columns: 1.2fr 1fr 1fr;
            }
        }

        @media (min-width: 1600px) {
            .content-area {
                padding-left: 40px !important;
                padding-right: 40px !important;
            }
        }

        /* Dark mode — layout */
        body.dark .erp-sidebar {
            background: #171717;
            border-color: #292929;
        }

        body.dark .erp-sidebar-brand {
            border-color: #292929;
        }

        body.dark .erp-nav-item:hover {
            background: #292929;
            color: var(--text);
        }

        body.dark .erp-nav-item.active {
            background: rgba(183, 191, 192, 0.12);
            color: var(--primary);
        }

        body.dark .erp-bottom-nav {
            background: rgba(23, 23, 23, 0.94);
            border-color: #292929;
        }

        body.dark .erp-mobile-menu-sheet {
            background: #292929;
        }

        body.dark .erp-mobile-menu-item {
            background: #171717;
            border-color: #414141;
        }

        body.dark .sub-header {
            background: linear-gradient(90deg, #313738 0%, #3f4849 50%, #4b5657 100%) !important;
        }

        body.dark #loginView {
            background: radial-gradient(circle at top, rgba(183, 191, 192, 0.06), transparent 50%), var(--bg);
        }

        body.dark .h-btn {
            background: #292929;
            border-color: #3e3e3e;
            color: #a1a1a1;
        }

        body.dark .h-btn:hover {
            color: var(--primary);
            border-color: rgba(183, 191, 192, 0.45);
            background: rgba(183, 191, 192, 0.1);
        }

        body.dark .h-btn.danger {
            color: #db8484;
        }

        body.dark .h-btn.active,
        body.dark .h-btn[aria-pressed="true"] {
            background: linear-gradient(135deg, #9aa6a8 0%, #5e6c6d 100%) !important;
            border-color: #b7bfc0 !important;
            color: #252a2b !important;
            box-shadow: 0 0 0 1px rgba(183, 191, 192, 0.35) !important;
        }

        /* Toggle OFF in dark mode — muted but clearly inactive */
        body.dark .dash-tool-btn,
        body.dark .dash-tool-btn[aria-pressed="false"],
        body.dark .report-filter-action-btn,
        body.dark .report-cat-toggle:not(.active),
        body.dark .month-nav-all:not(.active),
        body.dark .sub-tab-btn:not(.sub-tab-active):not([aria-current="true"]),
        body.dark .tab-btn:not(.active) {
            background: #171717 !important;
            border-color: #414141 !important;
            color: #727272 !important;
            box-shadow: none !important;
            opacity: 1 !important;
        }

        body.dark .dash-tool-btn:hover,
        body.dark .report-filter-action-btn:hover,
        body.dark .report-cat-toggle:not(.active):hover,
        body.dark .month-nav-all:not(.active):hover {
            background: rgba(183, 191, 192, 0.08) !important;
            border-color: rgba(183, 191, 192, 0.4) !important;
            color: #a1a1a1 !important;
        }

        /* Toggle ON in dark mode — solid teal, high contrast */
        body.dark .dash-tool-btn.active,
        body.dark .dash-tool-btn[aria-pressed="true"],
        body.dark .report-cat-toggle.active,
        body.dark .month-nav-all.active,
        body.dark .sub-tab-btn.sub-tab-active,
        body.dark .sub-tab-btn[aria-current="true"],
        body.dark .tab-btn.active {
            background: linear-gradient(135deg, #9aa6a8 0%, #5e6c6d 100%) !important;
            border-color: #b7bfc0 !important;
            color: #252a2b !important;
            box-shadow: 0 0 0 1px rgba(183, 191, 192, 0.35), 0 8px 20px rgba(94, 108, 109, 0.35) !important;
            font-weight: 800;
        }

        body.dark .dash-month-ctrl {
            background: #1e1e1e;
            border-color: #3e3e3e;
        }

        body.dark .dash-month-ctrl .hero-month-btn {
            background: #171717;
            color: var(--primary);
        }

        body.dark .dash-kpi-board.hero-card,
        body.dark .dash-kpi:not(.dash-kpi-total),
        body.dark .nav-card,
        body.dark .ph-list,
        body.dark .item-card,
        body.dark .acc-card,
        body.dark .vendor-card,
        body.dark .sup-card {
            background: var(--surface);
            border-color: var(--border);
        }

        body.dark .dash-kpi:not(.dash-kpi-total) {
            background: var(--surface-lt);
        }

        body.dark .dash-kpi-total {
            background: linear-gradient(135deg, #272c2d 0%, #384040 52%, #1f1f1f 100%);
        }

        /* Checkboxes / form focus in dark */
        body.dark input[type="checkbox"] {
            accent-color: #b7bfc0;
        }

        body.dark .btn-ghost {
            background: #171717 !important;
            border-color: #414141 !important;
            color: #a1a1a1 !important;
        }

        body.dark .btn-ghost:hover {
            border-color: rgba(183, 191, 192, 0.45) !important;
            color: #b7bfc0 !important;
            background: rgba(183, 191, 192, 0.08) !important;
        }

        /* ═══ Feature polish: density / overdue / payment / audit ═══ */
        body.density-compact .ph-row,
        body.density-compact .item-card,
        body.density-compact .vendor-card,
        body.density-compact .acc-header {
            min-height: 52px;
            padding: 8px 12px;
        }

        body.density-compact .nav-card {
            min-height: 92px;
            padding: 12px 10px;
            gap: 4px;
        }

        body.density-compact .nav-card i {
            width: 34px;
            height: 34px;
            font-size: 1.05rem;
        }

        body.density-compact .ph-avatar {
            width: 32px;
            height: 32px;
            font-size: 0.68rem;
        }

        body.density-compact .ph-name,
        body.density-compact .vendor-card-name {
            font-size: 0.82rem;
        }

        body.density-compact .dash-kpi {
            min-height: 78px;
            padding: 10px 12px;
        }

        .dash-alerts {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            margin-bottom: 16px;
        }

        .dash-alert-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            padding: 12px 14px;
            box-shadow: var(--sh-sm);
            cursor: pointer;
            transition: transform 0.15s, border-color 0.15s;
        }

        .dash-alert-card:hover {
            transform: translateY(-1px);
            border-color: rgba(15, 118, 110, 0.35);
        }

        .dash-alert-card.overdue {
            border-left: 4px solid var(--danger);
        }

        .dash-alert-card.due-soon {
            border-left: 4px solid var(--warning);
        }

        .dash-alert-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 6px;
        }

        .dash-alert-title {
            font-size: 0.78rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .dash-alert-amt {
            font-size: 0.95rem;
            font-weight: 800;
            color: var(--danger);
        }

        .dash-alert-card.due-soon .dash-alert-amt {
            color: #d97706;
        }

        .dash-alert-meta {
            font-size: 0.72rem;
            color: var(--muted);
            font-weight: 600;
        }

        .dash-alert-empty {
            display: none;
            padding: 12px 14px;
            border: 1px dashed var(--border);
            border-radius: var(--r-md);
            color: var(--muted);
            font-size: 0.8rem;
            font-weight: 600;
            background: var(--surface-lt);
            margin-bottom: 16px;
        }

        .dash-alert-empty.show {
            display: block;
        }

        @media (min-width: 700px) {
            .dash-alerts {
                grid-template-columns: 1fr 1fr;
            }
        }

        .pay-selection-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 12px;
            padding: 12px 14px;
            background: linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(20, 184, 166, 0.06));
            border: 1px solid rgba(15, 118, 110, 0.25);
            border-radius: var(--r-md);
        }

        .pay-selection-bar strong {
            display: block;
            font-size: 0.95rem;
            color: var(--primary);
            font-weight: 800;
        }

        .pay-selection-bar span {
            font-size: 0.72rem;
            color: var(--muted);
            font-weight: 600;
        }

        .pay-confirm-box b {
            color: var(--primary);
        }

        .settings-page {
            padding-bottom: 4px;
        }

        .settings-hero {
            display: flex;
            align-items: stretch;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 16px;
            padding: 20px 20px 18px;
            border-radius: 20px;
            background:
                radial-gradient(120% 140% at 100% 0%, rgba(0, 92, 85, 0.16), transparent 55%),
                linear-gradient(135deg, #e8f3f1 0%, #f8f9ff 48%, #eef4f8 100%);
            border: 1px solid rgba(0, 92, 85, 0.12);
            overflow: hidden;
            position: relative;
        }

        .settings-kicker {
            margin: 0 0 4px;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--primary);
        }

        .settings-hero .st-sub {
            margin: 0;
            max-width: 34rem;
            font-size: 0.88rem;
        }

        .settings-hero-mark {
            width: 64px;
            height: 64px;
            flex: 0 0 auto;
            align-self: center;
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 92, 85, 0.1);
            color: var(--primary);
            font-size: 1.45rem;
        }

        .settings-tabs-wrap {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
            margin-bottom: 16px;
        }

        @media (min-width: 720px) {
            .settings-tabs-wrap {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }
        }

        .settings-tab {
            display: flex;
            align-items: center;
            gap: 12px;
            text-align: left;
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            cursor: pointer;
            font-family: inherit;
            transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
        }

        .settings-tab:hover {
            border-color: rgba(0, 92, 85, 0.35);
        }

        .settings-tab.active {
            border-color: var(--primary);
            background: linear-gradient(180deg, rgba(0, 92, 85, 0.08), rgba(0, 92, 85, 0.02));
            box-shadow: 0 0 0 3px rgba(0, 92, 85, 0.1);
        }

        .settings-tab-icon {
            width: 38px;
            height: 38px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: var(--surface-lt);
            color: var(--muted);
            flex: 0 0 auto;
        }

        .settings-tab.active .settings-tab-icon {
            background: var(--primary);
            color: #fff;
        }

        .settings-tab-text {
            display: flex;
            flex-direction: column;
            gap: 1px;
            min-width: 0;
        }

        .settings-tab-text strong {
            font-size: 0.84rem;
            font-weight: 700;
            line-height: 1.2;
        }

        .settings-tab-text small {
            font-size: 0.68rem;
            color: var(--muted);
            font-weight: 500;
        }

        .settings-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 14px;
        }

        @media (min-width: 900px) {
            .settings-grid {
                grid-template-columns: 1fr 1fr;
            }
        }

        .settings-card-block {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 18px;
            padding: 16px;
            display: flex;
            flex-direction: column;
            min-height: 100%;
            box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
        }

        .settings-card-block--wide {
            grid-column: 1 / -1;
        }

        .settings-card-head {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            margin-bottom: 14px;
        }

        .settings-card-head--row {
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
        }

        .settings-card-head--row>.settings-card-head {
            margin-bottom: 0;
            flex: 1 1 auto;
        }

        .settings-card-head h3 {
            margin: 0 0 3px;
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--text);
        }

        .settings-card-head p {
            margin: 0;
            font-size: 0.74rem;
            color: var(--muted);
            line-height: 1.35;
        }

        .settings-card-badge {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 92, 85, 0.12);
            color: var(--primary);
            flex: 0 0 auto;
        }

        .settings-card-badge.alt {
            background: rgba(14, 116, 144, 0.12);
            color: #0e7490;
        }

        .settings-save-btn,
        .settings-btn-stack .st-btn {
            width: 100%;
            justify-content: center;
            margin-top: 12px;
        }

        .settings-btn-stack {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 4px;
        }

        .settings-btn-stack .st-btn {
            margin-top: 0;
        }

        .settings-hint {
            margin: 0 0 6px;
            font-size: 0.72rem;
            color: var(--muted);
        }

        .settings-status-box {
            padding: 10px 12px;
            border-radius: 12px;
            font-size: 0.78rem;
            margin-top: 10px;
        }

        .settings-empty {
            text-align: center;
            color: var(--muted);
            font-size: 0.78rem;
            padding: 28px 16px;
        }

        .settings-textarea {
            width: 100%;
            min-height: 96px;
            font-size: 0.78rem;
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 10px 12px;
            font-family: inherit;
            resize: vertical;
            outline: none;
            box-sizing: border-box;
            background: var(--surface-lt);
            color: var(--text);
        }

        .settings-textarea:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(0, 92, 85, 0.12);
            background: #fff;
        }

        .audit-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: min(52vh, 480px);
            overflow-y: auto;
            padding-right: 2px;
        }

        body.dark .settings-hero {
            background:
                radial-gradient(120% 140% at 100% 0%, rgba(131, 146, 147, 0.22), transparent 55%),
                linear-gradient(135deg, #1e2223 0%, #161a1a 55%, #1e1e1e 100%);
            border-color: rgba(255, 255, 255, 0.08);
        }

        body.dark .settings-tab,
        body.dark .settings-card-block {
            background: var(--surface);
        }

        body.dark .settings-tab.active {
            background: linear-gradient(180deg, rgba(131, 146, 147, 0.16), rgba(131, 146, 147, 0.04));
        }

        .audit-row {
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: var(--r-sm);
            background: var(--surface-lt);
        }

        .audit-row-top {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 4px;
        }

        .audit-action {
            font-size: 0.72rem;
            font-weight: 800;
            color: var(--primary);
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }

        .audit-time {
            font-size: 0.66rem;
            color: var(--muted);
            font-weight: 600;
            white-space: nowrap;
        }

        .audit-detail {
            font-size: 0.74rem;
            color: var(--text);
            font-weight: 600;
        }

        .audit-meta {
            font-size: 0.66rem;
            color: var(--muted);
            margin-top: 3px;
        }

        .shortcut-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .shortcut-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            padding: 8px 10px;
            border: 1px solid var(--border);
            border-radius: var(--r-sm);
            background: var(--surface-lt);
            font-size: 0.76rem;
        }

        .shortcut-item kbd {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 28px;
            height: 24px;
            padding: 0 7px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: var(--surface);
            font-family: inherit;
            font-weight: 800;
            font-size: 0.72rem;
            color: var(--primary);
        }

        body.dark .dash-alert-card,
        body.dark .pay-selection-bar,
        body.dark .pay-confirm-box,
        body.dark .audit-row,
        body.dark .shortcut-item {
            background: var(--surface-lt);
            border-color: var(--border);
        }

        body.dark .dash-alert-empty {
            background: #171717;
        }

        body.dark .ai-scan-panel {
            background: linear-gradient(180deg, rgba(183, 191, 192, 0.08) 0%, rgba(23, 23, 23, 0.95) 55%);
            border-color: rgba(183, 191, 192, 0.25);
        }

        body.dark .ai-scan-panel .ai-scan-title,
        body.dark .ai-scan-panel .ai-scan-copy {
            color: var(--text);
        }

        body.dark .ai-scan-hint,
        body.dark .ai-scan-panel textarea {
            background: #292929 !important;
            border-color: #414141 !important;
            color: var(--text) !important;
        }

        body.dark .st-form-sec {
            background: var(--surface);
        }

        body.dark .st-form-sec-title {
            color: var(--primary);
            border-bottom-color: var(--border);
        }

        body.dark .card-chip {
            background: linear-gradient(135deg, #ad8a32 0%, #836826 100%);
        }

        body.dark #tab-entry .modal-card.exp-form-card,
        body.dark #tab-vendor-entry .modal-card.exp-form-card {
            background: var(--surface);
        }

        body.dark #tab-entry .modal-actions,
        body.dark #tab-vendor-entry .modal-actions {
            background: var(--surface);
        }

        body.dark .supplier-bank-card {
            background: linear-gradient(145deg, #272c2d 0%, #384040 52%, #1f1f1f 100%);
            border-color: rgba(183, 191, 192, 0.2);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        }

        body.dark .card-invoice-count {
            background: rgba(183, 191, 192, 0.15);
            border-color: rgba(183, 191, 192, 0.25);
            color: var(--primary);
        }

        body.dark .sp-invoice-card {
            background: rgba(255, 255, 255, 0.04);
            border-color: rgba(255, 255, 255, 0.08);
        }

        body.dark .sp-invoice-card.is-selected {
            background: var(--surface);
            border-color: var(--border);
        }
        .erp-drive-archive-hint {
            margin: 8px 0 0;
            font-size: 0.72rem;
            line-height: 1.45;
            color: var(--muted);
        }

        .erp-drive-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 12px;
        }

        .erp-drive-archive-toolbar {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
            flex-wrap: wrap;
        }

        .erp-drive-archive-toolbar input[type="month"] {
            flex: 1 1 140px;
            min-width: 0;
            height: 40px;
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            padding: 0 10px;
            font-weight: 700;
            font-size: 0.78rem;
            background: var(--surface);
            color: var(--text);
        }

        .erp-drive-source-toggle,
        .erp-drive-view-toggle {
            display: flex;
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            overflow: hidden;
            flex: none;
        }

        .erp-drive-source-toggle button,
        .erp-drive-view-toggle button {
            min-width: 40px;
            height: 40px;
            border: none;
            background: var(--surface);
            color: var(--muted);
            cursor: pointer;
            font-size: 0.68rem;
            font-weight: 800;
            padding: 0 10px;
        }

        .erp-drive-view-toggle button {
            width: 40px;
            padding: 0;
        }

        .erp-drive-source-toggle button.is-on,
        .erp-drive-view-toggle button.is-on {
            background: var(--primary);
            color: #fff;
        }

        .erp-drive-file-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: 10px;
        }

        .erp-drive-file-card {
            display: flex;
            flex-direction: column;
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            overflow: hidden;
            background: var(--surface);
            text-decoration: none;
            color: inherit;
        }

        .erp-drive-file-card__thumb {
            aspect-ratio: 1;
            background: var(--bg);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            position: relative;
        }

        .erp-drive-file-card__thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .erp-drive-file-card__thumb i {
            font-size: 1.8rem;
            color: var(--primary);
            opacity: 0.7;
        }

        .erp-drive-file-card__badge {
            position: absolute;
            top: 6px;
            left: 6px;
            font-size: 0.58rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            padding: 2px 6px;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.72);
            color: #fff;
        }

        .erp-drive-file-card__meta {
            padding: 8px 10px 10px;
            min-width: 0;
        }

        .erp-drive-file-card__meta b,
        .erp-drive-file-card__meta span {
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .erp-drive-file-card__meta b {
            font-size: 0.72rem;
            font-weight: 800;
            color: var(--text);
        }

        .erp-drive-file-card__meta span {
            font-size: 0.65rem;
            color: var(--muted);
            margin-top: 2px;
        }

        .erp-drive-status {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .erp-drive-status-item {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            background: var(--surface);
            text-decoration: none;
            color: inherit;
        }

        .erp-drive-status-item__icon {
            width: 32px;
            height: 32px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: none;
            background: var(--bg);
            color: var(--primary);
        }

        .erp-drive-status-item__icon.tone-success { color: var(--success, #16a34a); }
        .erp-drive-status-item__icon.tone-danger { color: var(--danger); }
        .erp-drive-status-item__icon.tone-warning { color: var(--warning, #d97706); }
        .erp-drive-status-item__icon.tone-info { color: var(--primary); }

        .erp-drive-status-item__text {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .erp-drive-status-item__text b {
            font-size: 0.78rem;
            font-weight: 800;
        }

        .erp-drive-status-item__text span {
            font-size: 0.68rem;
            color: var(--muted);
            line-height: 1.4;
        }

        .erp-drive-empty {
            padding: 28px 16px;
            text-align: center;
            color: var(--muted);
            font-size: 0.78rem;
            font-weight: 700;
            border: 1px dashed var(--border);
            border-radius: var(--r-md);
        }

        .erp-drive-file-list-item {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: var(--r-md);
            background: var(--surface);
            text-decoration: none;
            color: inherit;
            margin-bottom: 8px;
        }

        .erp-drive-file-list-item:hover {
            border-color: var(--primary);
        }

        .erp-drive-file-list-item__icon {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--bg);
            color: var(--primary);
            flex: none;
        }

        .erp-drive-file-list-item__text {
            min-width: 0;
            flex: 1;
        }

        .erp-drive-file-list-item__text b,
        .erp-drive-file-list-item__text span {
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .erp-drive-file-list-item__text b {
            font-size: 0.78rem;
            font-weight: 800;
        }

        .erp-drive-file-list-item__text span {
            font-size: 0.65rem;
            color: var(--muted);
            margin-top: 2px;
        }

        .erp-drive-panel-count {
            margin-left: 8px;
            font-size: 0.68rem;
            font-weight: 800;
            color: var(--muted);
        }
