html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ========== F5: Outlined Floating Label with BT Badges ========== */
.mud-ob { position: relative; margin-bottom: 1.25rem; }
.mud-ob .mud-outline-wrap {
    position: relative;
    border: 1px solid #bdbdbd;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s;
}
.mud-ob .mud-outline-wrap:hover { border-color: #424242; }
.mud-ob .mud-outline-wrap:focus-within {
    border: 2px solid #1976d2;
}
.mud-ob.field-invalid .mud-outline-wrap { border: 2px solid #d32f2f; }

.mud-ob input,
.mud-ob select,
.mud-ob textarea {
    display: block;
    width: 100%;
    border: none;
    border-radius: 4px;
    background: transparent;
    padding: 16.5px 14px;
    font-size: 1rem;
    color: #212121;
    outline: none;
    font-family: inherit;
}
.mud-ob textarea { resize: vertical; min-height: 80px; }

.mud-ob label {
    position: absolute;
    top: 16px;
    left: 12px;
    font-size: 1rem;
    font-weight: 400;
    color: #999;
    background: transparent;
    padding: 0 4px;
    pointer-events: none;
    z-index: 1;
    transition: all 0.2s ease;
    transform-origin: left top;
}

/* Float label when focused or has value (input/textarea) */
.mud-ob input:focus ~ label,
.mud-ob input:not(:placeholder-shown) ~ label,
.mud-ob textarea:focus ~ label,
.mud-ob textarea:not(:placeholder-shown) ~ label {
    top: -9px;
    font-size: 0.75rem;
    color: #666;
    background: #fff;
}
.mud-ob input:focus ~ label,
.mud-ob textarea:focus ~ label { color: #1976d2; }

/* Select & date/time inputs always float (always have value) */
.mud-ob select ~ label,
.mud-ob input[type="date"] ~ label,
.mud-ob input[type="time"] ~ label {
    top: -9px;
    font-size: 0.75rem;
    color: #666;
    background: #fff;
}
.mud-ob select:focus ~ label,
.mud-ob input[type="date"]:focus ~ label,
.mud-ob input[type="time"]:focus ~ label { color: #1976d2; }

/* Error states */
.mud-ob.field-invalid label,
.mud-ob.field-invalid input:focus ~ label,
.mud-ob.field-invalid input:not(:placeholder-shown) ~ label,
.mud-ob.field-invalid select ~ label,
.mud-ob.field-invalid textarea:focus ~ label,
.mud-ob.field-invalid textarea:not(:placeholder-shown) ~ label {
    color: #d32f2f !important;
    background: #fff;
}
.mud-ob.field-invalid .mud-helper { color: #d32f2f; }

/* Required asterisk — disabled: requirements are dynamic and context-dependent */
/* .mud-ob.field-required label::after { content: ' *'; color: #d32f2f; } */

/* BT badge pinned on top-right of outline border */
.mud-ob .bt-pin {
    position: absolute;
    top: -8px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1565c0;
    background: #e3f2fd;
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid #bbdefb;
    font-family: 'Roboto Mono', monospace;
    letter-spacing: 0.3px;
    white-space: nowrap;
    line-height: 1.5;
    pointer-events: none;
}
.mud-ob .mud-outline-wrap:focus-within .bt-pin {
    color: #0d47a1;
    background: #bbdefb;
    border-color: #90caf9;
}
.mud-ob.field-invalid .bt-pin {
    color: #c62828;
    background: #ffebee;
    border-color: #ef9a9a;
}

/* Helper text below field */
.mud-helper {
    font-size: 0.75rem;
    color: #666;
    margin-top: 3px;
    padding-left: 14px;
    line-height: 1.3;
}

/* Section divider with title */
.f5-section {
    font-size: 0.875rem;
    font-weight: 500;
    color: #424242;
    margin: 1.5rem 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.f5-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}
.f5-section i { color: #1976d2; }

/* ========== End F5 ========== */

/* Validation: red step tabs when step has errors */
.step-has-errors .step-link,
.step-has-errors .nav-link {
    color: #dc3545 !important;
    font-weight: 600;
}
.step-has-errors .step-link::after,
.step-has-errors .nav-link::after {
    background-color: #dc3545 !important;
}

/* Red field highlighting for validation errors */
.field-invalid .form-control,
.field-invalid .form-select,
.field-invalid .custom-select,
.field-invalid input,
.field-invalid select,
.field-invalid textarea {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}
.field-invalid .form-label,
.field-invalid label {
    color: #dc3545 !important;
    font-weight: 600;
}
.field-error-hint {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

/* Mandatory field indicator — disabled: requirements are dynamic and context-dependent */
/* .field-required > .form-label::after,
.field-required > label::after {
    content: ' *';
    color: #dc3545;
    font-weight: bold;
} */

/* Step progress stepper */
.stepper-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}
.stepper {
    display: flex;
    align-items: flex-start;
    min-width: max-content;
    position: relative;
}
.stepper-step {
    flex: 1;
    text-align: center;
    cursor: pointer;
    position: relative;
    min-width: 70px;
    padding: 0 4px;
}
.stepper-step:hover .stepper-circle {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #fff;
    color: #6c757d;
    transition: all 0.2s ease;
    z-index: 1;
    position: relative;
}
.stepper-label {
    font-size: 0.7rem;
    color: #6c757d;
    white-space: nowrap;
}
/* Connecting line between steps */
.stepper-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: calc(50% + 20px);
    right: calc(-50% + 20px);
    height: 2px;
    background: #dee2e6;
    z-index: 0;
}
/* Active state */
.stepper-step.active .stepper-circle {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}
.stepper-step.active .stepper-label {
    color: #0d6efd;
    font-weight: 600;
}
/* Visited state */
.stepper-step.visited .stepper-circle {
    background: #198754;
    border-color: #198754;
    color: #fff;
}
.stepper-step.visited .stepper-label {
    color: #198754;
}
/* Error state */
.stepper-step.has-errors .stepper-circle {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}
.stepper-step.has-errors .stepper-label {
    color: #dc3545;
    font-weight: 600;
}
/* Error count badge above step circle */
.stepper-error-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 3px;
    border: 2px solid #fff;
    z-index: 2;
}
/* Connecting line colors */
.stepper-step:not(:last-child).visited::after {
    background: #198754;
}
.stepper-step:not(:last-child).active::after {
    background: #0d6efd;
}

/* ========== CPA Picker ========== */
.cpa-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999;
}
.cpa-dropdown {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #bdbdbd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 350px;
    display: flex;
    flex-direction: column;
    min-width: 320px;
}
.cpa-search-box {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.cpa-search-box input {
    flex: 1;
    border: 1px solid #bdbdbd;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
    outline: none;
}
.cpa-search-box input:focus {
    border-color: #1976d2;
}
.cpa-clear-link {
    font-size: 0.75rem;
    white-space: nowrap;
    color: #dc3545;
}
.cpa-results {
    overflow-y: auto;
    flex: 1 1 auto;
    /* In a bounded flex column a flex item defaults to min-height:auto, which
       refuses to shrink below its content height — so overflow-y never engages
       and deeper category nodes become unreachable. Force min-height:0 so the
       list scrolls within the parent's max-height. */
    min-height: 0;
}
.cpa-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.82rem;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.cpa-item:hover {
    background: #e3f2fd;
}
.cpa-item.active {
    background: #bbdefb;
    font-weight: 600;
}
.cpa-item.cpa-back {
    color: #1976d2;
    font-weight: 500;
}
.cpa-item.cpa-section {
    font-weight: 500;
}
.cpa-code-tag {
    background: #e8eaf6;
    color: #283593;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.cpa-empty {
    padding: 16px;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}
.cpa-breadcrumb {
    padding: 5px 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.78rem;
    background: #fafafa;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    flex-shrink: 0;
}
.cpa-breadcrumb a {
    color: #1976d2;
    text-decoration: none;
}
.cpa-breadcrumb a:hover {
    text-decoration: underline;
}
.cpa-sep {
    color: #999;
    margin: 0 2px;
}
.cpa-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    color: #999;
}

/* ========== Validation Error Bar ========== */
.validation-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border-top: 2px solid #dc3545;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
}
.validation-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #dc3545;
    font-weight: 600;
    font-size: 0.85rem;
    user-select: none;
}
.validation-bar-header:hover { background: #fff5f5; }
.validation-bar-header i.fa-chevron-up,
.validation-bar-header i.fa-chevron-down {
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.validation-bar-body {
    max-height: 40vh;
    overflow-y: auto;
    border-top: 1px solid #f0d0d0;
}
.validation-bar-item {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    border-bottom: 1px solid #f5f5f5;
    line-height: 1.4;
}
.validation-bar-item:last-child { border-bottom: none; }
.validation-bar-item .btn-link { color: #dc3545; font-size: 0.75rem; }

/* Reserve space at bottom so content isn't hidden behind the fixed bar */
.invoice-wizard { padding-bottom: 48px; }

/* ========== Minimal Mode: show only error fields ========== */
.minimal-mode .card { border: none; box-shadow: none; }
.minimal-mode .card-header { display: none; }
.minimal-mode .card-body { padding: 0; }
/* Hide rows that contain no error fields */
.minimal-mode .row:not(:has(.field-invalid)) { display: none; }
/* Hide columns that contain no error fields */
.minimal-mode .row > [class*="col"]:not(:has(.field-invalid)) { display: none; }
/* Hide non-error mud-ob fields (fallback for browsers without :has) */
.minimal-mode .mud-ob:not(.field-invalid) { display: none; }
/* Hide decorative elements */
.minimal-mode .f5-section { display: none; }
.minimal-mode .form-check { display: none; }
.minimal-mode hr { display: none; }
/* Make remaining error fields full-width for clarity */
.minimal-mode .row > [class*="col"]:has(.field-invalid) { flex: 0 0 100%; max-width: 100%; }
/* Tighter spacing */
.minimal-mode .mb-3 > h6 { margin-top: 0.5rem; }
.minimal-mode .mud-ob { margin-bottom: 0.75rem; }

/* ========== Mobile Responsive ========== */

/* Wizard header: wrap on mobile */
.wizard-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.wizard-header-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}
.wizard-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
}

/* Mobile step nav (hidden on desktop) */
.wizard-nav-mobile {
    display: none;
}

/* Bottom navigation (hidden on mobile) */
.wizard-nav-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0.75rem 0;
}

@media (max-width: 575.98px) {
    /* Reduce page padding on mobile */
    .content.px-4 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .content { padding-top: 0.5rem; }

    /* Wizard header: stack vertically */
    .wizard-header { gap: 0.4rem; }
    .wizard-header-title { font-size: 1rem; width: 100%; }
    .wizard-header-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .wizard-header-actions .btn-group { flex-shrink: 0; }

    /* Smaller buttons on mobile */
    .wizard-header-actions .btn { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
    .wizard-header-actions .btn i + span.btn-text { display: none; }

    /* Compact stepper for mobile: hide labels, shrink circles to fit all 9 steps */
    .stepper-container { margin-bottom: 0.5rem; padding: 0.25rem 0; overflow-x: visible; }
    .stepper { min-width: unset; justify-content: space-between; gap: 0; }
    .stepper-step { min-width: unset; flex: 1; padding: 0 1px; }
    .stepper-circle { width: 28px; height: 28px; font-size: 0.65rem; margin-bottom: 0; }
    .stepper-label { display: none; }
    .stepper-step:not(:last-child)::after { top: 14px; left: calc(50% + 16px); right: calc(-50% + 16px); }
    .stepper-error-count { min-width: 14px; height: 14px; font-size: 0.5rem; top: -6px; right: -6px; }

    /* Touch-friendly form fields */
    .mud-ob input, .mud-ob select, .mud-ob textarea {
        padding: 14px 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    .mud-ob { margin-bottom: 1rem; }
    .mud-ob label { font-size: 0.9rem; top: 14px; left: 10px; }
    .mud-ob input:focus ~ label,
    .mud-ob input:not(:placeholder-shown) ~ label,
    .mud-ob textarea:focus ~ label,
    .mud-ob textarea:not(:placeholder-shown) ~ label,
    .mud-ob select ~ label,
    .mud-ob input[type="date"] ~ label,
    .mud-ob input[type="time"] ~ label {
        font-size: 0.7rem;
    }

    /* Cards: tighter on mobile */
    .card-body { padding: 0.75rem; }
    .card-header { padding: 0.5rem 0.75rem; }
    .card-header h5 { font-size: 0.95rem; }

    /* Validation panel: compact */
    .card.border-danger .card-body { max-height: 200px; }
    .list-group-item { padding: 0.5rem; font-size: 0.85rem; }
    .list-group-item .badge { font-size: 0.65rem; }

    /* Hide bottom nav on mobile — replaced by top mobile nav */
    .wizard-nav-bottom { display: none; }

    /* Mobile step nav: prominent arrows + step label */
    .wizard-nav-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }
    .wizard-nav-mobile-btn {
        width: 48px;
        height: 48px;
        border: 2px solid #0d6efd;
        border-radius: 50%;
        background: #fff;
        color: #0d6efd;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        flex-shrink: 0;
        transition: all 0.15s;
        -webkit-tap-highlight-color: transparent;
    }
    .wizard-nav-mobile-btn:active:not(:disabled) {
        background: #0d6efd;
        color: #fff;
        transform: scale(0.95);
    }
    .wizard-nav-mobile-btn:disabled {
        border-color: #dee2e6;
        color: #adb5bd;
        cursor: default;
    }
    .wizard-nav-mobile-label {
        font-size: 0.95rem;
        font-weight: 600;
        color: #333;
        text-align: center;
        cursor: pointer;
        user-select: none;
        line-height: 1.2;
    }
    .wizard-nav-mobile-label i { color: #999; font-size: 0.7rem; }

    /* CPA picker: bottom sheet on mobile */
    .cpa-backdrop { background: rgba(0,0,0,0.3); }
    .cpa-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: unset;
        max-height: 65vh;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
        animation: slideUp 0.2s ease-out;
    }
    .cpa-dropdown::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin: 8px auto 4px;
    }
    .cpa-search-box input { padding: 10px 12px; font-size: 16px; }
    .cpa-item { padding: 10px 12px; font-size: 0.9rem; min-height: 44px; }
    .cpa-breadcrumb { font-size: 0.75rem; padding: 6px 10px; }

    /* Modal: near full-screen on mobile */
    .modal-dialog { margin: 0.5rem; max-width: none; }
    .modal-dialog.modal-lg { margin: 0.5rem; }
    .modal-dialog.modal-sm { margin: 0.5rem; max-width: none; }

    /* Table in modal: responsive */
    .modal-body .table { font-size: 0.8rem; }
    .modal-body .table td, .modal-body .table th { padding: 0.4rem; }

    /* Attachments: scrollable table on mobile */
    .table-striped { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-striped thead, .table-striped tbody, .table-striped tr { display: table; width: 100%; table-layout: auto; }

    /* Drop zone: compact on mobile */
    .drop-zone .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .drop-zone h5 { font-size: 1rem; }
    .drop-zone .fa-3x { font-size: 2rem !important; }

    /* XML preview: limited height on mobile */
    .xml-preview { max-height: 250px; }
    .xml-preview pre { font-size: 0.75rem; padding: 0.75rem; }

    /* Invoice line cards: tighter */
    .card .card-header.py-1 { padding: 0.4rem 0.5rem !important; }
    .card .card-body.p-2 { padding: 0.5rem !important; }

    /* Tabs (allowances/charges): scrollable on mobile */
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-tabs .nav-link { white-space: nowrap; font-size: 0.85rem; padding: 0.4rem 0.75rem; }

    /* Fix mode: tighter spacing */
    .mb-4 > h5 { font-size: 1rem; }

    /* BT pin badge: slightly smaller */
    .mud-ob .bt-pin { font-size: 0.55rem; padding: 1px 5px; right: 6px; }

    /* Section dividers */
    .f5-section { font-size: 0.8rem; margin: 1rem 0 0.75rem 0; }

    /* Alert: compact on mobile */
    .alert { font-size: 0.85rem; padding: 0.5rem 0.75rem; }

    /* Checkbox: touch-friendly */
    .form-check-input { width: 1.2em; height: 1.2em; margin-top: 0.15em; }
    .form-check-label { font-size: 0.9rem; }

    /* Template buttons: icon-only on small screens */
    .btn-group-sm .btn .btn-text-mobile-hide { display: none; }

    /* Accordion: compact on mobile */
    .accordion-button { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
}

/* Medium screens (tablets) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .content.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }

    .wizard-header-actions .btn { font-size: 0.8rem; }

    .stepper-step { min-width: 60px; }
    .stepper-circle { width: 32px; height: 32px; }
    .stepper-label { font-size: 0.65rem; }
}

/* CPA bottom sheet animation */
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Safe area for notched phones (iPhone X+) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .wizard-nav-bottom {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
    .validation-bar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .cpa-dropdown {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========== End Mobile Responsive ========== */