/* ==========================================================================
   Payslip Hub UI Components (Cards, Modals, Statements, Biometrics)
   ========================================================================== */

/* Summary Metrics Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (min-width: 640px) {
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-medium);
}

.metric-card.highlight {
    background: linear-gradient(145deg, var(--primary-glow) 0%, var(--bg-surface-elevated) 100%);
    border-color: var(--primary);
}

.metric-card.highlight::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

[data-theme="light"] .metric-card.highlight {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 4px 14px var(--primary-glow);
}

[data-theme="light"] .metric-card.highlight::after {
    display: none;
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.metric-value.net { color: var(--success); }
.metric-value.tax { color: var(--danger); }
.metric-value.nic { color: var(--info); }

.metric-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Banner Card */
.hero-banner {
    background: var(--primary-gradient);
    border-radius: var(--radius-lg);
    padding: 20px;
    color: #ffffff;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.hero-banner h2 {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero-banner p {
    font-size: 0.85rem;
    opacity: 0.9;
}

.hero-banner .banner-cta-btn {
    align-self: flex-start;
    background: #ffffff;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.hero-banner .banner-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: #f8fafc;
}

/* Section Titles */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Payslip Replica Statement Card */
.payslip-replica-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.replica-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-medium);
    margin-bottom: 16px;
}

@media (max-width: 480px) {
    .replica-header {
        flex-direction: column;
        gap: 10px;
    }
    .replica-employee {
        text-align: left !important;
    }
}

.replica-employer h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.replica-employer p {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 240px;
}

.replica-employee {
    text-align: right;
}

.replica-employee .emp-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.replica-employee .emp-addr {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.replica-meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tag-badge {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-badge strong {
    color: var(--text-primary);
}

/* Two Column Payments vs Deductions Table */
.statement-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 540px) {
    .statement-tables-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.statement-col {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--border-subtle);
}

.col-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
}

.col-header.payments { color: var(--success-light); }
.col-header.deductions { color: var(--danger); }

.item-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 4px 0;
    color: var(--text-secondary);
}

.item-row.total {
    font-weight: 700;
    color: var(--text-primary);
    border-top: 1px solid var(--border-subtle);
    margin-top: 6px;
    padding-top: 6px;
}

/* Net Pay Highlight Banner */
.net-pay-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16) 0%, rgba(15, 23, 42, 0.7) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.net-pay-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--success-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.net-pay-amount {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--success);
    letter-spacing: -0.02em;
}

/* Light Theme Overrides for Net Pay Banner & Table Headers */
[data-theme="light"] .net-pay-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14) 0%, rgba(16, 185, 129, 0.04) 55%, #ffffff 100%);
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.08);
}

[data-theme="light"] .net-pay-label {
    color: #047857;
}

[data-theme="light"] .net-pay-amount {
    color: #047857;
}

[data-theme="light"] .col-header.payments {
    color: #047857;
}

/* Statement Actions */
.statement-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-medium);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--primary-glow);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-sheet {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 480px) {
    .modal-sheet {
        padding: 18px 14px;
        border-radius: var(--radius-md);
        max-height: 94vh;
        gap: 12px;
    }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Upload Dropzone */
.dropzone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    background: var(--bg-surface-elevated);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dropzone.dragover, .dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.dropzone-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

/* Scanning Radar Progress */
.scanning-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px;
}

