body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: linear-gradient(160deg, #f0f4ff 0%, #e8ecf4 40%, #f5f0ff 100%); padding: 20px; min-height: 100vh; }
.container { max-width: 880px; margin: auto; background: rgba(255,255,255,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 32px; border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04); border: 1px solid rgba(255,255,255,0.6); }
.form-section { margin-bottom: 25px; padding: 15px; border: 1px solid #d2d2d7; border-radius: 8px; }
.donor-section { border: 2px solid #0071e3; background: #fbfbfd; }
.input-row { display: flex; gap: 15px; margin-bottom: 10px; align-items: flex-end; }
.input-row div { flex: 1; }
.s3-grid { display: flex; gap: 15px; margin-bottom: 10px; align-items: flex-end; }
.s3-field { flex: 1; }
.s3-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 10px;
    align-items: end;
}

.s3-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 10px;
    align-items: end;
}

.s3-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 10px;
    align-items: end;
}
label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #64748b; margin-bottom: 5px; letter-spacing: 0.4px; }
input, select { width: 100%; padding: 10px 12px; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 14px; box-sizing: border-box; background: #fff; color: #1e293b; transition: border-color 0.2s, box-shadow 0.2s; }
input:focus, select:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
input::placeholder { color: #94a3b8; }

.highlight-box { background-color: #fff3cd; padding: 10px; border-radius: 6px; margin: 10px 0; border: 1px solid #ffeeba; }
.sub-divider { border: 0; border-top: 1px dashed #d2d2d7; margin: 15px 0; }

/* Itemized Summary */
.invoice-summary { background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); padding: 22px; border-radius: 12px; margin: 15px 0; border: 1px solid #e2e8f0; box-shadow: inset 0 1px 2px rgba(0,0,0,0.03); }
.invoice-summary h4 { margin: 0 0 12px 0; color: #1e293b; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; font-size: 15px; font-weight: 700; }
.invoice-line { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 14px; }
.taxable-row { color: #4f46e5; font-weight: bold; border-top: 1px dashed #c7d2fe; padding-top: 5px; }
.sos-line { color: #92400e; background: linear-gradient(90deg, #fef3c7, #fffbeb); padding: 6px 8px; border-radius: 6px; border: 1px solid #fde68a; }
.total-box { margin-top: 12px; text-align: right; font-size: 20px; color: #1e293b; font-weight: 800; }

/* ALIGNMENT FIXES FOR PAYMENTS */
.payment-settlement { background: linear-gradient(135deg, #f8fafc, #f1f5f9); border: 1px solid #e2e8f0; padding: 16px; border-radius: 10px; margin-bottom: 10px; }
.final-payment-section { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border: 2px solid #34d399; padding: 16px; border-radius: 10px; }

.balance-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 200px;
}

.balance-row {
    display: flex;
    justify-content: flex-end; /* Right align numbers */
    align-items: center;
    font-family: 'Courier New', Courier, monospace;
    font-size: 20px;
    font-weight: bold;
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #d2d2d7;
    height: 38px;
    box-sizing: border-box;
}

.currency-symbol { font-size: 14px; margin-right: 5px; color: #86868b; }

.green-total {
    color: #059669;
    background: linear-gradient(90deg, #ecfdf5, #d1fae5);
    border-color: #6ee7b7;
    font-size: 24px;
}

.button-group { display: flex; gap: 12px; margin-top: 22px; }
.btn-main { flex: 3; padding: 16px; background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; border: none; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 4px 14px rgba(99,102,241,0.3); transition: transform 0.15s, box-shadow 0.15s; }
.btn-main:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.btn-alt { flex: 1; padding: 16px; background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; border: none; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; box-shadow: 0 4px 14px rgba(239,68,68,0.3); transition: transform 0.15s, box-shadow 0.15s; }
.btn-alt:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239,68,68,0.4); }

/* Quick Actions: unique hover outlines + click flash */
.quick-actions button[id],
#browseInventoryBtn,
#recallDealsBtn,
#resetBtn {
    width: 84px;
    min-width: 84px;
    height: 82px;
    border-radius: 10px;
    padding: 8px 6px !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    box-sizing: border-box;
    transition: box-shadow 0.14s ease;
}

.quick-actions button[id] img,
.quick-actions button[id] svg,
#browseInventoryBtn img,
#browseInventoryBtn svg,
#recallDealsBtn img,
#recallDealsBtn svg,
#resetBtn img,
#resetBtn svg {
    width: 38px !important;
    height: 38px !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

#resetBtn img,
#resetBtn svg {
    width: 38px !important;
    height: 38px !important;
}

.quick-actions button[id] span,
#browseInventoryBtn span,
#recallDealsBtn span,
#resetBtn span {
    line-height: 1.15;
    text-align: center;
}

.quick-actions button[id]:hover:not(.qa-flash-red):not(.qa-hover-off),
.quick-actions button[id]:focus-visible:not(.qa-flash-red):not(.qa-hover-off),
#browseInventoryBtn:hover:not(.qa-flash-red):not(.qa-hover-off),
#browseInventoryBtn:focus-visible:not(.qa-flash-red):not(.qa-hover-off),
#recallDealsBtn:hover:not(.qa-flash-red):not(.qa-hover-off),
#recallDealsBtn:focus-visible:not(.qa-flash-red):not(.qa-hover-off),
#resaleTitleOnlyBtn:hover:not(.qa-flash-red):not(.qa-hover-off),
#resaleTitleOnlyBtn:focus-visible:not(.qa-flash-red):not(.qa-hover-off),
#resetBtn:hover:not(.qa-flash-red):not(.qa-hover-off),
#resetBtn:focus-visible:not(.qa-flash-red):not(.qa-hover-off) {
    box-shadow: 0 0 0 2px var(--qa-hover-color, #0071e3);
}

#processDealBtn { --qa-hover-color: #0ea5e9; }
#openAddInventoryModeBtn { --qa-hover-color: #0ea5a4; }
#inventoryBtn { --qa-hover-color: #f59e0b; }
#browseInventoryBtn { --qa-hover-color: #f59e0b; }
#recallDealsBtn { --qa-hover-color: #6366f1; }
#resaleTitleOnlyBtn { --qa-hover-color: #2e7d32; }
#resetBtn { --qa-hover-color: #dc2626; }
#profitLossBtn { --qa-hover-color: #22c55e; }
#reportsBtn { --qa-hover-color: #6366f1; }
#openBackOfficeBtn { --qa-hover-color: #0891b2; }
#logoutBtn { --qa-hover-color: #f97316; }

.quick-actions button[id].qa-flash-red,
#browseInventoryBtn.qa-flash-red,
#recallDealsBtn.qa-flash-red,
#resaleTitleOnlyBtn.qa-flash-red {
    animation: qaHeatFlash 0.4s linear 1;
}

#resetBtn.qa-flash-red {
    animation: qaHeatFlash 0.4s linear 1;
}

#vehicleInfoSection .s3-action-btn.qa-flash-red {
    animation: qaHeatFlash 0.4s linear 1;
    border-radius: 8px;
}

@keyframes qaHeatFlash {
    0%, 12.5% { box-shadow: 0 0 0 2px #dc2626; }
    12.6%, 24.9% { box-shadow: none; }
    25%, 37.5% { box-shadow: 0 0 0 2px #dc2626; }
    37.6%, 49.9% { box-shadow: none; }
    50%, 62.5% { box-shadow: 0 0 0 2px #f97316; }
    62.6%, 74.9% { box-shadow: none; }
    75%, 87.5% { box-shadow: 0 0 0 2px #facc15; }
    87.6%, 100% { box-shadow: none; }
}

/* --- SECTION AESTHETICS --- */
.form-section { 
    margin-bottom: 28px; 
    padding: 24px; 
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 14px; 
    border: 1px solid rgba(226,232,240,0.8); 
    box-shadow: 0 4px 16px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.form-section:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.03);
}

/* 1. Pricing & Registration - Indigo gradient accent */
section.form-section:nth-of-type(1) { border-top: 4px solid transparent; border-image: linear-gradient(90deg, #6366f1, #818cf8) 1; }

/* 2. Secured Interest - Purple accent */
section.form-section:nth-of-type(2) { border-top: 4px solid transparent; border-image: linear-gradient(90deg, #a855f7, #c084fc) 1; }

/* 3. Purchase Vehicle - Emerald accent */
section.form-section:nth-of-type(3) { border-top: 4px solid transparent; border-image: linear-gradient(90deg, #10b981, #34d399) 1; }

/* 4. Plate Transfer (Donor) - Amber accent */
section.form-section:nth-of-type(4) { 
    border-top: 4px solid transparent; border-image: linear-gradient(90deg, #f59e0b, #fbbf24) 1;
    background: linear-gradient(135deg, rgba(255,251,235,0.7), rgba(255,255,255,0.9)); 
}

/* 5. Trade-In - Rose accent */
section.form-section:nth-of-type(5) { 
    border-top: 4px solid transparent; border-image: linear-gradient(90deg, #f43f5e, #fb7185) 1;
    background: linear-gradient(135deg, rgba(255,241,242,0.7), rgba(255,255,255,0.9)); 
}

/* 6. Buyer Info - Cyan accent */
section.form-section:nth-of-type(6) { border-top: 4px solid transparent; border-image: linear-gradient(90deg, #06b6d4, #22d3ee) 1; }

/* 7. Finalize & Print - Slate gradient accent */
section.form-section:nth-of-type(7) { border-top: 4px solid transparent; border-image: linear-gradient(90deg, #475569, #64748b) 1; }

/* Tweak section headers to look a bit more modern */
.form-section h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 17px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.3px;
}

/* Section 3 action bar: keep Scan VIN left, remaining actions on one right row */
#vehicleInfoSection .s3-action-row {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: nowrap;
}

#vehicleInfoSection .s3-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 56px;
}

#vehicleInfoSection .s3-action-row .s3-action-item:first-child {
    margin-right: 0;
}

#vehicleInfoSection .s3-action-btn {
    width: auto;
    height: auto;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    line-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    transition: box-shadow 0.18s ease;
}

#vehicleInfoSection .s3-action-btn:hover:not(.qa-flash-red):not(.qa-hover-off):not(.is-saving):not(.is-saved):not(.addmode-next-highlight):not(.addmode-quit-highlight),
#vehicleInfoSection .s3-action-btn:focus-visible:not(.qa-flash-red):not(.qa-hover-off):not(.is-saving):not(.is-saved):not(.addmode-next-highlight):not(.addmode-quit-highlight) {
    box-shadow: 0 0 0 2px #16a34a;
    border-radius: 8px;
}

#vehicleInfoSection .s3-action-btn.is-saving {
    box-shadow: 0 0 0 2px #dc2626;
    border-radius: 8px;
}

#vehicleInfoSection .s3-action-btn.is-saved {
    box-shadow: 0 0 0 2px #16a34a;
    border-radius: 8px;
}

#vehicleInfoSection .s3-action-btn.addmode-next-highlight {
    box-shadow: 0 0 0 2px #16a34a;
    border-radius: 8px;
}

#vehicleInfoSection .s3-action-btn.addmode-quit-highlight {
    box-shadow: 0 0 0 2px #dc2626;
    border-radius: 8px;
}

#vehicleInfoSection .s3-btn-icon {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px;
    min-height: 56px;
    margin-bottom: 0;
    object-fit: contain;
    display: inline-block;
    flex-shrink: 0;
}

#vehicleInfoSection .s3-btn-icon [stroke] {
    stroke-width: 1.2 !important;
}

#vehicleInfoSection .s3-btn-label {
    margin-top: 2px;
    font-size: 12px;
    color: #222;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

#vehicleInfoSection .s3-clear-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 78px;
    line-height: 1;
}

#vehicleInfoSection .s3-clear-btn .s3-clear-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.32);
    transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}

#vehicleInfoSection .s3-clear-btn .s3-btn-label {
    color: #b91c1c;
    font-size: 11px;
    font-weight: 700;
    margin-top: 0;
}

#vehicleInfoSection .s3-clear-btn:hover .s3-clear-icon-wrap,
#vehicleInfoSection .s3-clear-btn:focus-visible .s3-clear-icon-wrap {
    background: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.4);
}

/* =========================================
   --- LOGIN GATE STYLES ---
========================================= */
#loginGate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0c4a6e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: 'Inter', -apple-system, sans-serif;
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 44px;
    border-radius: 20px;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.1);
    text-align: center;
    max-width: 420px;
    width: 90%;
}

