@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    /* Pure Monochrome Premium System */
    --bg-page: #ffffff;
    --bg-card: #ffffff;

    --text-main: #000000;
    --text-muted: #666666;
    --text-light: #999999;

    --border-subtle: #eaeaea;
    --border-hover: #cccccc;

    --primary: #000000;
    --primary-hover: #222222;
    --primary-light: #f5f5f5;

    --accent: #000000;

    --success: #000000;
    --error: #cc0000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 60px;
    font-size: 13px;
}

/* Background Animation Canvas */
#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}

/* Ensure page content sits above canvas */
.page-container {
    position: relative;
    z-index: 1;
}

/* Base Utility Layout - Fill Screen Fluid */
.page-container {
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

/* Header / Brand Details */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0 40px;
    border-bottom: 1px solid var(--primary);
    margin-bottom: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-img {
    height: 64px;
    width: auto;
    object-fit: contain;
}

.brand-text h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
    text-transform: uppercase;
}

.brand-text span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-top: 2px;
}

.header-support a {
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.header-support a:hover {
    border-color: var(--primary);
}

/* Form Container & Typography */
.onboarding-form {
    background: var(--bg-card);
    width: 100%;
}

.form-header {
    margin-bottom: 32px;
}

.form-header h2 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin-bottom: 4px;
}

.form-header p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 800px;
}

/* Form Sections */
.form-section {
    display: flex;
    gap: 24px;
    padding: 32px 0;
    border-top: 1px solid var(--border-subtle);
}

.section-badge {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.section-body {
    flex: 1;
    min-width: 0;
}

.section-title {
    margin-bottom: 24px;
}

.section-title h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-main);
}

/* Grid & Inputs */
.input-row-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.input-row-grid.four-col {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

.span-full {
    grid-column: 1 / -1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    width: 100%;
}

label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="tel"],
input[type="email"],
select {
    width: 100%;
    padding: 10px 12px;
    background-color: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
    border-radius: 0;
    transition: border-color 0.2s ease;
}

input[type="text"]::placeholder,
input[type="tel"]::placeholder,
input[type="email"]::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

input[type="text"]:hover,
input[type="tel"]:hover,
input[type="email"]:hover,
select:hover {
    border-color: var(--text-muted);
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

.field-error {
    border-color: var(--error) !important;
    background-color: rgba(204, 0, 0, 0.05) !important;
}

/* Custom Select Dropdown */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='1.5' stroke-linecap='square' stroke-linejoin='miter'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

select {
    appearance: none;
    cursor: pointer;
    padding-right: 32px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

select option {
    white-space: normal;
}

/* Premium File Drop Zone */
.upload-area {
    margin-top: 24px;
}

.upload-area label {
    display: block;
    margin-bottom: 8px;
}

.file-drop-container {
    position: relative;
    border: 1px dashed var(--border-hover);
    background-color: var(--primary-light);
    padding: 24px;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.file-drop-container:hover,
.file-drop-container.dragover {
    border-style: solid;
    border-color: var(--primary);
    background-color: var(--bg-card);
}

.file-drop-container input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.upload-flex {
    display: flex;
    align-items: center;
    gap: 16px;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.upload-icon-container {
    width: 40px;
    height: 40px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.file-drop-container:hover .upload-icon-container {
    transform: scale(1.05);
}

.upload-text-container h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.upload-text-container p {
    font-size: 12px;
    color: var(--text-muted);
}

.browse-link {
    color: var(--text-main);
    font-weight: 600;
    text-decoration: underline;
}

/* File Actions (Preview & Remove) */
.file-actions {
    display: flex;
    gap: 8px;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    pointer-events: auto;
}

.btn-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.btn-action:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.btn-action.btn-remove:hover {
    color: var(--error);
}

/* Success State of Upload Zone */
.file-drop-container.has-file {
    border-style: solid;
    border-color: var(--primary);
    background-color: #ffffff;
}

.file-drop-container.has-file input[type="file"] {
    pointer-events: none;
    z-index: -1;
}

.file-drop-container.has-file .browse-link {
    display: none;
}

/* Action Footer */
.action-footer {
    display: flex;
    justify-content: flex-end;
    padding: 24px 0;
    border-top: 1px solid var(--primary);
    margin-top: 16px;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    font-family: inherit;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 32px;
    border: 1px solid var(--primary);
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--bg-card);
    color: var(--primary);
}

.btn-icon {
    transition: transform 0.2s ease;
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

/* Loading State for Button */
.btn-primary.loading {
    background-color: var(--text-muted);
    border-color: var(--text-muted);
    color: #ffffff;
    pointer-events: none;
}

.btn-primary.loading .btn-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* --- Stepper UI --- */
.stepper-wrapper {
    margin-bottom: 40px;
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.stepper-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

/* Horizontal connecting line behind all steps */
.stepper-track {
    position: absolute;
    top: 16px;
    left: calc(16.66% + 16px);
    right: calc(16.66% + 16px);
    height: 2px;
    background: var(--border-subtle);
    z-index: 0;
}

.stepper-track-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
}

.step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: default;
}

.step-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.step.active .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
}

.step.completed .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.step-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.step.active .step-label {
    color: var(--text-main);
    font-weight: 700;
}

.step.completed .step-label {
    color: var(--text-muted);
    font-weight: 600;
}

/* Step content show/hide */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}


/* ─────────────────────────────────────────────
   Address Details - Step 2
───────────────────────────────────────────── */

/* Entry form wrapper */
.address-entry-form {
    border: 1px solid var(--border-subtle);
    padding: 24px;
    background: #fafafa;
    margin-bottom: 24px;
}

/* Type label */
.addr-type-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 12px;
}

/* Type tabs row */
.addr-type-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.addr-type-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border-hover);
    background: #ffffff;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.addr-type-tab svg {
    flex-shrink: 0;
}

