:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --ink: #142033;
    --muted: #64748b;
    --line: #d9e1ec;
    --primary: #0f6d90;
    --primary-dark: #0b526e;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f9d85f;
    --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

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

body.modal-open {
    overflow: hidden;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 22px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 18px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav a {
    padding: 8px 10px;
    border-radius: 6px;
    color: #334155;
}

.nav a:hover {
    background: #eaf3f8;
    color: var(--primary-dark);
}

.page {
    width: min(1380px, calc(100% - 32px));
    margin: 18px auto 42px;
}

.auth-card,
.panel,
.filters-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(420px, 100%);
    margin: 9vh auto;
    padding: 28px;
}

.panel {
    padding: 22px;
}

.panel.wide {
    max-width: 980px;
    margin: 0 auto;
}

.panel.narrow {
    max-width: 520px;
    margin: 0 auto;
}

h1,
h2 {
    margin: 0 0 14px;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 16px;
}

p {
    color: var(--muted);
}

.form {
    display: grid;
    gap: 14px;
}

.form.compact {
    gap: 12px;
}

label,
.field-title {
    display: grid;
    gap: 6px;
    color: #213047;
    font-weight: 700;
    font-size: 12px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 9px 10px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.paste-box:focus {
    outline: 2px solid rgba(15, 109, 144, 0.2);
    border-color: var(--primary);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-weight: 800;
    cursor: pointer;
    font-size: 13px;
}

.button.primary {
    color: #fff;
    background: var(--primary);
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary,
.button.tiny {
    color: #1f334a;
    background: #fff;
    border-color: var(--line);
}

.button.tiny {
    min-height: 30px;
    padding: 5px 10px;
}

.actions,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.content-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}

.filters-panel {
    padding: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.vehicles-area {
    min-width: 0;
}

.vehicle-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.vehicle-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.vehicle-image {
    position: relative;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    background: #edf2f7;
    color: var(--muted);
}

.vehicle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-zoom-button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: zoom-in;
}

.image-zoom-button img {
    display: block;
}

.status {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 9px;
    border-radius: 5px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.status-disponivel {
    background: var(--success);
}

.status-vendido {
    background: var(--danger);
}

.vehicle-body {
    display: grid;
    gap: 12px;
    padding: 12px;
}

.vehicle-body h2 {
    margin: 0;
    min-height: 40px;
    font-size: 15px;
    line-height: 1.35;
    text-transform: uppercase;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    margin: 0;
}

.spec-grid div {
    min-width: 0;
}

.spec-grid dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.spec-grid dd {
    margin: 2px 0 0;
    font-weight: 700;
}

.prices {
    display: grid;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.prices span {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.prices .margin {
    padding: 7px 8px;
    background: var(--warning);
    border-radius: 6px;
}

.notes {
    margin: 0;
    color: #334155;
    white-space: pre-wrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.span-2 {
    grid-column: span 2;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f8fafc;
}

.check input {
    width: auto;
    min-height: auto;
}

.paste-box {
    display: grid;
    grid-template-columns: 1fr 230px;
    gap: 14px;
    min-height: 190px;
    padding: 16px;
    border: 2px dashed #adc1d4;
    border-radius: 8px;
    background: #f8fafc;
    cursor: text;
}

.paste-box strong,
.paste-box span {
    display: block;
}

.paste-box span {
    margin-top: 5px;
    color: var(--muted);
}

.preview {
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 7px;
    background: #e2e8f0;
    color: var(--muted);
}

.preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 56px 18px 18px;
    background: rgba(7, 13, 24, 0.88);
}

.image-modal[hidden] {
    display: none;
}

.image-modal img {
    max-width: min(1200px, 100%);
    max-height: calc(100vh - 88px);
    object-fit: contain;
    border-radius: 6px;
    background: #111827;
}

.image-modal-close {
    position: fixed;
    top: 14px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 7px;
    color: #fff;
    background: rgba(15, 23, 42, 0.85);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.split-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    align-items: start;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--primary-dark);
    color: #fff;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.flash {
    margin-bottom: 12px;
    padding: 11px 12px;
    border-radius: 7px;
    font-weight: 700;
}

.flash-success {
    color: #14532d;
    background: #dcfce7;
}

.flash-error {
    color: #7f1d1d;
    background: #fee2e2;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 28px;
    text-align: center;
    color: var(--muted);
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 8px;
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .content-grid,
    .split-layout,
    .paste-box {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .check-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 560px) {
    .page {
        width: min(100% - 20px, 1380px);
    }

    .form-grid,
    .check-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .section-head,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }
}
