/* ============================================================================
   vehicle.css — enhanced UI component layer (scoped to .veh-*)
   Testbed for a more decorated/polished design language than the base dashboard.
   Builds on the :root tokens in style.css. Roll out wider once proven.
   ============================================================================ */

.veh-hub {
    --veh-grad: linear-gradient(135deg, #60a5fa22, #4ade8018);
    --veh-shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Segmented sub-nav ─────────────────────────────────────────────────── */
/* Page header: L1 title (left) + L2 scope dropdown & primary action (right). */
.veh-pagehead {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.veh-pagehead h2 { margin: 0; font-size: 1.45rem; }
.veh-pagehead-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* L2 scope control — a dropdown, deliberately NOT tabs. */
.veh-scope {
    appearance: none;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b92a8'%3E%3Cpath d='M2 4l4 4 4-4z'/%3E%3C/svg%3E") no-repeat right 14px center;
    color: var(--text); font: inherit; font-weight: 600; font-size: .92rem;
    border: 1px solid var(--border); border-radius: 999px;
    padding: 9px 36px 9px 16px; cursor: pointer;
}
.veh-scope:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #60a5fa33; }

.veh-subnav {
    display: flex; gap: 2px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.veh-seg {
    appearance: none; border: 0; background: transparent;
    color: var(--text-muted); font: inherit; font-size: .86rem; font-weight: 600;
    padding: 10px 16px; cursor: pointer; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 7px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}
.veh-seg:hover { color: var(--text); }
.veh-seg.active { color: var(--text); border-bottom-color: var(--accent); }
.veh-seg .veh-seg-ico { font-size: .95rem; }

.veh-section { display: none; flex-direction: column; gap: 18px; }
.veh-section.active { display: flex; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.veh-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--veh-shadow);
    overflow: hidden;
}
.veh-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--veh-grad);
    border-bottom: 1px solid var(--border);
}
.veh-card-head .veh-ico {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    font-size: 1.2rem;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.veh-card-head h3 { margin: 0; font-size: 1rem; }
.veh-card-head .veh-sub { margin: 2px 0 0; font-size: .8rem; color: var(--text-muted); }
.veh-card-body { padding: 20px; }

/* ── Capture panel (L0 action opens a deep-linkable flow — not a Vehicle facet) ────────────────────────────────────── */
.capture-panel {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.capture-panel.open { display: flex; }
.veh-modal {
    width: 100%; max-width: 460px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--veh-shadow); overflow: hidden;
}
.veh-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; background: var(--veh-grad); border-bottom: 1px solid var(--border);
}
.veh-modal-head h3 { margin: 0; font-size: 1rem; }
.veh-modal-close {
    appearance: none; border: 0; background: transparent; color: var(--text-muted);
    font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px;
}
.veh-modal-close:hover { color: var(--text); }
.veh-modal-body { padding: 20px; }

/* ── Vehicle summary stat strip ────────────────────────────────────────── */
.veh-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.veh-stat {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
}
.veh-stat .veh-stat-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.veh-stat .veh-stat-v { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.veh-stat .veh-stat-v small { font-size: .75rem; font-weight: 500; color: var(--text-muted); }

/* ── Status pills ──────────────────────────────────────────────────────── */
.veh-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700;
}
.veh-pill.ok       { background: #22c55e22; color: var(--accent); }
.veh-pill.soon     { background: #fbbf2422; color: var(--warning); }
.veh-pill.overdue  { background: #f8717122; color: var(--danger); }

/* ── Enhanced form ─────────────────────────────────────────────────────── */
.veh-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.veh-field { display: flex; flex-direction: column; gap: 6px; }
.veh-field.veh-col-2 { grid-column: 1 / -1; }
.veh-field label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.veh-field .veh-help { font-size: .72rem; color: var(--text-muted); }
.veh-input, .veh-select {
    appearance: none;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 13px; font: inherit; font-size: .92rem;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.veh-input:focus, .veh-select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px #60a5fa33;
}
.veh-input:disabled, .veh-select:disabled { opacity: .55; cursor: not-allowed; }
.veh-input-group { display: flex; gap: 8px; }
.veh-input-group .veh-input { flex: 1; }

.veh-btn {
    appearance: none; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text);
    font: inherit; font-weight: 600; font-size: .9rem;
    padding: 11px 18px; border-radius: var(--radius-sm); cursor: pointer;
    transition: transform .1s, filter .15s; white-space: nowrap;
}
.veh-btn:hover:not(:disabled) { transform: translateY(-1px); }
.veh-btn:disabled { opacity: .5; cursor: not-allowed; }
.veh-btn-primary {
    border: 0; color: #0f1117;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: 0 2px 10px -2px rgba(74,222,128,.5);
}
.veh-form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.veh-note { font-size: .8rem; color: var(--text-muted); }

/* ── Empty / placeholder states ────────────────────────────────────────── */
.veh-empty {
    text-align: center; padding: 36px 20px; color: var(--text-muted);
}
.veh-empty .veh-empty-ico { font-size: 2.2rem; opacity: .6; }
.veh-empty h4 { margin: 12px 0 4px; color: var(--text); font-size: 1rem; }
.veh-empty p { margin: 0; font-size: .86rem; }

/* ── Photo-first onboarding (capture cards + dismissible manual form) ───── */
.veh-onboard-lead { margin: 0 0 16px; color: var(--text-muted); font-size: .9rem; }
.veh-capture-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px;
}
.veh-capture-card {
    border: 1px dashed var(--border); border-radius: var(--radius-sm);
    background: var(--surface-2); padding: 22px 16px; text-align: center; cursor: pointer;
    transition: border-color .15s, transform .1s, background .15s;
}
.veh-capture-card:hover { border-color: var(--brand); transform: translateY(-2px); background: var(--surface); }
.veh-capture-card .veh-cap-emoji { font-size: 1.9rem; }
.veh-capture-card h4 { margin: 9px 0 3px; font-size: .92rem; }
.veh-capture-card p { margin: 0; font-size: .76rem; color: var(--text-muted); }
.veh-cap-tag { display: inline-block; margin-top: 8px; font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.veh-cap-tag.req { color: var(--accent); background: #22c55e1a; }
.veh-cap-tag.opt { color: var(--text-muted); background: var(--bg); }
.veh-onboard-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.veh-manual-toggle {
    background: none; border: 0; color: var(--text-muted); cursor: pointer;
    font: inherit; font-size: .84rem; text-decoration: underline; padding: 0;
}
.veh-manual-toggle:hover { color: var(--text); }
.veh-manual-form { display: none; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.veh-manual-form.open { display: block; }
.veh-fieldset-label {
    grid-column: 1 / -1; font-size: .76rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 -4px;
}

/* ── Maintenance schedule (configure + record) ─────────────────────────── */
.veh-sched-list { display: flex; flex-direction: column; }
.veh-sched-row {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 16px;
    padding: 14px 0; border-bottom: 1px solid var(--border); align-items: center;
}
.veh-sched-row:last-child { border-bottom: 0; }
.veh-sched-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.veh-sched-name { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.veh-sched-meta { font-size: .8rem; color: var(--text-muted); }
.veh-sched-meta b { color: var(--text); font-weight: 600; }
.veh-sched-actions { display: flex; align-items: center; gap: 8px; }
.veh-btn-sm { padding: 6px 12px; font-size: .82rem; }

/* inline interval editor — AI default, user refines; both limits, first wins */
.veh-interval-edit {
    grid-column: 1 / -1;
    display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
    margin-top: 10px; padding: 14px; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--border);
}
.veh-interval-edit .veh-field { gap: 4px; }
.veh-interval-edit .veh-input { width: 120px; }
.veh-interval-sep { color: var(--text-muted); font-size: .85rem; padding-bottom: 11px; }
.veh-ai-note { flex-basis: 100%; font-size: .74rem; color: var(--brand); margin: 2px 0 0; }

/* add-from-catalog gallery */
.veh-catalog { display: flex; flex-wrap: wrap; gap: 8px; }
.veh-add-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px; border: 1px dashed var(--border); border-radius: 999px;
    background: var(--surface-2); color: var(--text); cursor: pointer;
    font: inherit; font-size: .85rem; font-weight: 600;
    transition: border-color .15s, transform .1s;
}
.veh-add-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.veh-add-chip .veh-add-int { color: var(--text-muted); font-weight: 500; font-size: .76rem; }

/* ── Overview: fleet timeline (consumption view) ───────────────────────── */
.veh-overview { display: flex; flex-direction: column; gap: 20px; }
/* #1243: container the bucketed remembrance groups render into (next-first). */
.veh-overview-timeline { display: flex; flex-direction: column; gap: 20px; }
.veh-tl-group { display: flex; flex-direction: column; gap: 12px; }
.veh-tl-group-label {
    font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); margin-bottom: 2px;
}
.veh-timeline {
    position: relative; margin-left: 7px; padding-left: 26px;
    border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px;
}
.veh-tl-item { position: relative; }
.veh-tl-dot {
    position: absolute; left: -34px; top: 14px; width: 13px; height: 13px;
    border-radius: 50%; border: 3px solid var(--bg); background: var(--text-muted);
}
.veh-tl-dot.overdue { background: var(--danger); }
.veh-tl-dot.soon    { background: var(--warning); }
.veh-tl-dot.ok      { background: var(--accent); }
.veh-tl-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--veh-shadow); padding: 12px 14px;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.veh-tl-body { flex: 1; min-width: 150px; }
.veh-tl-title { font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.veh-tl-meta { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }
.veh-tl-when { font-size: .78rem; color: var(--text-muted); font-weight: 700; white-space: nowrap; }
.veh-badge {
    font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}

/* ── Capture hero (header) ─────────────────────────────────────────────── */
.veh-capture-hero {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 9px 18px; border: 0; border-radius: 999px; cursor: pointer;
    font: inherit; font-weight: 700; font-size: .9rem; color: #0f1117;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: 0 4px 14px -3px rgba(74,222,128,.55);
    transition: transform .1s, filter .15s;
}
.veh-capture-hero:hover { transform: translateY(-1px); filter: brightness(1.05); }
.veh-capture-hero .veh-cap-ico { font-size: 1.1rem; }
.veh-capture-hero[aria-disabled="true"] {
    background: var(--surface-2); color: var(--text-muted);
    box-shadow: none; cursor: not-allowed;
    border: 1px dashed var(--border);
}

@media (max-width: 640px) {
    .veh-form { grid-template-columns: 1fr; }
    .veh-capture-hero .veh-cap-label { display: none; }
}

/* ── Photo-first onboarding wiring (#1240) ──────────────────────────────── */
/* Capture cards become file pickers; surface a per-card read state. */
.veh-capture-card { position: relative; cursor: pointer; }
.veh-cap-state { display: block; margin-top: 6px; font-size: .78rem; min-height: 1em; color: var(--muted, #8b92a8); }
.veh-cap-state.busy { color: #f59e0b; }
.veh-cap-state.ok   { color: #4ade80; }
.veh-cap-state.warn { color: #f87171; }

/* "from your photo" provenance tag on a pre-filled field (§7.7). */
.veh-from-photo {
    font-size: .68rem; font-weight: 600; color: #60a5fa;
    background: #60a5fa1a; border-radius: 999px; padding: 1px 7px; margin-left: 6px;
    vertical-align: middle; white-space: nowrap;
}

/* A field flagged for user confirmation (e.g. a VIN that failed its check digit). */
.veh-input-flag { border-color: #f59e0b !important; box-shadow: 0 0 0 2px #f59e0b33; }
.veh-help.veh-warn { color: #f59e0b; }
.veh-note.veh-warn { color: #f87171; }
.veh-note.veh-ok   { color: #4ade80; }

.veh-review-banner { margin-bottom: 12px; font-size: .85rem; color: var(--muted, #8b92a8); }

/* Capture-first service logging (#1244): the receipt-snap hero sits above the
   editable review form; the manual note de-emphasises typed entry as a fallback. */
.veh-cap-hero { text-align: center; padding: 4px 0 18px; border-bottom: 1px solid var(--border, #2a2f3e); margin-bottom: 18px; }
.veh-cap-pick { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.veh-cap-hero .veh-cap-state { margin-top: 10px; }
.veh-svc-manual { grid-column: 1 / -1; margin: 6px 0 0; font-size: .78rem; color: var(--text-muted, #8b92a8); }

/* ── Records facet (#1266) — service log, docs thumbs, condition slot ───── */
.veh-receipt { max-width: 72px; max-height: 54px; border: 1px solid var(--border); border-radius: 3px; object-fit: cover; background: #fff; vertical-align: middle; }
.veh-docs { display: flex; gap: 16px; flex-wrap: wrap; }
.veh-doc-label { font-size: .72rem; color: var(--text-muted); margin-bottom: 4px; }
.veh-doc-thumb { max-width: 132px; max-height: 96px; border: 1px solid var(--border); border-radius: 4px; object-fit: contain; background: #fff; display: block; }
.veh-timeline.veh-log .veh-tl-card { align-items: flex-start; }
.veh-tl-meta { font-size: .78rem; color: var(--text-muted); }
