/* ─── App shell: login, dashboard, registration steps ─── */

.app-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* Background */
.app-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: #030303;
    overflow: hidden;
}

.app-bg-mesh {
    position: absolute;
    inset: -15%;
    background:
        radial-gradient(ellipse 55% 45% at 15% 20%, rgba(212, 175, 55, 0.09) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 85% 15%, rgba(240, 207, 103, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 50% 100%, rgba(182, 140, 30, 0.07) 0%, transparent 55%);
    pointer-events: none;
}

.app-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(212, 175, 55, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 175, 55, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.45;
    pointer-events: none;
}

.app-bg video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.14) saturate(0.8);
}

.app-bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 55% at 50% -5%, rgba(212, 175, 55, 0.12), transparent 55%),
        radial-gradient(circle at 15% 85%, rgba(212, 175, 55, 0.04), transparent 35%),
        linear-gradient(180deg, rgba(3, 3, 3, 0.35), rgba(3, 3, 3, 0.96));
    pointer-events: none;
}

/* App header uses site-header-shell (site-header.css) */
.app-site-header .btn {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.app-topbar-actions--guest {
    display: flex;
}

/* Main */
.app-main {
    flex: 1;
    padding: var(--space-6) 0 var(--space-10);
}

/* Card shell */
.app-card {
    position: relative;
    background: rgba(10, 10, 10, 0.94);
    border: 1px solid rgba(212, 175, 55, 0.12);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-5);
    max-width: 900px;
    margin: 0 auto;
    /* visible so sticky step/contract action bars work on mobile */
    overflow: visible;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
}

.app-card::before { display: none; }

.app-card--narrow { max-width: 440px; }
.app-card--wide   { max-width: 880px; }
.app-card--step   { max-width: 720px; }

.app-page--auth .app-card { padding: var(--space-8) var(--space-5); }

/* Legacy h1 in card (fallback) */
.app-card > h1 {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    text-align: center;
}

.app-card > .subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
    line-height: 1.75;
    text-align: center;
}

/* Step body wrapper */
.step-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* Saved data panel */
.saved-panel {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 175, 55, 0.16);
    background: rgba(212, 175, 55, 0.04);
}

.saved-panel-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--gold-light);
}

.saved-panel-head .icon { width: 18px; height: 18px; }

.saved-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-2);
}

.saved-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.saved-item span {
    display: block;
    font-size: 0.7rem;
    color: var(--muted-2);
    margin-bottom: 4px;
}

.saved-item strong {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

/* Dashboard */
.app-page--dash .app-bg video {
    display: none;
}

.app-page--dash .app-bg-overlay {
    background:
        radial-gradient(ellipse 80% 55% at 50% -5%, rgba(212, 175, 55, 0.08), transparent 55%),
        linear-gradient(180deg, rgba(3, 3, 3, 0.5), rgba(3, 3, 3, 0.92));
}

.app-page--dash .app-card {
    background: rgba(12, 12, 12, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
    padding: var(--space-5) var(--space-5) var(--space-6);
}

.dash-shell {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.dash-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-head__icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: var(--gold-light);
    flex-shrink: 0;
}

.dash-head__icon .icon { width: 22px; height: 22px; }

.dash-head__title {
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

.dash-head__sub {
    margin: 0;
    font-size: 0.84rem;
    color: var(--muted);
    line-height: 1.6;
}

.dash-status-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-3);
}

.dash-status-card {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
}

.dash-status-card--accent {
    border-color: rgba(212, 175, 55, 0.22);
    background: rgba(212, 175, 55, 0.05);
}

.dash-status-card__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 8px;
}

.dash-status-card__label .icon { width: 14px; height: 14px; }

.dash-status-card__title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0 0 6px;
    line-height: 1.35;
}

.dash-status-card__text {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.65;
}

.dash-rank-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(212, 175, 55, 0.04));
}

.dash-rank-card__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.18);
    color: var(--gold);
}

.dash-rank-card__icon .icon { width: 24px; height: 24px; }

.dash-rank-card__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
}

.dash-rank-card__rank {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 4px;
}

.dash-rank-card__delivery {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.6;
}

.dash-rank-card__delivery strong { color: var(--gold); }

.dash-reject-alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: var(--space-4);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(231, 76, 60, 0.35);
    background: rgba(231, 76, 60, 0.08);
}

.dash-reject-alert__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.dash-reject-alert__icon .icon { width: 18px; height: 18px; }

.dash-reject-alert strong {
    display: block;
    margin-bottom: 4px;
    color: #ff8a80;
}

.dash-reject-alert p {
    margin: 0 0 4px;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--text);
}

.dash-reject-alert p span {
    font-weight: 700;
    color: #ffb4a9;
}

.dash-reject-alert__hint {
    font-size: 0.8rem !important;
    color: var(--muted) !important;
}

.dash-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.dash-block__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--gold-light);
    margin: 0;
}

.dash-block__title .icon { width: 17px; height: 17px; }

.dash-hero {
    text-align: center;
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 175, 55, 0.14);
    background: rgba(212, 175, 55, 0.05);
    margin-bottom: var(--space-5);
}

.dash-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    margin-bottom: var(--space-3);
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
}

.dash-hero h3 {
    font-size: 1.15rem;
    margin-bottom: var(--space-2);
    font-weight: 800;
}

.dash-hero p {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.7;
    max-width: 420px;
    margin: 0 auto;
}

