/* Selected vehicle: return bar, shared identity header, record tabs, Overview sections. */
.record-bar { display: flex; align-items: center; gap: 12px; min-height: 36px; margin-bottom: 10px; }
.back-btn { height: 32px; padding: 0 12px 0 8px; border-color: var(--border-strong); }
.back-btn .i { font-size: 17px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.crumbs .i { font-size: 12px; }
.crumbs b { color: var(--text); font-weight: 600; }
.record-pager { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.record-pager .icon-btn { width: 30px; height: 30px; border-color: var(--border); background: var(--surface); }
.record-pager .icon-btn[disabled] { opacity: .45; cursor: default; }

/* Identity header */
.identity {
  display: grid; grid-template-columns: minmax(200px, auto) minmax(0, 1fr) minmax(300px, 380px); align-items: stretch;
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.id-main { padding: 16px 20px 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.id-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--text-2); text-transform: uppercase; }
.id-code-row { display: flex; align-items: center; gap: 10px; }
.id-code { font-size: var(--fs-entity); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.id-owner { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.id-facts { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: start; align-content: center; gap: 4px 36px; padding: 16px 20px; border-left: 1px solid var(--border); }
.id-facts dt { font-size: 12px; font-weight: 600; color: var(--text-2); }
.id-facts dd { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.op-status {
  --tone: var(--success); --tone-bg: var(--success-bg); --tone-text: var(--success-text);
  position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-content: center;
  padding: 14px 18px 14px 20px; border-left: 1px solid var(--border); border-radius: 0 8px 0 0;
  background: color-mix(in srgb, var(--tone-bg) 70%, #fff);
}
.op-status::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 4px; border-radius: 0 3px 3px 0; background: var(--tone); }
.op-status.danger { --tone: var(--danger); --tone-bg: var(--danger-bg); --tone-text: var(--danger-text); }
.op-status.review { --tone: var(--review); --tone-bg: var(--review-bg); --tone-text: var(--review-text); }
.op-status.neutral { --tone: var(--neutral-line); --tone-bg: var(--neutral-bg); --tone-text: var(--text-2); }
.op-icon { grid-row: 1 / 4; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--tone); box-shadow: inset 0 0 0 1.5px var(--tone); }
.op-icon .i { font-size: 22px; stroke-width: 2; }
.op-caption { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.op-label { font-size: 21px; font-weight: 700; line-height: 1.15; color: var(--tone-text); }
.op-reason { font-size: 13px; color: var(--text); margin-top: 3px; }
.op-actions { grid-column: 2; display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Record tabs (entity subnavigation, distinct from visited tabs) */
.record-tabs {
  display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--r-panel) var(--r-panel); box-shadow: var(--shadow-panel);
  margin-bottom: 16px;
}
.record-tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; flex: none;
  font-size: 14px; font-weight: 600; color: var(--text-2); text-decoration: none; border-radius: 6px 6px 0 0;
}
.record-tab .i { font-size: 17px; }
.record-tab:hover { color: var(--text); background: var(--surface-sunken); }
.record-tab[aria-selected="true"] { color: #12686c; background: #eaf4f5; font-weight: 700; }
.record-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: #0f7f86; }
.record-tab .label-w::after { content: attr(data-text); display: block; height: 0; overflow: hidden; visibility: hidden; font-weight: 700; }

/* Overview layout */
.overview { display: grid; gap: 16px; }

/* Observation band: odometer + current faults */
.obs-band { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); }
.obs { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; padding: 14px 18px; align-items: start; }
.obs + .obs { border-left: 1px solid var(--border); }
.obs .icon-tile { width: 42px; height: 42px; border-radius: 50%; grid-row: 1 / 4; }
.obs .icon-tile .i { font-size: 21px; }
.obs-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.src-mark { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 4px; background: var(--dom-tele-bg); color: var(--dom-tele); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.src-mark .i { font-size: 11px; stroke-width: 2.4; }
.obs-value { font-size: var(--fs-value); font-weight: 700; line-height: 1.15; letter-spacing: -.015em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.obs-value .unit { font-size: 15px; font-weight: 600; color: var(--text-2); margin-left: 3px; letter-spacing: 0; }
.obs-value.is-muted { font-size: 18px; color: var(--text-2); font-weight: 600; }
.obs-value.danger { color: var(--danger-text); }
.obs-sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.fault-row { display: flex; align-items: flex-start; gap: 14px; }
.fault-list { flex: 1; min-width: 0; display: grid; gap: 4px; margin-top: 4px; }
.fault-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.fault-list .f-code { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fault-list .f-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.fault-sev { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.fault-sev.critical { background: var(--danger); }
.fault-sev.warning { background: var(--warning); }
.obs-actions { display: flex; justify-content: flex-end; align-items: flex-end; grid-column: 2; margin-top: 6px; }

/* Key dates */
.dates-head { margin-bottom: 10px; }
.due-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.due-card {
  --tone: transparent;
  position: relative; display: grid; grid-template-rows: auto auto auto auto 1fr auto; min-height: 196px; padding: 13px 14px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); box-shadow: var(--shadow-panel);
}
.due-card::before { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 3px; border-radius: 8px 8px 0 0; background: var(--tone); }
.due-card.overdue { --tone: var(--danger); border-color: var(--danger-line); }
.due-card.urgent { --tone: var(--warning); border-color: var(--warning-line); }
.due-top { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.due-top .icon-tile { width: 28px; height: 28px; border-radius: 7px; }
.due-top .icon-tile .i { font-size: 16px; }
.due-top h3 { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-top .badge { margin-left: auto; }
.due-kind { margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.due-big { font-size: 25px; font-weight: 700; line-height: 1.15; letter-spacing: -.015em; font-variant-numeric: tabular-nums; margin-top: 1px; }
.due-big.overdue { color: var(--danger-text); }
.due-big.urgent { color: var(--warning-text); }
.due-big.muted { font-size: 19px; color: var(--text-2); font-weight: 600; padding: 3px 0 2px; }
.due-rel { font-size: 13px; font-weight: 600; margin-top: 2px; color: var(--text); }
.due-rel.overdue { color: var(--danger-text); }
.due-rel.urgent { color: var(--warning-text); }
.due-rel.muted { color: var(--text-2); font-weight: 500; }
.due-last { align-self: start; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.due-foot { display: flex; align-items: center; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--border); }

/* Full-width work sections */
.work-sec { padding: 14px 16px 6px; }
.work-sec.maint { box-shadow: var(--shadow-panel), inset 4px 0 0 var(--dom-maint); }
.work-sec.lease { box-shadow: var(--shadow-panel), inset 4px 0 0 var(--dom-lease); }
.work-sec .sec-head { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.counts { display: flex; gap: 6px; }
.count-pill { display: inline-flex; align-items: baseline; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--surface-sunken); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); line-height: 22px; white-space: nowrap; }
.count-pill b { font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }

.work-list > li {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 220px auto; gap: 16px; align-items: center;
  padding: 12px 2px; border-bottom: 1px solid var(--border);
}
.work-list > li:last-child { border-bottom: 0; }
.wi-ref { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wi-ref .ref { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.wi-symptom { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wi-progress { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
.wi-progress .steps { width: 160px; flex: none; }
.wi-stage { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.wi-stage b { color: var(--text); font-weight: 600; }
.wi-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.wi-meta dt { color: var(--text-2); }
.wi-meta dd { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wi-meta dd.overdue { color: var(--danger-text); }
.wi-meta dd.urgent { color: var(--warning-text); }
.more-line { padding: 10px 2px 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 10px; }

/* Lease & Return */
.lease-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0; }
.lease-body > * { padding: 14px 4px 12px; }
.lease-body > * + * { border-left: 1px solid var(--border); padding-left: 20px; }
.lease-dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: relative; padding-right: 16px; }
.ld { position: relative; padding-top: 22px; }
.ld::before { content: ""; position: absolute; top: 7px; left: 14px; right: -2px; height: 2px; background: #e2d2c6; }
.ld:last-child::before { display: none; }
.ld-node { position: absolute; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #d4b29c; }
.ld.is-set .ld-node { border-color: var(--dom-lease); }
.ld.is-done .ld-node { background: var(--dom-lease); border-color: var(--dom-lease); }
.ld.is-urgent .ld-node { border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.ld.is-overdue .ld-node { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.ld.is-empty .ld-node { border-style: dashed; border-color: #b9a597; }
.ld-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ld-date { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 1px; }
.ld-date.muted { color: var(--text-3); font-weight: 600; font-size: 15px; }
.ld-sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.ld-sub.urgent { color: var(--warning-text); font-weight: 600; }
.ld-sub.overdue { color: var(--danger-text); font-weight: 600; }
.lease-sub-title { font-size: 12.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.return-task .steps { --step-color: var(--dom-lease); margin: 6px 0 4px; }
.step-names { display: grid; gap: 4px; font-size: 11.5px; color: var(--text-2); }
.step-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-names .is-current { color: var(--dom-lease); font-weight: 700; }
.step-names .is-done { color: var(--text); }
.rt-next { margin-top: 10px; font-size: 14px; font-weight: 600; }
.rt-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.rt-meta b { color: var(--text); font-weight: 600; }
.rt-meta .urgent { color: var(--warning-text); font-weight: 700; }
.usage { display: grid; gap: 12px; }
.usage-row .usage-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 12.5px; color: var(--text-2); }
.usage-row .usage-top b { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.usage-note { font-size: 12.5px; color: var(--text-2); }
.lease-foot { display: flex; align-items: center; gap: 10px; padding: 10px 0 8px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }

/* Renderer glue */
.crumbs a { color: var(--accent); font-weight: 600; text-decoration: none; border-radius: 4px; padding: 1px 3px; margin: -1px -3px; }
.crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.record-pager a.icon-btn { text-decoration: none; }
.id-remark { margin-top: 6px; }
.id-remark .remark-btn { max-width: 300px; }
.danger-text { color: var(--danger-text); font-weight: 700; }
.work-list > li:focus { outline: none; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--focus); background: var(--row-hover); }
.sec-head h2:focus { outline: none; }
.sec-head h2:focus-visible { box-shadow: var(--focus-ring); border-radius: 3px; }
#page-title:focus { outline: none; }

/* Boundary panel for record tabs outside this preview */
.tab-boundary { padding: 28px; display: grid; justify-items: start; gap: 8px; }
.tab-boundary h2 { font-size: 17px; }
.tab-boundary p { color: var(--text-2); max-width: 560px; }

/* Responsive */
@media (max-width: 1280px) {
  .identity { grid-template-columns: minmax(180px, auto) minmax(0, 1fr); }
  .op-status { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); border-radius: 0; }
  .due-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-list > li { grid-template-columns: 130px minmax(0, 1fr) auto; }
  .work-list .wi-meta { grid-column: 2; }
}
@media (max-width: 900px) {
  .obs-band, .lease-body { grid-template-columns: 1fr; }
  .obs + .obs, .lease-body > * + * { border-left: 0; border-top: 1px solid var(--border); padding-left: 4px; }
  .due-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .identity { grid-template-columns: 1fr; }
  .id-facts { border-left: 0; border-top: 1px solid var(--border); gap: 4px 20px; }
  .work-list > li { grid-template-columns: 1fr; gap: 8px; }
  .work-list .wi-meta { grid-column: auto; }
  .record-pager span { display: none; }
}

/* Tablet: the vehicle frame and its actions stay inside the viewport */
.overview > *, .tab-stack > *, .obs-band > *, .work-sec > * { min-width: 0; }
@media (max-width: 1100px) {
  .record-tabs { flex-wrap: wrap; overflow: visible; padding: 0 6px; }
  .record-tab { padding: 0 10px; min-height: 38px; }
  .rh-actions, .record-bar { flex-wrap: wrap; }
}
