/* ================================================================
   M1 Components
   Reusable UI primitives: buttons, badges, cards, tables, nav, forms,
   modal, toast, pagination, autocomplete, action menu, multi-select,
   asset selector, filter bar, stat pills, toggle, empty state, etc.
   Loads after m1-tokens.css, before m1-pages.css.
   ================================================================ */

/* === Base === */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 13px; }

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

h1 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 15px; font-weight: 700; margin: 0 0 6px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }

/* === HTMX Request States === */
.htmx-request {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s;
}
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* === Focus (ADA) === */
:focus-visible {
  outline: 2px solid var(--m1-teal);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(39,107,110,0.25);
}

/* === Skip Nav (ADA) === */
.skip-nav {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--m1-dark-green);
  color: var(--m1-bone);
  padding: 8px 16px;
  font-weight: 600;
}
.skip-nav:focus { left: 0; }

/* === Navbar === */
.navbar {
  background: var(--color-nav-bg);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--content-padding);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.navbar-brand img { height: 24px; }
.navbar-brand span {
  color: var(--color-nav-text);
  font-weight: 700;
  font-size: 14px;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 24px;
  height: 100%;
}
.navbar-link {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.navbar-link[aria-current="page"] {
  font-weight: 700;
  border-bottom-color: var(--m1-electric-green);
  background: rgba(255,255,255,0.08);
}
.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.navbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--m1-olive);
  color: var(--m1-bone);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.navbar-user-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-nav-text);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.navbar-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 160px;
  padding: 4px 0;
  z-index: 200;
}
.user-menu { position: relative; }
.user-menu.open .navbar-dropdown { display: block; }
.navbar-dropdown a {
  display: block;
  padding: 8px 16px;
  color: var(--color-text);
  font-size: 13px;
  text-decoration: none;
}
.navbar-dropdown a:hover { background: var(--color-surface-alt); }
.navbar-dropdown .logout { color: var(--color-danger); }
.dev-badge {
  background: var(--m1-dutch-white);
  color: var(--m1-dark-green);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

/* === Navbar Mobile === */
.navbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--color-nav-text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 12px;
}
@media (max-width: 768px) {
  .navbar-hamburger { display: block; }
  .navbar-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-nav-bg);
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 99;
  }
  .navbar-links.open { display: flex; }
  .navbar-link {
    height: auto;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .navbar-link[aria-current="page"] {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    border-left: 3px solid var(--m1-electric-green);
  }
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover { background: var(--color-success-hover); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { background: var(--color-danger-hover); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--m1-border-secondary);
}
.btn-secondary:hover { background: var(--color-surface-alt); }

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--m1-border-secondary);
}
.btn-outline:hover { background: var(--color-surface-alt); }

.btn-group { display: inline-flex; gap: 4px; }

.page-header-actions { display: flex; align-items: center; gap: 8px; }

.btn-sm { padding: 3px 10px; font-size: 12px; position: relative; }
.btn-sm::after {
  content: "";
  position: absolute;
  inset: -8px;
}

/* Loading state for buttons during HTMX requests */
.btn-loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}
.btn-loading::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.5s linear infinite;
  margin-right: 4px;
  vertical-align: middle;
}

/* === Cards / Panels === */
/* .card — canonical definition lives in Phase C primitives block below */

.section-header {
  background: var(--color-section-header-bg);
  color: var(--color-section-header-text);
  padding: 6px 12px;
  font-weight: 700;
  font-size: 13px;
  margin: 0;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* === Tables ===
   Two table primitives:
   - .data-table (dense, used by fleet/contracts list components)
   - .table      (page-level tables — sortable headers, row-danger)
*/
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--color-table-header);
  color: #fff;
  font-weight: 700;
  padding: 6px 8px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--color-border-warm);
}
.data-table tbody tr:nth-child(even) {
  background: var(--color-surface-alt);
}
.data-table tbody tr:hover {
  background: var(--m1-bone-80);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  background: var(--m1-artichoke);
  color: #fff;
  font-weight: 700;
  padding: 6px 8px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid #e0ddd4;
}
.table tbody tr:nth-child(even) {
  background: var(--color-surface-alt);
}
.table tbody tr:hover {
  background: var(--m1-bone-80);
}
.table tbody tr.row-danger {
  background: rgba(132,53,45,0.06);
}
.table thead th a,
.data-table thead th a {
  color: inherit;
  text-decoration: none;
}
.table thead th a:hover,
.data-table thead th a:hover {
  text-decoration: underline;
}

/* Text overflow protection for table cells with long content */
.table tbody td,
.data-table tbody td {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table tbody td a,
.data-table tbody td a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
}

/* === Table Responsive Wrapper === */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* === Autocomplete === */
.ac-wrap { position: relative; }
.ac-container { position: absolute; z-index: 50; width: 100%; max-height: 260px; overflow-y: auto; }
.ac-list {
  list-style: none; margin: 2px 0 0; padding: 0;
  background: #fff; border: 1px solid var(--m1-sand); border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.ac-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--m1-sand);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item:focus { background: rgba(29,48,38,0.06); }
.ac-item.highlighted { background: rgba(29,48,38,0.10); }
.ac-part-id { font-weight: 600; white-space: nowrap; }
.ac-detail { color: var(--m1-olive); font-size: 12px; }
.ac-empty { padding: 10px 12px; color: var(--m1-olive); font-size: 12px; font-style: italic; }

/* === Forms === */
.form-group { margin-bottom: 12px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--color-text);
}
.form-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: 13px;
  background: var(--color-surface);
}
.form-input:focus {
  border-color: var(--m1-teal);
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary-focus);
}
.form-input.is-invalid { border-color: var(--color-danger); }
.form-error {
  font-size: 12px;
  color: var(--color-danger-text);
  margin-top: 2px;
}
.form-error::before { content: "\2717 "; }

