@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap");

:root {
  --vi-primary-bg: #4a3eea;
  --vi-primary-action: #4a3eea;
  --vi-text: #000000;
  --vi-text-inverse: #ffffff;
  --vi-surface: #ffffff;
  --vi-border: #e6e7eb;
  --vi-muted: #5b6270;
  --vi-surface-soft: #f6f7fb;

  --vi-ink: var(--vi-text, #000000);
  --vi-bg: var(--vi-surface, #ffffff);
  --vi-card: #ffffff;
  --vi-accent: var(--vi-primary-action, #4a3eea);
  --vi-accent-soft: #edeafe;
  --vi-shadow: 0 10px 24px rgba(10, 10, 58, 0.08);
  --vi-radius: 16px;
  --vi-radius-sm: 6px;
  --vi-radius-md: 8px;
  --vi-radius-lg: 10px;
  --vi-radius-xl: 12px;
  --vi-radius-2xl: 14px;
  --vi-space-1: 2px;
  --vi-space-2: 4px;
  --vi-space-3: 6px;
  --vi-space-4: 8px;
  --vi-space-5: 10px;
  --vi-space-6: 12px;
  --vi-space-7: 14px;
  --vi-space-8: 16px;
  --vi-space-9: 18px;
  --vi-space-10: 20px;
  --vi-space-12: 24px;
  --vi-sidebar-offset: 16px;
  --vi-success: #17603a;
  --vi-error: #b42318;
}

/* Scope Rubik to portal containers only — prevents leaking into Frappe native modals/dialogs.
   .vi-dashboard covers all 5 portal page bodies (Dashboard/Admin/Inspections/Inspection/Registry)
   so every page gets the same typography, not just the two that happened to have an #id rule. */
.vi-dashboard,
.web-sidebar,
.sidebar-column {
  font-family: "Rubik", "Segoe UI", sans-serif;
  color: var(--vi-ink);
}

body {
  background: var(--vi-surface);
}

.sidebar-column {
  position: relative;
  background: transparent;
  padding: var(--vi-space-8) var(--vi-space-8) var(--vi-space-12);
  min-height: 100vh;
  border-radius: 0;
  overflow: visible;
  flex: 0 0 240px;
  max-width: 240px;
}

.web-sidebar {
  background: #ffffff;
  color: var(--vi-text);
  border-radius: var(--vi-radius-2xl);
  padding: var(--vi-space-9) var(--vi-space-8);
  box-shadow: 0 12px 28px rgba(10, 10, 58, 0.08);
  border: 1px solid #e1e4ea;
  margin-top: var(--vi-sidebar-offset);
}

.web-sidebar a {
  color: var(--vi-text);
  text-decoration: none;
}

.web-sidebar .sidebar-item {
  margin-bottom: var(--vi-space-3);
}

.web-sidebar .sidebar-item a {
  display: block;
  padding: var(--vi-space-6);
  border-radius: var(--vi-radius-lg);
  transition: background-color 0.15s ease;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  font-size: 16px;
  line-height: 1.3;
}

.web-sidebar .sidebar-item a:hover {
  background: rgba(74, 62, 234, 0.08);
  border-color: rgba(74, 62, 234, 0.2);
}

.web-sidebar .sidebar-item a.active {
  background: rgba(74, 62, 234, 0.16);
  font-weight: 600;
  border-color: rgba(74, 62, 234, 0.45);
  color: #2f24c7;
}

.web-sidebar .title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--vi-space-6);
}

@media (max-width: 768px) {
  .sidebar-column {
    flex: 0 0 220px;
    max-width: 220px;
    padding-top: var(--vi-space-12);
  }

  .web-sidebar {
    margin-top: var(--vi-space-8);
  }
}

@media (min-width: 992px) {
  .sidebar-column + .main-column {
    flex: 1 1 auto;
    max-width: calc(100% - 240px);
    min-width: 0;
  }
}


.vi-dashboard * {
  box-sizing: border-box;
}

.vi-dashboard {
  display: grid;
  gap: var(--vi-space-12);
  max-width: 980px;
  margin: var(--vi-space-12) auto;
  padding: 0 var(--vi-space-8);
}

.vi-page-header {
  display: block;
}

.vi-lang-toggle {
  display: inline-flex;
  border: 1.5px solid #d0d5dd;
  border-radius: 999px;
  overflow: hidden;
  background: var(--vi-surface);
  flex-shrink: 0;
}

.vi-lang-toggle button {
  border: none;
  background: transparent;
  padding: var(--vi-space-3) var(--vi-space-7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #6b7280;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.vi-lang-toggle button.active {
  background: var(--vi-accent);
  color: #fff;
  cursor: default;
}

.vi-lang-toggle button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.vi-navbar-lang-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: var(--vi-surface);
  padding: var(--vi-space-2) var(--vi-space-8);
}

/* Frappe's own website/navbar.scss has ".navbar-light .navbar-toggler .icon { stroke: none; }",
   which sets stroke as a literal value (not through --icon-stroke), so defining the CSS
   variable alone does nothing — it must be overridden at equal-or-higher specificity. */
.navbar-light .navbar-toggler .icon {
  stroke: var(--vi-muted) !important;
}

/* sidebar_items (our own routes) get rendered natively as .nav-link inside the mobile
   collapse — give them the same typography/color as the desktop sidebar (smaller size)
   instead of Frappe's default navbar link style. Matched to the same selector depth as
   Bootstrap's own ".navbar-light .navbar-nav .nav-link" (3 classes) so normal cascade
   order would be enough, but !important keeps it deterministic regardless of load order. */
.navbar-collapse .navbar-nav .nav-link {
  font-family: "Rubik", "Segoe UI", sans-serif !important;
  color: var(--vi-ink) !important;
  font-weight: 400 !important;
  font-size: 14px !important;
}

.navbar .vi-navbar-lang-slot {
  background: transparent;
  flex-shrink: 0;
  margin-left: var(--vi-space-4);
  padding: 0;
}

@media (max-width: 991.98px) {
  .navbar {
    position: relative;
  }

  /* Keep brand + toggler snug on the left instead of Bootstrap's default
     justify-content:space-between, which pushes the toggler to the far right where it
     collides with our fixed-position language toggle. */
  .navbar .container {
    justify-content: flex-start;
  }

  .navbar-toggler {
    margin-left: var(--vi-space-4);
  }

  /* Native behavior pushes page content down when the collapse opens. Float it as an
     overlay instead so the page underneath never shifts, and size it to its content
     instead of the full viewport width — it stays under the brand/toggler on the left,
     and grows/shrinks automatically if the menu labels change length. */
  .navbar-collapse {
    position: absolute;
    /* left:0 would anchor to the full-width .navbar, flush against the window edge.
       --vi-navbar-toggler-left is measured in portal_lang.js from the toggler button's
       actual rendered position, so the menu drops from directly under it regardless of
       logo width; var(--vi-space-4) is only the fallback before that JS runs. */
    top: calc(100% + var(--vi-space-2));
    left: var(--vi-navbar-toggler-left, var(--vi-space-4));
    width: max-content;
    max-width: calc(100vw - var(--vi-space-8));
    z-index: 900;
    /* Same card look as the desktop .web-sidebar: border + radius + shadow + padding. */
    background: #ffffff;
    border: 1px solid #e1e4ea;
    border-radius: var(--vi-radius-2xl);
    box-shadow: 0 12px 28px rgba(10, 10, 58, 0.08);
    padding: var(--vi-space-6) var(--vi-space-7);
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Pin the language toggle to the corner regardless of the collapse being open or
     closed. It's a sibling of .navbar-collapse in the DOM, not inside it, so with the
     collapse taking flex-basis:100% when open it would otherwise get wrapped onto its
     own row too — taking it out of flow entirely avoids depending on that. */
  .navbar .vi-navbar-lang-slot {
    position: absolute;
    top: 50%;
    right: var(--vi-space-8);
    transform: translateY(-50%);
    width: auto;
    margin: 0;
    padding: 0;
    border-top: none;
  }
}

.vi-hero {
  display: grid;
  gap: var(--vi-space-9);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding: var(--vi-space-12);
  background: var(--vi-bg);
  border: 1px solid var(--vi-border);
  border-radius: var(--vi-radius);
}

.vi-kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--vi-muted);
  margin: 0 0 var(--vi-space-4);
}