.addr-type-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.addr-type-tab.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* Fields area */
.addr-fields {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    animation: fadeIn 0.25s ease;
}

/* Add row */
.addr-add-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.btn-add-address {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--primary);
    color: #ffffff;
    border: 1px solid var(--primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.2s ease;
}

.btn-add-address:hover {
    background: #ffffff;
    color: var(--primary);
}

.addr-add-hint {
    font-size: 12px;
    color: var(--error);
}

/* ─── Address Table ─── */
.addr-table-wrapper {
    margin-top: 4px;
    border: 1px solid var(--border-subtle);
    animation: fadeIn 0.3s ease;
}

.addr-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary);
    color: #ffffff;
}

.addr-table-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.addr-count-badge {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.addr-table-scroll {
    overflow-x: auto;
}

.addr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.addr-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #f9f9f9;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.addr-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s ease;
}

.addr-table tbody tr:hover {
    background: #f5f5f5;
}

.addr-table tbody tr:last-child {
    border-bottom: none;
}

.addr-table tbody td {
    padding: 11px 14px;
    color: var(--text-main);
    vertical-align: middle;
}

.addr-table tbody td:first-child {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
}

/* Type badge inside table */
.addr-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--border-hover);
    border-radius: 2px;
    white-space: nowrap;
}

