:root {
    --bg: #071225;
    --surface: #121d36;
    --surface-strong: #0a1326;
    --surface-hover: #172542;
    --primary: #3b82f6;
    --primary-rgb: 59,130,246;
    --success: #22c55e;
    --text: #ffffff;
    --text-muted: #9fb4d3;
    --border: rgba(255,255,255,.08);
    --soft: rgba(255,255,255,.05);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at top left, rgba(var(--primary-rgb), .18), transparent 34%),
                linear-gradient(135deg, #061025, #071225 48%, #09162d);
    color: var(--text);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

body {
    min-height: 100vh;
}

a {
    color: inherit;
}

.portal-shell {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.portal-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.portal-card {
    background: rgba(18, 29, 54, .92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.portal-login-card {
    width: min(460px, 100%);
    padding: 30px;
}

.portal-logo {
    display: grid;
    place-items: center;
    margin-bottom: 22px;
}

.portal-logo img {
    width: 220px;
    max-width: 72%;
    height: auto;
}

.portal-eyebrow {
    margin: 0 0 4px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .02em;
}

.portal-title {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.05;
}

.portal-subtitle {
    margin: 8px 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.portal-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.portal-field label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
}

.portal-input {
    width: 100%;
    height: 52px;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 13px;
    background: var(--surface-strong);
    color: var(--text);
    padding: 0 15px;
    font: inherit;
    font-weight: 750;
    outline: none;
}

.portal-input:focus {
    border-color: rgba(var(--primary-rgb), .86);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .12);
}

.portal-input.uppercase {
    text-transform: uppercase;
}

.portal-button {
    min-height: 48px;
    border: 1px solid rgba(var(--primary-rgb), .55);
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    padding: 0 18px;
    font: inherit;
    font-weight: 850;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    text-decoration: none;
}

.portal-button.secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.portal-back-button {
    min-height: 46px;
    padding: 0 16px 0 12px;
    border-radius: 14px;
    border: 1px solid rgba(var(--primary-rgb), .35);
    background: rgba(var(--primary-rgb), .08);
    color: #dbeafe;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    text-decoration: none;
    font-weight: 900;
    transition: border-color .2s ease, background .2s ease;
}

.portal-back-button:hover {
    border-color: rgba(var(--primary-rgb), .85);
    background: rgba(var(--primary-rgb), .14);
}

.portal-back-button span {
    width: 14px;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-1px);
}

.portal-alert {
    padding: 13px 14px;
    border-radius: 13px;
    margin: 18px 0 0;
    background: rgba(239, 68, 68, .14);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, .28);
    font-weight: 750;
}

.portal-alert.success {
    background: rgba(34, 197, 94, .12);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, .28);
}

.portal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
}

.portal-brand img {
    width: 168px;
    height: auto;
}

.portal-brand-copy {
    display: grid;
    gap: 3px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}

.portal-brand-copy strong {
    color: var(--text);
    font-size: 15px;
    line-height: 1.1;
}

.portal-brand-copy span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;
}

.portal-token {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 800;
}

.portal-hero {
    display: grid;
    grid-template-columns: 1.35fr .65fr;
    gap: 18px;
    margin-bottom: 18px;
}

.portal-hero-main,
.portal-stat {
    padding: 22px;
}

.portal-stats {
    display: grid;
    gap: 12px;
}

.portal-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 86px;
}

.portal-stat strong {
    display: block;
    font-size: 28px;
}

.portal-stat span {
    color: var(--text-muted);
    font-weight: 750;
}

.portal-section {
    padding: 20px;
    margin-top: 18px;
}

.portal-section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 14px;
    margin-bottom: 14px;
}

.portal-section h2 {
    margin: 0;
    font-size: 21px;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.portal-vehicle-card {
    display: grid;
    gap: 13px;
    padding: 17px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    transition: border-color .2s ease, background .2s ease;
}

.portal-vehicle-card:hover {
    border-color: rgba(var(--primary-rgb), .85);
    background: var(--surface-hover);
}

.portal-vehicle-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.portal-vehicle-head h3 {
    margin: 0;
    font-size: 18px;
}

.portal-vehicle-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(255,255,255,.055));
    border: 1px solid rgba(255,255,255,.08);
    padding: 7px;
}

.portal-plate {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,.18);
    width: fit-content;
    font-weight: 900;
    letter-spacing: .04em;
}

.portal-plate span:first-child {
    background: var(--primary);
    color: #fff;
    padding: 0 7px;
    font-size: 11px;
    display: grid;
    place-items: center;
}

.portal-plate span:last-child {
    background: #fff;
    color: #111827;
    padding: 4px 10px;
    display: grid;
    place-items: center;
}

.portal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 750;
}

.portal-vehicle-facts {
    margin-top: 16px;
    align-items: center;
}

