/*
 * Fleet Management System — Industrial Thai Modern Design System
 * Theme: Warehouse Logbook × Thai Logistics
 * Palette: Dark grays, Thai gold accents, safety orange warnings
 */

/* ═══════════════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════════════════ */

:root {
  /* Warehouse Grays */
  --gray-950: #0a0a0a;
  --gray-900: #141414;
  --gray-850: #1a1a1a;
  --gray-800: #262626;
  --gray-750: #2a2a2a;
  --gray-700: #404040;
  --gray-600: #525252;
  --gray-500: #737373;
  --gray-400: #a3a3a3;

  /* Thai Gold */
  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-600: #d97706;

  /* Safety Orange */
  --orange-500: #f97316;
  --orange-600: #ea580c;

  /* Industrial Teal — must match Taoyen :root (taoyen.css loads first; this file overwrites :root) */
  --teal-500: #0d9488;
  --teal-600: #0f766e;

  /* Status Colors */
  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
  --purple: #a855f7;
  --amber: #fbbf24;

  /* Surfaces */
  --bg-primary: var(--gray-900);
  --bg-card: var(--gray-850);
  --bg-input: var(--gray-800);
  --bg-hover: rgba(255,255,255,0.03);
  --bg-active: rgba(245,158,11,0.1);

  /* Borders */
  --border-subtle: rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.16);
  --border-gold: rgba(245,158,11,0.4);

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: var(--gray-400);
  --text-muted: var(--gray-600);
  --text-gold: var(--gold-400);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-gold: 0 4px 16px rgba(245,158,11,0.25);

  /* Transitions */
  --nav-transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY
════════════════════════════════════════════════════════════════ */

/* Body & Base — dark “industrial” theme only when not using Taoyen app shell */
body:not(.ty-app) {
  font-family: 'IBM Plex Sans', 'Sarabun', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Thai Display - Page Titles */
.fms-title-thai,
.fms-page-title {
  font-family: 'Charmonman', serif;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-gold);
}

.fms-title-thai {
  font-size: 36px;
}

.fms-page-title {
  font-size: 42px;
  letter-spacing: 0.02em;
}

/* Latin Display - Headings (dark theme pages only) */
body:not(.ty-app) h1,
body:not(.ty-app) h2,
body:not(.ty-app) h3,
body:not(.ty-app) h4,
body:not(.ty-app) h5,
body:not(.ty-app) h6 {
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin: 0;
}

body:not(.ty-app) h1 { font-size: 32px; line-height: 1.2; }
body:not(.ty-app) h2 { font-size: 24px; line-height: 1.3; }
body:not(.ty-app) h3 { font-size: 18px; line-height: 1.4; }

/* Technical/Code - Monospace */
code, pre, .mono, .tabular {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* Labels - Small & Technical */
label, .fms-label {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/*
 * Login (Devise) — this file loads *last* in application.html.erb.
 * body:not(.ty-app) above sets light text on the document; form fields with white
 * backgrounds inherit that color, so typed text disappears unless overridden.
 * If dashboard.css is missing, stale, or 404 on deploy, these rules still apply.
 */
.auth-container .auth-card input[type="email"],
.auth-container .auth-card input[type="password"],
.auth-container .auth-card input[type="text"],
.auth-container .auth-card textarea {
  color: #1e293b !important;
  -webkit-text-fill-color: #1e293b !important;
  background-color: #ffffff !important;
}

.auth-container .auth-card input:-webkit-autofill,
.auth-container .auth-card input:-webkit-autofill:hover,
.auth-container .auth-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #1e293b !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
}

.auth-container .auth-card .auth-title {
  color: #0c1f3f !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  font-weight: 700 !important;
}

.auth-container .auth-card .auth-subtitle {
  color: #475569 !important;
}

.auth-container .auth-card .auth-logo-icon {
  background: linear-gradient(145deg, #5eead4 0%, #2dd4bf 35%, #0d9488 100%) !important;
  color: #0c1f3f !important;
}

.auth-container .auth-card label.form-label {
  font-family: "IBM Plex Sans", "Sarabun", -apple-system, sans-serif !important;
  font-size: 0.6875rem !important;
  color: #0c1f3f !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
}

.auth-container .auth-card .form-checkbox-label {
  font-family: "IBM Plex Sans", "Sarabun", -apple-system, sans-serif !important;
  font-size: 0.6875rem !important;
  color: #0c1f3f !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
}

.auth-container .auth-card .form-input:focus {
  border-color: #0d9488 !important;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.22) !important;
}

.auth-container .auth-card .btn.btn-primary,
.auth-container .auth-card button[type="submit"].btn-primary,
.auth-container .auth-card input[type="submit"].btn-primary {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%) !important;
  background-color: #0d9488 !important;
  color: #ffffff !important;
  border: 1px solid #0f766e !important;
}

.auth-container .auth-card .btn.btn-primary:hover {
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%) !important;
  background-color: #0f766e !important;
  border-color: #115e59 !important;
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT & NAVIGATION (Collapsible System)
════════════════════════════════════════════════════════════════ */

.fms-app-container {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Legacy shell — superseded by .ty-app-shell for signed-in Taoyen layout */
body.ty-app .fms-app-container {
  background: transparent;
}

/* Global Navigation */
.fms-global-nav {
  width: 64px;
  background: var(--gray-950);
  border-right: 1px solid var(--border-subtle);
  transition: var(--nav-transition);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow: hidden;

  &.expanded {
    width: 240px;

    .fms-nav-text {
      opacity: 1;
      visibility: visible;
    }
  }

  &.collapsed {
    width: 64px;

    .fms-nav-text {
      opacity: 0;
      visibility: hidden;
    }
  }
}

.fms-nav-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;

  &:hover {
    background: var(--bg-hover);
  }
}

.fms-logo-icon {
  font-family: 'Charmonman', serif;
  font-size: 24px;
  color: var(--gold-400);
  flex-shrink: 0;
}

.fms-logo-text {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin-left: 12px;
  white-space: nowrap;
}

.fms-nav-links {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fms-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 2px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
  white-space: nowrap;

  &:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  &.active {
    background: var(--bg-active);
    color: var(--gold-400);
    border-left: 2px solid var(--gold-500);
  }
}

.fms-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: currentColor;
}

.fms-nav-text {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  transition: var(--nav-transition);
}

.fms-logout-btn {
  width: 100%;
  margin-top: 12px;
  color: var(--red) !important;

  &:hover {
    background: var(--bg-hover);
  }
}

/* Page Sidebar (PM/Repair) */
.fms-page-sidebar {
  width: 280px;
  background: var(--gray-900);
  border-right: 1px solid var(--border-subtle);
  transition: var(--nav-transition);
  position: fixed;
  top: 0;
  left: 64px;
  bottom: 0;
  z-index: 90;
  overflow-y: auto;

  &.expanded {
    width: 280px;

    .fms-sidebar-content {
      opacity: 1;
      visibility: visible;
    }
  }

  &.collapsed {
    width: 0;
    border: none;

    .fms-sidebar-content {
      opacity: 0;
      visibility: hidden;
    }
  }
}

.fms-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);

  .fms-ref {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--gold-400);
    margin-bottom: 4px;
  }

  .fms-title {
    font-family: 'Charmonman', serif;
    font-size: 20px;
    color: var(--text-primary);
  }
}

.fms-sidebar-content {
  padding: 16px;
  transition: var(--nav-transition);
}

.fms-workflow-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fms-workflow-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 2px;
  border: 1px solid var(--border-subtle);
  transition: var(--transition-fast);

  &.active {
    background: var(--bg-active);
    border-color: var(--border-gold);
  }

  &.completed .fms-step-number {
    background: var(--teal-500);
    border-color: var(--teal-500);

    &::after {
      content: '✓';
    }
  }
}

.fms-step-number {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-medium);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.fms-step-content {
  flex: 1;

  .fms-step-title {
    font-family: 'Oswald', sans-serif;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 2px;
  }

  .fms-step-subtitle {
    font-size: 11px;
    color: var(--text-muted);
  }
}

/* Main Content Area */
.fms-main-content {
  margin-left: 64px;
  flex: 1;
  transition: var(--nav-transition);

  &.with-sidebar {
    margin-left: 344px;
  }
}

.fms-content-wrapper {
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Toggle Button */
.fms-nav-toggle {
  position: fixed;
  bottom: 24px;
  left: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold-500);
  border: none;
  color: var(--gray-950);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
  z-index: 200;
  transition: var(--transition-fast);

  &:hover {
    transform: scale(1.05);
    background: var(--gold-400);
  }

  &.toggled {
    left: 196px;
  }

  &.with-sidebar {
    left: 308px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   CARDS (Industrial Container)
════════════════════════════════════════════════════════════════ */

.fms-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  margin-bottom: 24px;
  position: relative;

  /* Decorative corner */
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    border-top: 2px solid var(--gold-500);
    border-left: 2px solid var(--gold-500);
    opacity: 0.5;
  }
}

.fms-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);

  .fms-card-title {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--gold-400);
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