.addr-type-badge.billing  { border-color: #1a1a1a; color: #1a1a1a; }
.addr-type-badge.shipping { border-color: #0066cc; color: #0066cc; }
.addr-type-badge.consignor{ border-color: #7b2fa8; color: #7b2fa8; }
.addr-type-badge.factory  { border-color: #b45309; color: #b45309; }

/* Bank account type badge variants */
.addr-type-badge.acct-savings { border-color: #16a34a; color: #16a34a; }
.addr-type-badge.acct-credit  { border-color: #dc2626; color: #dc2626; }
.addr-type-badge.acct-od      { border-color: #d97706; color: #d97706; }

/* Bank letter file badge in table */
.bank-file-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 500;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 3px 8px;
    border-radius: 2px;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Row delete button */
.btn-del-addr {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
    border-radius: 2px;
}

.btn-del-addr:hover {
    color: var(--error);
    transform: scale(1.1);
}

/* Empty state */
.addr-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-hover);
    background: #fafafa;
    margin-top: 4px;
}

.addr-empty-state p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}


/* --- Inline Notice Box --- */
.notice-box {
    display: flex;
    gap: 16px;
    background-color: #fafafa;
    border: 1px solid var(--border-hover);
    padding: 24px;
    align-items: flex-start;
}

.notice-box p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    color: var(--text-muted);
}

.notice-box strong {
    color: var(--text-main);
    font-weight: 700;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .page-container {
        padding: 16px;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding-bottom: 24px;
    }

    .form-section {
        flex-direction: column;
        gap: 16px;
        padding: 24px 0;
    }

    .section-badge {
        margin-bottom: 0;
    }

    /* On mobile, grids stack exactly to minimum sizes naturally but allow full override */
    .input-row-grid,
    .input-row-grid.four-col {
        grid-template-columns: 1fr;
    }

    .span-2,
    .span-3,
    .span-4,
    .span-full {
        grid-column: span 1;
    }

    .action-footer {
        justify-content: stretch;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* --- Preview Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    /* Deep stark dimming */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
}

.btn-close-modal:hover {
    color: var(--error);
    transform: scale(1.1);
}

.modal-body {
    flex: 1;
    background-color: #f5f5f5;
    position: relative;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: #ffffff;
    color: var(--text-main);
    padding: 16px 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 400px;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast-message {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
}

.toast.hiding {
    animation: fadeOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* --- Receipt View --- */
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
    background: #fafafa;
    border: 1px solid var(--border-subtle);
    padding: 32px;
}

.receipt-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.receipt-item.receipt-full {
    grid-column: 1 / -1;
}

.receipt-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.receipt-val {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
    word-break: break-word;
}

.receipt-divider {
    grid-column: 1 / -1;
    height: 1px;
    background-color: var(--border-subtle);
    margin: 8px 0;
}

.print-actions-footer {
    justify-content: flex-start;
    gap: 16px;
}

.btn-primary.btn-alt {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--text-main);
}

.btn-primary.btn-alt:hover {
    background-color: var(--text-main);
    color: #ffffff;
}

/* --- Print Styling --- */
@media print {
    body {
        background: none !important;
        background-color: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #bgCanvas,
    .no-print,
    #toastContainer,
    #previewModal,
    #mainFormContainer {
        display: none !important;
    }

    .page-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
    }

    .receipt-grid {
        background: transparent !important;
        border: 2px solid #000 !important;
        padding: 24px !important;
        gap: 16px !important;
        display: block !important;
    }

    .receipt-item {
        display: block !important;
        width: 100% !important;
        margin-bottom: 12px !important;
        break-inside: avoid;
    }

    .pdf-preview {
        display: none !important;
    }

    .pdf-only-badge {
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
        color: var(--success) !important;
        font-weight: 500;
        margin-top: 4px;
    }

    .receipt-divider {
        background-color: #000 !important;
        opacity: 0.2;
    }

    .receipt-label {
        color: #555 !important;
    }

    .receipt-val {
        color: #000 !important;
    }
}

/* --- Receipt View --- */
.receipt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
    background: #fafafa;
    border: 1px solid var(--border-subtle);
    padding: 32px;
}

.receipt-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    break-inside: avoid;
}

.receipt-item.receipt-full {
    grid-column: 1 / -1;
}

.receipt-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.receipt-val {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
    word-break: break-word;
}

.receipt-val img.img-preview {
    max-height: 120px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    padding: 2px;
    background: #fff;
    margin-top: 4px;
}

.receipt-val .file-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--success);
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
}

.receipt-val .file-badge svg {
    flex-shrink: 0;
}

.receipt-divider {
    grid-column: 1 / -1;
    height: 1px;
    background-color: var(--border-subtle);
    margin: 8px 0;
    break-inside: avoid;
}

/* Section heading rows inside the receipt grid */
.receipt-section-title {
    grid-column: 1 / -1;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #ffffff;
    background: var(--primary);
    padding: 6px 14px;
    margin-bottom: -4px;
    break-inside: avoid;
}