.form-input-sm { padding: 3px 6px; font-size: 12px; }

/* === Form Grid ===
   Canonical 4-column grid. Page-scope additions live in m1-pages.css
   (dense vehicle variants, section-header accordions, per-input styling).
*/
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 14px;
  align-items: start;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; }

/* === Field Error (inline below input) === */
.field-error {
  font-size: 11px;
  color: var(--color-danger);
  display: block;
  margin-top: 1px;
}

/* === Alert Banners === */
.alert {
  padding: 8px 14px;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 500;
}
.alert-danger {
  background: rgba(132,53,45,0.08);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

/* === Badges === */
/* Option B: left-border accent, Palette 1 (lightness separation, colorblind-safe) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  border-left: 3px solid transparent;
}
.badge-lg {
  padding: 5px 14px;
  font-size: 14px;
  border-left-width: 4px;
}
.badge-success { background: color-mix(in srgb, var(--m1-success) 7%, transparent);  color: var(--m1-teal-dark);      border-left-color: var(--m1-teal-dark); }
.badge-danger  { background: rgba(139,46,36,0.07);   color: #8B2E24;                  border-left-color: #8B2E24; }
.badge-warning { background: rgba(148,108,20,0.07);  color: var(--color-warning-text); border-left-color: var(--color-warning-text); }
.badge-neutral { background: rgba(112,112,112,0.07); color: #707070;                  border-left-color: #707070; }
.badge-primary { background: rgba(45,58,46,0.07);    color: var(--m1-dark-green);      border-left-color: var(--m1-dark-green); }

/* === Stat Pills === */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--color-surface);
  border-radius: var(--border-radius);
  border-left: 3px solid #999;
  font-size: 13px;
  box-shadow: var(--shadow-card);
}
.stat-pill .shape { font-size: 10px; }
.stat-pill .label { color: var(--color-text-secondary); }
.stat-pill .value { font-weight: 700; }

/* Task-board filter pills: a .stat-pill that is also a clickable filter button.
   The colored bar is the inner .stat-pill-border span, so suppress the default
   grey border-left and lay the parts out as label + bold count. */
.stat-pill-btn {
  border-left: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  overflow: hidden;
  gap: 0;
  transition: box-shadow 0.12s ease, background 0.12s ease;
}
.stat-pill-btn .stat-pill-border { align-self: stretch; width: 4px; }
.stat-pill-btn .stat-pill-label { padding: 4px 4px 4px 10px; color: var(--color-text-secondary); }
.stat-pill-btn .stat-pill-value { padding: 4px 12px 4px 4px; font-weight: 700; }
.stat-pill-btn:hover { background: rgba(29, 48, 38, 0.06); }
.stat-pill-btn.is-active {
  background: rgba(29, 48, 38, 0.10);
  box-shadow: inset 0 0 0 1px var(--m1-olive), var(--shadow-card);
}
.stat-pill-btn.is-active .stat-pill-label { color: var(--color-text); font-weight: 600; }

/* My-Tasks toggle styled to sit beside the filter pills. */
.task-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
}
.task-toggle.is-active {
  box-shadow: inset 0 0 0 1px var(--m1-olive), var(--shadow-card);
  background: rgba(29, 48, 38, 0.08);
}

/* === Stat Grid (responsive stat pill layout) === */
.stat-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-grid .stat-pill { flex: 1 1 auto; min-width: 120px; }

/* === Toggle === */
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}
.toggle {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--m1-toggle-off);
  border-radius: 10px;
  transition: background 0.2s;
}
.toggle .slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .slider { background: var(--color-success); }
.toggle input:checked + .slider::before { transform: translateX(16px); }

/* === Close Button (base — used in modals, toasts) === */
.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  color: inherit;
  opacity: 0.65;
  border-radius: var(--border-radius);
  transition: opacity 0.15s;
}
.close-btn:hover { opacity: 1; }