.fms-card-body {
  padding: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   STATUS BADGES (Technical Precision)
════════════════════════════════════════════════════════════════ */

.fms-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;

  &.approved {
    background: rgba(34, 199, 94, 0.12);
    border-color: rgba(34, 199, 94, 0.4);
    color: var(--green);
  }

  &.pending {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--amber);
  }

  &.rejected {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--red);
  }

  &.in-progress {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.4);
    color: var(--blue);
  }

  &.closed {
    background: rgba(115, 115, 115, 0.12);
    border-color: rgba(115, 115, 115, 0.4);
    color: var(--gray-400);
  }
}

/* ═══════════════════════════════════════════════════════════════
   TABLES (Data Grid)
════════════════════════════════════════════════════════════════ */

.fms-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Sans', sans-serif;

  thead {
    background: var(--gray-850);
    border-bottom: 2px solid var(--gold-500);

    th {
      padding: 12px 16px;
      text-align: left;
      font-family: 'Oswald', sans-serif;
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--gold-400);
    }
  }

  tbody {
    tr {
      border-bottom: 1px solid var(--border-subtle);
      transition: background 0.1s;

      &:hover {
        background: var(--bg-hover);
      }

      &.row-clickable {
        cursor: pointer;

        &:hover {
          background: rgba(245, 158, 11, 0.05);
        }
      }
    }

    td {
      padding: 12px 16px;
      color: var(--text-secondary);

      &.col-id {
        font-family: 'JetBrains Mono', monospace;
        color: var(--gold-400);
      }

      &.col-status {
        text-align: center;
      }
    }
  }
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS (Industrial Action)
════════════════════════════════════════════════════════════════ */

.fms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.fms-btn-primary {
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-600) 100%);
  color: var(--gray-950);
  font-weight: 600;
  box-shadow: var(--shadow-gold);

  &:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
  }
}

.fms-btn-secondary {
  background: transparent;
  border-color: var(--border-medium);
  color: var(--text-primary);

  &:hover:not(:disabled) {
    border-color: var(--gold-500);
    color: var(--gold-400);
    background: var(--bg-hover);
  }
}

.fms-btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, #dc2626 100%);
  color: white;
  font-weight: 600;
}

.fms-btn-ghost {
  background: transparent;
  color: var(--text-secondary);

  &:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
  }
}

/* ═══════════════════════════════════════════════════════════════
   FORMS (Precision Input)
════════════════════════════════════════════════════════════════ */

.fms-form-group {
  margin-bottom: 20px;
}

.fms-label {
  display: block;
  margin-bottom: 8px;

  .required {
    color: var(--gold-500);
  }
}

.fms-input,
.fms-select,
.fms-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition-fast);

  &:focus {
    outline: none;
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.fms-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23f59e0b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

.fms-textarea {
  min-height: 100px;
  resize: vertical;
}

.fms-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.fms-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--red);
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES (Replaces Tailwind)
════════════════════════════════════════════════════════════════ */

/* Flexbox */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing */
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* Text */
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* Colors */
.text-gold { color: var(--gold-400); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* Backgrounds */
.bg-gray { background: var(--gray-850); }

/* Border */
.border { border: 1px solid var(--border-subtle); }
.border-b { border-bottom: 1px solid var(--border-subtle); }
.border-gold { border-color: var(--gold-500); }

/* Rounded */
.rounded { border-radius: 0.25rem; }
.rounded-sm { border-radius: 0.125rem; }

/* Shadow */
.shadow { box-shadow: var(--shadow-md); }

/* Animation */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeSlideUp 0.4s ease-out forwards;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .fms-global-nav {
    width: 56px;

    &.expanded {
      width: 200px;
    }
  }

  .fms-page-sidebar {
    width: 0;

    &.expanded {
      width: 240px;
      left: 56px;
    }
  }

  .fms-main-content {
    margin-left: 56px;

    &.with-sidebar {
      margin-left: 56px;
    }
  }

  .fms-content-wrapper {
    padding: 16px;
  }

  .fms-nav-toggle {
    width: 40px;
    height: 40px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   REQUEST DETAIL PAGE
════════════════════════════════════════════════════════════════ */

.fms-request-container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 24px;
}

.fms-request-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.fms-header-left {
  flex: 1;
}

.fms-header-right {
  flex-shrink: 0;
}

.fms-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.fms-detail-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fms-label {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.fms-value {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 400;
}

.fms-hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD COMPONENTS
════════════════════════════════════════════════════════════════ */

.fms-dashboard-container {
  padding: 24px;
}

.fms-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.fms-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.fms-request-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fms-request-card {
  display: block;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  padding: 16px;
  text-decoration: none;
  transition: all var(--transition-fast);

  &:hover {
    background: var(--bg-hover);
    border-color: var(--border-gold);
    transform: translateY(-1px);
  }

  &.fms-request-card-urgent {
    border-left: 3px solid var(--gold-500);
  }
}

.fms-request-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.fms-request-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.fms-request-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fms-request-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.fms-info-label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fms-info-value {
  color: var(--text-secondary);
  font-weight: 500;
}

.fms-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES (for WO/PDF)
════════════════════════════════════════════════════════════════ */

@media print {
  .fms-global-nav,
  .fms-page-sidebar,
  .fms-nav-toggle,
  .ty-app-sidebar,
  .ty-page-sidebar,
  .ty-nav-toggle,
  .workflow-topnav,
  .ty-topnav {
    display: none !important;
  }

  .fms-main-content {
    margin-left: 0 !important;
  }

  body {
    background: white;
    color: black;
  }

  .fms-card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   FORM PAGE HEADER - Consistent Back Button Placement
═════════════════════════════════════════════════════════════════ */

.form-page-header {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  padding: 16px 0 !important;
  margin-bottom: 24px !important;
}

.form-page-header .btn {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER ENHANCED - For drivers/trips pages
═════════════════════════════════════════════════════════════════ */

.page-header-enhanced {
  margin-bottom: 24px;
}

.page-header-enhanced .page-header-main {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
}

.page-header-enhanced .page-actions {
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   FORM ACTIONS - Layout (Cancel/secondary first, primary last, end-aligned)
   Top border only inside .card — trip/driver/work_order use local panel styles.
═════════════════════════════════════════════════════════════════ */

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
}

.card .card-body .form-actions {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-actions .btn,
.form-actions input[type="submit"],
.form-actions button[type="submit"] {
  min-height: 44px;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn,
  .form-actions input[type="submit"],
  .form-actions button[type="submit"] {
    width: 100%;
    justify-content: center;
  }
}

/*
 * Maintenance analytics reports — Taoyen shell
 * Scoped to .fms-report.fms-report-page only (no body.ty-app dependency) so
 * grid/cards/timeline/bars always apply inside the report root.
 */

.fms-report.fms-report-page {
  --ra-border: var(--ty-slate-200, #e2e8f0);
  --ra-surface: var(--ty-white, #ffffff);
  --ra-muted: var(--ty-slate-500, #64748b);
  --ra-navy: var(--ty-navy-mid, #1a3460);
  --ra-teal: var(--ty-teal, #0d9488);
  /* Restrained elevation — matches polished dashboard cards, not glossy marketing tiles */
  --ra-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.04);
  --ra-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --ra-radius: var(--ty-radius-lg, 14px);
  --ra-font-code: var(--ty-font-code, "JetBrains Mono", ui-monospace, monospace);
  --ra-font: var(--ty-font-th, "Sarabun", ui-sans-serif, system-ui, sans-serif);
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.5rem 0 3rem;
  font-family: var(--ra-font);
  color: var(--ty-slate-800, #1e293b);
}

/* Page chrome when report is shown — soft page bed so white panels read clearly */
body.ty-app:has(.fms-report-layout) .ty-content-wrapper.fms-content-wrapper,
body.ty-app:has(.fms-report.fms-report-page) .ty-content-wrapper.fms-content-wrapper {
  max-width: 1200px;
  background-color: #f1f5f9;
  border-radius: 0;
  padding-bottom: 0.5rem;
}

/* In-report title — calm editorial block (no competing gradients) */
.fms-report.fms-report-page .fms-report-page-intro {
  margin: 0 0 1.25rem;
  padding: 1.25rem 1.35rem 1.2rem 1.4rem;
  border-radius: var(--ra-radius);
  border: 1px solid var(--ra-border);
  border-left: 4px solid var(--ra-teal);
  background: var(--ra-surface);
  box-shadow: var(--ra-shadow-sm);
}

.fms-report.fms-report-page .fms-report-page-intro__title {
  margin: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ra-navy);
  line-height: 1.25;
}

.fms-report.fms-report-page .fms-report-page-intro__lead {
  margin: 0.5rem 0 0;
  max-width: 62ch;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ty-slate-600, #475569);
}

/* --- Exports row --- */
.fms-report.fms-report-page .fms-report-actions-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.15rem;
  margin-bottom: 1rem;
  background: var(--ra-surface);
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
  box-shadow: var(--ra-shadow-sm);
}

.fms-report.fms-report-page .fms-report-actions-hint {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ty-slate-600, #475569);
}

.fms-report.fms-report-page .fms-report-actions-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.fms-report.fms-report-page .fms-report-actions-btns .btn {
  min-height: 38px;
}

/* --- Filter shell --- */
.fms-report.fms-report-page .fms-report-filter-shell {
  margin-bottom: 1.25rem;
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--ra-shadow-sm);
}

.fms-report.fms-report-page .fms-report-filter-shell-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ty-slate-500, #64748b);
  background: var(--ty-slate-50, #f8fafc);
  border-bottom: 1px solid var(--ra-border);
}

.fms-report.fms-report-page .fms-report-filter-shell-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ra-teal);
  opacity: 0.85;
}

.fms-report.fms-report-page .fms-report-filter-shell .fms-report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  margin-bottom: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff !important;
}

.fms-report.fms-report-page .fms-report-filter-form {
  margin: 0;
}

.fms-report.fms-report-page .fms-report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--ra-border);
  border-radius: var(--ty-radius-sm, 6px);
  margin-bottom: 1.25rem;
  box-shadow: var(--ra-shadow);
}

.fms-report.fms-report-page .fms-report-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ty-slate-600, #475569);
}

.fms-report.fms-report-page .fms-report-select,
.fms-report.fms-report-page .fms-report-filters input[type="date"],
.fms-report.fms-report-page .fms-report-filters input[type="number"] {
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--ra-border);
  border-radius: 6px;
  background: var(--ty-slate-50, #f8fafc);
  color: var(--ty-slate-800, #1e293b);
}

.fms-report.fms-report-page .fms-report-input-narrow {
  max-width: 6.5rem;
}

.fms-report.fms-report-page .fms-report-input-narrow--md {
  max-width: 8.5rem;
}

.fms-report.fms-report-page .fms-report-filter-sep {
  width: 1px;
  height: 22px;
  background: var(--ra-border);
}

/* --- Generic KPI strip --- */
.fms-report.fms-report-page .fms-report-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 1.35rem;
}

.fms-report.fms-report-page .fms-report-kpi-strip--five {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.fms-report.fms-report-page .fms-report-kpi-card {
  position: relative;
  padding: 15px 16px 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--ra-border);
  background: #fff;
  box-shadow: var(--ra-shadow-sm);
}

.fms-report.fms-report-page .fms-report-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ty-navy-mid, #1a3460);
}