.vi-title {
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 700;
  margin: 0 0 var(--vi-space-4);
}

.vi-subtitle {
  color: var(--vi-muted);
  margin: 0 0 var(--vi-space-9);
}

.vi-actions {
  display: flex;
  gap: var(--vi-space-6);
  flex-wrap: wrap;
}

.vi-search {
  display: flex;
  gap: var(--vi-space-6);
  align-items: center;
  margin: var(--vi-space-4) 0 var(--vi-space-8);
}

.vi-search .vi-input {
  max-width: 320px;
}

.vi-item-search {
  margin-top: 0;
}

.vi-count {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--vi-space-5) var(--vi-space-9);
  border-radius: 999px;
  border: 1px solid #cfd3dd;
  background: #f3f4f7;
  color: var(--vi-ink);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vi-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  color: inherit;
  text-decoration: none;
}

.vi-primary {
  background: var(--vi-accent);
  color: #fff;
  border-color: var(--vi-accent);
}

.vi-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.6);
}

.vi-btn-sm {
  padding: 5px var(--vi-space-5);
  font-size: 12px;
}

.vi-hero-card {
  background: var(--vi-card);
  border-radius: var(--vi-radius);
  padding: var(--vi-space-9);
  box-shadow: var(--vi-shadow);
  display: grid;
  gap: var(--vi-space-5);
}