/* === Toast === */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 8px);
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--border-radius);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
  min-width: 280px;
}
.toast-success { background: var(--color-success); color: #fff; }
.toast-warning { background: var(--color-warning); color: var(--color-text); }
.toast-error { background: var(--color-danger); color: #fff; }
.toast .close-btn {
  margin-left: auto;
  font-size: 16px;
}
.toast.dismissing {
  animation: toast-out 0.3s ease forwards;
  pointer-events: none;
}

/* === Modal === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 900;
  display: none;
}
.modal-backdrop.active { display: flex; align-items: center; justify-content: center; }
.modal {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-warm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}
.modal-body { padding: 16px; }
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-warm);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  margin-top: 12px;
}
.pagination .info { color: var(--color-text-muted); margin-right: auto; }
.pagination .page-btn {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 12px;
}
.pagination .page-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.pagination .page-btn:hover:not(.active) { background: var(--color-surface-alt); }

/* === Filter Bar === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px var(--content-padding);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-warm);
  flex-wrap: wrap;
}
.filter-bar .form-input { width: auto; min-width: 150px; }

/* === File Upload === */
.file-upload-zone {
  border: 2px dashed var(--m1-border-secondary);
  border-radius: var(--border-radius);
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.file-upload-zone:hover,
.file-upload-zone.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

/* === Document Upload (#250 refinement) ===
   Compact themed toolbar for the inline uploader on MLA / Contract detail
   pages. Reuses design tokens and keeps the existing HTMX form wiring; the
   native file input is visually hidden and driven by a styled button +
   filename readout (handlers delegated in app.js). */

/* Hide the native file input; we drive it from a styled trigger button. */
.doc-up [type="file"] { position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The picked-file readout (filename + size). */
.doc-up-file {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-up-file.has-file { color: var(--color-text); font-weight: 500; }

/* Compact themed toolbar. */
.doc-up-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border-warm);
}
.doc-up-toolbar .form-group { margin-bottom: 0; }
.doc-up-toolbar .doc-up-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 220px;
}
.doc-up-toolbar .doc-up-file { flex: 1 1 auto; }
.doc-up-toolbar .doc-up-submit { margin-left: auto; }

/* === Multi-Select === */
.ms-container { position: relative; }
.ms-input-area {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 32px;
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  cursor: text;
  transition: border-color 0.15s;
}
.ms-input-area:focus-within {
  border-color: var(--m1-teal);
  box-shadow: 0 0 0 2px var(--color-primary-focus);
}

.ms-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  background: var(--m1-bone-80);
  border: 1px solid var(--m1-border-secondary);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.ms-chip-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.ms-chip-remove:hover { color: var(--color-danger); }

.ms-input {
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 13px;
  flex: 1;
  min-width: 80px;
  padding: 2px 4px;
  background: transparent;
}

.ms-listbox {
  display: none;
  position: absolute;
  z-index: 50;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  list-style: none;
  margin: 0;
  padding: 0;
}
.ms-container.open .ms-listbox { display: block; }

.ms-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}
.ms-option:hover,
.ms-option.highlighted { background: var(--m1-bone-60); }
.ms-option[aria-selected="true"] { background: var(--color-primary-selected); }
.ms-option.hidden { display: none; }
.ms-check {
  width: 16px;
  height: 16px;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  color: var(--color-primary);
}
.ms-option[aria-selected="true"] .ms-check {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* === Action Menu === */
.am-container { position: relative; display: inline-block; }
.am-trigger {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  padding: 2px 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--color-text-muted);
  transition: background 0.1s, color 0.1s;
}
.am-trigger:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-color: #ccc;
}

.am-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 60;
  min-width: 160px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px 0;
}
.am-container.open .am-menu { display: block; }

.am-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background 0.1s;
}
.am-item:hover { background: var(--m1-bone-60); }
.am-danger { color: var(--color-danger); }
.am-danger:hover { background: var(--color-danger-subtle); }
.am-icon { width: 16px; text-align: center; flex-shrink: 0; }
.am-divider { height: 1px; background: var(--color-border-warm); margin: 4px 0; }

/* === Batch Action Bar === */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--content-padding);
  background: var(--m1-dark-green);
  color: var(--m1-bone);
  border-radius: var(--border-radius);
  margin-bottom: 8px;
}
.batch-bar.hidden { display: none; }
.batch-count { font-weight: 600; font-size: 13px; }
.batch-actions { display: flex; gap: 6px; margin-left: auto; }
.batch-clear {
  background: transparent;
  color: var(--m1-bone);
  border-color: rgba(230,225,210,0.3);
}
.batch-clear:hover { background: rgba(255,255,255,0.1); }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-text-muted);
}
.empty-state-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.empty-state-text { font-size: 13px; margin-bottom: 16px; }

/* === Text Overflow === */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Layout Utilities === */
.content { padding: var(--content-padding); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.hidden { display: none !important; }
.flex-wrap { flex-wrap: wrap; }
.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.max-w-320 { max-width: 320px; }
.max-w-400 { max-width: 400px; }
.card-flush { padding: 0; overflow: hidden; }
.card-body { border-radius: 0 0 var(--border-radius) var(--border-radius); }
.col-w-36 { width: 36px; }
.col-w-40 { width: 40px; }

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Responsive: Tablet (768px - 1199px) === */
@media (max-width: 1199px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid .span-3,
  .form-grid .span-4 { grid-column: span 2; }

  .stat-pill { padding: 6px 14px; min-height: 44px; }
  .btn { min-height: 44px; padding: 8px 16px; }
  .btn-sm { min-height: 36px; padding: 5px 12px; }

  /* Touch targets for small interactive elements */
  .am-trigger { min-height: 44px; min-width: 44px; justify-content: center; }
  .ms-chip-remove { min-height: 28px; min-width: 28px; padding: 4px 6px; }
  .data-table input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }

  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-bar .form-input { min-width: 0; flex: 1 1 140px; }
}

/* === Responsive: Mobile (<768px) === */
@media (max-width: 767px) {
  html { font-size: 14px; }
  .content { padding: 12px; }

  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 { grid-column: span 1; }

  .flex-between { flex-direction: column; align-items: flex-start; gap: 8px; }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .form-input { width: 100%; min-width: 0; }

  .stat-pill {
    width: 100%;
    min-height: 44px;
    padding: 8px 14px;
  }

  .btn { min-height: 44px; }

  .pagination { flex-wrap: wrap; }
  .pagination .info { width: 100%; margin-bottom: 8px; }

  .modal { width: 95%; max-width: none; }

  .batch-bar { flex-wrap: wrap; }
  .batch-actions { width: 100%; justify-content: flex-start; margin-left: 0; }

  /* Touch-friendly table rows */
  .data-table tbody td { padding: 8px; }
}
/* ═══════════════════════════════════════════════════════════════════════════
 * m1-brand.css — ADDITIONS for Login + Dashboard refresh (Phase B PR)
 *
 * HOW TO APPLY: append this block to the END of static/css/m1-brand.css.
 * No existing rules are changed or deleted. New selectors are either
 * (a) promoted from the login page's inline <style>, or (b) new utilities
 * required by the dashboard / navbar refresh.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* === Icons (Lucide) ======================================================== */
