/* CAMUS — Estilos de páginas específicas. */

.grid-2 > .card + .card, .grid-3 > .card + .card, .grid-main > .card + .card { margin-top: 0; }

/* ─── Acceso (login, restablecer contraseña) ─── */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    background: var(--paper);
}
.auth-panel { display: flex; flex-direction: column; padding: var(--s-8) clamp(24px, 6vw, 88px); }
.auth-brand { display: flex; align-items: center; gap: var(--s-3); font-weight: 760; font-size: var(--fs-lg); font-variation-settings: 'wdth' var(--wdth-narrow); }
.auth-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 380px; width: 100%; margin: var(--s-8) 0; }
.auth-title { font-size: var(--fs-3xl); font-weight: 780; font-variation-settings: 'wdth' var(--wdth-tight); letter-spacing: -0.015em; line-height: 1.05; }
.auth-lead { color: var(--ink-3); margin: var(--s-2) 0 var(--s-6); }
.auth-form .form-group + .form-group { margin-top: var(--s-4); }
.auth-form > .btn { margin-top: var(--s-6); }
.auth-foot { font-size: var(--fs-xs); color: var(--ink-3); display: flex; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.auth-foot a { color: var(--ink-2); }

/* Lámina: el lado derecho dibuja el recorrido de una orden como despiece */
.auth-plate {
    background: var(--ink);
    color: #fff;
    padding: var(--s-10) clamp(24px, 5vw, 72px);
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.plate-head { position: relative; max-width: 30ch; font-size: var(--fs-xl); font-weight: 650; line-height: 1.25; color: #fff; font-variation-settings: 'wdth' var(--wdth-narrow); }
.plate-figure { position: relative; margin: var(--s-8) 0; }
.plate-figure svg { width: 100%; height: auto; max-height: 52vh; }
.plate-legend { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-6); font-size: var(--fs-md); color: rgba(255,255,255,0.82); }
.plate-legend li { display: flex; gap: var(--s-3); align-items: baseline; border-top: 1px solid rgba(255,255,255,0.14); padding-top: var(--s-2); }
.plate-legend b { font-variation-settings: 'wdth' var(--wdth-tight); color: var(--placa); min-width: 1.5em; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-plate { display: none; }
    .auth-panel { padding: var(--s-6) var(--s-5); }
    .auth-form-wrap { margin: var(--s-10) 0; }
}

/* ─── Páginas públicas (portal y recibo) ─── */
.public { background: var(--ground); min-height: 100vh; }
.public-bar {
    background: var(--brand-dark); color: var(--on-brand-dark);
}
.public-bar-inner {
    max-width: 760px; margin: 0 auto;
    padding: var(--s-4) var(--s-5);
    display: flex; align-items: center; gap: var(--s-3);
}
.public-bar .brand-name { font-size: var(--fs-lg); }
.public-bar a { color: inherit; }
.public-main { max-width: 760px; margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-10); }
.public-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.public-hero h1 { font-size: var(--fs-2xl); font-weight: 780; font-variation-settings: 'wdth' var(--wdth-tight); }
.public-foot { text-align: center; font-size: var(--fs-xs); color: var(--ink-3); padding: var(--s-6) var(--s-5); }
.public .stage-strip { box-shadow: none; }
@media (min-width: 641px) { .public .stage-strip { grid-template-columns: repeat(8, minmax(84px, 1fr)); } }
.public .card + .card { margin-top: var(--s-4); }
.public-call { background: var(--brand); color: var(--on-brand); }
.public-call:hover { background: color-mix(in srgb, var(--brand) 88%, #000); color: var(--on-brand); }
.portal-now { font-size: var(--fs-lg); margin-bottom: var(--s-4); }
.portal-now strong { font-weight: 780; font-variation-settings: 'wdth' var(--wdth-tight); }
.card-header .text-sm { display: inline-flex; align-items: center; gap: 6px; }
.card-header .text-sm .icon { width: 15px; height: 15px; }

.ready-banner {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-4) var(--s-5);
    background: var(--ok-bg); color: var(--ok);
    border: 1px solid color-mix(in srgb, var(--ok) 25%, #fff);
    border-radius: var(--r-lg);
    font-weight: 600;
    margin-bottom: var(--s-5);
}
.ready-banner .icon { width: 22px; height: 22px; }

/* Recibo / documento */
.doc { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.doc-head { display: flex; justify-content: space-between; gap: var(--s-5); padding: var(--s-6); border-bottom: 1px solid var(--ink); flex-wrap: wrap; }
.doc-head h1 { font-size: var(--fs-xl); font-weight: 780; font-variation-settings: 'wdth' var(--wdth-tight); }
.doc-code { font-size: var(--fs-2xl); font-weight: 780; font-variation-settings: 'wdth' 70; text-align: right; line-height: 1; }
.doc-section { padding: var(--s-5) var(--s-6); }
.doc-section + .doc-section { border-top: 1px solid var(--rule); }
.doc-section h2 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: var(--s-3); font-weight: 650; }
.doc-terms { font-size: var(--fs-xs); color: var(--ink-3); }
.doc-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; margin-bottom: var(--s-4); }

@media print {
    .public-bar, .doc-actions, .public-foot { display: none !important; }
    .public, body { background: #fff; }
    .public-main { padding: 0; max-width: none; }
    .doc { border: 0; box-shadow: none; }
}

/* ─── Errores ─── */
.error-page { max-width: 520px; margin: var(--s-12) auto; text-align: center; }
.error-code { font-size: 5rem; font-weight: 800; font-variation-settings: 'wdth' 62; line-height: 1; color: var(--ink); }
.error-page h1 { margin: var(--s-3) 0 var(--s-2); }
.error-page p { color: var(--ink-3); margin-bottom: var(--s-6); }

/* ─── Mecánico (celular) ─── */
.job-list { display: flex; flex-direction: column; gap: var(--s-3); }
.job {
    background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg);
    box-shadow: var(--shadow-1); padding: var(--s-4) var(--s-5);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2) var(--s-4); align-items: center;
}
.job-title { font-weight: 700; font-size: var(--fs-base); }
.job-meta { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-3); }
.job .btn { min-height: 44px; }
.job--en_proceso { border-color: color-mix(in srgb, var(--brand) 55%, var(--rule)); background: var(--brand-wash); }
.job--completado { opacity: 0.75; }
.job-complete { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.job-complete .form-control { flex: 1; }
.job-complete .form-control { min-height: 44px; min-width: 180px; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--rule); }
.task:last-child { border-bottom: 0; }
.task-title { font-size: var(--fs-base); }
.veh-photo--wide { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; }
@media (max-width: 640px) {
    .job { grid-template-columns: 1fr; }
    .job .btn { width: 100%; }
}