.vi-hero-label {
  font-size: 12px;
  color: var(--vi-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vi-hero-date {
  font-size: 24px;
  font-weight: 600;
}

.vi-hero-meta strong {
  font-weight: 500;
}

.vi-hero-meta {
  display: flex;
  gap: var(--vi-space-3);
  color: var(--vi-muted);
  font-size: 13px;
}

.vi-grid {
  display: grid;
  gap: var(--vi-space-8);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.vi-stat {
  background: var(--vi-card);
  border-radius: var(--vi-radius-2xl);
  padding: var(--vi-space-8);
  border: 1px solid #d4d9e2;
  box-shadow: 0 10px 24px rgba(10, 10, 58, 0.1);
}

.vi-stat-label {
  color: var(--vi-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vi-stat-value {
  font-size: 26px;
  font-weight: 600;
  margin: var(--vi-space-4) 0 var(--vi-space-2);
}

.vi-stat-foot {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-panels {
  display: grid;
  gap: var(--vi-space-8);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}

.vi-panel {
  background: var(--vi-card);
  border-radius: var(--vi-radius);
  border: 1px solid #d4d9e2;
  padding: var(--vi-space-9);
  box-shadow: 0 10px 24px rgba(10, 10, 58, 0.1);
}

.vi-panel-accent {
  background: var(--vi-primary-bg, #0a0a3a);
  color: #fff;
}

.vi-panel-accent .vi-btn {
  color: #fff;
}

.vi-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vi-space-6);
}

.vi-panel h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 var(--vi-space-6);
}

.vi-link {
  font-size: 13px;
  color: var(--vi-accent);
  text-decoration: none;
}

.vi-panel-accent .vi-link {
  color: #e7fffb;
}

.vi-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--vi-space-5);
}

.vi-list-item {
  padding: var(--vi-space-6);
  border-radius: var(--vi-radius-xl);
  border: 1px solid #d9dee7;
  background: #f7f8fb;
  display: flex;
  flex-direction: column;
  gap: var(--vi-space-2);
}

/* Delete Inspections modal */
.vi-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--vi-space-8);
  z-index: 1000;
}

.vi-modal {
  background: #fff;
  border-radius: var(--vi-radius);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.vi-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--vi-space-9) var(--vi-space-10) var(--vi-space-2);
}

.vi-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.vi-modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--vi-muted);
  padding: 0 var(--vi-space-2);
}

.vi-modal-subtitle {
  margin: 0;
  padding: 0 var(--vi-space-10) var(--vi-space-4);
  font-size: 13px;
  color: var(--vi-muted);
}