.logo-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.logo-icon {
    color: white;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
}

.login-card h2 {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 24px;
}

.login-card p {
    color: #64748b;
    margin-bottom: 25px;
    font-size: 15px;
}

.login-card input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 20px;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    background: #f8fafc;
}

.login-card input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
    background: #fff;
}

.login-card button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}

.login-card button:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

.login-card button:active {
    transform: scale(0.98);
}

/* =========================================
   --- URGENT ACTION HIGHLIGHT ---
========================================= */
#newPlateExp {
    border: 2px solid #ff3b30;
    background-color: #ffffff;
    box-shadow: inset 0 1px 3px rgba(255, 59, 48, 0.1);
}

@keyframes otdEstimatePulse {
    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35), 0 0 12px rgba(196, 181, 253, 0.55);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.55), 0 0 22px rgba(196, 181, 253, 0.9);
    }
}

.otd-estimate-glow {
    background: #ffffff !important;
    border: 1px solid #a78bfa !important;
    animation: otdEstimatePulse 1.25s ease-in-out infinite;
}

@keyframes greenGlowPulse {
    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.35), 0 0 12px rgba(74, 222, 128, 0.5);
    }
    50% {
        box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.6), 0 0 22px rgba(74, 222, 128, 0.9);
    }
}

.green-glow-pulse {
    background: #ffffff !important;
    border: 1px solid #4ade80 !important;
    animation: greenGlowPulse 1.25s ease-in-out infinite;
}