/* All <i data-lucide> elements get this base treatment. They're hydrated into
   SVGs on the client; these rules apply to both the placeholder and the SVG. */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: -0.15em;
  color: currentColor;
  stroke: currentColor;
  stroke-width: 1.75;
}
.icon svg { display: block; width: 100%; height: 100%; }
.icon-12 { width: 12px; height: 12px; }
.icon-14 { width: 14px; height: 14px; }
.icon-16 { width: 16px; height: 16px; }
.icon-20 { width: 20px; height: 20px; }
.icon-24 { width: 24px; height: 24px; }
.icon-36 { width: 36px; height: 36px; }

.icon-muted       { color: var(--color-text-muted); }
.icon-muted-nav   { color: var(--m1-sand); }           /* for dark navbar */
.icon-success     { color: var(--color-success); }
.icon-danger      { color: var(--color-danger); }
.icon-warning     { color: var(--color-warning-text); }
.icon-input {
  /* used inside .input-with-icon — absolutely positioned */
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  z-index: 1;
}

.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-left: 30px; }

/* === Breadcrumb ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 600;
}
.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--color-link-on-light);
  text-decoration: underline;
}
.breadcrumb-separator {
  color: var(--m1-border-secondary);
  font-weight: 400;
}
.breadcrumb-current {
  color: var(--color-text);
}

/* Navbar user chip refinements (keep existing .navbar-user-btn behavior) */
.navbar-user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Stat pill icon slot =================================================== */
/* Adds an icon slot inside .stat-pill. Backward-compatible: pills without
   .stat-pill-icon children keep rendering exactly as before. */
.stat-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}
.stat-pill .label { white-space: nowrap; }
.stat-pill .value { margin-left: 2px; }

/* === Action required — icon slot =========================================== */
.action-required-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}
.action-required-heading .icon { color: var(--color-danger); }

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* === Auth pages (Login today; any auth surface tomorrow) =================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--m1-dark-green);
  background-size: cover;
  background-position: center;
  position: relative;
}
.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  /* dark-green overlay: heavier top-left, lighter bottom-right */
  background: linear-gradient(160deg, rgba(29,48,38,0.72) 0%, rgba(29,48,38,0.45) 100%);
}
.auth-container {
  position: relative;
  z-index: 1;
  text-align: center;
  width: 90%;
  max-width: 380px;
}
.auth-logo { margin-bottom: 28px; }
.auth-logo img {
  height: 44px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.auth-card {
  background: rgba(230,225,210,0.88);         /* bone @ 88% — warm glass */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(230,225,210,0.3);
  border-radius: var(--border-radius-lg);
  padding: 36px 32px 28px;
  color: var(--m1-dark-green);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--m1-dark-green);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.auth-subtitle {
  font-size: 12px;
  color: var(--m1-olive);
  margin-bottom: 24px;
  letter-spacing: 0.03em;
}
.auth-card .form-group { margin-bottom: 16px; text-align: left; }
.auth-card .form-label {
  color: var(--m1-dark-green);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.auth-card .form-input {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(89,97,82,0.2);
  color: var(--m1-dark-green);
  padding: 8px 10px;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.auth-card .input-with-icon .form-input {
  padding-left: 32px;
}
.auth-card .form-input::placeholder {
  color: var(--m1-olive);
  opacity: 0.6;
}
.auth-card .form-input:focus {
  border-color: var(--m1-teal);
  background: rgba(255,255,255,0.8);
  box-shadow: 0 0 0 3px rgba(39,107,110,0.25);
}

.password-wrap { position: relative; }
.password-wrap .form-input { padding-right: 56px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  border-radius: var(--border-radius);
  color: var(--m1-olive);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 12px;
  font-family: var(--font-family);
  letter-spacing: 0.03em;
  transition: color 0.15s;
}
.password-toggle:hover { color: var(--m1-dark-green); }
.password-toggle:focus-visible {
  outline: 2px solid var(--m1-teal);
  outline-offset: 1px;
}

/* Microsoft / Entra SSO button */
.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: var(--m1-teal);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  min-height: 44px;
}
.btn-microsoft:hover {
  background: var(--m1-slate-gray);
  color: #fff;
  text-decoration: none;
}
.btn-microsoft:active { transform: scale(0.98); }
.btn-microsoft:focus-visible {
  outline: 2px solid var(--m1-dark-green);
  outline-offset: 2px;
}
.btn-microsoft.is-loading,
.btn-auth.is-loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: wait;
}

/* Local-auth submit button — same dimensions as Microsoft button for alignment */
.btn-auth {
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  font-size: 14px;
  min-height: 44px;
  transition: background 0.15s, transform 0.1s;
}
.btn-auth:active { transform: scale(0.98); }
.btn-auth:focus-visible {
  outline: 2px solid var(--m1-dark-green);
  outline-offset: 2px;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(132,53,45,0.1);
  border: 1px solid rgba(132,53,45,0.3);
  border-radius: var(--border-radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--m1-burnt-dark);
  text-align: left;
}
.auth-error .icon { flex-shrink: 0; margin-top: 1px; color: var(--m1-burnt-dark); }

.auth-help {
  margin-top: 16px;
  font-size: 12px;
  font-weight: 400;
  color: var(--m1-olive-dark);
}
.auth-help a {
  color: var(--m1-teal-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
  transition: color 0.15s;
}
.auth-help a:hover { color: var(--m1-dark-green); }

.auth-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(29,48,38,0.12);
  font-size: 10px;
  font-weight: 400;
  color: var(--m1-olive);
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px 24px;
    border-radius: var(--border-radius);
  }
  .auth-container { width: 94%; }
  .auth-card .form-input {
    padding: 10px 12px;
    font-size: 16px;                  /* prevent iOS zoom on focus */
  }
  .auth-card .input-with-icon .form-input { padding-left: 34px; }
  .password-wrap .form-input { padding-right: 60px; }
  .password-toggle { padding: 6px 8px; }
}