.vi-modal-tools {
  display: flex;
  align-items: center;
  gap: var(--vi-space-4);
  padding: var(--vi-space-4) var(--vi-space-10);
  border-bottom: 1px solid #e6e9f0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.vi-modal-list {
  overflow-y: auto;
  padding: var(--vi-space-3) var(--vi-space-6);
}

.vi-modal-row {
  display: flex;
  align-items: center;
  gap: var(--vi-space-6);
  padding: var(--vi-space-5) var(--vi-space-4);
  border-radius: var(--vi-radius-lg);
  cursor: pointer;
}

.vi-modal-row:hover {
  background: #f4f6fb;
}

.vi-modal-row-info {
  min-width: 0;
}

.vi-modal-row-title {
  font-weight: 500;
  font-size: 14px;
}

.vi-modal-row-meta {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--vi-space-5);
  padding: var(--vi-space-7) var(--vi-space-10);
  border-top: 1px solid #e6e9f0;
}

.vi-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vi-list-item strong {
  color: var(--vi-ink);
}

.vi-list-title {
  font-weight: 500;
}

.vi-list-meta {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-empty {
  margin-top: var(--vi-space-6);
  color: var(--vi-muted);
  font-size: 13px;
}

.vi-bullets {
  padding-left: var(--vi-space-9);
  margin: 0 0 var(--vi-space-8);
  display: grid;
  gap: var(--vi-space-4);
  font-size: 14px;
}

.vi-panel-actions {
  display: flex;
  gap: var(--vi-space-6);
}

@media (max-width: 768px) {
  .vi-hero {
    padding: var(--vi-space-9);
  }

  .vi-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Header & toolbar ──────────────────────────────────────────────── */

.vi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vi-space-6);
  margin-bottom: var(--vi-space-8);
}

.vi-header-actions {
  display: flex;
  align-items: center;
  gap: var(--vi-space-4);
}

.vi-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vi-space-4);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--vi-surface);
  padding: var(--vi-space-5) 0;
  margin: var(--vi-space-4) 0 var(--vi-space-8);
  border-bottom: 1px solid var(--vi-border);
}

/* ─── Status & banner ───────────────────────────────────────────────── */

.vi-status {
  font-size: 13px;
  color: var(--vi-success);
  margin-left: auto;
}

.vi-status.vi-error {
  color: var(--vi-error);
}

.vi-recovery-status {
  flex-basis: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--vi-muted);
}

.vi-recovery-notice {
  padding: var(--vi-space-4) 0;
  border-bottom: 1px solid var(--vi-border);
  overflow-wrap: anywhere;
}

.vi-recovery-notice .vi-btn {
  margin: 0 var(--vi-space-2) var(--vi-space-2) 0;
  white-space: normal;
}

.vi-recovery-conflicts {
  display: grid;
  gap: var(--vi-space-3);
  margin: var(--vi-space-4) 0;
}

.vi-recovery-conflict {
  display: grid;
  gap: var(--vi-space-1);
  max-width: 640px;
}

.vi-status-muted {
  color: var(--vi-muted);
  font-size: 12px;
}

.vi-title-group {
  display: flex;
  flex-direction: column;
  gap: var(--vi-space-1);
}

.vi-banner {
  margin: var(--vi-space-6) 0 var(--vi-space-8);
  padding: var(--vi-space-5) var(--vi-space-6);
  border-radius: var(--vi-radius-lg);
  font-size: 13px;
  font-weight: 600;
}

.vi-banner.vi-banner-closed {
  background: #eef2f7;
  color: #344054;
  border: 1px solid #d0d5dd;
}

.vi-report {
  margin-top: var(--vi-space-8);
}

.vi-report-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--vi-ink);
}

.vi-report-body > *:first-child {
  margin-top: 0;
}

.vi-report-pdf-status {
  min-height: 18px;
  margin-bottom: var(--vi-space-2);
}

.vi-report-pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vi-space-3);
  margin-bottom: var(--vi-space-6);
}

.vi-report-comparison {
  margin-top: var(--vi-space-8);
}