/* ─── Superadmin: talleres ─── */
.tenant-row-brand { display: flex; align-items: center; gap: var(--s-3); }
.swatch { width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.12); flex: none; }
.brand-preview {
    border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden;
}
.brand-preview-bar { padding: var(--s-4); display: flex; align-items: center; gap: var(--s-3); }
.brand-preview-body { padding: var(--s-4); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; background: var(--paper); }

/* ─── Historial del vehículo ─── */
.hist-meta { display: flex; align-items: center; gap: 6px; padding: var(--s-3) var(--s-5) 0; font-size: var(--fs-sm); color: var(--ink-3); }
.hist-meta .icon { width: 15px; height: 15px; }
.hist-report { margin: var(--s-2) var(--s-5) var(--s-3); padding: var(--s-2) var(--s-3); background: var(--sunken); border-radius: var(--r-md); font-size: var(--fs-md); color: var(--ink-2); }
.hist-photos { display: flex; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-3) var(--s-5) var(--s-4); border-top: 1px solid var(--rule); }
.hist-photos img { width: 72px; height: 54px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--rule); }
.ai-card { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); }
.ai-msg.is-thinking { color: var(--ink-3); font-style: italic; }
.ai-msg.is-error { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.ai-input-area textarea { min-height: 40px; resize: none; }
.ai-suggestions[hidden] { display: none; }

/* ─── Chat IA por vehículo ─── */
.ai-panel { display: flex; flex-direction: column; height: min(520px, 70vh); }
.ai-messages { flex: 1; overflow-y: auto; padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.ai-msg { max-width: 88%; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); font-size: var(--fs-md); line-height: 1.5; white-space: pre-wrap; }
.ai-msg.bot { background: var(--sunken); border: 1px solid var(--rule); align-self: flex-start; }
.ai-msg.user { background: var(--ink); color: #fff; align-self: flex-end; }
.ai-suggestions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 var(--s-5) var(--s-3); }
.ai-input-area { display: flex; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--rule); }

/* ─── Vehículos ─── */
.veh-thumb {
    width: 40px; height: 40px; flex: none; border-radius: var(--r-md);
    background: var(--sunken); border: 1px solid var(--rule);
    display: grid; place-items: center; color: var(--ink-3); overflow: hidden;
}
.veh-thumb img { width: 100%; height: 100%; object-fit: cover; }

.veh-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--s-5); align-items: start; }
.photo-drop {
    display: grid; place-items: center;
    aspect-ratio: 4 / 3; border-radius: var(--r-lg);
    border: 1.5px dashed var(--rule-strong); background: var(--sunken);
    cursor: pointer; overflow: hidden; position: relative;
    transition: border-color var(--t-fast), background var(--t-fast);
}
.photo-drop:hover { border-color: var(--brand-ink); background: var(--brand-wash); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-drop img[hidden], .photo-drop-empty[hidden] { display: none; }
.photo-drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--ink-3); font-size: var(--fs-sm); padding: var(--s-3); }
.photo-drop-empty .icon { width: 26px; height: 26px; }
.photo-drop-empty strong { color: var(--ink); }
input.sr-only:focus-visible + .photo-drop { box-shadow: var(--focus); }
@media (max-width: 720px) { .veh-form-layout { grid-template-columns: 1fr; } }