/* ============================================================
   Phase C — Contracts + Fleet primitives
   Card, data-table toolbar, status dots, detail-page layout,
   meta-grid, tab-strip, timeline, doc-list, integration rows.
   ============================================================ */


/* ---------- 1. Card primitive ------------------------------- */
/* NOTE: should be promoted into m1-brand.css; see INCONSISTENCIES #1 */
.card{
  background: var(--color-surface);
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card h3.card-title{
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--m1-olive);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card + .card{ margin-top: 12px; }

/* Nested subsection inside a card (e.g. Billing & Payment inside Contract terms) */
.card-section{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-warm);
}
.card-section-title{
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--m1-olive);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-section-title i{ width: 12px; height: 12px; }

/* Count chip used in card titles: "Concessions & notes [4]" */
.count-chip{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: var(--m1-bone);
  color: var(--m1-olive-dark);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 9px;
  letter-spacing: .02em;
}

/* Missing semantic from Phase B (see INCONSISTENCIES #2) */
.badge-info{
  background: rgba(39,107,110,0.08);
  color: var(--m1-teal-dark);
  border-left-color: var(--m1-teal-dark);
}


/* ---------- 2. Data-table toolbar --------------------------- */
.data-table-toolbar{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px var(--content-padding);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-warm);
  flex-wrap: wrap;
}
.dtt-search{
  flex: 1;
  max-width: 320px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--m1-olive-dark);
}
.dtt-search input{
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--color-text);
}
.dtt-search input::placeholder{ color: var(--m1-placeholder); }
.dtt-filters{ display: flex; gap: 6px; flex-wrap: wrap; }

.filter-chip{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-warm);
  border-radius: 14px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}
.filter-chip:hover{ background: var(--m1-bone-60); }
.filter-chip.active{
  background: var(--m1-dark-green);
  color: var(--m1-bone);
  border-color: var(--m1-dark-green);
}
.filter-chip .count{
  background: rgba(255,255,255,.18);
  padding: 0 5px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 700;
}
.filter-chip:not(.active) .count{
  background: var(--m1-bone);
  color: var(--m1-olive-dark);
}

.dtt-spacer{ flex: 1; }
.dtt-view{
  display: inline-flex;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius);
  padding: 2px;
}
.dtt-view button{
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: 11.5px;
  color: var(--m1-olive-dark);
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.dtt-view button.active{
  background: var(--color-surface);
  color: var(--m1-dark-green);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}


/* ---------- 3. Bulk bar (compact) --------------------------- */
.bulk-bar-compact{
  background: var(--m1-dark-green);
  color: var(--m1-bone);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}
.bulk-bar-compact .sel-count{
  background: var(--m1-electric-green);
  color: var(--m1-dark-green);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 11.5px;
}
.bulk-bar-compact .bbc-actions{ margin-left: auto; display: flex; gap: 6px; }
.bulk-bar-compact button{
  background: rgba(255,255,255,.1);
  color: var(--m1-bone);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--border-radius);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  font-weight: 500;
}
.bulk-bar-compact button:hover{ background: rgba(255,255,255,.18); }
.bulk-bar-compact .bb-close{ background: transparent; border: none; opacity: .7; }


