:root {
    --red: #e60000;
    --red-dark: #bb0000;
    --ink: #141414;
    --muted: #757575;
    --line: #d7d7d7;
    --soft: #f6f6f6;
    --white: #ffffff;
    --shadow: 0 18px 45px rgba(0, 0, 0, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: #f3f3f3;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    position: relative;
    width: min(100vw, 1100px);
    min-height: 100vh;
    margin: 0 auto;
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow);
}

.app-shell::before,
.app-shell::after {
    content: "";
    position: absolute;
    bottom: -125px;
    width: 320px;
    height: 180px;
    border-radius: 50% 50% 0 0;
    background: var(--red);
    z-index: 0;
}

.app-shell::before {
    left: -110px;
}

.app-shell::after {
    right: -110px;
}

.screen::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 46px;
    height: 150px;
    pointer-events: none;
    opacity: .45;
    background:
        repeating-radial-gradient(ellipse at 25% 100%, transparent 0 24px, rgba(0, 0, 0, .08) 25px 26px, transparent 27px 54px),
        repeating-radial-gradient(ellipse at 72% 100%, transparent 0 28px, rgba(0, 0, 0, .07) 29px 30px, transparent 31px 60px);
    z-index: 0;
}

.topbar {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 56px 1fr 80px;
    align-items: center;
    min-height: 56px;
    padding: 0 16px;
    color: var(--white);
    background: linear-gradient(90deg, var(--red-dark), var(--red));
}

.topbar h1 {
    margin: 0;
    text-align: center;
    font-size: 20px;
    line-height: 1.1;
}

.nav-icon {
    display: inline-grid;
    gap: 5px;
    width: 28px;
}

.nav-icon span {
    display: block;
    height: 3px;
    border-radius: 3px;
    background: var(--white);
}

.logout-link {
    justify-self: end;
    font-size: 13px;
    font-weight: 700;
}

.screen {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    min-height: calc(100vh - 56px);
    padding: 34px clamp(18px, 6vw, 84px) 150px;
}

.logo-block {
    display: grid;
    justify-items: center;
    gap: 20px;
    width: min(100%, 480px);
}

.dealer-logo {
    width: min(100%, 340px);
    max-height: 90px;
    object-fit: contain;
}

.toyota-logo {
    width: min(52vw, 210px);
    max-height: 150px;
    object-fit: contain;
}

.form-panel {
    width: min(100%, 620px);
}

.form-panel.compact {
    width: min(100%, 460px);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 14px;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: var(--white);
}

.input-with-icon {
    position: relative;
    margin-bottom: 14px;
}

.field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    translate: 0 -50%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.input-with-icon input {
    padding-left: 54px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    min-height: 30px;
    padding: 0 10px;
    translate: 0 -50%;
    border: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin-top: 12px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

.btn.primary {
    border-color: var(--red);
    color: var(--white);
    background: linear-gradient(180deg, #f20a0a, var(--red));
}

.btn.secondary {
    color: var(--ink);
    background: var(--white);
}

.btn.whatsapp {
    width: min(100%, 320px);
    border-color: #08a02d;
    color: var(--white);
    background: #08a02d;
}

.btn.small,
.btn.mini {
    width: auto;
    min-height: 38px;
    margin-top: 0;
}

.btn.mini {
    min-height: 34px;
    padding: 0 16px;
    font-size: 13px;
}

.btn.disabled {
    opacity: .45;
    pointer-events: none;
}

.menu-list {
    display: grid;
    gap: 16px;
    width: min(100%, 560px);
    margin-top: 18px;
}

.menu-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: center;
    min-height: 70px;
    padding: 10px 18px;
    border: 1px solid var(--red);
    border-radius: 8px;
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    background: rgba(255, 255, 255, .8);
}

.menu-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--white);
    background: var(--red);
    font-size: 14px;
    text-transform: uppercase;
}

.form-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    align-items: center;
    gap: 12px 18px;
}

.form-grid label {
    margin: 0;
}

.upload-label {
    margin-top: 18px;
}

.upload-box {
    position: relative;
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 142px;
    padding: 16px;
    border: 1px dashed #aaa;
    border-radius: 6px;
    background: rgba(255, 255, 255, .6);
    cursor: pointer;
}

.upload-box input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-mark {
    display: grid;
    place-items: center;
    width: 66px;
    height: 54px;
    border: 5px solid #999;
    border-radius: 8px;
    color: #777;
    font-size: 12px;
    font-weight: 700;
}

.upload-box b {
    z-index: 1;
    padding: 10px 24px;
    border-radius: 6px;
    color: var(--white);
    background: var(--red);
}

