        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0
        }

        :root {
            --bg: #f4f5f7;
            --white: #ffffff;
            --border: #e2e5ea;
            --text: #1a1d23;
            --muted: #6b7280;
            --accent: #111827;
            --accent2: #374151;
            --input-bg: #f9fafb;
            --warn-bg: #fffbeb;
            --warn-border: #fcd34d;
            --warn-text: #92400e;
            --radius: 10px;
            --shadow: 0 1px 3px rgba(71, 40, 40, .08), 0 1px 2px rgba(0, 0, 0, .05);
            --shadow-lg: 0 4px 20px rgba(0, 0, 0, .10)
        }

        body {
            font-family: "Montserrat", sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            font-size: 14px
        }

        /* TOPBAR */
        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--white);
            border-bottom: 1px solid var(--border);
            padding: 0 16px;
            height: 56px;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: var(--shadow);
            flex-wrap: wrap;
            gap: 8px;
        }

        .topbar__left {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            min-width: 0;
            flex: 1;
        }

        .topbar__title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 200px;
        }

        .topbar__autosave {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 12px;
            color: #6b7280;
            white-space: nowrap;
        }

        .topbar__autosave svg {
            color: #22c55e
        }

        .topbar__status {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: var(--muted);
            white-space: nowrap;
        }

        .topbar__status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #9ca3af
        }

        .topbar__right {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .btn {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 6px 12px;
            border-radius: 7px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            border: 1px solid transparent;
            transition: all .15s;
            font-family: "Montserrat", sans-serif;
            white-space: nowrap;
        }

        .btn-ghost {
            background: none;
            border-color: var(--border);
            color: var(--text)
        }

        .btn-ghost:hover {
            background: var(--bg)
        }

        .btn-primary {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent)
        }

        .btn-primary:hover {
            background: var(--accent2)
        }

        .btn-indigo {
            background: #6366f1;
            color: #fff;
            border-color: #6366f1
        }

        .btn-indigo:hover {
            background: #4f46e5
        }

        /* TABS - Mobile navigation */
        .mobile-tabs {
            display: none;
            background: var(--white);
            border-bottom: 1px solid var(--border);
            position: sticky;
            top: 43px;
            z-index: 90;
        }

        .mobile-tabs__inner {
            display: flex;
        }

        .mobile-tab {
            flex: 1;
            padding: 10px 8px;
            font-size: 12px;
            font-weight: 600;
            text-align: center;
            cursor: pointer;
            border: none;
            background: none;
            color: var(--muted);
            border-bottom: 2px solid transparent;
            transition: all .15s;
            font-family: "Montserrat", sans-serif;
        }

        .mobile-tab.active {
            color: #6366f1;
            border-bottom-color: #6366f1;
        }

        /* APP LAYOUT */
        .app {
            display: grid;
            grid-template-columns: 1fr 1fr;
            height: calc(100vh - 56px);
            overflow: hidden
        }

        .left-panel {
            overflow-y: auto;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            background: var(--bg)
        }

        .right-panel {
            overflow-y: auto;
            background: #e5e7eb;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 0
        }

        /* CARD */
        .card {
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 16px;
            box-shadow: var(--shadow)
        }

        .card__title {
            font-size: 13px;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 14px
        }

        /* FORM GRIDS */
        .form-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px
        }

        .form-grid-4 {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr;
            gap: 10px
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 4px
        }

        .form-group.full {
            grid-column: 1/-1
        }

        label {
            font-size: 11px;
            font-weight: 600;
            color: var(--muted);
            letter-spacing: .03em
        }

        input[type=text],
        input[type=email],
        input[type=tel],
        input[type=date],
        input[type=number],
        select,
        textarea {
            padding: 7px 9px;
            border: 1px solid var(--border);
            border-radius: 7px;
            font-size: 13px;
            font-family: "Montserrat", sans-serif;
            background: var(--input-bg);
            color: var(--text);
            transition: border-color .15s, box-shadow .15s;
            width: 100%
        }

        input:focus,
        select:focus,
        textarea:focus {
            outline: none;
            border-color: #6366f1;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, .12)
        }

        textarea {
            resize: vertical;
            min-height: 68px
        }

        select {
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
            padding-right: 28px
        }

        .color-field {
            display: flex;
            align-items: center;
            gap: 8px
        }

        .color-field label {
            margin: 0;
            font-size: 12px;
            font-weight: 600;
            color: var(--muted)
        }

        .color-swatch {
            width: 34px;
            height: 26px;
            border-radius: 5px;
            border: 1px solid var(--border);
            cursor: pointer;
            padding: 2px;
            overflow: hidden
        }

        .color-swatch input[type=color] {
            width: 100%;
            height: 100%;
            border: none;
            padding: 0;
            cursor: pointer;
            background: none
        }

        .btn-reset {
            padding: 3px 8px;
            font-size: 11px;
            border-radius: 5px;
            border: 1px solid var(--border);
            background: #fff;
            cursor: pointer;
            font-weight: 600;
            color: var(--muted)
        }

        .btn-reset:hover {
            background: var(--bg)
        }

        .logo-upload-area {
            border: 2px dashed var(--border);
            border-radius: 8px;
            padding: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 6px;
            cursor: pointer;
            transition: border-color .15s;
            min-height: 72px;
            background: var(--input-bg);
            position: relative
        }

        .logo-upload-area:hover {
            border-color: #6366f1
        }

        .logo-upload-area input {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
            width: 100%;
            height: 100%
        }

        .logo-upload-area img {
            max-height: 56px;
            max-width: 140px;
            object-fit: contain
        }

        .logo-upload-area span {
            font-size: 12px;
            color: var(--muted)
        }

        .logo-remove {
            position: absolute;
            top: -8px;
            right: -8px;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: #ef4444;
            color: #fff;
            border: none;
            cursor: pointer;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2
        }

        .warning-banner {
            background: var(--warn-bg);
            border: 1px solid var(--warn-border);
            border-radius: var(--radius);
            padding: 12px 14px;
            display: flex;
            gap: 10px;
            align-items: flex-start
        }

        .warning-banner svg {
            color: #f59e0b;
            flex-shrink: 0;
            margin-top: 1px
        }

        .warning-banner p {
            font-size: 12px;
            color: var(--warn-text);
            line-height: 1.5
        }

        .warning-banner strong {
            font-weight: 700
        }

        /* DISCOUNT ROW */
        .discount-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
            padding: 10px 12px;
            background: #f0fdf4;
            border: 1px solid #bbf7d0;
            border-radius: 8px;
            flex-wrap: wrap
        }

        .discount-row label {
            font-size: 12px;
            font-weight: 700;
            color: #15803d;
            margin: 0;
            white-space: nowrap
        }

        .discount-input-wrap {
            display: flex;
            align-items: center;
            gap: 4px
        }

        .discount-input-wrap input {
            max-width: 72px;
            font-weight: 700;
            color: #15803d;
            background: #fff;
            border-color: #86efac;
            width: 72px
        }

        .discount-input-wrap input:focus {
            border-color: #22c55e;
            box-shadow: 0 0 0 3px rgba(34, 197, 94, .12)
        }

        .discount-input-wrap span {
            font-size: 13px;
            font-weight: 700;
            color: #15803d
        }

        .discount-saving {
            margin-left: auto;
            font-size: 11px;
            font-weight: 700;
            color: #15803d;
            font-family: "Montserrat", sans-serif;
            background: #dcfce7;
            padding: 3px 8px;
            border-radius: 100px;
            display: none
        }

        /* ITEMS TABLE */
        .items-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 4px
        }

        .items-table th {
            font-size: 10px;
            font-weight: 700;
            color: var(--muted);
            letter-spacing: .05em;
            text-transform: uppercase;
            padding: 5px 6px;
            border-bottom: 1px solid var(--border);
            text-align: left
        }

        .items-table td {
            padding: 5px 3px;
            vertical-align: middle
        }

        .items-table td input {
            padding: 5px 7px;
            font-size: 12px
        }

        .items-table .td-desc {
            width: 44%
        }

        .items-table .td-qty {
            width: 14%
        }

        .items-table .td-rate {
            width: 20%
        }

        .items-table .td-amt {
            width: 18%;
            text-align: right
        }

        .items-table .td-del {
            width: 4%
        }

        .item-amount {
            font-size: 12px;
            font-weight: 600;
            text-align: right;
            padding: 5px 7px;
            color: var(--text);
            font-family: "Montserrat", sans-serif;
        }

        .btn-del-row {
            background: none;
            border: none;
            cursor: pointer;
            color: #d1d5db;
            padding: 4px;
            border-radius: 4px;
            display: flex;
            align-items: center
        }

        .btn-del-row:hover {
            color: #ef4444;
            background: #fef2f2
        }

        .btn-add-row {
            margin-top: 8px;
            padding: 7px 12px;
            background: var(--bg);
            border: 1px dashed var(--border);
            border-radius: 7px;
            font-size: 12px;
            font-weight: 600;
            color: var(--muted);
            cursor: pointer;
            width: 100%;
            transition: all .15s
        }

        .btn-add-row:hover {
            border-color: #6366f1;
            color: #6366f1
        }

        .extra-charges {
            display: flex;
            flex-direction: column;
            gap: 7px;
            margin-top: 10px
        }

        .extra-row {
            display: grid;
            grid-template-columns: 1fr 1fr 40px;
            gap: 7px;
            align-items: center
        }

        .btn-add-extra {
            margin-top: 7px;
            padding: 5px 10px;
            background: var(--bg);
            border: 1px dashed var(--border);
            border-radius: 7px;
            font-size: 12px;
            font-weight: 600;
            color: var(--muted);
            cursor: pointer;
            transition: all .15s
        }

        .btn-add-extra:hover {
            border-color: #6366f1;
            color: #6366f1
        }

        .btn-del-extra {
            background: none;
            border: none;
            cursor: pointer;
            color: #d1d5db;
            padding: 3px;
            border-radius: 4px
        }

        .btn-del-extra:hover {
            color: #ef4444
        }

        /* PREVIEW HEADER */
        .preview-header-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 14px
        }

        .preview-header-bar h3 {
            font-size: 13px;
            font-weight: 700;
            color: #374151
        }

        .preview-header-bar span {
            font-size: 11px;
            color: #9ca3af
        }

        /* INVOICE PAPER */
        .invoice-paper {
            background: #fff;
            border-radius: 8px;
            box-shadow: var(--shadow-lg);
            max-width: 680px;
            margin: 0 auto;
            width: 100%;
            overflow-y: auto;
            font-family: "Montserrat", sans-serif;
            display: flex;
            flex-direction: column;
            min-height: 100%;
        }

        .inv-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 24px 28px
        }

        .inv-header__logo img {
            max-height: 52px;
            max-width: 150px;
            object-fit: contain
        }

        .inv-header__right {
            text-align: right
        }

        .inv-header__right h2 {
            font-size: 26px;
            font-weight: 800;
            letter-spacing: .06em
        }

        .inv-header__meta {
            font-size: 11px;
            margin-top: 4px;
            opacity: .8;
            line-height: 1.6
        }

        .inv-body {
            padding: 24px 28px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            flex-grow: 1;
        }

        .inv-parties {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px
        }

        .inv-party__label {
            font-size: 9px;
            font-weight: 700;
            letter-spacing: .1em;
            text-transform: uppercase;
            color: var(--muted);
            display: flex;
            align-items: center;
            gap: 5px;
            margin-bottom: 7px
        }

        .inv-party__label::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #111;
            display: block
        }

        .inv-party__name {
            font-size: 13px;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 3px
        }

        .inv-party__about {
            font-size: 11px;
            color: var(--muted);
            line-height: 1.6;
            white-space: pre-wrap;
            word-break: break-word
        }

        .inv-party__contact {
            font-size: 10px;
            margin-top: 5px;
            padding-top: 4px;
            border-top: 1px dashed #e5e7eb
        }

        .inv-party__contact span {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            margin-right: 10px;
            color: #4b5563
        }

        .inv-items-table {
            width: 100%;
            border-collapse: collapse
        }

        .inv-items-table th {
            font-size: 10px;
            font-weight: 700;
            color: var(--muted);
            letter-spacing: .05em;
            text-transform: uppercase;
            padding: 9px 10px;
            border-bottom: 1px solid var(--border);
            text-align: left
        }

        .inv-items-table th:last-child {
            text-align: right
        }

        .inv-items-table td {
            padding: 10px 10px;
            font-size: 12px;
            border-bottom: 1px solid #f3f4f6;
            vertical-align: top
        }

        .inv-items-table td:nth-child(2),
        .inv-items-table td:nth-child(3) {
            text-align: center;
            color: var(--muted)
        }

        .inv-items-table td:last-child {
            text-align: right;
            font-weight: 700;
            font-family: "Montserrat", sans-serif;
        }

        .inv-items-table tr:last-child td {
            border-bottom: none
        }

        /* TOTALS */
        .inv-totals-wrap {
            display: flex;
            justify-content: flex-end
        }

        .inv-totals {
            width: 300px;
            background: #fff;
            border: 1px solid var(--border);
            border-radius: 8px;
            overflow: hidden
        }

        .inv-totals__row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 7px 13px;
            border-bottom: 1px solid #f3f4f6;
            font-size: 12px
        }

        .inv-totals__row .lbl {
            color: var(--muted);
            font-size: 12px
        }

        .inv-totals__row .val {
            font-family: "Montserrat", sans-serif;
            font-weight: 600;
            color: var(--text);
            font-size: 12px
        }

        .inv-totals__row.green-row .lbl {
            color: #15803d
        }

        .inv-totals__row.green-row .val {
            color: #15803d
        }

        .inv-totals__total {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 14px;
            font-size: 14px;
            font-weight: 800
        }

        .inv-totals__total .lbl {
            font-size: 14px;
            font-weight: 800;
            letter-spacing: .04em
        }

        .inv-totals__total .val {
            font-family: "Montserrat", sans-serif;
            font-size: 14px;
            font-weight: 800
        }

        /* BANK DETAILS */
        .bank-details-section {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 12px 14px;
            margin-top: 10px;
        }

        .bank-details-title {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: .1em;
            text-transform: uppercase;
            color: #475569;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .bank-details-content {
            font-size: 10px;
            line-height: 1.7;
            color: #1e293b;
            white-space: pre-wrap;
            font-family: "Montserrat", sans-serif;
            background: #fff;
            padding: 9px 10px;
            border-radius: 6px;
            border: 1px solid #e2e8f0;
        }

        /* REMARKS */
        .remarks-section {
            background: #fffbeb;
            border: 1px solid #fde68a;
            border-radius: 8px;
            padding: 10px 14px;
            margin-bottom: 10px;
            display: none;
        }

        .remarks-title {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: .1em;
            text-transform: uppercase;
            color: #92400e;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .remarks-content {
            font-size: 11px;
            line-height: 1.6;
            color: #78350f;
            white-space: pre-wrap;
            word-break: break-word;
        }

        /* FOOTER */
        .inv-footer {
            display: flex;
            justify-content: center;
            align-items: center;
            padding-top: 14px;
            margin-top: auto;
            border-top: 1px solid var(--border);
            color: #94a3b8;
        }

        .inv-footer span {
            font-size: 11px;
        }

        .inv-footer a {
            font-size: 11px;
            color: #000;
            text-decoration: none;
            font-weight: bold;
        }

        /* BANK EDIT CARD */
        .bank-edit-card {
            background: #f0f9ff;
            border: 1px solid #bae6fd;
            border-radius: 8px;
            padding: 14px;
        }

        .bank-edit-title {
            font-size: 12px;
            font-weight: 700;
            color: #0369a1;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .bank-edit-note {
            font-size: 10px;
            color: #0284c7;
            margin-top: 7px;
            text-align: center;
        }

        /* MY INVOICES PAGE */
        #myInvoicesPage {
            display: none;
            position: fixed;
            inset: 0;
            top: 56px;
            background: var(--bg);
            z-index: 90;
            overflow-y: auto;
            padding: 20px 16px;
        }

        .mi-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 10px;
        }

        .mi-header h2 {
            font-size: 18px;
            font-weight: 700;
            color: var(--text)
        }

        .mi-header span {
            font-size: 12px;
            color: var(--muted)
        }

        .mi-empty {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 12px;
            padding: 50px 20px;
            color: var(--muted)
        }

        .mi-empty svg {
            color: #d1d5db
        }

        .mi-empty p {
            font-size: 14px;
            font-weight: 500
        }

        .mi-empty small {
            font-size: 12px;
            color: #9ca3af
        }

        .mi-table-wrap {
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow)
        }

        .mi-table {
            width: 100%;
            border-collapse: collapse
        }

        .mi-table thead {
            background: #f9fafb
        }

        .mi-table th {
            font-size: 10px;
            font-weight: 700;
            color: var(--muted);
            letter-spacing: .05em;
            text-transform: uppercase;
            padding: 10px 12px;
            border-bottom: 1px solid var(--border);
            text-align: left;
            white-space: nowrap
        }

        .mi-table td {
            padding: 12px;
            font-size: 12px;
            border-bottom: 1px solid #f3f4f6;
            vertical-align: middle
        }

        .mi-table tbody tr:last-child td {
            border-bottom: none
        }

        .mi-table tbody tr:hover {
            background: #fafafa;
            cursor: pointer
        }

        .mi-inv-num {
            font-weight: 700;
            color: var(--text);
            font-family: "Montserrat", sans-serif;
            font-size: 11px
        }

        .mi-client {
            font-weight: 500;
            color: var(--text)
        }

        .mi-client-sub {
            font-size: 10px;
            color: var(--muted);
            margin-top: 2px
        }

        .mi-amount {
            font-family: "Montserrat", sans-serif;
            font-weight: 700;
            color: var(--text)
        }

        .mi-date {
            color: var(--muted);
            font-size: 11px
        }

        .mi-actions {
            display: flex;
            gap: 5px
        }

        .btn-open {
            padding: 4px 10px;
            border-radius: 5px;
            font-size: 11px;
            font-weight: 600;
            background: #eff6ff;
            color: #2563eb;
            border: 1px solid #bfdbfe;
            cursor: pointer;
            transition: all .15s
        }

        .btn-open:hover {
            background: #dbeafe
        }

        .btn-delete {
            padding: 4px 10px;
            border-radius: 5px;
            font-size: 11px;
            font-weight: 600;
            background: #fef2f2;
            color: #dc2626;
            border: 1px solid #fecaca;
            cursor: pointer;
            transition: all .15s
        }

        .btn-delete:hover {
            background: #fee2e2
        }

        .mi-badge {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            border-radius: 100px;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: .04em;
            text-transform: uppercase
        }

        .mi-badge--draft {
            background: #f3f4f6;
            color: #6b7280
        }

        .mi-badge--paid {
            background: #dcfce7;
            color: #15803d
        }

        .mi-badge--unpaid {
            background: #fef2f2;
            color: #dc2626
        }

        .mi-badge--overdue {
            background: #fef3c7;
            color: #d97706
        }

        .mi-stats {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
            margin-bottom: 20px
        }

        .mi-stat {
            background: var(--white);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 14px 16px;
            box-shadow: var(--shadow)
        }

        .mi-stat__label {
            font-size: 10px;
            font-weight: 700;
            color: var(--muted);
            letter-spacing: .05em;
            text-transform: uppercase;
            margin-bottom: 5px
        }

        .mi-stat__val {
            font-size: 20px;
            font-weight: 700;
            color: var(--text);
            font-family: "Montserrat", sans-serif;
        }

        .mi-stat__val.green {
            color: #16a34a
        }

        .mi-stat__val.red {
            color: #dc2626
        }

        /* MODAL */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, .4);
            backdrop-filter: blur(4px);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
            animation: fadeIn .2s ease-out;
            padding: 16px;
        }

        .modal-card {
            background: #fff;
            border-radius: 12px;
            width: 400px;
            max-width: 100%;
            padding: 22px;
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04);
            transform: scale(.95);
            transition: transform .2s ease-out;
            font-family: "Montserrat", sans-serif;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-overlay.active .modal-card {
            transform: scale(1);
        }

        .modal-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 14px;
        }

        .modal-icon {
            width: 38px;
            height: 38px;
            background: #f0fdf4;
            color: #16a34a;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-title {
            font-size: 17px;
            font-weight: 700;
            color: #111827;
        }

        .modal-body {
            font-size: 13px;
            color: #4b5563;
            line-height: 1.5;
            margin-bottom: 20px;
        }

        .modal-footer {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .modal-btn {
            width: 100%;
            padding: 9px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            border: 1px solid transparent;
            transition: all .2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-family: "Montserrat", sans-serif;
        }

        .modal-btn-primary {
            background: #111827;
            color: #fff;
        }

        .modal-btn-primary:hover {
            background: #374151;
        }

        .modal-btn-secondary {
            background: #fff;
            border-color: #e5e7eb;
            color: #374151;
        }

        .modal-btn-secondary:hover {
            background: #f9fafb;
        }

        .modal-btn-ghost {
            background: transparent;
            color: #6b7280;
            margin-top: 4px;
            border: none;
        }

        .modal-btn-ghost:hover {
            color: #111827;
        }

        @keyframes fadeIn {
            from {
                opacity: 0
            }

            to {
                opacity: 1
            }
        }

        /* ===================== RESPONSIVE ===================== */

        /* Large screens - hide tabs */
        @media (min-width: 500px) {
            .mobile-tabs {
                top: 45px;
            }
        }

        @media (min-width: 769px) {
            .mobile-tabs {
                display: none !important;
            }
        }

        /* Tablet: 769px–1024px */
        @media (max-width: 1024px) {
            .app {
                grid-template-columns: 1fr;
                height: auto;
                overflow: visible;
            }

            .left-panel,
            .right-panel {
                height: auto;
                overflow-y: visible;
            }

            .right-panel {
                padding: 16px;
            }

            .form-grid-4 {
                grid-template-columns: 1fr 1fr;
            }
        }

        /* Mobile: below 769px */
        @media (max-width: 768px) {
            body {
                font-size: 13px;
            }

            .topbar {
                height: auto;
                padding: 8px 12px;
                gap: 8px;
            }

            .topbar__title {
                font-size: 12px;
                max-width: 130px;
            }

            .topbar__autosave {
                font-size: 11px;
            }

            .topbar__status {
                display: none;
            }

            /* Hide some topbar buttons on very small screens */
            .btn-ghost.print-btn {
                display: none;
            }

            .mobile-tabs {
                display: block;
            }

            .app {
                display: block;
            }

            /* Show/hide panels via JS tabs */
            .left-panel {
                padding: 12px;
                gap: 12px;
            }

            .right-panel {
                padding: 12px;
            }

            .left-panel.hidden,
            .right-panel.hidden {
                display: none;
            }

            .form-grid {
                grid-template-columns: 1fr;
            }

            .form-grid-4 {
                grid-template-columns: 1fr 1fr;
            }

            .card {
                padding: 14px;
            }

            .card__title {
                font-size: 12px;
                margin-bottom: 12px;
            }

            /* Invoice paper */
            .invoice-paper {
                min-height: auto;
                border-radius: 6px;
            }

            .inv-header {
                padding: 16px 18px;
            }

            .inv-header__right h2 {
                font-size: 20px;
            }

            .inv-body {
                padding: 16px 18px;
                gap: 16px;
            }

            .inv-parties {
                grid-template-columns: 1fr;
                gap: 14px;
            }

            .inv-totals {
                width: 100%;
            }

            .inv-totals-wrap {
                justify-content: stretch;
            }

            /* My Invoices */
            .mi-stats {
                grid-template-columns: 1fr 1fr;
            }

            .mi-header {
                flex-direction: column;
                align-items: flex-start;
            }

            /* Table scroll on mobile */
            .mi-table-wrap {
                overflow-x: auto;
            }

            .mi-table {
                min-width: 500px;
            }

            /* Items table on mobile */
            .items-table {
                min-width: 340px;
            }

            .items-table-wrap {
                overflow-x: auto;
            }

            /* Extra row */
            .extra-row {
                grid-template-columns: 1fr 1fr 36px;
                gap: 6px;
            }

            /* Color fields */
            .color-settings {
                flex-wrap: wrap;
                gap: 12px;
            }

            /* Warning banner */
            .warning-banner {
                padding: 10px 12px;
            }

            /* Discount row */
            .discount-row {
                gap: 6px;
            }

            .discount-saving {
                margin-left: 0;
            }

            /* Preview header */
            .preview-header-bar {
                margin-bottom: 10px;
            }

            .preview-header-bar span {
                display: none;
            }

            /* Footer section in invoice */
            #bankQRSectionLastPage {
                padding: 0 16px 10px 16px;
            }

            #bankQRSectionLastPage>div {
                flex-direction: column;
            }

            #qrCodeSection {
                min-width: unset !important;
                width: 100% !important;
            }

            .btn {
                padding: 6px 10px;
                font-size: 11px;
            }
        }

        /* Very small screens */
        @media (max-width: 400px) {
            .topbar__autosave {
                display: none;
            }

            .form-grid-4 {
                grid-template-columns: 1fr 1fr;
            }

            .mi-stats {
                grid-template-columns: 1fr 1fr;
            }

            .btn {
                padding: 5px 8px;
                font-size: 11px;
                gap: 3px;
            }

            .btn svg {
                display: none;
            }
        }

        @media print {
            body {
                background: #fff
            }

            .topbar,
            .left-panel,
            .preview-header-bar,
            .right-panel>*:not(.invoice-paper),
            .mobile-tabs {
                display: none !important
            }

            .app {
                display: block;
                height: auto
            }

            .right-panel {
                padding: 0;
                background: #fff
            }

            .invoice-paper {
                box-shadow: none;
                border-radius: 0;
                max-width: 100%;
                display: table !important;
                width: 100%;
                border: none !important;
                height: auto !important;
                min-height: 0 !important;
            }

            .print-header-wrapper {
                display: table-header-group !important;
            }

            .print-body-wrapper {
                display: table-row-group !important;
            }

            .print-footer-wrapper {
                display: table-footer-group !important;
            }
        }