.radar-spinner {
    width: 64px;
    height: 64px;
    border: 3px solid var(--border-medium);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Duplicate Warning Banner */
.duplicate-warning-box {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 14px;
    color: var(--warning);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

/* ==========================================================================
   Biometric Lock Screen Overlay & Premium Keypad
   ========================================================================== */
.lock-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(10, 15, 29, 0.84);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    transition: opacity 0.25s ease;
}

.lock-screen-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    max-width: 380px;
    width: 100%;
    margin: auto;
    padding: 36px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.6), 0 0 36px var(--primary-glow);
    animation: lockCardEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lockCardEnter {
    from { opacity: 0; transform: scale(0.95) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.lock-shield-icon {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 0 28px var(--primary-glow);
    animation: pulseLock 2.5s infinite ease-in-out;
}

.lock-shield-icon svg {
    width: 36px;
    height: 36px;
    stroke: #ffffff;
}

@keyframes pulseLock {
    0%, 100% { transform: scale(1); box-shadow: 0 0 24px var(--primary-glow); }
    50% { transform: scale(1.05); box-shadow: 0 0 36px var(--primary-glow); }
}

.lock-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.lock-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 300px;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* PIN Display Dots */
.pin-display-wrapper {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pin-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 24px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    background: transparent;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
    background: var(--primary);
    border-color: var(--primary-light);
    box-shadow: 0 0 12px var(--primary-glow);
    transform: scale(1.15);
}

.pin-dots.shake {
    animation: pinShake 0.4s ease-in-out;
}

@keyframes pinShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.lock-pin-hint {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

/* ==========================================================================
   Circular PIN Pad (Fixed from Squeezed Layout)
   ========================================================================== */
.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 270px;
    margin: 0 auto 16px auto;
}

.pin-key {
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 72px;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-full);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pin-key .pin-num {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
}

.pin-key .pin-letters {
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
    min-height: 9px;
}

.pin-key-action {
    background: rgba(255, 255, 255, 0.03);
    border-color: transparent;
    color: var(--text-secondary);
}

.pin-key:hover {
    background: var(--bg-main);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.pin-key:active, .pin-key.pressed {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    transform: scale(0.92) !important;
    box-shadow: 0 0 20px var(--primary-glow) !important;
}

.pin-key:active .pin-letters, .pin-key.pressed .pin-letters {
    color: rgba(255, 255, 255, 0.85);
}

.pin-key:active svg, .pin-key.pressed svg {
    stroke: #ffffff;
}

.lock-keyboard-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 8px;
}

.lock-keyboard-hint kbd {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 0.7rem;
}

.lock-signout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 12px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.lock-signout-btn:hover {
    color: var(--danger, #ef4444);
}

/* ==========================================================================
   Swipe to Unlock Slider
   ========================================================================== */
.swipe-unlock-container {
    width: 100%;
    max-width: 320px;
    margin: 16px auto 24px auto;
}

.swipe-track {
    position: relative;
    height: 56px;
    background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.12));
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

.swipe-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: var(--primary-glow, rgba(59, 130, 246, 0.25));
    border-radius: 28px;
    pointer-events: none;
    transition: background 0.2s ease;
}

.swipe-label {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(90deg, var(--text-secondary) 0%, var(--primary-light, #60a5fa) 50%, var(--text-secondary) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: swipeShimmer 2.4s infinite linear;
    text-transform: uppercase;
}

@keyframes swipeShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.swipe-thumb {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient, linear-gradient(135deg, #3b82f6, #2563eb));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 12px var(--primary-glow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 2;
}

.swipe-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 0 18px var(--primary-glow);
}

.swipe-thumb:active, .swipe-thumb.dragging {
    cursor: grabbing;
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 24px var(--primary-glow);
}

.swipe-thumb svg {
    transition: transform 0.2s ease;
}

.swipe-thumb.dragging svg {
    transform: translateX(2px);
}

@media (max-width: 380px) {
    .lock-screen-card {
        padding: 24px 16px;
        border-radius: var(--radius-lg);
    }
    .pin-pad {
        gap: 10px;
        max-width: 240px;
    }
    .pin-key .pin-num {
        font-size: 1.3rem;
    }
}

/* ==========================================================================
   Global Drag-and-Drop Anywhere Overlay
   ========================================================================== */
.global-drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(8, 13, 26, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeInOverlay 0.18s ease-out;
}

.global-drag-overlay.active {
    display: flex;
}

.global-drag-overlay * {
    pointer-events: none; /* Prevents nested child elements from firing dragleave */
}

.global-drag-card {
    background: rgba(19, 27, 46, 0.92);
    border: 2.5px dashed var(--primary);
    border-radius: var(--radius-xl);
    padding: 44px 32px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 0 50px var(--primary-glow), inset 0 0 24px var(--primary-glow);
    animation: dragPulse 1.8s ease-in-out infinite alternate;
}

@keyframes dragPulse {
    0% {
        transform: scale(0.985);
        border-color: var(--primary);
        box-shadow: 0 0 30px var(--primary-glow);
    }
    100% {
        transform: scale(1.015);
        border-color: var(--primary-light);
        box-shadow: 0 0 65px var(--primary-glow);
    }
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.global-drag-icon-glow {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 0 32px var(--primary-glow);
    animation: bounceDragIcon 1.2s ease-in-out infinite alternate;
}

@keyframes bounceDragIcon {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.global-drag-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.global-drag-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    max-width: 360px;
    line-height: 1.45;
    margin: 0;
}

.global-drag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-full);
    color: var(--success-light);
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 4px;
}

/* ==========================================================================
   Monthly View: Filter, Search & Sorting Bar
   ========================================================================== */
.monthly-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.monthly-search-wrap {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.monthly-search-input {
    width: 100%;
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 8px 12px 8px 34px;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.monthly-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.monthly-select-filter {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.monthly-select-filter:focus {
    border-color: var(--primary);
}

.tax-code-clickable {
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.tax-code-clickable:hover {
    transform: scale(1.03);
    border-color: var(--primary);
}

/* ==========================================================================
   P60 Certificate & Mortgage Proof Sheet
   ========================================================================== */
.p60-certificate-sheet {
    background: #ffffff;
    color: #0f172a;
    border-radius: var(--radius-md);
    padding: 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    border: 2px solid #cbd5e1;
}

.p60-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.p60-brand-block .p60-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.p60-brand-block .p60-subtitle {
    font-size: 0.78rem;
    color: #475569;
    margin-top: 2px;
}

.p60-year-badge {
    text-align: right;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
}

.p60-year-badge .tax-year-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
}

.p60-year-badge .tax-year-val {
    display: block;
    font-size: 1.15rem;
    font-weight: 900;
    color: #0f172a;
}

.p60-year-badge .tax-year-dates {
    font-size: 0.65rem;
    color: #64748b;
}

.p60-grid-boxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.p60-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
}

.p60-box-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 2px;
}

.p60-box-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.p60-box-val.emp-name {
    font-size: 1.05rem;
    color: #1e293b;
}

.p60-box-val.highlight {
    color: #4338ca;
}

.p60-statutory-totals {
    border: 2px solid #0f172a;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 18px;
}

.p60-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

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

.p60-total-row.highlight {
    background: #f8fafc;
}

.p60-total-row.net {
    background: #f0fdf4;
    border-top: 2px solid #0f172a;
}

.p60-col-title strong {
    display: block;
    font-size: 0.88rem;
    color: #0f172a;
}

.p60-col-title .sub {
    font-size: 0.72rem;
    color: #64748b;
}

.p60-col-amt {
    font-size: 1.25rem;
    font-weight: 900;
    color: #0f172a;
}

.p60-col-amt.tax {
    color: #b91c1c;
}

.p60-col-amt.nic {
    color: #0369a1;
}

.p60-col-amt.net {
    color: #15803d;
    font-size: 1.35rem;
}

.p60-schedule-section {
    margin-bottom: 16px;
}

.p60-schedule-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin-bottom: 6px;
}

.p60-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.p60-table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    text-align: left;
}

.p60-table td {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

.p60-footer {
    border-top: 1px dashed #cbd5e1;
    padding-top: 12px;
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.4;
}

/* ==========================================================================
   Print Stylesheet (@media print) for P60 and Reports
   ========================================================================== */
@media print {
    body * {
        visibility: hidden !important;
    }

    #p60Modal, #p60Modal * {
        visibility: visible !important;
    }

    #p60Modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    .modal-sheet.p60-modal-sheet {
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .no-print {
        display: none !important;
    }

    .p60-certificate-sheet {
        box-shadow: none !important;
        border: 2px solid #000000 !important;
        padding: 16px !important;
    }
}

/* ==========================================================================
   HMRC Income Tax Levels Card & Personal Band Breakdown
   ========================================================================== */
.tax-levels-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.tax-levels-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.tax-levels-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
}

