:root {
  color-scheme: light;
  --ink: #172126;
  --ink-soft: #526169;
  --ink-faint: #78878e;
  --nav: #16313b;
  --nav-deep: #10262e;
  --nav-muted: #a8bec6;
  --accent: #d99218;
  --accent-dark: #a96600;
  --teal: #22746f;
  --teal-soft: #e4f1ef;
  --surface: #ffffff;
  --canvas: #f3f5f4;
  --surface-muted: #f7f8f7;
  --border: #d9dfdc;
  --border-strong: #bec9c5;
  --danger: #b93a35;
  --danger-soft: #fbeceb;
  --warning: #986713;
  --warning-soft: #fff5dc;
  --success: #287a4d;
  --success-soft: #e8f5ed;
  --shadow: 0 16px 40px rgba(22, 49, 59, 0.16);
  --sidebar-width: 264px;
  --topbar-height: 76px;
  --radius: 8px;
  font-family: Inter, Aptos, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body.nav-open {
  overflow: hidden;
}

body {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="checkbox"],
input[type="file"] + * {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(217, 146, 24, 0.36);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.global-progress {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  background: rgba(217, 146, 24, 0.25);
}

.global-progress::after {
  position: absolute;
  width: 34%;
  height: 100%;
  background: var(--accent);
  content: "";
  animation: progress-slide 1s ease-in-out infinite;
}

@keyframes progress-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(390%); }
}

/* Authentication */
.auth-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(350px, 0.95fr) minmax(460px, 1.05fr);
  background: var(--surface);
}

.auth-brand {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  padding: clamp(44px, 7vw, 100px);
  overflow: hidden;
  background: var(--nav);
  color: #fff;
}

.auth-brand::before,
.auth-brand::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.auth-brand::before {
  top: 0;
  right: 11%;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.09);
}

.auth-brand::after {
  top: 22%;
  right: 0;
  width: 44%;
  height: 1px;
  background: rgba(255, 255, 255, 0.09);
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
}

.brand-mark img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
}

.brand-mark img.is-missing {
  display: none;
}

.brand-fallback {
  position: absolute;
  color: var(--nav);
  font-size: 13px;
  font-weight: 800;
}

.brand-mark-large {
  width: min(320px, 78%);
  height: auto;
  aspect-ratio: 3.4 / 1;
  margin-bottom: 52px;
  background: #fff;
}

.brand-mark-large img {
  padding: 0;
}

.brand-mark-large .brand-fallback {
  font-size: 28px;
}

.product-label,
.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-brand h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(42px, 5vw, 70px);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: 0;
}

.auth-accent {
  width: 84px;
  height: 6px;
  margin-top: 34px;
  background: var(--accent);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 48px clamp(32px, 7vw, 110px);
}

.auth-form-wrap {
  width: 100%;
  max-width: 430px;
}

.mobile-brand {
  display: none;
}

.auth-form-wrap h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
}

.auth-subtitle {
  margin: 10px 0 34px;
  color: var(--ink-soft);
}

.auth-form {
  display: grid;
  gap: 20px;
}