.fms-report.fms-report-page .fms-report-kpi-card--blue::before {
  background: var(--ty-navy-mid, #1a3460);
}
.fms-report.fms-report-page .fms-report-kpi-card--gold::before {
  background: var(--gold-500, #f59e0b);
}
.fms-report.fms-report-page .fms-report-kpi-card--green::before {
  background: var(--ty-teal, #0d9488);
}
.fms-report.fms-report-page .fms-report-kpi-card--red::before {
  background: #dc2626;
}
.fms-report.fms-report-page .fms-report-kpi-card--amber::before {
  background: #d97706;
}

.fms-report.fms-report-page .fms-report-kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ty-slate-500, #64748b);
}

.fms-report.fms-report-page .fms-report-kpi-value {
  margin-top: 6px;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  font-weight: 700;
  font-family: var(--ra-font);
  color: var(--ra-navy);
  font-variant-numeric: tabular-nums;
}

.fms-report.fms-report-page .fms-report-kpi-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ty-slate-600, #475569);
}

/* --- Vehicle history KPI strip --- */
.fms-report.fms-report-page .fms-report-vehicle-kpi-strip {
  display: grid;
  grid-template-columns: minmax(148px, 1.2fr) repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-card {
  position: relative;
  padding: 13px 14px 15px;
  border: 1px solid var(--ra-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--ra-shadow-sm);
  min-width: 0;
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 12px 12px 0 0;
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-card--plate::before {
  background: linear-gradient(90deg, var(--ty-navy-mid, #1a3460), var(--ra-teal), var(--gold-500, #f59e0b));
}
.fms-report.fms-report-page .fms-report-vehicle-kpi-card--navy::before {
  background: var(--ty-navy-mid, #1a3460);
}
.fms-report.fms-report-page .fms-report-vehicle-kpi-card--gold::before {
  background: var(--gold-500, #f59e0b);
}
.fms-report.fms-report-page .fms-report-vehicle-kpi-card--red::before {
  background: #dc2626;
}
.fms-report.fms-report-page .fms-report-vehicle-kpi-card--teal::before {
  background: var(--ra-teal);
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ty-slate-500, #64748b);
  margin-bottom: 6px;
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-value {
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 700;
  font-family: var(--ra-font);
  color: var(--ra-navy);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-plate {
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  font-weight: 700;
  font-family: var(--ra-font);
  letter-spacing: 0.03em;
  color: var(--ra-navy);
  line-height: 1.15;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-kicker {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ra-teal);
}

.fms-report.fms-report-page .fms-report-vehicle-kpi-card--plate {
  background: var(--ty-slate-50, #f8fafc);
}

/* --- Two-column layout --- */
.fms-report.fms-report-page .fms-report-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, min(400px, 100%));
  gap: 1.35rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

.fms-report.fms-report-page .fms-report-two-col > * {
  min-width: 0;
}

.fms-report.fms-report-page > .fms-report-two-col {
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
  background: var(--ty-slate-50, #f8fafc);
  box-shadow: var(--ra-shadow-sm);
}

.fms-report.fms-report-page > .fms-report-two-col > .fms-card {
  margin-bottom: 0;
  box-shadow: var(--ra-shadow-sm);
}

@media (min-width: 1100px) {
  .fms-report.fms-report-page .fms-report-two-col--vehicle {
    grid-template-columns: minmax(0, 1fr) 400px;
  }
}

@media (max-width: 900px) {
  .fms-report.fms-report-page .fms-report-two-col {
    grid-template-columns: 1fr;
  }

  .fms-report.fms-report-page .fms-report-vehicle-kpi-strip {
    grid-template-columns: 1fr 1fr;
  }

  .fms-report.fms-report-page .fms-report-vehicle-kpi-card--plate {
    grid-column: 1 / -1;
  }

  .fms-report.fms-report-page .fms-report-tl-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .fms-report.fms-report-page .fms-report-bar-row {
    flex-wrap: wrap;
  }
}

/* --- Panels & section titles --- */
.fms-report.fms-report-page .fms-report-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--ty-slate-800, #1e293b);
}

.fms-report.fms-report-page .fms-report-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ra-border);
}

.fms-report.fms-report-page .fms-report-panel {
  padding: 1rem 1.1rem 1.2rem;
  border: 1px solid var(--ra-border);
  border-radius: var(--ra-radius);
  background: #fff;
  box-shadow: var(--ra-shadow-sm);
}

.fms-report.fms-report-page .fms-report-panel .fms-report-section-title:first-child {
  margin-top: 0;
}

.fms-report.fms-report-page .fms-report-panel .fms-card {
  box-shadow: 0 2px 12px rgba(12, 31, 63, 0.05);
}

.fms-report.fms-report-page .fms-report-panel-empty {
  text-align: center;
  padding: 2rem 1.25rem;
  border-radius: var(--ty-radius-sm, 6px);
  border: 1px dashed var(--ty-slate-300, #cbd5e1);
  color: var(--ty-slate-600, #475569);
  font-size: 0.9rem;
  line-height: 1.55;
}

.fms-report.fms-report-page .fms-report-panel-empty--soft {
  background: linear-gradient(180deg, var(--ty-slate-50, #f8fafc) 0%, #ffffff 100%);
}

.fms-report.fms-report-page .fms-report-panel-empty p {
  margin: 0 auto;
  max-width: 36rem;
}

/* --- Cards inside reports --- */
.fms-report.fms-report-page .fms-card {
  background: #fff !important;
  border: 1px solid var(--ra-border) !important;
  border-radius: var(--ra-radius);
  color: var(--ty-slate-800, #1e293b) !important;
  margin-bottom: 1rem;
}

.fms-report.fms-report-page .fms-card::before {
  opacity: 0.35;
}

.fms-report.fms-report-page .fms-card-header {
  border-bottom: 1px solid var(--ra-border);
  padding: 12px 16px;
}

.fms-report.fms-report-page .fms-card-header .fms-card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--ra-navy);
}

.fms-report.fms-report-page .fms-report-side-card-body {
  padding: 16px 18px;
}

/* --- Timeline --- */
.fms-report.fms-report-page .fms-report-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.fms-report.fms-report-page .fms-report-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--ra-teal), var(--ra-border));
  border-radius: 2px;
  opacity: 0.5;
}

.fms-report.fms-report-page .fms-report-tl-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
}

.fms-report.fms-report-page .fms-report-tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 8px;
  border: 2px solid var(--ra-navy);
  background: var(--ra-navy);
}

.fms-report.fms-report-page .fms-report-tl-dot.is-repeat {
  border-color: #dc2626;
  background: #dc2626;
}

.fms-report.fms-report-page .fms-report-tl-card {
  padding: 12px 14px;
  border: 1px solid var(--ra-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--ra-shadow-sm);
  border-left: 3px solid var(--ra-teal);
  transition: box-shadow 0.2s ease;
}

.fms-report.fms-report-page .fms-report-tl-card:hover {
  box-shadow: var(--ra-shadow);
}

.fms-report.fms-report-page .fms-report-tl-card.is-flagged {
  border-color: #fecaca;
  border-left-color: #dc2626;
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
}

.fms-report.fms-report-page .fms-report-tl-row {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.fms-report.fms-report-page .fms-report-tl-date {
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  color: var(--ty-slate-600, #475569);
  font-size: 12px;
}

.fms-report.fms-report-page .fms-report-tl-title {
  font-weight: 600;
  line-height: 1.35;
  color: var(--ty-slate-800, #1e293b);
}

.fms-report.fms-report-page .fms-report-tl-amt {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ra-teal);
  font-variant-numeric: tabular-nums;
}

/* --- Horizontal bars --- */
.fms-report.fms-report-page .fms-report-bar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fms-report.fms-report-page .fms-report-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.fms-report.fms-report-page .fms-report-bar-row:nth-child(odd) {
  background: rgba(248, 250, 252, 0.65);
  border-radius: 8px;
  padding-left: 6px;
  padding-right: 6px;
}

.fms-report.fms-report-page .fms-report-bar-label {
  width: 112px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ty-slate-600, #475569);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fms-report.fms-report-page .fms-report-bar-track {
  flex: 1;
  min-width: 48px;
  height: 22px;
  background: #e8ecf1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--ra-border);
}

.fms-report.fms-report-page .fms-report-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.35s ease;
}

.fms-report.fms-report-page .fms-report-bar-fill--navy {
  background: var(--ra-navy);
}
.fms-report.fms-report-page .fms-report-bar-fill--gold {
  background: var(--gold-500, #f59e0b);
}
.fms-report.fms-report-page .fms-report-bar-fill--teal {
  background: var(--ra-teal);
}
.fms-report.fms-report-page .fms-report-bar-fill--sky {
  background: #38bdf8;
}
.fms-report.fms-report-page .fms-report-bar-fill--peach {
  background: #fb923c;
}
.fms-report.fms-report-page .fms-report-bar-fill--gray {
  background: var(--ty-slate-300, #cbd5e1);
}

.fms-report.fms-report-page .fms-report-bar-val {
  width: 88px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--ra-font);
  font-size: 12px;
  font-weight: 600;
  color: var(--ty-slate-800, #1e293b);
  font-variant-numeric: tabular-nums;
}

.fms-report.fms-report-page .fms-report-bar-pct {
  width: 48px;
  text-align: right;
  font-size: 12px;
  color: var(--ty-slate-600, #475569);
}

/* --- Repeat alerts --- */
.fms-report.fms-report-page .fms-report-repeat-alert {
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: var(--ty-radius-sm, 6px);
  background: #fff1f2;
}

.fms-report.fms-report-page .fms-report-repeat-alert-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fms-report.fms-report-page .fms-report-badge-repeat {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: #dc2626;
  border-radius: 999px;
}

.fms-report.fms-report-page .fms-report-repeat-plate {
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  color: var(--ra-navy);
}

.fms-report.fms-report-page .fms-report-repeat-body {
  font-size: 13px;
  color: var(--ty-slate-700, #334155);
  line-height: 1.45;
}

/* --- Heatmap --- */
.fms-report.fms-report-page .fms-report-heatmap-wrap {
  margin: 0 -4px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--ra-border);
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(12, 31, 63, 0.04);
}

.fms-report.fms-report-page table.fms-report-heatmap {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.fms-report.fms-report-page table.fms-report-heatmap th,
.fms-report.fms-report-page table.fms-report-heatmap td {
  padding: 8px 10px;
  border: 1px solid var(--ra-border);
  text-align: center;
}

.fms-report.fms-report-page table.fms-report-heatmap th {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ty-slate-600, #475569);
  background: var(--ty-slate-50, #f8fafc);
}

.fms-report.fms-report-page table.fms-report-heatmap td.fms-hm-label {
  text-align: left;
  font-weight: 600;
}

.fms-report.fms-report-page .fms-hm-0 {
  background: #fff;
}
.fms-report.fms-report-page .fms-hm-1 {
  background: rgba(13, 148, 136, 0.12);
}
.fms-report.fms-report-page .fms-hm-2 {
  background: rgba(13, 148, 136, 0.22);
}
.fms-report.fms-report-page .fms-hm-3 {
  background: rgba(13, 148, 136, 0.35);
}
.fms-report.fms-report-page .fms-hm-4 {
  background: rgba(13, 148, 136, 0.5);
}
.fms-report.fms-report-page .fms-hm-5 {
  background: rgba(13, 148, 136, 0.65);
  color: #fff;
}

.fms-report.fms-report-page .fms-report-heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ra-border);
}

.fms-report.fms-report-page .fms-report-heatmap-legend span:first-child {
  font-weight: 700;
  color: var(--ty-slate-600, #475569);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.1em;
}

/* --- Tables --- */
.fms-report.fms-report-page .fms-report-table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--ra-radius) var(--ra-radius);
}

.fms-report.fms-report-page table.fms-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
}

.fms-report.fms-report-page table.fms-table thead {
  background: linear-gradient(180deg, #eef2f7 0%, #e2e8f0 100%);
  border-bottom: 2px solid var(--ra-navy);
}

.fms-report.fms-report-page table.fms-table thead th {
  padding: 11px 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ty-slate-700, #334155);
}

.fms-report.fms-report-page table.fms-table tbody tr {
  border-bottom: 1px solid var(--ra-border);
  transition: background 0.12s ease;
}

.fms-report.fms-report-page table.fms-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.85);
}

.fms-report.fms-report-page table.fms-table tbody tr:hover {
  background: rgba(13, 148, 136, 0.06);
}

.fms-report.fms-report-page table.fms-table tbody td {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--ty-slate-800, #1e293b);
}

.fms-report.fms-report-page td.fms-report-table-empty-cell {
  text-align: center;
  padding: 2.25rem 1.25rem !important;
  color: var(--ty-slate-600, #475569);
  font-size: 0.95rem;
  line-height: 1.5;
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}

.fms-report.fms-report-page .fms-report-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 0 0 var(--ra-radius) var(--ra-radius);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--ra-border);
  border-top: none;
}

.fms-report.fms-report-page .fms-report-pagination-meta {
  font-size: 13px;
  color: var(--ty-slate-600, #475569);
}

/* --- Pills & badges --- */
.fms-report.fms-report-page .fms-report-plate-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  color: var(--ra-navy);
  background: var(--ty-slate-100, #f1f5f9);
  border: 1px solid var(--ra-border);
  border-radius: 999px;
  text-decoration: none;
}

.fms-report.fms-report-page .fms-report-plate-badge:hover {
  background: #e2e8f0;
}

.fms-report.fms-report-page .fms-report-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ty-slate-700, #334155);
  background: var(--ty-slate-100, #f1f5f9);
  border: 1px solid var(--ra-border);
  border-radius: 999px;
}

.fms-report.fms-report-page .fms-report-count-badge {
  display: inline-flex;
  min-width: 1.5rem;
  justify-content: center;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ra-navy);
  background: #fff;
  border: 1px solid var(--ra-border);
  border-radius: 6px;
}

.fms-report.fms-report-page .fms-report-rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 4px 8px;
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 800;
  border-radius: 8px;
  border: 1px solid var(--ra-border);
  background: #fff;
}

.fms-report.fms-report-page .fms-report-rank-pill.r1 {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
}
.fms-report.fms-report-page .fms-report-rank-pill.r2 {
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
}
.fms-report.fms-report-page .fms-report-rank-pill.r3 {
  background: #f8fafc;
}
.fms-report.fms-report-page .fms-report-rank-pill.rn {
  background: #fff;
  color: var(--ty-slate-600, #475569);
}

.fms-report.fms-report-page .fms-report-card-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--ra-muted);
}

.fms-report.fms-report-page .fms-report-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ty-slate-600, #475569);
  border: 1px dashed var(--ty-slate-300, #cbd5e1);
  border-radius: var(--ra-radius);
  background: #fafbfc;
}

.fms-report.fms-report-page .fms-report-kpi-value,
.fms-report.fms-report-page .fms-report-bar-val,
.fms-report.fms-report-page .fms-report-tl-amt,
.fms-report.fms-report-page .fms-report-vehicle-kpi-value {
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════
   Vehicle history — editorial module (Taoyen tokens, no new fonts)
════════════════════════════════════════════════════════════════ */

.fms-report.fms-report-page.fms-report-vehicle-page {
  padding-top: 0;
}

.fms-report-vehicle-page .fms-report-vh-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--ra-radius);
  margin-bottom: 1.25rem;
  border: 1px solid rgba(26, 52, 96, 0.28);
  box-shadow: var(--ra-shadow);
}

.fms-report-vehicle-page .fms-report-vh-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 20% 0%, rgba(13, 148, 136, 0.22), transparent 55%),
    linear-gradient(145deg, #0c1f3f 0%, #1a3460 48%, #115e59 100%);
  opacity: 1;
}

.fms-report-vehicle-page .fms-report-vh-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath fill='rgba(255,255,255,0.04)' d='M0 0h60v60H0zm60 60h60v60H60z'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

.fms-report-vehicle-page .fms-report-vh-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 220px);
  gap: 1.25rem 1.5rem;
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.15rem, 3vw, 2.25rem);
}