.vi-report-comparison-heading {
  margin-bottom: var(--vi-space-5);
}

.vi-report-comparison-heading h2 {
  margin: 0 0 var(--vi-space-2);
  font-size: 18px;
}

.vi-report-draft-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--vi-space-5);
  align-items: start;
}

.vi-report-draft {
  min-width: 0;
  border: 1px solid var(--vi-border);
  border-radius: var(--vi-radius-lg);
  background: var(--vi-surface);
  padding: var(--vi-space-6);
}

.vi-report-draft-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--vi-space-2) var(--vi-space-4);
  margin-bottom: var(--vi-space-3);
}

.vi-report-draft-header h3 {
  margin: 0;
  font-size: 15px;
}

.vi-report-draft-meta,
.vi-report-draft-empty,
.vi-report-draft-status {
  font-size: 12px;
}

.vi-report-draft-meta,
.vi-report-draft-empty {
  color: var(--vi-muted);
}

.vi-report-draft-status {
  min-height: 18px;
  margin: 0 0 var(--vi-space-3);
}

.vi-report-draft-body {
  max-height: 520px;
  overflow: auto;
  overflow-wrap: anywhere;
}

.vi-report-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vi-space-3);
  margin-top: var(--vi-space-5);
}

@media (max-width: 760px) {
  .vi-report-draft-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ─── Form sections ─────────────────────────────────────────────────── */

.vi-section {
  border: 1px solid var(--vi-border);
  border-radius: var(--vi-radius-xl);
  padding: var(--vi-space-8);
  margin-bottom: var(--vi-space-8);
  background: var(--vi-surface);
}

.vi-section-title {
  margin: 0 0 var(--vi-space-6);
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: var(--vi-space-5);
  cursor: pointer;
  list-style: none;
}

.vi-section-title::-webkit-details-marker {
  display: none;
}

.vi-section-name {
  font-weight: 600;
}

.vi-section-count {
  font-size: 12px;
  color: var(--vi-muted);
  background: var(--vi-surface-soft);
  padding: var(--vi-space-1) var(--vi-space-4);
  border-radius: 999px;
}

.vi-section-toggle {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: 2px solid #d0d5dd;
  border-radius: var(--vi-radius-sm);
  position: relative;
  flex-shrink: 0;
}

.vi-section-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-right: 3px solid var(--vi-muted);
  border-bottom: 3px solid var(--vi-muted);
  transform: translateY(-1px) rotate(45deg);
}

.vi-section[open] .vi-section-toggle::before {
  transform: translateY(1px) rotate(-135deg);
}

.vi-section[open] .vi-section-title {
  margin-bottom: var(--vi-space-6);
}

.vi-section-body {
  display: flex;
  flex-direction: column;
  padding-left: var(--vi-space-8);
}

/* ─── Form items ────────────────────────────────────────────────────── */

.vi-item {
  padding: var(--vi-space-5) 0;
  border-top: 1px solid var(--vi-border);
}

.vi-item:first-child {
  border-top: 0;
  padding-top: var(--vi-space-2);
}

/* Main row: label left, controls right */
.vi-item-row {
  display: flex;
  align-items: center;
  gap: var(--vi-space-8);
}

.vi-item-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}

.vi-item-controls {
  display: flex;
  align-items: center;
  gap: var(--vi-space-4);
  flex-shrink: 0;
}

/* Response input in item row — fixed width */
.vi-item-controls .vi-response {
  width: 160px;
}

/* Observation row — full width below the main row */
.vi-obs-row {
  margin-top: var(--vi-space-4);
}

.vi-obs-row .vi-input {
  font-size: 13px;
  resize: vertical;
}

/* Photo control buttons */
.vi-photo-ctrl {
  display: flex;
  align-items: center;
  gap: var(--vi-space-3);
}

.vi-btn-remove {
  color: var(--vi-error);
  border-color: #f4b8b8;
  background: #fef2f2;
}

.vi-btn-remove:hover {
  color: var(--vi-error);
  background: #fee2e2;
  transform: translateY(-1px);
  box-shadow: none;
}