.dash-status {
    text-align: center;
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: var(--space-5);
}

.dash-status h3 { font-size: 1.1rem; margin-bottom: 8px; font-weight: 800; }
.dash-status p { color: var(--muted); font-size: 0.9rem; line-height: 1.7; }

.dash-status--contract {
    margin-top: 14px;
    border-color: rgba(212, 175, 55, 0.35);
    background: rgba(212, 175, 55, 0.07);
    text-align: right;
}

.dash-status--contract h3,
.dash-status--contract p {
    text-align: right;
}

.dash-support-box {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: rgba(212, 175, 55, 0.08);
    color: var(--gold-light);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.5;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dash-support-box__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.dash-support-box__body strong {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--gold-light);
}

.dash-support-box__body span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.dash-support-box:hover {
    border-color: rgba(212, 175, 55, 0.55);
    background: rgba(212, 175, 55, 0.12);
    color: #fff3cc;
}

.dash-support-box__icon .icon,
.dash-support-box__arrow .icon {
    width: 20px;
    height: 20px;
}

.dash-support-box__text {
    flex: 1;
    text-align: center;
}

.dash-timeline-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.dash-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.dash-timeline__item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.dash-timeline__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.dash-timeline__label {
    font-size: 0.86rem;
    font-weight: 700;
}

.dash-timeline__status {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    white-space: normal;
    text-align: end;
    min-width: 0;
}

.contract-download-card__btn + .contract-download-card__btn {
    margin-top: 8px;
}

.dash-timeline__item--done {
    border-color: rgba(39, 174, 96, 0.22);
    background: rgba(39, 174, 96, 0.05);
}

.dash-timeline__item--done .dash-timeline__dot {
    background: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.15);
}

.dash-timeline__item--done .dash-timeline__status {
    color: #27ae60;
}

.dash-timeline__item--current {
    border-color: rgba(212, 175, 55, 0.35);
    background: rgba(212, 175, 55, 0.07);
}

.dash-timeline__item--current .dash-timeline__dot {
    background: var(--gold-light);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.dash-timeline__item--current .dash-timeline__status {
    color: var(--gold-light);
}

.dash-timeline__item--waiting {
    border-color: rgba(243, 156, 18, 0.28);
    background: rgba(243, 156, 18, 0.06);
}

.dash-timeline__item--waiting .dash-timeline__dot {
    background: #f39c12;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.15);
}

.dash-timeline__item--waiting .dash-timeline__status {
    color: #f39c12;
}

.contract-download-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dash-doc-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
}

.dash-doc-badge--ok {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.12);
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.dash-doc-badge--draft {
    color: var(--gold-light);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.25);
}

.dash-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--gold-light);
    margin-bottom: var(--space-3);
}

.dash-section-title .icon { width: 18px; height: 18px; }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: var(--space-3);
}

.dash-card {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    min-width: 0;
    overflow: hidden;
}

.dash-card--car {
    grid-column: 1 / -1;
}

.dash-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.dash-card .label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--muted);
    margin-bottom: 5px;
    font-weight: 600;
}

.dash-card .label .icon { width: 14px; height: 14px; }

.dash-card .value {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

.car-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.car-display__brand {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
}

.car-display__model {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.mixed-script {
    unicode-bidi: isolate;
}

.saved-item--car {
    grid-column: 1 / -1;
}

.saved-item strong .car-display__brand {
    font-size: 0.72rem;
}

.saved-item strong .car-display__model {
    font-size: 0.82rem;
}

.dash-downloads {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.contract-download-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.contract-download-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(212, 175, 55, 0.1);
    color: var(--gold);
    flex-shrink: 0;
}

.contract-download-card__icon .icon {
    width: 22px;
    height: 22px;
}

.contract-download-card__info {
    flex: 1;
    min-width: 180px;
}

.contract-download-card__info strong {
    display: block;
    color: #fff;
    font-size: 0.92rem;
    margin-bottom: 4px;
}

.contract-download-card__info span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.contract-download-card__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #111;
    font-weight: 800;
    font-size: 0.86rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    flex-shrink: 0;
}

.contract-download-card__btn:hover {
    transform: translateY(-1px);
}

.dash-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-actions .btn {
    flex: 1;
    min-width: 140px;
    min-height: 46px;
    font-size: 0.88rem;
}

/* Page loader */
.page-loader {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: opacity 0.25s, visibility 0.25s;
}

.page-loader.is-active {
    visibility: visible;
    opacity: 1;
}

html.page-loading { overflow: hidden; }

.page-loader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 28px;
    background: rgba(14, 14, 14, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: page-loader-in 0.2s ease;
}

@keyframes page-loader-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.page-loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: app-spin 0.75s linear infinite;
}

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

.page-loader-text {
    color: var(--gold-light);
    font-size: 0.92rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .app-card { padding: var(--space-6) var(--space-4); border-radius: var(--radius-lg); }
    .app-bg video { display: none; }
    .app-topbar-title,
    .site-header-shell__title { display: none; }
    .dash-actions .btn { min-width: 100%; }

    .dash-timeline__item {
        grid-template-columns: auto 1fr;
        gap: 8px 10px;
    }
    .dash-timeline__status {
        grid-column: 2;
        text-align: start;
        font-size: 0.68rem;
    }
}

@media (max-width: 480px) {
    .app-main { padding: var(--space-4) 0 var(--space-8); }
}