.fms-report-vehicle-page .fms-report-vh-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.88);
}

.fms-report-vehicle-page .fms-report-vh-plate {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  font-weight: 700;
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.2);
}

.fms-report-vehicle-page .fms-report-vh-lead {
  margin: 0;
  max-width: 52ch;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(248, 250, 252, 0.88);
}

.fms-report-vehicle-page .fms-report-vh-hero-art {
  position: relative;
  justify-self: end;
  width: min(200px, 100%);
  aspect-ratio: 1;
}

.fms-report-vehicle-page .fms-report-vh-hero-ring {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
  background: conic-gradient(
    from 200deg,
    rgba(13, 148, 136, 0.35),
    rgba(255, 255, 255, 0.12),
    rgba(13, 148, 136, 0.35)
  );
  mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  opacity: 0.85;
}

.fms-report-vehicle-page .fms-report-vh-hero-gridlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(255, 255, 255, 0.07) 1px,
    transparent 1px
  );
  background-size: 100% 22px;
  opacity: 0.35;
  border-radius: 50%;
}

.fms-report-vehicle-page .fms-report-actions-card {
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid var(--ra-border);
}

.fms-report-vehicle-page .fms-report-filter-shell--vehicle {
  margin-bottom: 1.35rem;
  box-shadow: var(--ra-shadow-sm);
}