.region-toggle-pills {
    display: inline-flex;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    padding: 3px;
    gap: 3px;
}

.region-pill-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.region-pill-btn:hover {
    color: var(--text-primary);
}

.region-pill-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.tax-levels-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.tax-levels-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.tax-levels-table th {
    padding: 12px 16px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.82rem;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
    text-transform: capitalize;
}

.tax-levels-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.tax-levels-table tr:last-child td {
    border-bottom: none;
}

.tax-levels-table td.rate-cell {
    text-align: right;
    font-weight: 800;
}

.tax-rate-val {
    color: #dc2626; /* High-contrast authoritative red */
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

.tax-active-row {
    background: var(--primary-glow);
    border-left: 4px solid var(--primary-light);
}

.active-band-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    background: var(--primary-glow);
    color: var(--primary-light);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.tax-levels-footnotes {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-subtle);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.tax-levels-footnotes p {
    margin: 3px 0;
}

/* Personalized Salary Tax Split Container */
.personal-tax-split-container {
    margin-top: 20px;
    padding: 16px 18px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
}

.personal-tax-split-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.tax-slice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.tax-slice-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tax-slice-card.active-bracket {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.tax-slice-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.tax-slice-taxed {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}

.tax-slice-rate-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #dc2626;
}

/* ==========================================================================
   Privacy & Stealth Mode (PII Masking)
   ========================================================================== */
.pii-maskable {
    transition: filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    display: inline-block;
}

body.privacy-mode .pii-maskable {
    filter: blur(5px);
    user-select: none;
    cursor: pointer;
}

body.privacy-mode .pii-maskable:hover,
body.privacy-mode .pii-maskable:active,
body.privacy-mode .pii-maskable.unmasked {
    filter: blur(0);
}

#privacyToggleBtn {
    transition: all 0.2s ease;
}