/* ─── Detalle de orden ─── */
.page-sub .estado { margin-right: var(--s-2); vertical-align: 1px; }
.veh-photo { width: 96px; height: 96px; flex: none; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--rule); }
.veh-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-med) var(--ease-out); }
.veh-photo:hover img { transform: scale(1.06); }
.upload-row { display: flex; gap: var(--s-3); align-items: flex-end; flex-wrap: wrap; }
.upload-row .form-group + .form-group { margin-top: 0; }
.check-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; margin: 0; }
.check-results > div { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); margin-right: var(--s-5); }
.check-results dt { font-size: var(--fs-md); color: var(--ink-2); }
.check-results dd { margin: 0; }
.level { display: inline-flex; align-items: center; gap: 3px; }
.level span { width: 8px; height: 14px; border-radius: 2px; background: var(--rule); }
.level span.on { background: var(--ink); }
.level b { font-size: var(--fs-xs); margin-left: 6px; font-weight: 650; }
.next-states { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.next-states legend { margin-bottom: var(--s-2); padding: 0; }
.next-state {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) var(--s-3); border: 1px solid var(--rule); border-radius: var(--r-md);
    cursor: pointer; font-size: var(--fs-md); font-weight: 600; background: var(--paper);
}
.next-state input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.next-state:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.next-state:has(input:checked) .callout { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.next-state:has(input:focus-visible) { box-shadow: var(--focus); }
.callout-sm { width: 24px; height: 24px; font-size: var(--fs-xs); }
.callout.is-bad { border-color: var(--bad); color: var(--bad); }
.next-state:has(input:checked) .callout.is-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.copy-field { display: flex; gap: var(--s-2); }
.copy-field .form-control { flex: 1; min-width: 0; font-size: var(--fs-sm); }

/* ─── Reportes ─── */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.bar-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 48px; align-items: center; gap: var(--s-3); }
.bar-label { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md); }
.bar-track { height: 12px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; background: currentColor; min-width: 2px; padding: 0; }
.bar-fill::before { display: none; }
.bar-value { text-align: right; font-weight: 700; font-variation-settings: 'wdth' var(--wdth-tight); }
@media (max-width: 640px) { .bar-row { grid-template-columns: 1fr 40px; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }
.load-row { display: block; }

/* ─── Nueva orden ─── */
.stack-tight { display: flex; flex-direction: column; gap: var(--s-2); }
.mech-option {
    align-items: center; padding: var(--s-2) var(--s-3);
    border: 1px solid var(--rule); border-radius: var(--r-md);
}
.mech-option input { margin-top: 0; }
.mech-option:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 60%, var(--rule)); background: var(--brand-wash); }
.mech-option .avatar { width: 26px; height: 26px; font-size: var(--fs-xs); }
.sticky-submit { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-5); }
.is-muted-row td { color: var(--ink-3); }

.stock { display: flex; align-items: center; gap: var(--s-2); }
.stock-n { font-weight: 760; font-size: var(--fs-lg); font-variation-settings: "wdth" var(--wdth-tight); min-width: 2ch; }

.doc-section.flush { padding-left: 0; padding-right: 0; padding-bottom: 0; }
.doc-pad { padding: 0 var(--s-6); }
.split-plain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6); }
@media (max-width: 640px) { .split-plain { grid-template-columns: 1fr; } .doc-head { padding: var(--s-4); } .doc-section { padding: var(--s-4); } .doc-pad { padding: 0 var(--s-4); } }

.plan-amount { font-size: var(--fs-3xl); font-weight: 780; font-variation-settings: "wdth" 72; line-height: 1; }
.note-box .icon { display: inline; vertical-align: -3px; width: 16px; height: 16px; color: var(--ok); }

.tenant-chip { width: 30px; height: 30px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; border: 1px solid rgba(0,0,0,0.1); }
.tenant-chip span { width: 12px; height: 12px; border-radius: 50%; }
.color-field { display: flex; align-items: center; gap: var(--s-2); }
.color-field input[type='color'] { width: 56px; flex: none; }
.color-field code { font-size: var(--fs-sm); color: var(--ink-2); }
.brand-preview { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.brand-preview .brand-logo { width: 36px; height: 36px; }
.brand-preview-body .callout { width: 28px; height: 28px; }
.brand-preview-note { padding: 0 var(--s-4) var(--s-4); background: var(--paper); }