.portal-fact {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border-radius: 9px;
    background: rgba(255,255,255,.045);
    border: 1px solid rgba(255,255,255,.07);
    color: var(--text-muted);
}

.portal-fact strong {
    color: var(--text);
}

.vehicle-detail-hero {
    display: block;
    padding: 22px;
    margin-bottom: 18px;
}

.vehicle-detail-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.vehicle-detail-title-row .portal-vehicle-logo {
    width: 82px;
    height: 82px;
    flex: 0 0 auto;
}

.portal-history {
    display: grid;
    gap: 12px;
}

.portal-history-item {
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 15px;
}

.portal-history-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.portal-history-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
    flex-shrink: 0;
}

.portal-job-images-button {
    min-height: 34px;
    border: 1px solid rgba(var(--primary-rgb), .34);
    background: rgba(var(--primary-rgb), .08);
    color: #bfdbfe;
    border-radius: 11px;
    padding: 0 8px 0 11px;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.portal-job-images-button:hover {
    border-color: rgba(var(--primary-rgb), .82);
    background: rgba(var(--primary-rgb), .15);
}

.portal-job-images-button span {
    min-width: 22px;
    height: 22px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(var(--primary-rgb), .18);
    color: var(--text);
    font-size: 12px;
}

.portal-download-button {
    min-height: 38px;
    border: 1px solid rgba(var(--primary-rgb), .36);
    background: rgba(var(--primary-rgb), .08);
    color: #bfdbfe;
    border-radius: 12px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    transition: border-color .2s ease, background .2s ease;
}

.portal-download-button:hover {
    border-color: rgba(var(--primary-rgb), .82);
    background: rgba(var(--primary-rgb), .15);
}

.portal-history-title {
    margin: 0;
    font-size: 16px;
}

.portal-price {
    font-weight: 900;
    color: #60a5fa;
    white-space: nowrap;
}

.portal-note {
    color: var(--text-muted);
    line-height: 1.45;
    margin: 8px 0 0;
}

.portal-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.portal-image-card {
    border: 0;
    border-radius: 15px;
    background: var(--surface-strong);
    padding: 0;
    overflow: hidden;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,.07);
    transition: border-color .2s ease, background .2s ease;
}

.portal-image-card:hover {
    border-color: rgba(var(--primary-rgb), .75);
    background: var(--surface-hover);
}

.portal-image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.portal-image-caption {
    display: grid;
    gap: 3px;
    min-height: 54px;
    padding: 9px 10px 10px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.25;
}

.portal-image-caption strong,
.portal-image-caption small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-image-caption strong {
    color: var(--text);
    font-size: 13px;
}

.portal-image-caption small {
    color: var(--text-muted);
}

.portal-lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(12px);
}

.portal-lightbox.open {
    display: grid;
}

.portal-lightbox img {
    max-width: min(100%, 1100px);
    max-height: 82vh;
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
}

.portal-lightbox-close {
    position: fixed;
    top: 22px;
    right: 22px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 26px;
    cursor: pointer;
}

.portal-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 72px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(18, 29, 54, .78);
    color: var(--text);
    font-size: 50px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding-bottom: 7px;
}

.portal-lightbox-nav:hover {
    border-color: rgba(var(--primary-rgb), .8);
    background: rgba(18, 29, 54, .96);
}

.portal-lightbox-nav.prev {
    left: 24px;
}

.portal-lightbox-nav.next {
    right: 24px;
}

.portal-lightbox-caption {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    max-width: min(760px, calc(100% - 32px));
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(18, 29, 54, .88);
    border: 1px solid var(--border);
    color: var(--text);
    white-space: pre-line;
    text-align: center;
    font-weight: 750;
}

.portal-empty {
    margin: 0;
    padding: 18px;
    border-radius: 15px;
    background: var(--surface-strong);
    color: var(--text-muted);
}

@media (max-width: 760px) {
    .portal-shell {
        width: min(100% - 20px, 1160px);
        padding: 18px 0 34px;
    }

    .portal-top,
    .portal-hero {
        grid-template-columns: 1fr;
        display: grid;
    }

    .portal-top {
        align-items: start;
    }

    .portal-brand img {
        width: 142px;
    }

    .portal-brand-copy {
        padding-left: 11px;
    }

    .portal-brand-copy span {
        display: block;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .portal-token {
        width: fit-content;
    }

    .portal-section-head {
        align-items: start;
        flex-direction: column;
    }

    .portal-lightbox-nav {
        width: 44px;
        height: 58px;
        font-size: 38px;
    }

    .portal-lightbox-nav.prev {
        left: 10px;
    }

    .portal-lightbox-nav.next {
        right: 10px;
    }

    .portal-lightbox-caption {
        bottom: 12px;
        font-size: 13px;
    }
}