/* Option segmented control (replaces select for predefined options) */
.vi-option-group {
  display: inline-flex;
  border: 1.5px solid #d0d5dd;
  border-radius: var(--vi-radius-md);
  overflow: hidden;
  background: var(--vi-surface);
  flex-shrink: 0;
}

#inspection-app .vi-option-btn {
  padding: 5px var(--vi-space-7);
  border: none;
  border-right: 1px solid #d0d5dd;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  line-height: 1.4;
  border-radius: 0;
  box-shadow: none;
  outline: none;
}

#inspection-app .vi-option-btn:last-child {
  border-right: none;
}

.vi-option-separator {
  align-self: stretch;
  background: #eef1f5;
  border-right: 1px solid #d0d5dd;
  flex: 0 0 7px;
}

#inspection-app .vi-option-btn:hover:not(:disabled):not(.selected) {
  background: #f3f4f6;
  color: #374151;
}

/* Selected state — semantic colors by value */
#inspection-app .vi-option-btn.selected {
  background: var(--vi-accent);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Ok"].selected,
#inspection-app .vi-option-btn[data-value="Yes"].selected {
  background: var(--vi-success);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Fail"].selected,
#inspection-app .vi-option-btn[data-value="No"].selected {
  background: var(--vi-error);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="N/A"].selected {
  background: var(--vi-muted);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Good"].selected,
#inspection-app .vi-option-btn[data-value="Great"].selected,
#inspection-app .vi-option-btn[data-value="Excellent"].selected {
  background: var(--vi-success);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Fair"].selected,
#inspection-app .vi-option-btn[data-value="Attention"].selected {
  background: #b45309;
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Poor"].selected,
#inspection-app .vi-option-btn[data-value="Severe"].selected {
  background: var(--vi-error);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Normal"].selected {
  background: var(--vi-success);
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Slight"].selected {
  background: #d97706;
  color: #fff;
}

#inspection-app .vi-option-btn[data-value="Moderate"].selected {
  background: #b45309;
  color: #fff;
}

/* Road Feel extras — condition tags + diagnosis flag */
.vi-base-evidence {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.vi-base-evidence .vi-photo-ctrl { flex-wrap: wrap; }
.vi-evidence-item { display: flex; flex-direction: column; gap: var(--vi-space-3); }
.vi-evidence-caption { font-size: 14px; font-weight: 600; color: var(--vi-text); }
.vi-evidence-thumb {
  width: 140px;
  height: 105px;
  object-fit: contain;
  display: block;
}
.vi-roadfeel {
  margin: var(--vi-space-5) 0 0;
  padding: var(--vi-space-5) var(--vi-space-6);
  border-radius: var(--vi-radius-lg);
  background: var(--vi-surface-soft);
  border: 1px solid var(--vi-border);
}

.vi-roadfeel[hidden] {
  display: none;
}

.vi-roadfeel-hint {
  font-size: 12px;
  color: var(--vi-muted);
  margin-bottom: var(--vi-space-4);
}

.vi-tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vi-space-3);
}

#inspection-app .vi-tag {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid #d0d5dd;
  background: var(--vi-surface);
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
  box-shadow: none;
}

#inspection-app .vi-tag.selected {
  background: var(--vi-accent);
  border-color: var(--vi-accent);
  color: #fff;
}

#inspection-app .vi-tag:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.vi-diag-toggle {
  display: flex;
  align-items: center;
  gap: var(--vi-space-4);
  margin-top: var(--vi-space-5);
  font-size: 12px;
  font-weight: 500;
  color: #92400e;
  cursor: pointer;
}

@media (max-width: 640px) {
  .vi-option-group {
    flex-wrap: wrap;
    max-width: 100%;
  }
  #inspection-app .vi-option-btn {
    padding: 5px var(--vi-space-5);
    font-size: 12px;
  }
}

#inspection-app .vi-option-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.vi-label {
  font-size: 14px;
  font-weight: 500;
}

.vi-input {
  width: 100%;
  padding: var(--vi-space-4) var(--vi-space-5);
  border: 1px solid #d0d5dd;
  border-radius: var(--vi-radius-sm);
  font-family: inherit;
  font-size: inherit;
}

