:root {
  color-scheme: light;
  --page: #f1f4f1;
  --white: #fff;
  --ink: #192b26;
  --muted: #536762;
  --line: #dbe4df;
  --rule: #e9eeeb;
  --sidebar: #132924;
  --sidebar-soft: #27433b;
  --sidebar-text: #c5d6cd;
  --mint: #c5f0b4;
  --green: #215c47;
  --green-hover: #174632;
  --green-soft: #e8f4ed;
  --amber: #735211;
  --amber-soft: #fcf0d6;
  --red: #9c3c28;
  --red-soft: #fbece6;
  --neutral: #edf1ef;
  --model: #e8f0eb;
  --model-grid: #74908729;
  --shadow: 0 12px 36px #203b2c0b;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body[data-server]:not([data-authorized]) .nav,
body[data-server]:not([data-authorized]) .main > section { display: none; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
ul { list-style: none; padding: 0; margin: 0; }
svg { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.app { display: grid; grid-template-columns: 204px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); min-width: 0; min-height: 100vh; position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 43px; padding: 27px 16px 23px; }
.brand { display: flex; align-items: center; gap: 11px; padding-inline: 5px; }
.brand-icon { background: var(--mint); width: 37px; height: 37px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.brand-icon::before { content: ""; display: block; width: 10px; height: 16px; border-inline: 2px solid var(--sidebar); transform: skewX(-19deg); }
.brand strong, .brand div > span { display: block; }
.brand strong { color: var(--white); font-size: 16px; font-weight: 780; letter-spacing: .055em; line-height: 1.15; }
.brand div > span { margin-top: 3px; font-size: 12px; }
.nav { display: grid; gap: 5px; }
.nav button { width: 100%; display: flex; align-items: center; gap: 9px; min-height: 45px; padding: 7px 9px; border: 0; border-radius: 10px; text-align: left; font-size: 13px; font-weight: 680; background: transparent; color: inherit; }
.nav button:hover, .nav button[aria-current="page"] { background: var(--sidebar-soft); color: var(--white); }
.nav button[aria-current="page"] svg { color: var(--mint); }
.nav button:focus-visible { outline-color: var(--mint); }
.nav-count { margin-left: auto; font-size: 11px; padding: 1px 5px; border-radius: 5px; background: var(--sidebar-soft); color: var(--mint); }
.sidebar-source { display: flex; gap: 9px; margin-top: auto; padding: 15px 5px 0; border-top: 1px solid var(--sidebar-soft); font-size: 12px; font-weight: 650; }
.sidebar-source div > span { display: block; opacity: .82; margin-top: 2px; font-size: 11px; font-weight: 500; }
.source-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--mint); }

.main { width: min(100%, 1480px); padding: 30px clamp(18px, 2.7vw, 42px) 40px; margin-inline: auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; column-gap: 20px; row-gap: 12px; margin-bottom: 22px; }
.page-header h1 { font-size: clamp(32px, 4vw, 52px); font-weight: 770; line-height: 1.06; letter-spacing: -.052em; }
.page-header p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
[tabindex="-1"]:focus { outline: none; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; white-space: normal; font-weight: 690; font-size: 13px; line-height: 1.25; }
.primary { background: var(--green); color: var(--white); }
.primary:hover { background: var(--green-hover); }
.secondary, .icon-button { background: var(--white); border-color: var(--line); }
.secondary:hover, .icon-button:hover { background: var(--page); }
.text-button { background: transparent; color: var(--green); border: 0; border-radius: 6px; min-height: 36px; padding: 5px 2px; text-align: left; font-weight: 680; font-size: 13px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-button { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 8px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 19px; }
.metric { display: grid; align-content: center; gap: 3px; text-align: left; padding: 12px 15px; min-height: 86px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); }
button.metric:hover { border-color: var(--green); }
.metric span { color: var(--muted); font-size: 12px; font-weight: 630; }
.metric strong { font-size: 31px; font-weight: 760; line-height: 1.05; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-red strong { color: var(--red); }
.metric-amber strong { color: var(--amber); }

.workspace { display: grid; grid-template-columns: minmax(200px, 246px) minmax(0, 1fr); align-items: start; gap: 16px; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.roster { overflow: hidden; }
.roster-head { padding: 15px 13px 11px; border-bottom: 1px solid var(--rule); }
.roster-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.roster-title h2 { font-size: 17px; font-weight: 750; }
.roster-title span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.search { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding-inline: 8px; background: var(--page); color: var(--muted); }
.search svg { width: 16px; height: 16px; }
.search input { width: 100%; min-width: 0; min-height: 38px; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 13px; }
.search:focus-within { outline: 2px solid var(--green); outline-offset: 1px; }
.roster-head > select { font-size: 13px; width: 100%; min-width: 0; margin-top: 7px; min-height: 36px; padding: 4px 6px; }
.vehicle-list { max-height: 566px; overflow-y: auto; scrollbar-color: var(--line) transparent; padding: 4px 6px; }
.vehicle-list button { width: 100%; min-height: 58px; display: grid; grid-template-columns: 46px minmax(0, 1fr) 7px; gap: 7px; align-items: center; text-align: left; padding: 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; }
.vehicle-list button:hover { background: var(--page); }
.vehicle-list button[aria-current="true"] { background: var(--green-soft); border-color: var(--line); }
.vehicle-list button:focus-visible { outline-offset: -2px; }
.vehicle-list strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.vehicle-list small { color: var(--muted); font-size: 11px; }
.roster-thumbnail { display: grid; place-items: center; width: 46px; height: 36px; overflow: hidden; border-radius: 6px; background: var(--model); color: var(--muted); }
.roster-thumbnail > * { grid-area: 1 / 1; }
.roster-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; visibility: hidden; }
.roster-thumbnail img.loaded { visibility: visible; }
.vehicle-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.vehicle-dot.urgent { background: var(--red); }
.vehicle-dot.soon { background: var(--amber); }
.empty { color: var(--muted); font-size: 14px; padding-block: 13px; }
.roster-empty { padding-inline: 13px; }

.vehicle { overflow: hidden; }
.vehicle-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; padding: 16px 20px 10px; }
.vehicle-head h2 { font-size: clamp(22px, 3vw, 34px); font-weight: 780; line-height: 1.12; letter-spacing: -.039em; overflow-wrap: anywhere; }
.vehicle-overline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 640; }
.plate { background: var(--neutral); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); letter-spacing: .055em; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 20px; padding: 4px 8px; color: var(--muted); background: var(--neutral); font-size: 11px; font-weight: 720; line-height: 1.25; white-space: nowrap; }
.badge.good { color: var(--green); background: var(--green-soft); }
.badge.soon { color: var(--amber); background: var(--amber-soft); }
.badge.urgent { color: var(--red); background: var(--red-soft); }
.vehicle-tabs { display: flex; gap: clamp(8px, 2.1vw, 18px); margin-inline: 20px; flex-wrap: wrap; }
.vehicle-tabs button { border: 0; border-bottom: 2px solid transparent; padding: 9px 2px; min-height: 41px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 680; }
.vehicle-tabs button[aria-current="page"] { border-color: var(--green); color: var(--green); }