/* Compact embedded tables inside the receipt (addresses & banks) */
.receipt-sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    border: 1px solid var(--border-subtle);
}

.receipt-sub-table thead th {
    padding: 8px 10px;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #f3f3f3;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.receipt-sub-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
}

.receipt-sub-table tbody tr:last-child {
    border-bottom: none;
}

.receipt-sub-table tbody td {
    padding: 8px 10px;
    color: var(--text-main);
    vertical-align: middle;
    font-size: 11px;
}

.print-actions-footer {
    justify-content: flex-start;
    gap: 16px;
}

.btn-primary.btn-alt {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--text-main);
}

.btn-primary.btn-alt:hover {
    background-color: var(--text-main);
    color: #ffffff;
}

.btn-primary.btn-print {
    background-color: #1a1a1a;
    color: #ffffff;
    border: 1px solid #1a1a1a;
    position: relative;
    overflow: hidden;
}

.btn-primary.btn-print::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.btn-primary.btn-print:hover {
    background-color: #333333;
    border-color: #333333;
    color: #ffffff;
}

.btn-primary.btn-print .btn-icon {
    transition: transform 0.2s ease;
}

.btn-primary.btn-print:hover .btn-icon {
    transform: scale(1.15);
}

.required-asterisk {
    color: #ef4444 !important;
    font-weight: bold;
    margin-left: 2px;
}