.vi-input:focus {
  outline: 2px solid var(--vi-accent);
  outline-offset: 1px;
  border-color: var(--vi-accent);
}

.vi-sub {
  font-size: 12px;
  color: var(--vi-muted);
  margin-top: var(--vi-space-4);
  display: block;
}

/* ─── Card list ─────────────────────────────────────────────────────── */

.vi-card-list {
  display: grid;
  gap: var(--vi-space-6);
  margin-top: var(--vi-space-8);
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* New Inspection details form */
.vi-form {
  display: grid;
  gap: var(--vi-space-10);
  margin-top: var(--vi-space-4);
}

.vi-form-group {
  background: var(--vi-surface);
  border: 1px solid var(--vi-border);
  border-radius: var(--vi-radius-2xl);
  padding: var(--vi-space-8) var(--vi-space-9);
}

.vi-form-group-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 var(--vi-space-6);
  color: var(--vi-ink);
}

.vi-form-grid {
  display: grid;
  gap: var(--vi-space-6) var(--vi-space-8);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.vi-field {
  display: flex;
  flex-direction: column;
  gap: var(--vi-space-2);
}

.vi-field-label {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-field-with-action {
  position: relative;
}

.vi-scan-btn {
  position: absolute;
  right: var(--vi-space-3);
  bottom: var(--vi-space-3);
}

/* Inspection Order logistics and field data on the inspection form */
.vi-order-logistics,
.vi-field-data {
  margin-top: var(--vi-space-6);
}

.vi-order-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--vi-space-2) var(--vi-space-6);
  margin: 0;
}

.vi-order-details dt {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-order-details dd {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .vi-order-details {
    grid-template-columns: 1fr;
  }

  .vi-order-details dd {
    margin-bottom: var(--vi-space-3);
  }
}

/* VIN barcode scanner */
.vi-scan-modal {
  max-width: 460px;
}

.vi-scan-video {
  width: 100%;
  max-height: 55vh;
  background: #0f172a;
  border-radius: var(--vi-radius-xl);
  object-fit: cover;
  display: block;
}

.vi-scan-hint {
  padding: var(--vi-space-5) var(--vi-space-10) 0;
  font-size: 13px;
  color: var(--vi-muted);
  text-align: center;
}

.vi-scan-hint.vi-error {
  color: var(--vi-error);
}

.vi-form-actions {
  display: flex;
  align-items: center;
  gap: var(--vi-space-7);
}

.vi-card-check {
  margin-right: var(--vi-space-4);
  vertical-align: middle;
}

.vi-subsection {
  margin: var(--vi-space-9) 0 var(--vi-space-2);
  padding: var(--vi-space-3) var(--vi-space-5);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vi-accent);
  background: var(--vi-accent-soft);
  border-radius: var(--vi-radius-md);
}

.vi-subsection:first-child {
  margin-top: var(--vi-space-3);
}

.vi-scale010 {
  display: inline-flex;
  align-items: center;
  gap: var(--vi-space-5);
}

.vi-scale010-range {
  width: 150px;
  max-width: 100%;
  accent-color: var(--vi-accent);
  cursor: pointer;
}

.vi-scale010-out {
  min-width: 24px;
  font-weight: 600;
  font-size: 15px;
  text-align: right;
}

.vi-scale010-out-wide {
  min-width: 72px;
}

.vi-card {
  display: block;
  padding: var(--vi-space-7) var(--vi-space-8);
  border: 1px solid var(--vi-border);
  border-radius: var(--vi-radius-xl);
  background: var(--vi-surface);
  box-shadow: 0 10px 24px rgba(10, 10, 58, 0.1);
  color: inherit;
  text-decoration: none;
}

.vi-card:hover {
  border-color: var(--vi-accent);
}

.vi-card-action {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.vi-vehicle-card {
  display: grid;
  gap: var(--vi-space-6);
}

.vi-vehicle-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--vi-space-6);
}