.model-area { background: radial-gradient(ellipse at 48% 22%, var(--white), var(--model) 79%); border-block: 1px solid var(--line); }
.model-controls, .model-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 10px; padding: 8px 15px; color: var(--muted); font-size: 12px; font-weight: 640; }
.model-views { display: flex; flex-wrap: wrap; gap: 5px; }
.model-views button, .component-tabs button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); min-height: 33px; padding: 4px 7px; font-size: 12px; font-weight: 650; }
.model-views button:hover, .component-tabs button:hover { background: var(--white); }
.model-views button[aria-pressed="true"], .component-tabs button[aria-pressed="true"] { color: var(--green); border-color: var(--line); background: var(--white); }
.model-views svg { width: 16px; height: 16px; }
.mesh-figure { margin: 0; }
.mesh-stage { position: relative; height: clamp(280px, 33vw, 470px); overflow: hidden; background: #e3ede8; isolation: isolate; }
.mesh-preview { position: absolute; inset: 0; display: grid; place-items: center; background: #e0e7e3; }
.mesh-preview img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.mesh-preview span { position: absolute; inset: auto auto 12px 12px; padding: 4px 8px; border-radius: 6px; color: var(--ink); background: #ffffffef; font-size: 12px; font-weight: 650; }
.mesh-caption { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 13px; padding: 8px 14px; background: #e2ece6; border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; }
.mesh-caption span { color: var(--muted); font-size: 11px; }
.mesh-caption a { color: var(--green); text-underline-offset: 2px; }
.photo-stage { display: grid; position: relative; margin: 0; min-width: 0; min-height: 220px; background: radial-gradient(ellipse at 45% 18%, #3e5650, #132924 75%); color: var(--white); }
.photo-stage img { width: 100%; height: clamp(220px, 27vw, 365px); min-width: 0; object-fit: contain; }
.photo-media { position: relative; }
.photo-media img { display: block; }
.photo-stage img:not([src]) { visibility: hidden; }
.photo-stage figcaption { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 3px 16px; padding: 9px 14px; color: #f1f6f3; background: #132924; font-size: 12px; }
.photo-credit { color: #c5d6cd; font-size: 11px; }
.photo-credit a { color: inherit; text-underline-offset: 2px; }
.photo-credit a:focus-visible { outline-color: var(--mint); }
.model-stage { position: relative; min-width: 0; min-height: 210px; height: clamp(220px, 23vw, 320px); overflow: hidden; isolation: isolate; }
.model-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y pinch-zoom; }
.model-stage canvas:active { cursor: grabbing; }
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot { position: absolute; display: grid; place-items: center; transform: translate(-50%, -50%); width: 37px; height: 37px; padding: 0; border: 0; background: transparent; color: var(--muted); pointer-events: auto; }
.hotspot::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--white); background: currentColor; box-shadow: 0 0 0 1px currentColor, 0 2px 5px #13312b4d; }
.hotspot[aria-pressed="true"]::before { width: 19px; height: 19px; box-shadow: 0 0 0 3px #1c5b4760, 0 2px 5px #13312b4d; }
.hotspot.soon { color: var(--amber); }
.hotspot.urgent { color: var(--red); }
.model-footer { border-top: 1px solid var(--model-grid); }
.component-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.component-tabs button.soon::after, .component-tabs button.urgent::after { content: ""; margin-left: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.component-tabs button.urgent::after { background: var(--red); }
.inspection { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 12px 17px; border-bottom: 1px solid var(--rule); }
.inspection h3, .block-heading h3 { font-size: 15px; font-weight: 750; }
.inspection p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.inspection-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; }
.vehicle-bottom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.info-block { padding: 10px 16px 15px; min-width: 0; }
.info-block + .info-block { border-left: 1px solid var(--rule); }
.block-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; min-height: 36px; }
.facts { display: grid; gap: 0; }
.facts > div, .due-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px; padding-block: 7px; border-top: 1px solid var(--rule); }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { font-size: 12px; font-weight: 670; text-align: right; overflow-wrap: anywhere; max-width: 19ch; }
.facts dd small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.due-list strong, .due-list small { display: block; overflow-wrap: anywhere; }
.due-list strong { font-weight: 690; font-size: 12px; }
.due-list small { color: var(--muted); font-size: 11px; }
.history { padding: 13px 19px 21px; border-top: 1px solid var(--rule); }
.history-filter { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; color: var(--muted); font-size: 13px; padding-block: 5px 11px; }
.history-summary { color: var(--muted); padding: 8px 0; font-size: 13px; }
.facts a { color: var(--green); text-underline-offset: 2px; }
.history-filter select { min-height: 36px; padding: 4px 6px; max-width: 100%; }
.history-list li { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 12px; padding-block: 12px; border-bottom: 1px solid var(--rule); }
.history-list time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.history-list strong { display: block; font-size: 14px; }
.history-list p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }

.alerts-panel { max-width: 920px; padding: 17px; }
.alert-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 13px; }
.alert-filters button { min-height: 39px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 13px; font-weight: 680; }
.alert-filters button[aria-pressed="true"] { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.alert-list li { border-top: 1px solid var(--rule); }
.alert-list button { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 9px; text-align: left; padding: 8px 3px; border: 0; border-radius: 6px; background: transparent; }
.alert-list button:hover { background: var(--page); }
.alert-list strong, .alert-list small { display: block; }
#procurement-counts .metric:last-child strong { font-size: clamp(16px, 2vw, 25px); overflow-wrap: anywhere; }
.alert-views { margin-bottom: 12px; }
.calendar-day h3 { color: var(--green); font-size: 13px; padding: 9px 0 3px; }
.calendar-day + .calendar-day { margin-top: 8px; }
.calendar-day .alert-list { margin-top: 0; }
.alert-list strong { font-size: 14px; }
.alert-list small, .alert-footnote { color: var(--muted); font-size: 12px; }
.alert-footnote { margin-top: 14px; }

.widget-layout { display: grid; grid-template-columns: minmax(0, 478px) minmax(0, 370px); align-items: start; gap: 17px; }
.chat { border: 1px solid var(--line); background: var(--white); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.chat-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; }
.chat-head span:not(.chat-avatar) { display: block; color: var(--muted); font-size: 12px; }
.chat-avatar { display: grid; place-items: center; border-radius: 50%; width: 36px; height: 36px; background: var(--green); color: var(--white); }
.chat-body { padding: 18px; background-color: var(--model); background-image: radial-gradient(var(--model-grid) 1px, transparent 1px); background-size: 11px 11px; }
.chat iframe { display: block; border: 0; border-radius: 13px 13px 13px 3px; width: 100%; height: 312px; background: var(--white); }
.widget-context { padding: 17px; }
.widget-context h2 { font-size: 17px; }
.widget-context p { color: var(--muted); font-size: 14px; margin-top: 9px; }
.widget-context a { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 690; margin-top: 11px; color: var(--green); }
.widget-context a svg { width: 15px; }
.access-message { padding: 14px; }

dialog { position: fixed; padding: 0; width: min(calc(100% - 28px), 548px); max-height: calc(100% - 24px); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 74px #1830254d; }
dialog::backdrop { background: #14292188; }
dialog form { padding: 18px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 13px; }
.dialog-head h2 { font-size: 24px; letter-spacing: -.025em; }
.dialog-head p { color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; border: 0; margin: 0 0 11px; padding: 0; min-width: 0; }
.form-grid label, .notes-label { display: grid; align-content: start; gap: 3px; min-width: 0; font-size: 13px; font-weight: 680; }
.form-grid .full { grid-column: 1 / -1; }
#checklist-parts { margin: 0; }
input, select, textarea { border: 1px solid var(--line); border-radius: 7px; min-width: 0; background: var(--white); color: var(--ink); }
.form-grid input, .form-grid select, .notes-label textarea { min-height: 41px; padding: 6px 8px; width: 100%; font-size: 16px; }
.notes-label textarea { resize: vertical; }
.form-error { margin-top: 9px; color: var(--red); font-size: 13px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.toast { position: fixed; bottom: 16px; right: 16px; max-width: calc(100% - 32px); padding: 10px 13px; border-radius: 9px; background: var(--sidebar); color: var(--white); box-shadow: var(--shadow); font-size: 14px; z-index: 3; }

@media (max-width: 1040px) {
  .app { grid-template-columns: 176px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
  .workspace { grid-template-columns: minmax(170px, 207px) minmax(0, 1fr); }
  .model-footer { justify-content: flex-start; }
  .vehicle-bottom { grid-template-columns: 1fr; }
  .info-block + .info-block { border-left: 0; border-top: 1px solid var(--rule); }
}

@media (max-width: 795px) {
  .app { display: block; }
  .sidebar { position: static; min-height: auto; padding: 11px 17px; gap: 10px; }
  .nav { display: flex; gap: 5px; }
  .nav button { flex: 1; min-width: 0; justify-content: center; }
  .nav-count { margin-left: 0; }
  .sidebar-source { display: none; }
  .main { padding-top: 21px; }
  .vehicle-bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-block + .info-block { border-top: 0; border-left: 1px solid var(--rule); }
}

@media (max-width: 635px) {
  .main { padding-inline: 13px; }
  .page-header { align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 12px; }
  .metric { min-height: 67px; padding: 8px 10px; }
  .metric strong { font-size: 27px; }
  .workspace, .widget-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .vehicle-list { max-height: 172px; }
  .vehicle-head { flex-wrap: wrap; padding-inline: 13px; }
  .vehicle-tabs { margin-inline: 13px; }
  .model-stage { height: 240px; }
  .mesh-stage { height: 285px; }
  .model-views button, .component-tabs button { min-height: 38px; }
  .inspection { flex-wrap: wrap; padding-inline: 13px; }
  .inspection-actions { justify-content: flex-start; }
  .vehicle-bottom { grid-template-columns: 1fr; }
  .info-block + .info-block { border-left: 0; border-top: 1px solid var(--rule); }
}

@media (max-width: 410px) {
  .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav button { padding-inline: 6px; gap: 5px; font-size: 12px; min-height: 39px; }
  .nav button svg { width: 15px; height: 15px; }
  .nav-count { font-size: 10px; padding-inline: 3px; }
  .model-stage { height: 212px; }
  .mesh-stage { height: 250px; }
  .photo-stage img { height: 200px; }
  .photo-stage { min-height: 200px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-body { padding: 11px; }
  .history-list li { grid-template-columns: 1fr; gap: 2px; }
}