#privacyToggleBtn.active {
    color: var(--primary-light);
    background: var(--primary-glow);
    border: 1px solid var(--primary);
}

.ni-reveal-badge {
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.ni-reveal-badge:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

@media print {
    body.privacy-mode .pii-maskable {
        filter: none !important;
    }
}

/* ==========================================================================
   Theme Selector & Active Sessions Components
   ========================================================================== */
.theme-segmented-control {
    display: flex;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
    margin-top: 10px;
}

.theme-segment-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-segment-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.theme-segment-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    gap: 12px;
    transition: border-color 0.2s ease;
}

.session-item.is-current {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
}

.session-device-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    flex-shrink: 0;
}

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

.session-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.session-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.session-badge-current {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.session-badge-current::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

/* ==========================================================================
   Modular Theme Palette Selector
   ========================================================================== */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 20px;
}

.palette-card {
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    user-select: none;
}

.palette-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.palette-card.active {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
    box-shadow: 0 0 0 1px var(--primary), var(--shadow-glow);
}

.palette-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.palette-card-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.palette-card-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 900;
}

.palette-card.active .palette-card-check {
    display: flex;
}

.palette-card-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin-bottom: 12px;
}

.palette-swatches {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.palette-swatch-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.palette-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ==========================================================================
   Settings Company Selector & Switch Toggle
   ========================================================================== */
.settings-company-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-company-option:hover {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
}

.settings-company-option.active {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 24px;
    transition: .3s;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: .3s;
}

.switch-toggle input:checked + .switch-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.switch-toggle input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

/* ==========================================================================
   Carousel Component (Yearly View Salary & Trajectory)
   ========================================================================== */
.carousel-container {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.carousel-track {
    display: flex;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.carousel-slide {
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.carousel-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0 4px;
}

.carousel-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.carousel-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--border-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 6px;
}

.carousel-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.carousel-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--primary);
}

/* ==========================================================================
   Live Mobile Camera Scanner & Viewfinder
   ========================================================================== */
.camera-viewfinder-modal {
    z-index: 9999;
    padding: 0;
    background: #000;
}

.camera-viewfinder-container {
    width: 100%;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    background: #000;
    overflow: hidden;
}

.camera-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    z-index: 10;
}

.camera-viewfinder-title {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.camera-ctrl-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(8px);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.camera-ctrl-btn:hover, .camera-ctrl-btn:active {
    background: rgba(255, 255, 255, 0.35) !important;
    transform: scale(1.05);
}

.camera-ctrl-btn.active {
    background: var(--primary) !important;
    border-color: var(--primary-light) !important;
    color: #fff !important;
}

.camera-video-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#cameraLiveVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Document Alignment Guide Box */
.camera-guide-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88%;
    height: 60%;
    max-height: 420px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.guide-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--primary-light);
    border-style: solid;
    border-width: 0;
}