.upload-box img {
    display: none;
    max-width: min(100%, 430px);
    max-height: 230px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.upload-box.has-preview .image-mark,
.upload-box.previewing .image-mark {
    display: none;
}

.upload-box.has-preview img,
.upload-box.previewing img {
    display: block;
}

.filter-row {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: min(100%, 720px);
}

.filter-row label {
    margin: 0;
}

.sales-table {
    width: min(100%, 820px);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, .8);
}

.sales-head,
.sales-row {
    display: grid;
    grid-template-columns: 110px 1fr 180px 120px;
    align-items: center;
}

.sales-head {
    min-height: 48px;
    color: var(--white);
    font-weight: 700;
    text-align: center;
    background: var(--red);
}

.sales-row {
    min-height: 92px;
    border-top: 1px solid var(--line);
}

.sales-row > span {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 10px;
}

.sales-row small {
    color: var(--muted);
}

.sales-id {
    font-weight: 700;
}

.thumb {
    width: 108px;
    height: 58px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.pager {
    display: grid;
    grid-template-columns: 110px 1fr 110px;
    align-items: center;
    gap: 18px;
    width: min(100%, 520px);
    font-weight: 700;
    text-align: center;
}

.result-card {
    width: min(100%, 680px);
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .85);
}

.business-card {
    display: block;
    width: 100%;
    border-radius: 6px;
}

.info-list {
    display: grid;
    gap: 10px;
    width: min(100%, 680px);
}

.info-list div {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 18px;
    min-height: 46px;
    align-items: center;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .8);
}

.not-found {
    display: grid;
    justify-items: center;
    gap: 20px;
    text-align: center;
}

.missing-doc {
    position: relative;
    width: 118px;
    height: 150px;
    border: 7px solid #b8b8b8;
    border-radius: 10px;
}

.missing-doc::after {
    content: "";
    position: absolute;
    right: -7px;
    top: -7px;
    width: 42px;
    height: 42px;
    border-left: 7px solid #b8b8b8;
    border-bottom: 7px solid #b8b8b8;
    background: var(--white);
}

.missing-doc span {
    position: absolute;
    right: -36px;
    bottom: -22px;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    color: var(--white);
    background: var(--red);
    font-size: 44px;
    font-weight: 700;
}

.not-found h2 {
    margin: 0;
    font-size: clamp(22px, 4vw, 34px);
}

.brand-footer {
    position: absolute;
    left: 50%;
    bottom: 52px;
    z-index: 2;
    display: grid;
    justify-items: center;
    translate: -50% 0;
}

.brand-footer strong {
    color: var(--red);
    font-size: clamp(34px, 5vw, 48px);
    line-height: 1;
}

.brand-footer span {
    font-size: 16px;
}

.alert {
    width: min(100%, 620px);
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 700;
}

.alert-success {
    color: #065f24;
    background: #dff7e6;
}

.alert-error {
    color: #9d0000;
    background: #ffe4e4;
}

.empty-state {
    text-align: center;
}

@media (max-width: 760px) {
    .app-shell {
        width: 100vw;
        min-height: 100svh;
    }

    .topbar {
        grid-template-columns: 42px 1fr 56px;
        min-height: 52px;
        padding: 0 12px;
    }

    .topbar h1 {
        font-size: 17px;
    }

    .screen {
        min-height: calc(100svh - 52px);
        padding: 28px 18px 138px;
    }

    .dealer-logo {
        width: min(100%, 260px);
    }

    .toyota-logo {
        width: 170px;
    }

    .form-grid {
        grid-template-columns: 92px 1fr;
        gap: 10px 10px;
    }

    .form-grid label,
    label {
        font-size: 12px;
    }

    input,
    select {
        min-height: 40px;
        font-size: 13px;
    }

    .filter-row {
        grid-template-columns: 1fr 1fr;
    }

    .filter-row label {
        grid-column: 1 / -1;
    }

    .sales-head {
        display: none;
    }

    .sales-table {
        display: grid;
        gap: 10px;
        border: 0;
        background: transparent;
    }

    .sales-row {
        grid-template-columns: 70px 1fr 62px 58px;
        min-height: 78px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(255, 255, 255, .88);
    }

    .sales-row > span {
        padding: 6px;
        font-size: 12px;
    }

    .sales-row b {
        font-size: 13px;
    }

    .sales-row small {
        display: none;
    }

    .thumb {
        width: 48px;
        height: 48px;
    }

    .btn.mini {
        min-height: 34px;
        padding: 0 10px;
        font-size: 12px;
    }

    .info-list div {
        grid-template-columns: 96px 1fr;
        gap: 10px;
        padding: 0 12px;
        font-size: 13px;
    }

    .upload-box img {
        max-height: 170px;
    }
}

@media (min-width: 900px) {
    .app-shell {
        min-height: 720px;
        margin-top: 24px;
        margin-bottom: 24px;
        border-radius: 20px;
    }

    .screen {
        min-height: 664px;
    }
}