/* --- Help & Modal Styles --- */
.btn-help {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-help:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.modal-overlay.show {
    display: flex !important;
    animation: fadeIn 0.2s ease forwards;
}

.modal-overlay.show .modal-content {
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Print & PDF Styling --- */
@media print {
    body {
        background: none !important;
        background-color: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #bgCanvas,
    .no-print,
    #toastContainer,
    #previewModal,
    #helpGuideModal,
    #mainFormContainer {
        display: none !important;
    }

    .page-container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
    }

    .receipt-grid {
        background: transparent !important;
        border: 1px solid #ccc !important;
        padding: 20px !important;
        gap: 14px !important;
        display: block !important;
    }

    .receipt-section-title {
        background: #000 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .receipt-divider {
        background-color: #ccc !important;
    }

    .receipt-label {
        color: #555 !important;
    }

    .receipt-val {
        color: #000 !important;
        font-size: 12px !important;
    }

    .receipt-sub-table {
        border: 1px solid #ccc !important;
        font-size: 10px !important;
        break-inside: auto;
        width: 100% !important;
        table-layout: fixed;
        word-break: break-word;
    }

    .addr-table-scroll {
        overflow: visible !important;
        overflow-x: visible !important;
    }

    .receipt-sub-table thead th {
        background: #f0f0f0 !important;
        color: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 8px !important;
    }

    .receipt-sub-table tbody td {
        font-size: 10px !important;
        padding: 5px 8px !important;
    }

    .addr-type-badge {
        border: 1px solid #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 8px !important;
    }

    .bank-file-badge {
        background: #f0fdf4 !important;
        border: 1px solid #aaa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .img-preview {
        max-height: 80px !important;
    }
}

/* ───────────────────────────────────────────────────────────── */
/* Autocomplete Searchable Select Styles                        */
/* ───────────────────────────────────────────────────────────── */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-wrapper select {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.searchable-select-input-container {
    position: relative;
    width: 100%;
}

.searchable-select-input-container::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='1.5' stroke-linecap='square' stroke-linejoin='miter'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.searchable-select-wrapper.open .searchable-select-input-container::after {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-select-input {
    width: 100%;
    padding: 10px 12px;
    padding-right: 32px !important;
    background-color: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
    border-radius: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.searchable-select-input:hover {
    border-color: var(--text-muted);
}

.searchable-select-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-card);
}

.searchable-select-input.field-error {
    border-color: var(--error) !important;
    background-color: rgba(204, 0, 0, 0.05) !important;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--primary);
    border-top: none;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.searchable-select-wrapper.open .searchable-select-dropdown {
    display: block;
}

.searchable-select-option {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.searchable-select-option:hover,
.searchable-select-option.highlighted {
    background-color: var(--primary-light);
}

.searchable-select-option.selected {
    font-weight: 600;
    background-color: var(--primary-light);
}

.searchable-select-no-results {
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Custom Scrollbar for Dropdown to match premium look */
.searchable-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
    background-color: var(--border-hover);
    border-radius: 3px;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* SLEEK DISABLED STATE STYLING */
input:disabled,
select:disabled,
.searchable-select-input:disabled {
    background-color: #fafafa !important;
    color: var(--text-light) !important;
    border-color: var(--border-subtle) !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Address Autocomplete Suggestions styling */
#addressSuggestionsDropdown {
    border-radius: 0;
    max-height: 280px;
}
.address-suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.address-suggestion-item:last-child {
    border-bottom: none;
}
.address-suggestion-item:hover,
.address-suggestion-item.highlighted {
    background-color: var(--primary-light);
}

/* Phone Country Badge Styling */
.phone-input-wrapper {
    position: relative;
    width: 100%;
}
.phone-input-wrapper input[type="tel"] {
    padding-right: 110px; /* Space for the country badge on the right */
}
.phone-country-badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--primary-light);
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
/* -------------------------------------------------------------------------- */
/* Onboarding Loading Screen                                                  */
/* -------------------------------------------------------------------------- */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    background-image: url('MWLoading.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

body.no-scroll {
    overflow: hidden !important;
}



.onboarding-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.onboarding-content {
    position: absolute;
    bottom: 12%;
    z-index: 2; /* Sit in front of overlay tint */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 90%;
    width: 480px;
    gap: 20px;
}

.onboarding-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

.onboarding-spinner::before,
.onboarding-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.onboarding-spinner::before {
    top: 0; left: 0; right: 0; bottom: 0;
    border-top-color: rgba(0, 0, 0, 0.9);
    border-bottom-color: rgba(0, 0, 0, 0.9);
    animation: spinLoader 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.2));
}

.onboarding-spinner::after {
    top: 10px; left: 10px; right: 10px; bottom: 10px;
    border-left-color: rgba(0, 0, 0, 0.5);
    border-right-color: rgba(0, 0, 0, 0.5);
    animation: spinLoaderReverse 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.onboarding-status {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    color: #1a1a1a;
    letter-spacing: 0.15em;
    margin: 8px 0;
    text-shadow: none;
    transition: color 0.3s ease;
}

.onboarding-status.error {
    color: #cc0000;
    font-weight: 600;
    text-shadow: none;
}

.onboarding-status.success {
    color: #1a1a1a;
    font-weight: 600;
    text-shadow: none;
}

/* Sleek Geometric Progress Bar */
.onboarding-progress-container {
    width: 320px;
    height: 6px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    padding: 1px;
}

.onboarding-progress-bar {
    width: 0%;
    height: 100%;
    background: #000000;
    border-radius: 2px;
    position: relative;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

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

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

/* Mobile Responsiveness for Onboarding Overlay */
@media (max-width: 768px) {
    .onboarding-overlay {
        background-size: cover;
        background-position: top center;
    }
    
    .onboarding-content {
        width: 90%;
        max-width: 320px;
        bottom: 15%;
    }

    .onboarding-progress-container {
        width: 100%;
        max-width: 260px;
    }
    
    .onboarding-status {
        font-size: 11px;
        letter-spacing: 0.1em;
        margin: 12px 0;
    }
    
    .onboarding-spinner {
        width: 48px;
        height: 48px;
        margin-bottom: 5px;
    }
}

/* --- PDF Generation Styling --- */
.generating-pdf .receipt-grid {
    display: block !important;
    border: 1px solid #ccc !important;
    padding: 20px !important;
}

.generating-pdf .receipt-item {
    display: block !important;
    width: 100% !important;
    margin-bottom: 12px !important;
    break-inside: avoid;
}

.generating-pdf .pdf-preview {
    display: none !important;
}

.generating-pdf .pdf-only-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    color: var(--success) !important;
    font-weight: 500;
    margin-top: 4px;
}

.pdf-only-badge {
    display: none !important;
}