/* ---------- 4. Tables --------------------------------------- */
.tbl{
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: var(--color-surface);
}
.tbl thead th{
  background: var(--m1-bone);
  color: var(--m1-olive-dark);
  font-weight: 600;
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--color-border-warm);
  white-space: nowrap;
  position: relative;
}
.tbl thead th.sortable{ cursor: pointer; padding-right: 22px; }
.tbl thead th.sortable [data-lucide]{
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--m1-artichoke);
  width: 11px;
  height: 11px;
}
.tbl thead th.sorted{ color: var(--m1-dark-green); }
.tbl thead th.sorted [data-lucide]{ color: var(--m1-dark-green); }
.tbl thead th.check{ width: 26px; padding-left: 14px; }
.tbl tbody td{
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border-warm);
  vertical-align: middle;
}
.tbl tbody tr:hover{ background: var(--m1-bone-60); }
.tbl tbody tr.selected{ background: #F3F6EC; }
.tbl tbody tr.selected:hover{ background: #EDF1E3; }
.tbl a.row-link{
  color: var(--m1-teal-dark);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 12px;
}
.tbl .muted{ color: var(--m1-olive); }
.tbl input[type="checkbox"]{
  accent-color: var(--m1-teal);
  width: 13px;
  height: 13px;
  cursor: pointer;
}


/* ---------- 5. Status dots + badges (7 fleet states) -------- */
.status-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3px currentColor;
  margin: 0 2px;
}
.sd-available   { color: #4A7856; }
.sd-onrent      { color: var(--m1-teal-dark); }
.sd-onboarding  { color: #C89B2E; }
.sd-offboarding { color: var(--m1-artichoke); }
.sd-inservice   { color: var(--m1-amber); }
.sd-sold        { color: #6B6E5C; }
.sd-totalloss   { color: var(--m1-burnt-dark); }

.badge [data-lucide]{ width: 11px; height: 11px; }
.badge-onrent       { background: rgba(30,85,87,.08);  color: var(--m1-teal-dark);  border-left-color: var(--m1-teal-dark); }
.badge-onboarding   { background: rgba(200,155,46,.09); color: #8F6A10;              border-left-color: #C89B2E; }
.badge-offboarding  { background: rgba(115,118,96,.1);  color: var(--m1-artichoke);  border-left-color: var(--m1-artichoke); }
.badge-inservice    { background: rgba(148,108,20,.08); color: var(--m1-amber);      border-left-color: var(--m1-amber); }
.badge-sold         { background: rgba(107,110,92,.1);  color: #5A5D4D;              border-left-color: #6B6E5C; }
.badge-totalloss    { background: rgba(107,42,36,.08);  color: var(--m1-burnt-dark); border-left-color: var(--m1-burnt-dark); }
.badge-neutral      { background: rgba(112,112,112,.07); color: #6A6A6A;             border-left-color: #8C8C8C; }


/* ---------- 6. VIN cell ------------------------------------- */
.vin{
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-feature-settings: "liga" 0;
  letter-spacing: -.01em;
  user-select: all;
  color: var(--m1-olive-dark);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.vin .copy{
  opacity: 0;
  transition: opacity .1s;
  color: var(--m1-artichoke);
  cursor: pointer;
  display: inline-flex;
}
tr:hover .vin .copy{ opacity: 1; }


/* ---------- 7. Availability bar (reserved for future) ------- */
/* See INCONSISTENCIES #11: utilization column deferred. */
.avail-bar{
  width: 100px;
  height: 6px;
  background: var(--m1-bone-80);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}
.avail-bar .seg-onrent    { background: var(--m1-teal-dark); }
.avail-bar .seg-available { background: #4A7856; }
.avail-bar .seg-service   { background: var(--m1-amber); }
.avail-label{
  font-size: 11px;
  color: var(--m1-olive);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}


/* ---------- 8. Pagination (Phase C data-table variant) ------ */
/* Scoped under .data-table-pagination so it does not override the
   existing .pagination primitive used by components/pagination.html. */
.data-table-pagination{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-warm);
  font-size: 12px;
  color: var(--m1-olive-dark);
}
.data-table-pagination .showing{ margin-right: auto; }
.pg-btn{
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-warm);
  background: var(--color-surface);
  border-radius: var(--border-radius);
  color: var(--m1-olive-dark);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.pg-btn:hover{ background: var(--m1-bone-60); }
.pg-btn.active{
  background: var(--m1-dark-green);
  color: var(--m1-bone);
  border-color: var(--m1-dark-green);
  font-weight: 700;
}
.pg-btn.disabled{ opacity: .35; cursor: not-allowed; }
.pg-sep{ color: var(--m1-artichoke); }
.pg-jump{ display: flex; align-items: center; gap: 4px; font-size: 11.5px; }
.pg-jump input{
  width: 44px;
  height: 24px;
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius);
  padding: 0 6px;
  font-family: inherit;
  font-size: 11.5px;
  text-align: center;
}


/* ---------- 9. Tab strip ------------------------------------ */
.tab-strip{
  display: flex;
  gap: 2px;
  padding: 0 var(--content-padding);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-warm);
  overflow-x: auto;
}
.tab-strip button,
.tab-strip a{
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--m1-olive-dark);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  white-space: nowrap;
  text-decoration: none;
}
.tab-strip button:hover,
.tab-strip a:hover{ color: var(--m1-dark-green); }
.tab-strip button.active,
.tab-strip a.active{
  color: var(--m1-dark-green);
  border-bottom-color: var(--m1-teal);
  font-weight: 700;
}
.tab-strip .tab-count{
  background: var(--m1-bone);
  color: var(--m1-olive-dark);
  padding: 0 6px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 600;
}
.tab-strip button.active .tab-count,
.tab-strip a.active .tab-count{
  background: var(--m1-teal);
  color: #fff;
}


/* ---------- 10. Detail page layout -------------------------- */
.detail-header{
  padding: 14px var(--content-padding) 10px;
  background: var(--color-bg);
}
.detail-header-row{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 8px;
}
.detail-title{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.detail-title h1{ margin: 0; font-size: 22px; letter-spacing: -.01em; }
.detail-actions{
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.detail-layout{ padding: 16px var(--content-padding); background: var(--color-bg); }

/* Weighted 2-col for both contract and fleet. Collapses to single column < 1281px. */
.detail-body{ display: grid; gap: 14px; align-items: start; }
.detail-body .card{ margin: 0; }

/* Contract variant */
.detail-body.layout-weighted:not(.layout-fleet){
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.detail-body.layout-weighted:not(.layout-fleet) .contract-main{
  flex: 1.55;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.detail-body.layout-weighted:not(.layout-fleet) .contract-rail{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Fleet variant — 2fr / 1fr for map + DMV + integrations rail */
.detail-body.layout-weighted.layout-fleet{
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.detail-body.layout-weighted.layout-fleet .fleet-main{
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.detail-body.layout-weighted.layout-fleet .fleet-rail{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Collapse both variants on narrow viewports */
@media (max-width: 1280px){
  .detail-body.layout-weighted,
  .detail-body.layout-weighted.layout-fleet{
    flex-direction: column;
  }
}


/* ---------- 11. Meta grid ----------------------------------- */
.meta-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
}
.meta-grid.two  { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.meta-grid.three{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.meta-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.meta-grid dt{
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--m1-olive);
  font-weight: 600;
  margin-bottom: 2px;
}
.meta-grid dd{
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--m1-dark-green);
  font-weight: 500;
}
.meta-grid dd.mono{ font-family: var(--font-mono); font-size: 12px; }


/* ---------- 12. Contract-specific: fees, signatures, notes - */
.fee-table{ width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fee-table th{
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--m1-olive);
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid var(--color-border-warm);
}
.fee-table td{
  padding: 6px;
  border-bottom: 1px dashed var(--color-border-warm);
  color: var(--m1-dark-green);
}
.fee-table tr:last-child td{ border-bottom: none; }
.fee-table td.num{ text-align: right; font-variant-numeric: tabular-nums; }

.sig-row{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--color-border-warm);
}
.sig-row:last-child{ border-bottom: none; }
.sig-row:first-child{ padding-top: 2px; }
.sig-role{
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--m1-olive);
  grid-column: 1 / -1;
  margin-bottom: 2px;
}
.sig-name   { font-size: 13.5px; font-weight: 600; color: var(--m1-dark-green); line-height: 1.2; }
.sig-title  { font-size: 11.5px; color: var(--m1-olive); margin-top: 1px; }
.sig-company{ font-size: 11.5px; color: var(--m1-olive); margin-top: 1px; }
.sig-email  { font-size: 11.5px; color: var(--m1-olive); font-family: var(--font-mono); margin-top: 4px; display: block; }
.sig-email a{ color: var(--m1-teal-dark); }
.sig-date{
  font-size: 11px;
  color: var(--m1-olive);
  font-variant-numeric: tabular-nums;
  text-align: right;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sig-date .sig-date-label{
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--m1-artichoke);
}
.sig-date .sig-date-val{ font-size: 12px; color: var(--m1-dark-green); font-weight: 600; }

/* Concession/note rows — two tag slots: (type) + (source) */
.note-item{
  padding: 10px 0;
  border-bottom: 1px dashed var(--color-border-warm);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
}
.note-item:first-child{ padding-top: 2px; }
.note-item:last-child { border-bottom: none; padding-bottom: 2px; }
.note-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  grid-column: 1 / -1;
}
.note-tag{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.note-tag i{ width: 11px; height: 11px; }
.note-tag.concession      { background: rgba(39,107,110,.12); color: var(--m1-teal-dark); }
.note-tag.note            { background: rgba(115,118,96,.14); color: var(--m1-olive-dark); }
.note-tag.source-mla      { background: rgba(212,165,116,.18); color: #8a5a2b; }
.note-tag.source-contract { background: rgba(39,107,110,.08); color: var(--m1-dark-green); }
.note-body{
  grid-column: 1 / -1;
  font-size: 13px;
  line-height: 1.5;
  color: var(--m1-dark-green);
}
.note-body .mla-ref{
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #8a5a2b;
  font-weight: 600;
}


/* ---------- 13. Fleet-specific: telematics + integrations --- */

/* Full-width assignment card above fleet-detail tabs */
.assignment-card{
  border-left: 3px solid var(--m1-teal);
  background: var(--color-surface);
  margin-bottom: 14px;
}
.assignment-card .card-title{ color: var(--m1-teal-dark); }

/* Compact live-telematics strip */
.tele-strip{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius-lg);
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  font-size: 12.5px;
}
.tele-strip .ts-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--m1-dark-green);
  color: #fff;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tele-strip .pulse-dot{
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--m1-electric-green);
  box-shadow: 0 0 0 0 rgba(170,211,114,.7);
  animation: ts-pulse 1.8s infinite;
}
@keyframes ts-pulse{
  0%  { box-shadow: 0 0 0 0 rgba(170,211,114,.7); }
  70% { box-shadow: 0 0 0 6px rgba(170,211,114,0); }
  100%{ box-shadow: 0 0 0 0 rgba(170,211,114,0); }
}
.tele-strip .ts-item{ display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tele-strip .ts-item dt{
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--m1-olive);
  font-weight: 600;
}
.tele-strip .ts-item dd{ margin: 0; font-size: 12.5px; font-weight: 500; color: var(--m1-dark-green); }
.tele-strip .ts-item.mono dd{ font-family: var(--font-mono); font-size: 11.5px; }
.tele-strip .ts-sep{ width: 1px; align-self: stretch; background: var(--color-border-warm); }
.tele-strip .ts-spacer{ flex: 1; }
.tele-strip .ts-link{
  font-size: 11.5px;
  color: var(--m1-teal-dark);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.tele-strip .ts-link:hover{ color: var(--m1-teal); }

/* Static map placeholder card */
.tele-map{
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: #F4F2EB;
}
.tele-map-canvas{
  position: relative;
  height: 130px;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(39,107,110,0.10), transparent 60%),
    linear-gradient(180deg, #EEEBE0 0%, #E1DECF 100%);
}
.tele-map-canvas svg{ width: 100%; height: 100%; display: block; }
.tele-pin{
  position: absolute;
  transform: translate(-50%,-100%);
  color: var(--m1-burnt-umber);
  filter: drop-shadow(0 2px 3px rgba(29,48,38,0.35));
}
.tele-pin [data-lucide]{
  width: 22px;
  height: 22px;
  stroke-width: 2.25;
  fill: var(--m1-burnt-umber);
  color: #fff;
}
.tele-pin .pulse{
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--m1-burnt-umber);
  opacity: .55;
  animation: tele-pulse 2s ease-out infinite;
}
@keyframes tele-pulse{
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(3.2); opacity: 0; }
}
.tele-map-meta{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-warm);
}
.tele-addr { font-size: 13px; color: var(--m1-dark-green); font-weight: 600; }
.tele-coord{ font-family: var(--font-mono); font-size: 10.5px; color: var(--m1-olive); margin-top: 1px; }
.tele-expand{
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m1-olive);
  border: 1px solid var(--color-border-warm);
  background: var(--color-surface-alt);
  flex: none;
}
.tele-expand:hover{ background: var(--m1-bone); color: var(--m1-dark-green); }
.tele-expand [data-lucide]{ width: 13px; height: 13px; }

/* Integrations list */
.integ-list{ display: flex; flex-direction: column; gap: 4px; }
.integ-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  text-decoration: none;
  color: inherit;
  transition: background .1s, border-color .1s;
}
.integ-row:hover{ background: var(--m1-bone-60); border-color: var(--m1-sand); }
.integ-row.integ-disabled{
  opacity: .58;
  pointer-events: none;
  background: var(--color-surface-alt);
}
.integ-logo{
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .02em;
  overflow: hidden;
}
.integ-logo img{ width: 22px; height: 22px; object-fit: contain; }
.integ-geotab  { background: #14457B; }
.integ-fleetio { background: #2A9D73; }
.integ-excede  { background: var(--m1-dark-green); }
.integ-samsara { background: #1A1A1A; }
.integ-meta{ flex: 1; min-width: 0; }
.integ-name{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--m1-dark-green);
  display: flex;
  align-items: center;
  gap: 8px;
}
.integ-sub{ font-size: 11px; color: var(--m1-olive); margin-top: 1px; }
.integ-status{
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid currentColor;
}
.integ-status.live{ color: #4A7856;             background: rgba(74,120,86,.08); }
.integ-status.soon{ color: var(--m1-amber);     background: rgba(148,108,20,.08); }
.integ-status.off { color: var(--m1-artichoke); background: rgba(115,118,96,.08); }
.integ-actions{ display: flex; gap: 6px; flex: none; margin-left: auto; }
.integ-actions .btn{ padding: 4px 8px; font-size: 11px; }
.integ-actions .btn i{ width: 12px; height: 12px; }


/* ---------- 14. Timeline (activity feed) -------------------- */
.timeline{ position: relative; padding-left: 22px; }
.timeline::before{
  content: "";
  position: absolute;
  left: 9px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--color-border-warm);
}
.tl-item{ position: relative; padding-bottom: 14px; }
.tl-item:last-child{ padding-bottom: 0; }
.tl-icon{
  position: absolute;
  left: -22px;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m1-olive-dark);
}
.tl-icon [data-lucide]{ width: 11px; height: 11px; }
.tl-icon.success{ color: #4A7856; border-color: #4A7856; }
.tl-icon.info   { color: var(--m1-teal-dark); border-color: var(--m1-teal-dark); }
.tl-icon.warn   { color: var(--m1-amber); border-color: var(--m1-amber); }
.tl-line{ font-size: 12.5px; line-height: 1.4; }
.tl-line strong{ font-weight: 600; color: var(--m1-dark-green); }
.tl-detail{ font-size: 11.5px; color: var(--m1-olive); margin-top: 2px; }
.tl-time  { font-size: 11px;   color: var(--m1-artichoke); margin-top: 2px; }


/* ---------- 15. Document list ------------------------------- */
.doc-list{ display: flex; flex-direction: column; gap: 4px; }
.doc-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--color-border-warm);
  border-radius: var(--border-radius);
  background: var(--color-surface);
}
.doc-row:hover{ background: var(--m1-bone-60); }
.doc-icon{
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius);
  background: var(--m1-bone);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m1-olive-dark);
  flex: none;
}
.doc-icon.pdf{ background: rgba(107,42,36,.1); color: var(--m1-burnt-dark); }
.doc-icon.xls{ background: rgba(74,120,86,.1); color: #4A7856; }
.doc-icon.img{ background: rgba(30,85,87,.1); color: var(--m1-teal-dark); }
.doc-meta{ flex: 1; min-width: 0; }
.doc-name{ font-size: 12.5px; font-weight: 500; color: var(--m1-dark-green); }
.doc-sub{ font-size: 11px; color: var(--m1-olive); display: flex; gap: 8px; }
.doc-actions{ display: flex; gap: 4px; }


/* ---------- 16. Form section summary (collapsible) ---------- */
.form-section > summary{
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--m1-olive-dark);
  font-weight: 600;
}
.form-section > summary::-webkit-details-marker{ display: none; }
.form-section > summary > [data-lucide]{
  width: 14px;
  height: 14px;
  color: var(--m1-olive);
}