/* Shared controls */
.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field label,
.field legend {
  color: #34444b;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-control,
.select-control select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input,
.field select,
.field textarea,
.select-control select {
  padding: 10px 12px;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-control:hover,
.select-control select:hover {
  border-color: #93a39d;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-control:focus-within,
.select-control select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(34, 116, 111, 0.12);
  outline: 0;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-hint {
  color: var(--ink-faint);
  font-size: 12px;
}

.input-action-wrap,
.input-suffix-wrap {
  position: relative;
}

.input-action-wrap input {
  padding-right: 50px;
}

.input-icon-button {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
}

.input-icon-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.input-suffix-wrap input {
  padding-right: 50px;
}

.input-suffix-wrap > span {
  position: absolute;
  top: 50%;
  right: 13px;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  border-color: #195e5a;
  background: #195e5a;
}

.button-secondary {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--ink);
}

.button-secondary:hover:not(:disabled) {
  border-color: #95a49f;
  background: var(--surface-muted);
}

.button-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.button-danger:hover:not(:disabled) {
  border-color: #962c28;
  background: #962c28;
}

.button-small {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 13px;
}

.button-block {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.button-block .icon {
  margin-left: auto;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-muted);
  color: var(--ink);
}

.icon-button-danger:hover:not(:disabled) {
  border-color: #efb5b2;
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-button-inverse {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #dbe8ec;
}

.icon-button-inverse:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.form-error {
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  border-radius: 3px;
  background: var(--danger-soft);
  color: #8b2925;
  font-size: 13px;
}

/* Application shell */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  background: var(--nav);
  color: #fff;
}

.sidebar-brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand > div:nth-child(2) {
  min-width: 0;
}

.sidebar-brand-name,
.sidebar-brand-caption {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 800;
}

.sidebar-brand-caption {
  margin-top: 2px;
  color: var(--nav-muted);
  font-size: 11px;
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.primary-nav {
  display: grid;
  gap: 6px;
  padding: 22px 12px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 13px;
  padding: 9px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--nav-muted);
  font-size: 14px;
  font-weight: 650;
  text-align: left;
}

.nav-item::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -12px;
  width: 3px;
  background: transparent;
  content: "";
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.is-active::before {
  background: var(--accent);
}

.sidebar-account {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--nav-deep);
}

.account-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #241b0b;
  font-size: 14px;
  font-weight: 850;
  text-transform: uppercase;
}

.account-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.account-copy strong,
.account-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 13px;
}