.guide-corner.top-left {
    top: -2px;
    left: -2px;
    border-top-width: 4px;
    border-left-width: 4px;
    border-top-left-radius: 12px;
}

.guide-corner.top-right {
    top: -2px;
    right: -2px;
    border-top-width: 4px;
    border-right-width: 4px;
    border-top-right-radius: 12px;
}

.guide-corner.bottom-left {
    bottom: -2px;
    left: -2px;
    border-bottom-width: 4px;
    border-left-width: 4px;
    border-bottom-left-radius: 12px;
}

.guide-corner.bottom-right {
    bottom: -2px;
    right: -2px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-bottom-right-radius: 12px;
}

.guide-laser {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(99,102,241,0) 0%, var(--primary-light) 50%, rgba(99,102,241,0) 100%);
    box-shadow: 0 0 10px var(--primary-light);
    animation: laserScan 2.4s ease-in-out infinite alternate;
}

@keyframes laserScan {
    0% { top: 8%; opacity: 0.2; }
    50% { opacity: 1; }
    100% { top: 92%; opacity: 0.2; }
}

.guide-label {
    position: absolute;
    bottom: -32px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.camera-bottom-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 24px 20px 32px;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    z-index: 10;
}

.camera-shutter-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: 4px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.camera-shutter-btn:active {
    transform: scale(0.92);
}

.shutter-inner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #ffffff;
    transition: all 0.15s ease;
}

.camera-shutter-btn:active .shutter-inner {
    background: var(--primary-light);
    width: 48px;
    height: 48px;
}

.camera-gallery-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.camera-gallery-btn:hover {
    opacity: 1;
}

/* Image Orientation Toolbar */
.orientation-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg-surface);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.rotate-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rotate-btn:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

/* ==========================================================================
   Visual Document Inspector & Interactive Schema Tuner
   ========================================================================== */
.doc-inspector-wrapper {
    position: relative;
    background: #000;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 320px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .doc-inspector-wrapper {
        height: 380px;
    }
}

.doc-inspector-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(18, 20, 29, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    padding: 6px 12px;
    z-index: 10;
}

.inspector-tools-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inspector-tool-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.inspector-tool-btn:hover, .inspector-tool-btn.active {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary-light);
}

.inspector-zoom-level {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}

.doc-inspector-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    background: #0d0f17;
}

.doc-inspector-canvas-plane {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    transition: transform 0.05s linear;
}

#inspBaseImage {
    display: block;
    max-width: none;
    pointer-events: none;
}

.doc-inspector-svg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

/* Field Bounding Box Highlight */
.doc-field-rect {
    transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

@keyframes fieldBoxPulse {
    0% {
        stroke-width: 3px;
        stroke: #38bdf8;
        filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8));
        fill-opacity: 0.3;
    }
    50% {
        stroke-width: 6px;
        stroke: #f59e0b;
        filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.95)) drop-shadow(0 0 28px rgba(245, 158, 11, 0.8));
        fill-opacity: 0.7;
    }
    100% {
        stroke-width: 3px;
        stroke: #38bdf8;
        filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8));
        fill-opacity: 0.3;
    }
}

.doc-field-rect.pulse-highlight,
.doc-field-rect.pulsing-highlight,
.doc-field-group.pulse-highlight rect {
    animation: fieldBoxPulse 0.9s infinite ease-in-out !important;
}

/* Crop Overlay & Handles */
.doc-crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.doc-crop-box {
    position: absolute;
    border: 2px dashed var(--primary-light);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    background: transparent;
}

.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 2px solid var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 5;
}

.handle-tl { top: 0; left: 0; cursor: nwse-resize; }
.handle-tr { top: 0; left: 100%; cursor: nesw-resize; }
.handle-bl { top: 100%; left: 0; cursor: nesw-resize; }
.handle-br { top: 100%; left: 100%; cursor: nwse-resize; }
.handle-t { top: 0; left: 50%; cursor: ns-resize; }
.handle-b { top: 100%; left: 50%; cursor: ns-resize; }
.handle-l { top: 50%; left: 0; cursor: ew-resize; }
.handle-r { top: 50%; left: 100%; cursor: ew-resize; }

.crop-actions-bar {
    position: absolute;
    bottom: -38px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    white-space: nowrap;
    z-index: 10;
}