.vi-vehicle-top .vi-card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vi-vehicle-tag {
  flex-shrink: 0;
  min-width: 104px;
  text-align: center;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  border: 2px solid #334155;
  padding: var(--vi-space-3) var(--vi-space-4);
  border-radius: var(--vi-radius-sm);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: "Courier New", monospace;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.vi-vehicle-mid {
  display: flex;
  justify-content: space-between;
  gap: var(--vi-space-6);
  flex-wrap: wrap;
}

.vi-vehicle-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vi-space-6);
  flex-wrap: wrap;
}

.vi-vehicle-actions {
  display: flex;
  gap: var(--vi-space-4);
  flex-wrap: wrap;
}

/* ─── Badges ────────────────────────────────────────────────────────── */

.vi-badges {
  display: flex;
  gap: var(--vi-space-4);
  flex-wrap: wrap;
}

.vi-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px var(--vi-space-5);
  font-size: 12px;
  font-weight: 600;
}

.vi-badge-warning {
  background: #fff4db;
  color: #8a5a00;
  border: 1px solid #f2d18b;
}

.vi-badge-success {
  background: #eaf9f0;
  color: #17603a;
  border: 1px solid #b8e7c9;
}

.vi-badge-neutral {
  background: #eef2f7;
  color: #344054;
  border: 1px solid #d0d5dd;
}

/* ─── Progress bar ──────────────────────────────────────────────────── */

.vi-progress-wrap {
  display: grid;
  gap: var(--vi-space-3);
  margin-top: var(--vi-space-1);
}

.vi-progress-meta {
  font-size: 12px;
  color: var(--vi-muted);
}

.vi-progress {
  height: 8px;
  border-radius: 999px;
  background: #e6e9f1;
  overflow: hidden;
}

.vi-progress > span {
  display: block;
  height: 100%;
  background: var(--vi-accent);
  border-radius: inherit;
}

/* ─── Card text ─────────────────────────────────────────────────────── */

.vi-card-title {
  font-size: 14px;
  font-weight: 600;
}

.vi-card-status {
  font-size: 13px;
  color: var(--vi-muted);
  margin-top: var(--vi-space-2);
}

.vi-card-meta {
  font-size: 12px;
  color: var(--vi-muted);
  margin-top: var(--vi-space-3);
}

@media (max-width: 768px) {
  #inspection-app {
    padding: 0 var(--vi-space-6);
  }

  .vi-vehicle-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .vi-vehicle-actions {
    width: 100%;
  }

  .vi-vehicle-actions .vi-btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .vi-item-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--vi-space-4);
  }

  .vi-item-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .vi-item-controls .vi-response {
    width: 100%;
    flex: 1;
  }
}

/* Inspection Validation workspace (/validation) */
.vi-validation-filters {
  margin: 0 0 var(--vi-space-6, 12px);
  flex-wrap: wrap;
}

.vi-validation-filters .vi-btn.active {
  background: var(--vi-accent-soft);
  border-color: var(--vi-accent);
}

.vi-validation-lifecycle,
.vi-validation-report,
.vi-validation-evidence,
.vi-validation-findings,
.vi-validation-media {
  margin-bottom: 16px;
}

.vi-validation-steps {
  margin: 8px 0;
  padding-left: 20px;
}

.vi-validation-steps li.done {
  color: #1a7f37;
}

.vi-validation-steps li.todo {
  color: #9a6700;
  font-weight: 600;
}

.vi-validation-odometer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.vi-validation-odometer .vi-input {
  max-width: 160px;
}

.vi-validation-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.vi-validation-photos .vi-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vi-validation-photos img,
.vi-media-preview img,
.vi-media-preview video {
  max-width: 100%;
  border-radius: var(--vi-radius-md);
}

.vi-validation-photos img {
  width: 140px;
  height: 105px;
  object-fit: cover;
}

.vi-finding-observation {
  color: var(--vi-muted);
  font-size: 13px;
}

.vi-finding-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.vi-revalidate-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  max-width: 560px;
}

.vi-media-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.vi-media-item .vi-list-title {
  flex: 1 1 220px;
  overflow-wrap: anywhere;
}

.vi-media-preview {
  margin-top: 12px;
  max-width: 640px;
}