.fms-report-vehicle-page .fms-report-vh-kpi-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.fms-report-vehicle-page .fms-report-vh-kpi-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ty-slate-50, #f8fafc);
  border: 1px solid var(--ra-border);
  color: var(--ra-navy);
}

.fms-report-vehicle-page .fms-report-vh-kpi-icon svg {
  display: block;
}

.fms-report-vehicle-page .fms-report-vehicle-kpi-card--plate .fms-report-vh-kpi-icon {
  background: rgba(13, 148, 136, 0.08);
  color: var(--ra-teal);
}

.fms-report-vehicle-page .fms-report-vh-scope-line {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fms-report-vehicle-page .fms-report-section-title--vh {
  margin-top: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ty-slate-800, #1e293b);
}

.fms-report-vehicle-page .fms-report-section-title--vh::after {
  opacity: 0.85;
}

.fms-report-vehicle-page .fms-report-section-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ty-slate-50, #f8fafc);
  border: 1px solid var(--ra-border);
  color: var(--ra-teal);
  flex-shrink: 0;
}

.fms-report-vehicle-page .fms-report-section-ic svg {
  display: block;
}

.fms-report-vehicle-page .fms-report-vh-composition {
  display: flex;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 0.5rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.fms-report-vehicle-page .fms-report-vh-composition-seg {
  display: block;
  height: 100%;
  min-width: 2px;
  transition: filter 0.15s ease;
}

.fms-report-vehicle-page .fms-report-vh-composition-seg:hover {
  filter: brightness(1.08);
}

.fms-report-vehicle-page .fms-report-vh-seg--navy {
  background: var(--ra-navy);
}
.fms-report-vehicle-page .fms-report-vh-seg--gold {
  background: var(--gold-500, #f59e0b);
}
.fms-report-vehicle-page .fms-report-vh-seg--teal {
  background: var(--ra-teal);
}
.fms-report-vehicle-page .fms-report-vh-seg--peach {
  background: #fb923c;
}

.fms-report-vehicle-page .fms-report-vh-composition-legend {
  margin: 0 0 1rem;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ra-muted);
}

.fms-report-vehicle-page .fms-report-vh-sidecard {
  margin-bottom: 1.25rem;
  border-radius: var(--ra-radius);
  overflow: hidden;
}

.fms-report-vehicle-page .fms-report-bar-row--vh {
  padding: 6px 0;
}

.fms-report-vehicle-page .fms-report-bar-track {
  height: 26px;
  border-radius: 8px;
}

.fms-report-vehicle-page .fms-report-bar-fill {
  border-radius: 6px;
}

.fms-report-vehicle-page .fms-report-panel--vh-timeline {
  padding-top: 1.15rem;
}

.fms-report-vehicle-page .fms-report-timeline--vh {
  gap: 14px;
}

.fms-report-vehicle-page .fms-report-tl-item--vh {
  grid-template-columns: 16px 1fr;
}

.fms-report-vehicle-page .fms-report-tl-dot {
  margin-top: 10px;
  box-shadow: 0 0 0 3px rgba(26, 52, 96, 0.12);
}

.fms-report-vehicle-page .fms-report-vh-tl-card {
  padding: 14px 16px 15px;
  border-radius: 12px;
  border: 1px solid var(--ra-border);
  background: #fff;
  box-shadow: var(--ra-shadow-sm);
}

.fms-report-vehicle-page .fms-report-vh-tl-card.is-flagged {
  border-color: #fecaca;
  border-left: 4px solid #dc2626;
  background: #fff5f5;
}

.fms-report-vehicle-page .fms-report-vh-tl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.fms-report-vehicle-page .fms-report-vh-tl-date {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ty-slate-700, #334155);
  background: var(--ty-slate-50, #f8fafc);
  border: 1px solid var(--ra-border);
  border-radius: 999px;
}

.fms-report-vehicle-page .fms-report-vh-tl-cost {
  font-family: var(--ra-font);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  color: var(--ra-teal);
  white-space: nowrap;
}

.fms-report-vehicle-page .fms-report-vh-tl-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ty-slate-800, #1e293b);
}

.fms-report-vehicle-page .fms-report-vh-empty {
  border-style: solid;
  border-color: rgba(26, 52, 96, 0.12);
  background: linear-gradient(180deg, #f8fafc, #fff);
}

.fms-report-vehicle-page .fms-report-vh-alert {
  border-radius: 12px;
  box-shadow: var(--ra-shadow-sm);
}

@media (max-width: 720px) {
  .fms-report-vehicle-page .fms-report-vh-hero-grid {
    grid-template-columns: 1fr;
  }

  .fms-report-vehicle-page .fms-report-vh-hero-art {
    display: none;
  }

  .fms-report-vehicle-page .fms-report-vh-tl-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   Reports — one flat wrapper (no nested Bootstrap card + inset gradient).
────────────────────────────────────────────────────────────────────────── */

body.ty-app .fms-report-layout {
  width: 100%;
  max-width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0.35rem 12px 2.75rem;
  box-sizing: border-box;
}

body.ty-app .fms-report-layout .fms-report.fms-report-page {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* No stacked drop shadows on section wrappers */
body.ty-app .fms-report-layout .fms-report-filter-shell,
body.ty-app .fms-report-layout .fms-report-actions-card,
body.ty-app .fms-report-layout .fms-report-page-intro,
body.ty-app .fms-report-layout .fms-report-panel,
body.ty-app .fms-report-layout .fms-report-two-col {
  box-shadow: none !important;
}

/*
 * KPI strip — mirrors mockup8 `.kpi-strip` / `.kpi-card` (report-category.html ~236–288).
 * Taoyen tokens replace mockup :root (navy-mid, teal, gold, amber, red).
 */
body.ty-app .fms-report-layout .fms-report-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

@media (min-width: 1200px) {
  body.ty-app .fms-report-layout .fms-report-kpi-strip--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card {
  display: block;
  position: relative;
  padding: 14px 16px !important;
  border-radius: 10px !important;
  overflow: hidden;
  border: 1px solid var(--ty-slate-200, #e2e8f0) !important;
  background: var(--ty-white, #fff) !important;
  box-shadow: none !important;
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card--blue::before {
  background: var(--ty-navy-mid, #1a3460);
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card--gold::before {
  background: var(--gold-500, #f59e0b);
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card--green::before {
  background: var(--ty-teal, #0d9488);
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card--red::before {
  background: #dc2626;
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card--amber::before {
  background: #d97706;
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card > .fms-report-kpi-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ty-slate-400, #94a3b8);
  margin-bottom: 4px;
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card > .fms-report-kpi-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ty-slate-800, #1e293b);
  font-variant-numeric: tabular-nums;
}

body.ty-app .fms-report-layout .fms-report-kpi-strip .fms-report-kpi-card > .fms-report-kpi-sub {
  font-size: 11px;
  color: var(--ty-slate-400, #94a3b8);
  margin-top: 3px;
}

/* Vehicle KPI row — mockup8 `vehicle-header` / tile density; keep existing markup */
body.ty-app .fms-report-layout .fms-report-vehicle-kpi-strip {
  gap: 14px;
  margin-bottom: 24px;
}

body.ty-app .fms-report-layout .fms-report-vehicle-kpi-strip .fms-report-vehicle-kpi-card {
  padding: 14px 16px !important;
  border-radius: 10px !important;
  border: 1px solid var(--ty-slate-200, #e2e8f0) !important;
  background: var(--ty-white, #fff) !important;
  box-shadow: none !important;
}

/* Chart / table panels: list-style card headers (not workflow navy band) */
body.ty-app .fms-report-layout .fms-card-header {
  background: var(--ty-slate-50, #f8fafc) !important;
  color: var(--ty-navy-mid, #1a3460) !important;
  border-bottom: 1px solid var(--ty-slate-200, #e2e8f0) !important;
  padding: 14px 18px !important;
}

body.ty-app .fms-report-layout .fms-card-header .fms-card-title {
  color: var(--ty-navy-mid, #1a3460) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

body.ty-app .fms-report-layout .fms-card {
  border-radius: 12px !important;
  overflow: hidden;
}

/* mockup8 `.two-col` → ~1fr + 380px sidebar charts */
@media (min-width: 1100px) {
  body.ty-app .fms-report-layout .fms-report-two-col--vehicle,
  body.ty-app .fms-report-layout .fms-report-two-col {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    gap: 20px;
  }
}

/* mockup8 `.bar-track` / `.bar-fill` — short tracks on slate wash */
body.ty-app .fms-report-layout .fms-report-bar-track {
  height: 20px !important;
  background: var(--ty-slate-100, #f1f5f9) !important;
  border-radius: 3px !important;
  border: none !important;
}

body.ty-app .fms-report-layout .fms-report-bar-fill--navy {
  background: var(--ty-navy-mid, #1a3460) !important;
}

body.ty-app .fms-report-layout .fms-report-bar-fill--gold {
  background: var(--gold-500, #f59e0b) !important;
}

body.ty-app .fms-report-layout .fms-report-bar-fill--teal {
  background: var(--ty-teal, #0d9488) !important;
}

/* mockup8 `.filter-bar` — single padded strip */
body.ty-app .fms-report-layout .fms-report-filter-shell {
  border-radius: 10px !important;
  box-shadow: none !important;
}

body.ty-app .fms-report-layout .fms-report-filter-shell-head {
  padding: 10px 16px !important;
}

body.ty-app .fms-report-layout .fms-report-filter-shell .fms-report-filters {
  padding: 12px 16px !important;
  gap: 10px 14px !important;
}

/* Page intro: calmer “title band” like mockup topbar + page (Taoyen, not mockup gold wash) */
body.ty-app .fms-report-layout .fms-report-page-intro {
  border-left: none !important;
  border-radius: 10px !important;
  padding: 16px 18px !important;
  background: var(--ty-white, #fff) !important;
  border-bottom: 2px solid var(--ty-slate-200, #e2e8f0) !important;
  box-shadow: none !important;
  margin-bottom: 20px !important;
}

body.ty-app .fms-report-layout .fms-report-page-intro__title {
  font-size: 1.125rem !important;
  font-weight: 600 !important;
}

/* Section titles inside reports — mockup `.section-divider` weight */
body.ty-app .fms-report-layout .fms-report-section-title {
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--ty-slate-400, #94a3b8) !important;
}

body.ty-app .fms-report-layout .fms-card-header .fms-card-title {
  font-size: 13px !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   mockup8 structural class names — scoped to `.fms-report-m8` only (layout DOM).
   Mirrors mockup8_pages_en/report-*.html; colors use Taoyen / existing tokens.
══════════════════════════════════════════════════════════════════════════ */

body.ty-app .fms-report-layout .fms-report-m8 > .page-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0;
  margin: 0;
}

/* Filters — mockup `.filter-bar` */
body.ty-app .fms-report-layout .fms-report-m8 form.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 16px;
  margin-bottom: 0;
  background: var(--ty-white, #fff);
  border: 1px solid var(--ty-slate-200, #e2e8f0);
  border-radius: 10px;
  box-shadow: none;
}

body.ty-app .fms-report-layout .fms-report-m8 form.filter-bar .fms-btn-primary {
  min-height: 38px;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
}

body.ty-app .fms-report-layout .fms-report-m8 .filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ty-slate-600, #475569);
  white-space: nowrap;
}

body.ty-app .fms-report-layout .fms-report-m8 .filter-sep {
  width: 1px;
  height: 24px;
  background: var(--ty-slate-200, #e2e8f0);
  flex-shrink: 0;
}

body.ty-app .fms-report-layout .fms-report-m8 .filter-bar .fms-report-select,
body.ty-app .fms-report-layout .fms-report-m8 form.filter-bar .fms-report-select {
  width: auto;
  min-width: 0;
}

/* KPI — mockup `.kpi-strip` / `.kpi-card.blue` … */
body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 0;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip--4 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

@media (min-width: 900px) {
  body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip--5 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

@media (min-width: 1200px) {
  body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip--5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip .kpi-card {
  position: relative;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px solid var(--ty-slate-200, #e2e8f0);
  border-radius: 10px;
  background: var(--ty-white, #fff);
  box-shadow: none;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-strip .kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-card.blue::before {
  background: var(--ty-navy-mid, #1a3460);
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-card.gold::before {
  background: var(--gold-500, #f59e0b);
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-card.green::before {
  background: var(--ty-teal, #0d9488);
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-card.red::before {
  background: #dc2626;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-card.amber::before {
  background: #d97706;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ty-slate-400, #94a3b8);
  margin-bottom: 4px;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ty-slate-800, #1e293b);
  font-variant-numeric: tabular-nums;
  font-family: var(--ty-font-code, ui-monospace, monospace);
  letter-spacing: -0.02em;
}

body.ty-app .fms-report-layout .fms-report-m8 .kpi-sub {
  font-size: 11px;
  color: var(--ty-slate-400, #94a3b8);
  margin-top: 3px;
}

/* Two columns — mockup `.two-col` */
body.ty-app .fms-report-layout .fms-report-m8 .two-col {
  display: grid;
  gap: 20px;
  margin-bottom: 0;
  grid-template-columns: 1fr;
}

@media (min-width: 1100px) {
  body.ty-app .fms-report-layout .fms-report-m8 .two-col--balanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.ty-app .fms-report-layout .fms-report-m8 .two-col:not(.two-col--balanced) {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  }
}

/* Cards — mockup `.card` (scoped; not Bootstrap) */
body.ty-app .fms-report-layout .fms-report-m8 .card {
  background: var(--ty-white, #fff);
  border: 1px solid var(--ty-slate-200, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: none;
}

body.ty-app .fms-report-layout .fms-report-m8 .card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ty-slate-200, #e2e8f0);
  background: var(--ty-slate-50, #f8fafc);
}

body.ty-app .fms-report-layout .fms-report-m8 .card-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--ty-navy-mid, #1a3460);
}

body.ty-app .fms-report-layout .fms-report-m8 .card-meta {
  font-size: 11px;
  color: var(--ty-slate-400, #94a3b8);
}

body.ty-app .fms-report-layout .fms-report-m8 .card-body {
  padding: 16px 18px;
}

body.ty-app .fms-report-layout .fms-report-m8 .card-body--flush {
  padding: 0;
}

/* Bar chart rows — mockup `.bar-group` … */
body.ty-app .fms-report-layout .fms-report-m8 .bar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-label {
  width: 130px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ty-slate-600, #475569);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-track {
  flex: 1;
  height: 20px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--ty-slate-100, #f1f5f9);
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--ty-navy-mid, #1a3460);
  transition: width 0.35s ease;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-fill.gold {
  background: var(--gold-500, #f59e0b);
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-fill.teal {
  background: var(--ty-teal, #0d9488);
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-fill.sky {
  background: #7dd3fc;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-fill.peach {
  background: #fdba74;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-fill.muted {
  background: #94a3b8;
}

body.ty-app .fms-report-layout .fms-report-m8 .bar-val {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  width: 120px;
  flex-shrink: 0;
  font-size: 11px;
  font-family: var(--ty-font-code, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ty-slate-600, #475569);
}

/* Tables — mockup `.repair-table` */
body.ty-app .fms-report-layout .fms-report-m8 table.repair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

body.ty-app .fms-report-layout .fms-report-m8 table.repair-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ty-slate-500, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--ty-slate-200, #e2e8f0);
  white-space: nowrap;
}

body.ty-app .fms-report-layout .fms-report-m8 table.repair-table thead {
  background: var(--ty-slate-50, #f8fafc);
}

body.ty-app .fms-report-layout .fms-report-m8 table.repair-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ty-slate-200, #e2e8f0);
  vertical-align: middle;
}

body.ty-app .fms-report-layout .fms-report-m8 table.repair-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.85);
}

body.ty-app .fms-report-layout .fms-report-m8 table.repair-table tbody tr:hover td {
  background: rgba(224, 242, 254, 0.35);
}

body.ty-app .fms-report-layout .fms-report-m8 table.repair-table td.amount-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

body.ty-app .fms-report-layout .fms-report-m8 .table-scroll {
  overflow-x: auto;
}

/* Vehicle history — mockup `.vehicle-header`, `.timeline`, `.tl-*` */
body.ty-app .fms-report-layout .fms-report-m8 .vehicle-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 0;
  background: var(--ty-white, #fff);
  border: 1px solid var(--ty-slate-200, #e2e8f0);
  border-radius: 10px;
  box-shadow: none;
}

body.ty-app .fms-report-layout .fms-report-m8 .vehicle-plate-large {
  font-family: var(--ty-font-code, ui-monospace, monospace);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border-radius: 6px;
  background: #0ea5e9;
  color: #fff !important;
}

body.ty-app .fms-report-layout .fms-report-m8 .vehicle-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 24px;
  flex: 1;
  min-width: 200px;
}

body.ty-app .fms-report-layout .fms-report-m8 .vstat-label {
  font-size: 11px;
  color: var(--ty-slate-400, #94a3b8);
}

body.ty-app .fms-report-layout .fms-report-m8 .vstat-val {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ty-slate-800, #1e293b);
}

body.ty-app .fms-report-layout .fms-report-m8 .vstat-val--accent-gold {
  color: var(--gold-500, #f59e0b);
}

body.ty-app .fms-report-layout .fms-report-m8 .vstat-val--accent-red {
  color: #dc2626;
}

body.ty-app .fms-report-layout .fms-report-m8 .section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ty-slate-400, #94a3b8);
}

body.ty-app .fms-report-layout .fms-report-m8 .section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ty-slate-200, #e2e8f0);
}

body.ty-app .fms-report-layout .fms-report-m8 .timeline {
  position: relative;
  padding-left: 28px;
}

body.ty-app .fms-report-layout .fms-report-m8 .timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--ty-slate-200, #e2e8f0);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-item {
  position: relative;
  margin-bottom: 14px;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-dot {
  position: absolute;
  left: -24px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ty-white, #fff);
  border: 2px solid var(--ty-slate-300, #cbd5e1);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-dot.repair {
  border-color: var(--ty-navy-mid, #1a3460);
  background: var(--ty-navy-mid, #1a3460);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-dot.repeat {
  border-color: #dc2626;
  background: #dc2626;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-dot.pm {
  border-color: var(--ty-teal, #0d9488);
  background: var(--ty-teal, #0d9488);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-dot.transaction {
  border-color: #0284c7;
  background: #0284c7;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-dot.backfill {
  border-color: #7c3aed;
  background: #7c3aed;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-group-count {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ty-slate-600, #475569);
  background: var(--ty-slate-100, #f1f5f9);
  border-radius: 999px;
  vertical-align: middle;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-card--group .tl-card-body {
  padding-top: 10px;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--ty-slate-200, #e2e8f0);
  background: var(--ty-white, #fff);
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 13px;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table th,
body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--ty-slate-100, #f1f5f9);
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table th {
  background: var(--ty-slate-50, #f8fafc);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ty-slate-600, #475569);
  white-space: nowrap;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table td.num,
body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table th.num {
  text-align: right;
  white-space: nowrap;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-detail-table tfoot td {
  border-bottom: none;
  border-top: 1px solid var(--ty-slate-200, #e2e8f0);
  background: var(--ty-slate-50, #f8fafc);
  font-weight: 600;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-table-footnote {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ty-slate-500, #64748b);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-card {
  padding: 10px 14px;
  border: 1px solid var(--ty-slate-200, #e2e8f0);
  border-radius: 10px;
  background: var(--ty-white, #fff);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-card.flagged {
  border-color: #fecaca;
  background: #fef2f2;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-card-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ty-slate-100, #f1f5f9);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-card-header {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-date {
  font-size: 11px;
  color: var(--ty-slate-400, #94a3b8);
  font-variant-numeric: tabular-nums;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-wo-ref {
  display: inline-block;
  margin-top: 4px;
  max-width: 100%;
  font-size: 10px;
  font-weight: 600;
  color: var(--ty-teal, #0d9488);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.22);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-card.flagged .tl-wo-ref {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.22);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-title {
  flex: 1;
  min-width: 140px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ty-slate-800, #1e293b);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-amount {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ty-slate-700, #334155);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-flag {
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Repeat alert — mockup `.repeat-alert` */
body.ty-app .fms-report-layout .fms-report-m8 .repeat-alert {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 10px;
  background: #fef2f2;
}

body.ty-app .fms-report-layout .fms-report-m8 .repeat-alert .alert-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

body.ty-app .fms-report-layout .fms-report-m8 .badge-repeat {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
}

body.ty-app .fms-report-layout .fms-report-m8 .repeat-alert .alert-detail {
  font-size: 12px;
  color: var(--ty-slate-600, #475569);
}

body.ty-app .fms-report-layout .fms-report-m8 .two-col__stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Intro + exports row — match elevation of filters/KPI (shell rules were too flat) */
body.ty-app .fms-report-layout .fms-report-m8 .fms-report-page-intro {
  margin: 0 !important;
  padding: 1rem 1.15rem !important;
  border-radius: 10px !important;
  border: 1px solid var(--ty-slate-200, #e2e8f0) !important;
  border-left: 3px solid var(--ty-teal, #0d9488) !important;
  background: var(--ty-white, #fff) !important;
  box-shadow: none !important;
}

body.ty-app .fms-report-layout .fms-report-m8 .fms-report-actions-card {
  margin: 0 !important;
  padding: 12px 16px !important;
  border-radius: 10px !important;
  border: 1px solid var(--ty-slate-200, #e2e8f0) !important;
  background: var(--ty-slate-50, #f8fafc) !important;
  box-shadow: none !important;
}

body.ty-app .fms-report-layout .fms-report-m8 .fms-report-m8-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 768px) {
  body.ty-app .fms-report-layout .fms-report-m8 .fms-report-m8-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: stretch;
  }

  body.ty-app .fms-report-layout .fms-report-m8 .fms-report-m8-head .fms-report-actions-card {
    align-self: center;
  }
}

/* Heatmap card body — separate from zebra tables */
body.ty-app .fms-report-layout .fms-report-m8 .card-body .fms-report-heatmap-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--ty-slate-200, #e2e8f0);
}

body.ty-app .fms-report-layout .fms-report-m8 .tl-amount {
  font-family: var(--ty-font-code, ui-monospace, monospace);
}

/* Vehicle history hero — plate + KPI strip (aligned with monthly_summary visual language) */
body.ty-app .fms-report-layout .fms-report-m8 .vh-hero-card .card-body {
  padding-bottom: 1.35rem;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-hero-plate {
  text-align: center;
  margin-bottom: 4px;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-hero-plate .vehicle-plate-large {
  display: inline-block;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-hero-meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ty-slate-500, #64748b);
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-hero-card .kpi-strip {
  margin-top: 10px;
}

body.ty-app .fms-report-layout .fms-report-m8 .vh-composition-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--ty-slate-500, #64748b);
  line-height: 1.45;
}

/* =============================================================================
   Vehicle History (.rep-vh) — DOM/CSS parity with replication_prompts/
   01_vehicle_history.md + localhost:3210 prototype (scoped; no global leaks).
   ============================================================================= */

body.ty-app:has(.rep-vh) .ty-content-wrapper.fms-content-wrapper {
  background: transparent !important;
}

body.ty-app .fms-report-layout:has(.rep-vh) {
  padding: 10px 16px 28px;
  max-width: 1240px;
  margin: 0 auto;
  background: var(--vh-bg, #f4f5f7);
  border-radius: 14px;
}

body.ty-app .fms-report-layout .rep-vh {
  --vh-navy: #0b1f3a;
  --vh-navy-mid: #1a3255;
  --vh-navy-light: #2a4a72;
  --vh-gold: #e8a020;
  --vh-teal: #0d7a6a;
  --vh-red: #c0392b;
  --vh-bg: #f4f5f7;
  --vh-surface: #ffffff;
  --vh-border: #e2e5ea;
  --vh-text: #111827;
  --vh-text-sec: #4b5563;
  --vh-text-hint: #9ca3af;
  --vh-r-sm: 6px;
  --vh-r-md: 10px;
  --vh-r-lg: 14px;
  --vh-mono: var(--ty-font-code, "IBM Plex Mono", ui-monospace, monospace);
  --vh-sans: var(--ty-font-th, "Sarabun", system-ui, sans-serif);

  box-sizing: border-box;
  font-family: var(--vh-sans);
  color: var(--vh-text);
}

body.ty-app .fms-report-layout .rep-vh *,
body.ty-app .fms-report-layout .rep-vh *::before,
body.ty-app .fms-report-layout .rep-vh *::after {
  box-sizing: border-box;
}

/* —— A) Topbar —— */
body.ty-app .fms-report-layout .rep-vh .topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 12px;
}

body.ty-app .fms-report-layout .rep-vh .topbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--vh-navy-mid);
  letter-spacing: -0.02em;
}

body.ty-app .fms-report-layout .rep-vh .topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.ty-app .fms-report-layout .rep-vh .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--vh-r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--vh-sans);
}

body.ty-app .fms-report-layout .rep-vh .btn-outline {
  border-color: var(--vh-border);
  background: var(--vh-surface);
  color: var(--vh-navy-mid);
}

body.ty-app .fms-report-layout .rep-vh .btn-outline:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.ty-app .fms-report-layout .rep-vh .btn-primary {
  background: var(--vh-navy-mid);
  border-color: var(--vh-navy-mid);
  color: #fff;
}

body.ty-app .fms-report-layout .rep-vh .btn-primary:hover {
  background: var(--vh-navy-light);
  border-color: var(--vh-navy-light);
}

/* —— B) Filter bar —— */
body.ty-app .fms-report-layout .rep-vh .filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--vh-surface);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-r-md);
}

body.ty-app .fms-report-layout .rep-vh .filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--vh-text-sec);
}

body.ty-app .fms-report-layout .rep-vh .filter-select {
  min-height: 36px;
  padding: 6px 10px;
  min-width: 9rem;
  font-size: 14px;
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-r-sm);
  background: #fff;
  color: var(--vh-text);
  font-family: var(--vh-sans);
}

body.ty-app .fms-report-layout .rep-vh .filter-sep {
  width: 1px;
  height: 24px;
  background: var(--vh-border);
  flex-shrink: 0;
}

body.ty-app .fms-report-layout .rep-vh .filter-bar .btn-primary {
  margin-left: auto;
}

@media (max-width: 640px) {
  body.ty-app .fms-report-layout .rep-vh .filter-bar .btn-primary {
    margin-left: 0;
    width: 100%;
  }
}

/* —— C) Vehicle header panel —— */
body.ty-app .fms-report-layout .rep-vh .panel {
  background: var(--vh-surface);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-r-md);
  padding: 16px;
}

body.ty-app .fms-report-layout .rep-vh .vehicle-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

body.ty-app .fms-report-layout .rep-vh .vehicle-plate-large {
  font-size: 26px;
  font-weight: 700;
  color: var(--vh-navy-mid);
  font-family: var(--vh-mono);
  letter-spacing: 0.06em;
  line-height: 1.2;
}

body.ty-app .fms-report-layout .rep-vh .vehicle-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  flex: 1;
  min-width: 0;
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .vehicle-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}

@media (max-width: 480px) {
  body.ty-app .fms-report-layout .rep-vh .vehicle-stats {
    grid-template-columns: 1fr;
  }
}

body.ty-app .fms-report-layout .rep-vh .vstat {
  background: var(--vh-surface);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-r-sm);
  padding: 10px 12px;
}

body.ty-app .fms-report-layout .rep-vh .vstat--signal-ok {
  border-color: rgba(13, 122, 106, 0.35);
  background: linear-gradient(180deg, rgba(13, 122, 106, 0.06) 0%, #fff 100%);
}

body.ty-app .fms-report-layout .rep-vh .vstat-label {
  font-size: 11px;
  color: var(--vh-text-hint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.ty-app .fms-report-layout .rep-vh .vstat-val {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--vh-mono);
  font-variant-numeric: tabular-nums;
  color: var(--vh-text);
}

body.ty-app .fms-report-layout .rep-vh .vstat-val--accent-gold {
  color: var(--vh-navy-mid);
}

body.ty-app .fms-report-layout .rep-vh .vstat-val--repeat {
  color: var(--vh-red);
}

body.ty-app .fms-report-layout .rep-vh .vstat--signal-ok .vstat-val {
  color: var(--vh-teal);
}

/* —— D) Two-column —— */
body.ty-app .fms-report-layout .rep-vh .two-col {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .two-col {
    grid-template-columns: 1fr;
  }
}

body.ty-app .fms-report-layout .rep-vh .section-divider {
  display: flex;
  align-items: center;
  margin: 12px 0 10px;
  font-size: 12px;
  color: var(--vh-text-sec);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.ty-app .fms-report-layout .rep-vh .section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--vh-border);
  margin-left: 10px;
}

body.ty-app .fms-report-layout .rep-vh .two-col__main .section-divider:first-child {
  margin-top: 0;
}

/* Timeline */
body.ty-app .fms-report-layout .rep-vh .timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.ty-app .fms-report-layout .rep-vh .tl-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
}

body.ty-app .fms-report-layout .rep-vh .tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--vh-navy-mid);
  margin-top: 10px;
}

body.ty-app .fms-report-layout .rep-vh .tl-dot.repair {
  border-color: var(--vh-navy-mid);
  background: var(--vh-navy-mid);
}

body.ty-app .fms-report-layout .rep-vh .tl-dot.repeat {
  border-color: var(--vh-red);
  background: var(--vh-red);
}

body.ty-app .fms-report-layout .rep-vh .tl-card {
  background: var(--vh-surface);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-r-sm);
  padding: 10px 12px;
}

body.ty-app .fms-report-layout .rep-vh .tl-card.flagged {
  border-color: #facac5;
  background: #fdf3f2;
}

body.ty-app .fms-report-layout .rep-vh .tl-card-header {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 8px;
  align-items: start;
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .tl-card-header {
    grid-template-columns: 1fr;
  }
}

body.ty-app .fms-report-layout .rep-vh .tl-date {
  font-family: var(--vh-mono);
  font-size: 12px;
  color: var(--vh-text-sec);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body.ty-app .fms-report-layout .rep-vh .tl-wo-ref {
  display: inline-block;
  max-width: 100%;
  font-size: 10px;
  font-weight: 600;
  color: var(--vh-teal);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(13, 122, 106, 0.1);
  border: 1px solid rgba(13, 122, 106, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.ty-app .fms-report-layout .rep-vh .tl-card.flagged .tl-wo-ref {
  color: var(--vh-red);
  background: rgba(192, 57, 43, 0.08);
  border-color: rgba(192, 57, 43, 0.25);
}

body.ty-app .fms-report-layout .rep-vh .tl-title {
  color: var(--vh-text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
}

body.ty-app .fms-report-layout .rep-vh .tl-amount {
  font-family: var(--vh-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--vh-navy-mid);
  text-align: right;
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .tl-amount {
    text-align: left;
  }
}

body.ty-app .fms-report-layout .rep-vh .tl-card-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(192, 57, 43, 0.25);
}

body.ty-app .fms-report-layout .rep-vh .tl-card-foot .badge-repeat {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--vh-red);
  color: #fff;
  letter-spacing: 0.04em;
}

/* Bars */
body.ty-app .fms-report-layout .rep-vh .card {
  background: var(--vh-surface);
  border: 1px solid var(--vh-border);
  border-radius: var(--vh-r-lg);
  overflow: hidden;
}

body.ty-app .fms-report-layout .rep-vh .card-body {
  padding: 14px 16px;
}

body.ty-app .fms-report-layout .rep-vh .bar-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--vh-text-hint);
}

body.ty-app .fms-report-layout .rep-vh .bar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.ty-app .fms-report-layout .rep-vh .bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .bar-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

body.ty-app .fms-report-layout .rep-vh .bar-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--vh-text-sec);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .bar-label {
    width: 100%;
  }
}

body.ty-app .fms-report-layout .rep-vh .bar-track {
  flex: 1;
  height: 20px;
  background: var(--vh-bg);
  border-radius: 3px;
  overflow: hidden;
  min-width: 0;
}

body.ty-app .fms-report-layout .rep-vh .bar-fill {
  height: 100%;
  background: var(--vh-navy);
  border-radius: 3px;
  transition: width 0.4s ease;
}

body.ty-app .fms-report-layout .rep-vh .bar-fill.gold {
  background: var(--vh-gold);
}

body.ty-app .fms-report-layout .rep-vh .bar-fill.teal {
  background: var(--vh-teal);
}

body.ty-app .fms-report-layout .rep-vh .bar-fill.peach {
  background: #e8a080;
}

body.ty-app .fms-report-layout .rep-vh .bar-fill.gray {
  background: #b0bec5;
}

body.ty-app .fms-report-layout .rep-vh .bar-val {
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--vh-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--vh-text-sec);
}

@media (max-width: 900px) {
  body.ty-app .fms-report-layout .rep-vh .bar-val {
    width: 100%;
    text-align: left;
  }
}

/* Repeat alerts */
body.ty-app .fms-report-layout .rep-vh .repeat-stack {
  margin-top: 4px;
}

body.ty-app .fms-report-layout .rep-vh .repeat-alert {
  background: #fdf3f2;
  border: 1px solid #facac5;
  border-left: 4px solid var(--vh-red);
  border-radius: var(--vh-r-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

body.ty-app .fms-report-layout .rep-vh .repeat-alert:last-child {
  margin-bottom: 0;
}

body.ty-app .fms-report-layout .rep-vh .repeat-alert .alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

body.ty-app .fms-report-layout .rep-vh .repeat-alert .badge-repeat {
  background: var(--vh-red);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}

body.ty-app .fms-report-layout .rep-vh .repeat-alert .truck-id {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--vh-mono);
  color: var(--vh-navy);
}

body.ty-app .fms-report-layout .rep-vh .repeat-alert .alert-detail {
  font-size: 12px;
  color: var(--vh-text-sec);
  line-height: 1.45;
}

body.ty-app .fms-report-layout .rep-vh .alert-sep {
  color: var(--vh-text-hint);
}

/* Empty states */
body.ty-app .fms-report-layout .rep-vh .vh-empty {
  margin: 0;
  padding: 20px 16px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--vh-text-hint);
  background: rgba(255, 255, 255, 0.85);
  border: 1px dashed var(--vh-border);
  border-radius: var(--vh-r-sm);
}

body.ty-app .fms-report-layout .rep-vh .vh-empty--compact {
  padding: 14px;
  font-size: 13px;
}

body.ty-app .fms-report-layout .rep-vh .vh-empty p {
  margin: 0;
}

/* Transaction history styles (spreadsheet import) */
body.ty-app .fms-report-layout .rep-vh .tl-dot.transaction {
  border-color: var(--vh-sky);
  background: var(--vh-sky);
}

body.ty-app .fms-report-layout .rep-vh .badge-duplicate {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--vh-amber);
  color: var(--vh-navy-dark);
  border-radius: 999px;
  margin-left: 6px;
}