.crop-apply-btn, .crop-cancel-btn {
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Mapping Action Banner */
.doc-mapping-banner {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(18, 20, 29, 0.95);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 20;
    animation: bannerSlideUp 0.2s ease-out;
}

@keyframes bannerSlideUp {
    from { transform: translate(-50%, 15px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.pulsing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: pulseDot 1.2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.6); opacity: 1; }
}

.field-pick-btn {
    background: transparent;
    border: none;
    color: var(--primary-light);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.15s ease;
}

.field-pick-btn:hover {
    color: #fff;
    text-decoration: underline;
}

.field-show-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: color 0.15s ease;
}

.field-show-btn:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

@keyframes boxPulseHighlight {
    0% {
        stroke-width: 2px;
        filter: drop-shadow(0 0 2px var(--primary));
    }
    50% {
        stroke-width: 5px;
        stroke: #ffffff;
        filter: drop-shadow(0 0 10px var(--primary)) drop-shadow(0 0 16px var(--primary-light));
    }
    100% {
        stroke-width: 2px;
        filter: drop-shadow(0 0 2px var(--primary));
    }
}

.doc-field-rect.pulsing-highlight {
    animation: boxPulseHighlight 0.8s infinite ease-in-out;
}

/* Fullscreen Modal Mode for Document Inspector & Scanner */
.modal-sheet.modal-sheet-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    padding: 16px 20px !important;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.modal-sheet.modal-sheet-fullscreen #scannerStepPreview {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-sheet.modal-sheet-fullscreen .doc-inspector-wrapper {
    height: 48vh;
    min-height: 320px;
}

@media (min-width: 992px) {
    .modal-sheet.modal-sheet-fullscreen .scanner-workstation-grid {
        display: grid;
        grid-template-columns: 1.15fr 1fr;
        gap: 20px;
        align-items: start;
        flex: 1;
        min-height: 0;
    }

    .modal-sheet.modal-sheet-fullscreen .scanner-workstation-grid .doc-inspector-wrapper {
        height: calc(100vh - 170px);
        margin-bottom: 0;
        position: sticky;
        top: 0;
    }

    .modal-sheet.modal-sheet-fullscreen .scanner-workstation-grid .payslip-replica-card {
        max-height: calc(100vh - 170px);
        overflow-y: auto;
        margin-bottom: 0;
    }
}

/* ==========================================================================
   Perspective Cropper & 4-Corner Pin Normalization Engine
   ========================================================================== */
.persp-cropper-wrapper {
    display: flex;
    flex-direction: column;
    background: #000000;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 14px;
}

.persp-cropper-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(18, 20, 29, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 10;
}

.persp-tool-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.persp-tool-btn:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary-light);
}

.persp-cropper-viewport {
    position: relative;
    height: 400px;
    background: #080a10;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

@media (min-width: 768px) {
    .persp-cropper-viewport {
        height: 460px;
    }
}

.persp-canvas-plane {
    position: absolute;
}

#perspSourceCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.persp-svg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.persp-corner-pin {
    cursor: grab;
    transition: transform 0.1s ease;
}

.persp-corner-pin:hover circle {
    fill: #38bdf8;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.9));
}

.persp-corner-pin:active {
    cursor: grabbing;
}

.persp-edge-handle {
    cursor: grab;
    transition: all 0.15s ease;
}

.persp-edge-handle:hover {
    r: 12;
    fill: #38bdf8;
    stroke: #ffffff;
}

/* Real-time Magnifier Loupe */
.persp-loupe {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #38bdf8;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 12px rgba(56, 189, 248, 0.6);
    overflow: hidden;
    pointer-events: none;
    z-index: 50;
    background: #000;
}

#perspLoupeCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.persp-loupe-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.persp-loupe-crosshair::before,
.persp-loupe-crosshair::after {
    content: '';
    position: absolute;
    background: #f43f5e;
}

.persp-loupe-crosshair::before {
    top: 0;
    left: 7px;
    width: 2px;
    height: 16px;
}

.persp-loupe-crosshair::after {
    top: 7px;
    left: 0;
    width: 16px;
    height: 2px;
}

.persp-cropper-actions {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(18, 20, 29, 0.95);
    border-top: 1px solid var(--border-subtle);
}