.account-copy span {
  color: var(--nav-muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  min-width: 0;
  min-height: 100vh;
  grid-column: 2;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-width: 0;
  height: var(--topbar-height);
  align-items: center;
  gap: 16px;
  padding: 12px clamp(22px, 3vw, 42px);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-title {
  min-width: 0;
  flex: 1;
}

.topbar-title p,
.topbar-title h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title p {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-title h1 {
  margin-top: 1px;
  font-size: 22px;
  line-height: 1.2;
}

.mobile-nav-button {
  display: none;
}

.nextcloud-button {
  display: inline-flex;
  min-height: 40px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.nextcloud-button:hover {
  border-color: var(--accent);
  background: #f8faf9;
}

.nextcloud-button-icon {
  color: var(--teal);
  font-size: 18px;
  line-height: 1;
}

.workspace-scroll {
  min-width: 0;
  padding: 30px clamp(22px, 3vw, 42px) 54px;
}

.tab-panel {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  min-height: 64px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 23px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.section-heading p {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.stat-strip {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.52);
}

.stat-item {
  min-width: 0;
  padding: 15px 18px;
  border-right: 1px solid var(--border);
}

.stat-item:last-child {
  border-right: 0;
}

.stat-item span,
.stat-item strong {
  display: block;
}

.stat-item span {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-item strong {
  margin-top: 3px;
  overflow: hidden;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.search-control {
  display: flex;
  width: min(420px, 100%);
  min-width: 220px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
}

.search-control .icon {
  width: 18px;
  color: var(--ink-faint);
}

.search-control input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  outline: 0;
}

.search-control input::placeholder {
  color: #839097;
}

.select-control {
  min-width: 190px;
}

.select-control select {
  height: 46px;
}

.check-filter {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.check-filter input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--teal);
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

.segmented-control button {
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.segmented-control button:hover {
  color: var(--ink);
}

.segmented-control button.is-active {
  background: var(--nav);
  color: #fff;
}

.data-region {
  min-height: 180px;
}

.data-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.col-width-7 { width: 7%; }
.col-width-8 { width: 8%; }
.col-width-11 { width: 11%; }
.col-width-13 { width: 13%; }
.col-width-16 { width: 16%; }
.col-width-17 { width: 17%; }
.col-width-18 { width: 18%; }
.col-width-20 { width: 20%; }
.col-width-22 { width: 22%; }
.col-width-24 { width: 24%; }
.col-width-25 { width: 25%; }

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e6eae8;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-muted);
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table td {
  overflow-wrap: anywhere;
  color: #35454c;
  font-size: 13px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fbfcfb;
}

.data-table .cell-primary {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.data-table .cell-secondary {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .mileage-cell {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  white-space: nowrap;
}

.data-table .notes-cell {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.table-actions .icon-button {
  width: 34px;
  height: 34px;
}

.invoice-cell {
  min-width: 0;
}

.invoice-download-link {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.invoice-download-link:hover {
  color: #195e5a;
  text-decoration: underline;
}

.invoice-download-link .icon {
  width: 16px;
  height: 16px;
}

.invoice-cell .cell-secondary {
  max-width: 100%;
}

.record-with-image {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.record-thumb {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #edf1ef;
  color: #617078;
}

.record-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record-thumb .icon {
  width: 19px;
}

.record-photo-gallery {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.selected-image-list,
.existing-image-list {
  display: grid;
  margin-top: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.selected-image-item {
  display: grid;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  text-decoration: none;
  gap: 5px;
}

.selected-image-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 3px;
  object-fit: cover;
}

.selected-image-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-copy {
  min-width: 0;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf0ef;
  color: #536269;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.badge .icon {
  width: 13px;
  height: 13px;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-admin {
  background: var(--teal-soft);
  color: #165f5a;
}

.empty-state,
.loading-state,
.error-state {
  display: grid;
  min-height: 260px;
  align-content: center;
  justify-items: center;
  padding: 40px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-align: center;
}

.empty-state-icon,
.error-state-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 15px;
  place-items: center;
  border-radius: 50%;
  background: #e7ecea;
  color: #5d6c72;
}

.error-state-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.empty-state h3,
.error-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.empty-state p,
.error-state p {
  max-width: 420px;
  margin: 7px 0 0;
  font-size: 13px;
}

.error-state .button {
  margin-top: 18px;
}

.loading-state {
  align-content: start;
  gap: 12px;
  border-style: solid;
  text-align: left;
}

.skeleton-row {
  width: 100%;
  height: 58px;
  border-radius: 5px;
  background: #e7ebe9;
  animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes skeleton-pulse {
  to { opacity: 0.45; }
}

/* Vehicle cards */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 16px;
}

.vehicle-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex-direction: column;
}

.vehicle-image {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  place-items: center;
  overflow: hidden;
  background: #dfe6e3;
  color: #718078;
}

.vehicle-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-image > .icon {
  width: 46px;
  height: 46px;
  opacity: 0.7;
}

.vehicle-status {
  position: absolute;
  top: 10px;
  right: 10px;
  box-shadow: 0 2px 8px rgba(23, 33, 38, 0.14);
}

.vehicle-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}

.vehicle-card-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.vehicle-card-heading h3 {
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-model {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-mileage {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 15px 0;
  padding: 12px 0;
  border-top: 1px solid #e8ebe9;
  border-bottom: 1px solid #e8ebe9;
}

.vehicle-mileage span {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.vehicle-mileage strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vehicle-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.vehicle-details > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.vehicle-details dt {
  color: var(--ink-faint);
  font-size: 12px;
}

.vehicle-details dd {
  margin: 0;
  overflow: hidden;
  color: #34444b;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-compliance {
  display: grid;
  gap: 11px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e8ebe9;
}

.vehicle-compliance-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.vehicle-compliance-copy,
.vehicle-document-copy {
  display: grid;
  min-width: 0;
}

.vehicle-compliance-copy strong,
.vehicle-document-copy strong {
  color: #34444b;
  font-size: 12px;
}

.vehicle-compliance-copy span,
.vehicle-document-copy small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.vehicle-compliance-row .badge {
  flex: 0 0 auto;
}

.vehicle-document-row,
.vehicle-document-link {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.vehicle-document-row {
  color: var(--teal);
}

.vehicle-document-row.is-empty {
  color: var(--ink-faint);
  font-size: 11px;
}

.vehicle-document-row > .icon,
.vehicle-document-link > .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.vehicle-document-link {
  max-width: 100%;
  color: var(--teal);
  text-decoration: none;
}

.vehicle-document-link:hover {
  color: #195e5a;
  text-decoration: underline;
}

.vehicle-document-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-allocations {
  min-height: 38px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e8ebe9;
  color: var(--ink-soft);
  font-size: 12px;
}

.vehicle-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 13px;
}

/* Modal forms */
.modal {
  width: min(680px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(10, 25, 31, 0.62);
}

.modal-frame {
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
}

.modal-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.97);
}

.modal-header h2 {
  margin: 0;
  font-size: 21px;
}

.modal-header .eyebrow {
  margin-bottom: 4px;
  color: var(--teal);
}

.modal-body {
  padding: 24px;
}

.entity-form {
  display: grid;
  gap: 24px;
}

.account-form {
  display: grid;
  max-width: 720px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.account-form > .form-error,
.account-form-actions {
  grid-column: 1 / -1;
}

.account-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.transfer-request-form {
  display: flex;
  max-width: 820px;
  align-items: flex-end;
  gap: 12px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.transfer-request-form .field {
  min-width: 0;
  flex: 1;
}

.transfer-request-form .button {
  flex: 0 0 auto;
}

.transfer-sections {
  display: grid;
  gap: 34px;
}

.transfer-section {
  min-width: 0;
  padding-top: 6px;
}

.transfer-section + .transfer-section {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.transfer-section-title {
  margin: 0 0 14px;
  font-size: 17px;
}

.transfer-section-empty {
  margin: 0;
  padding: 18px 0;
  color: var(--ink-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field-span-2 {
  grid-column: span 2;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.upload-control {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  background: var(--surface-muted);
  cursor: pointer;
}

.upload-control:hover {
  border-color: var(--teal);
  background: #f3f8f7;
}

.upload-control > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-preview {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--ink-faint);
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}

.upload-copy strong,
.upload-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.upload-copy small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 11px;
}

.invoice-control,
.document-control {
  display: grid;
  gap: 10px;
}

.invoice-current,
.current-document {
  display: grid;
  min-height: 66px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 11px;
}

.invoice-file-icon,
.document-file-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 5px;
  background: var(--teal-soft);
  color: var(--teal);
}

.invoice-current-copy,
.current-document-copy {
  display: grid;
  min-width: 0;
}

.invoice-current-copy strong,
.invoice-current-copy small,
.current-document-copy strong,
.current-document-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-current-copy strong,
.current-document-copy strong {
  font-size: 13px;
}

.invoice-current-copy small,
.current-document-copy small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 11px;
}

.invoice-current .button .icon,
.current-document .button .icon {
  width: 16px;
  height: 16px;
}

.invoice-remove-control,
.document-remove-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.invoice-remove-control input,
.document-remove-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--danger);
}

.invoice-upload-control .upload-preview,
.document-upload-control .upload-preview {
  color: var(--teal);
}

.assignment-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.assignment-fieldset legend {
  margin-bottom: 7px;
  padding: 0;
}

.assignment-list {
  display: grid;
  max-height: 175px;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

.assignment-option {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #e8ebe9;
  font-size: 13px;
  cursor: pointer;
}

.assignment-option:last-child {
  border-bottom: 0;
}

.assignment-option:hover {
  background: var(--surface-muted);
}

.assignment-option input {
  width: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--teal);
}

.assignment-empty {
  padding: 12px;
  color: var(--ink-faint);
  font-size: 12px;
}

.switch-row {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  cursor: pointer;
}

.switch-row > span:first-child {
  display: grid;
  gap: 2px;
}

.switch-row strong {
  font-size: 13px;
}

.switch-row small {
  color: var(--ink-faint);
  font-size: 11px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch > span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #aab5b1;
  transition: background-color 150ms ease;
}

.switch > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  content: "";
  transition: transform 150ms ease;
}

.switch input:checked + span {
  background: var(--teal);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(217, 146, 24, 0.36);
  outline-offset: 2px;
}

.confirm-modal {
  width: min(420px, calc(100vw - 32px));
}

.confirm-modal .modal-frame {
  padding: 28px;
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 15px;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-modal h2 {
  margin: 0;
  font-size: 20px;
}

.confirm-modal p {
  margin: 9px 0 22px;
  color: var(--ink-soft);
  font-size: 13px;
}

.confirm-modal .modal-actions {
  justify-content: center;
}

/* Notifications */
.toast-region {
  position: fixed;
  z-index: 1100;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(380px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--success);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(22, 49, 59, 0.18);
  animation: toast-enter 180ms ease-out;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast > .icon {
  margin-top: 1px;
  color: var(--success);
}

.toast.is-error > .icon {
  color: var(--danger);
}

.toast-copy {
  min-width: 0;
  flex: 1;
}

.toast-copy strong,
.toast-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.toast-copy strong {
  font-size: 13px;
}

.toast-copy span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 1020px) {
  :root {
    --topbar-height: 68px;
  }

  .auth-screen {
    grid-template-columns: minmax(310px, 0.8fr) minmax(400px, 1.2fr);
  }

  .auth-brand {
    padding: 48px;
  }

  .auth-brand h1 {
    font-size: 46px;
  }

  .brand-mark-large {
    width: 250px;
    height: auto;
    margin-bottom: 40px;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    min-height: 100vh;
    grid-column: auto;
  }

  .sidebar {
    width: min(300px, calc(100vw - 48px));
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close,
  .mobile-nav-button {
    display: inline-grid;
  }

  .nav-scrim {
    position: fixed;
    z-index: 29;
    inset: 0;
    background: rgba(10, 25, 31, 0.58);
  }
}

@media (max-width: 760px) {
  .auth-screen {
    display: block;
    background: var(--surface);
  }

  .auth-brand {
    display: none;
  }

  .auth-panel {
    min-height: 100vh;
    align-items: flex-start;
    padding: max(30px, 7vh) 22px 36px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: max(52px, 9vh);
    color: var(--nav);
    font-size: 14px;
    font-weight: 800;
  }

  .auth-form-wrap h2 {
    font-size: 31px;
  }

  .workspace-scroll {
    padding: 22px 16px 40px;
  }

  .topbar {
    gap: 11px;
    padding: 10px 16px;
  }

  .topbar-title h1 {
    font-size: 19px;
  }

  .section-heading {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .section-heading .button {
    width: 100%;
  }

  .stat-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-item {
    padding: 12px 10px;
  }

  .stat-item strong {
    font-size: 16px;
  }

  .data-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-control {
    width: 100%;
    min-width: 100%;
  }

  .select-control {
    min-width: min(190px, 54%);
    flex: 1;
  }

  .check-filter {
    padding-right: 0;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .data-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: grid;
    gap: 12px;
  }

  .data-table tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .data-table td {
    display: grid;
    min-height: 42px;
    align-items: start;
    padding: 10px 13px;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid #e8ebe9;
  }

  .data-table td::before {
    color: var(--ink-faint);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .data-table td:first-child {
    display: block;
    padding: 14px 13px;
    background: var(--surface-muted);
  }

  .data-table td:first-child::before,
  .data-table td[data-label="Actions"]::before {
    display: none;
  }

  .data-table td[data-label="Actions"] {
    display: block;
    padding: 9px 13px;
  }

  .data-table .cell-secondary {
    white-space: normal;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .vehicle-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .modal-frame {
    max-height: calc(100vh - 20px);
  }

  .modal-header,
  .modal-body {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .account-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .transfer-request-form {
    align-items: stretch;
    flex-direction: column;
  }

  .transfer-request-form .button {
    width: 100%;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .upload-control {
    flex-wrap: wrap;
  }

  .upload-copy {
    min-width: 120px;
  }

  .upload-control > .button {
    width: 100%;
  }

  .invoice-current,
  .current-document {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .invoice-current .button,
  .invoice-remove-control,
  .current-document .button,
  .document-remove-control {
    width: 100%;
    grid-column: span 2;
  }

  .invoice-remove-control,
  .document-remove-control {
    min-height: 38px;
    justify-content: center;
  }

  .modal-actions .button {
    flex: 1;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
  }
}

@media (max-width: 430px) {
  .stat-item span {
    font-size: 9px;
  }

  .stat-item strong {
    font-size: 14px;
  }

  .select-control {
    min-width: 100%;
  }

  .check-filter {
    width: 100%;
  }

  .vehicle-details > div {
    grid-template-columns: 62px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.load-more-row {
  display: flex;
  justify-content: center;
  padding: 18px 0 4px;
}
.clickable-row { cursor:pointer; }
.clickable-row:hover td { background:#f4f8f9; }
.attention-entry-check { width:max-content; }
.camera-capture-control { position:relative; width:max-content; margin-top:10px; }
.camera-capture-control input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.vehicle-check-sheet { min-width:0; border:1px solid #ccd8dc; padding:16px; }
.vehicle-check-sheet legend { padding:0 6px; font-weight:700; font-size:14px; }
.vehicle-check-sheet > p { margin:0 0 12px; color:#52636a; font-size:13px; }
.vehicle-check-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 16px; }
.vehicle-check-grid h4 { grid-column:1/-1; margin:10px 0 0; padding-bottom:6px; border-bottom:1px solid #d5e0e3; color:#36515a; font-size:12px; text-transform:uppercase; letter-spacing:0; }
.vehicle-check-grid h4:first-child { margin-top:0; }
.vehicle-check-grid label { display:flex; align-items:center; gap:10px; min-width:0; min-height:42px; padding:8px 10px; border:1px solid #dde5e8; background:#fff; }
.vehicle-check-grid input { width:18px; height:18px; margin:0; flex:0 0 18px; accent-color:#176b5b; }
.vehicle-check-grid span { min-width:0; overflow-wrap:anywhere; line-height:1.3; }
@media (max-width: 650px) {
  .vehicle-check-sheet { padding:12px 10px; }
  .vehicle-check-sheet > p { line-height:1.45; }
  .vehicle-check-grid { grid-template-columns:minmax(0,1fr); gap:7px; }
  .vehicle-check-grid h4 { margin-top:14px; padding:0 2px 7px; }
  .vehicle-check-grid label { min-height:48px; padding:10px 11px; font-size:14px; }
  .vehicle-check-grid input { width:20px; height:20px; flex-basis:20px; }
}
.admin-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; }
.admin-block { min-width:0; }
.admin-block h3 { margin:0 0 12px; font-size:15px; }
.report-list { border-top:1px solid var(--border-color, #d8e0e3); }
.report-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:20px; padding:18px 0; border-bottom:1px solid var(--border-color, #d8e0e3); }
.report-copy { min-width:0; }
.report-copy strong { display:block; font-size:15px; }
.report-copy p { margin:4px 0 0; color:#52636a; font-size:13px; line-height:1.4; }
.report-actions { display:grid; grid-template-columns:minmax(180px,220px) auto; align-items:end; gap:10px; }
.report-format-field { display:grid; gap:5px; }
.report-format-field label { color:#52636a; font-size:11px; font-weight:700; }
.report-format-field select { width:100%; min-height:42px; }
.report-download { min-height:42px; white-space:nowrap; }
@media (max-width: 850px) { .admin-grid { grid-template-columns:1fr; } }
@media (max-width: 650px) {
  .report-row { grid-template-columns:minmax(0,1fr); align-items:stretch; gap:14px; }
  .report-actions { grid-template-columns:minmax(0,1fr) auto; }
}
@media (max-width: 390px) {
  .report-actions { grid-template-columns:minmax(0,1fr); }
  .report-download { width:100%; }
}
.queued-photo-item { width:100%; max-width:100%; box-sizing:border-box; align-content:start; overflow:hidden; cursor:pointer; }
.queued-photo-item:focus { outline:2px solid #176b5b; outline-offset:2px; }
.queued-photo-actions { position:static; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:6px; width:100%; min-width:0; padding-top:6px; }
.queued-photo-actions[hidden] { display:none; }
.queued-photo-actions .button { width:100%; min-width:0; min-height:34px; padding:6px 4px; overflow:hidden; font-size:11px; white-space:nowrap; }
@media (max-width: 390px) {
  .selected-image-list, .existing-image-list { grid-template-columns:minmax(0,1fr); }
  .selected-image-item img { aspect-ratio:16 / 10; }
}
