/* =========================================================
   Bodyshop Desk — Theme Styles (clean + consolidated)
   ========================================================= */

/* --- Variables & Base Typography --- */
:root {
  --color-primary: #2563eb;          /* indigo-600 */
  --color-primary-hover: #1d4ed8;    /* indigo-700 */
  --color-text-dark: #1e293b;        /* slate-800 */
  --color-text-medium: #475569;      /* slate-600 */
  --color-text-light: #64748b;       /* slate-500 */
  --color-bg-light: #f8fafc;         /* slate-50 */
  --color-bg-medium: #f1f5f9;        /* slate-100 */
  --color-border: #e2e8f0;           /* slate-200 */
  --color-white: #ffffff;
  --color-danger: #dc2626;           /* red-600 */

  --font-family-base: 'Inter', sans-serif;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 6px 14px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.10), 0 4px 6px -4px rgb(0 0 0 / 0.10);
  --border-radius: 0.75rem;          /* 12px */

  /* Layout */
  --sidebar-width: 215px;            /* match your original sidebar width */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-base);
  background-color: var(--color-bg-light);
  color: var(--color-text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Header (public pages) --- */
.main-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}
.main-header nav { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; font-size: 1.25rem; font-weight: 700; color: var(--color-text-dark); text-decoration: none; }
.logo-icon { margin-right: .5rem; color: var(--color-primary); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .625rem 1rem; border-radius: .5rem; border: 0; cursor: pointer;
  text-decoration: none; font-weight: 500; font-size: .875rem;
  transition: background-color .2s, opacity .2s;
}
.btn-primary { background: var(--color-primary); color: var(--color-white); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:disabled { background: #a5b4fc; cursor: not-allowed; opacity: .7; }
.btn-secondary {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  color: var(--color-text-medium);
  font-weight: 600;
}.btn-secondary:hover {
  background-color: var(--color-bg-light);
  border-color: #cbd5e1; /* slate-300 */
}.btn-full { width: 100%; justify-content: center; padding-top: .75rem; padding-bottom: .75rem; font-weight: 700; }

.btn-sm {
  display: inline-block; padding: .25rem .75rem; font-size: .75rem; font-weight: 500;
  border-radius: 9999px; text-decoration: none;
  background: var(--color-bg-medium); color: var(--color-text-medium);
  transition: background-color .2s;
}
.btn-sm:hover { background: var(--color-border); }

.btn-view {
  background: var(--color-primary); color: var(--color-white);
  font-weight: 600; padding: .5rem 1rem; border-radius: 9999px; text-decoration: none;
  transition: background-color .2s;
}
.btn-view:hover { background: var(--color-primary-hover); }

.btn-lg { padding: .75rem 2.5rem; font-size: 1rem; }

/* --- Cards, Forms, Notifications --- */
.card {
  background: var(--color-white);
  padding: 0.95rem 1.5rem;
  border: 1px solid var(--color-border); box-shadow: var(--shadow-sm);
  margin: 10px 0;
  border-radius: 5px;
}

.form-container { padding: 2rem; }
.form-header { text-align: center; margin-bottom: 1.5rem; }
.form-header h1 { margin: 0 0 .25rem; font-weight: 700; font-size: 1.5rem; }
.form-header p { margin: 0; color: var(--color-text-light); }

.form-group label { display: block; font-size: .875rem; font-weight: 500; color: var(--color-text-medium); margin-bottom: .25rem; }
.form-group input, .form-control {
  padding: .75rem 1rem; border: 1px solid var(--color-border); border-radius: .5rem;
  transition: border-color .2s, box-shadow .2s; background: var(--color-white); font-size: 1rem;
  width: 100%;
  box-sizing: border-box
}
.form-group input:focus, .form-control:focus { outline: 0; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(79,70,229,.3); }

.form-footer { text-align: center; font-size: .875rem; color: var(--color-text-light); margin-top: 1rem; }
.form-footer a { color: var(--color-primary); font-weight: 500; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

/* Customer highlight (inputs + table cells) */
.customer-name-field { background: #fef9c3 !important; font-weight: 600; }
.customer-name-cell  { background: #fef9c3; font-weight: 600; font-family: 'Courier New', Courier, monospace; }

/* Error / Notification boxes */
.error-box { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; border-radius: .5rem; padding: 1rem; margin-bottom: 1.5rem; }
.error-box p { margin: 0; font-size: .875rem; font-weight: 500; }
.notification { padding: 1rem; border-radius: .5rem; margin-bottom: 1.5rem; font-weight: 500; }
.notification.success { background: #dcfce7; color: #166534; }
.notification.error   { background: #fee2e2; color: #991b1b; }

/* --- Auth pages --- */
.login-main { flex-grow: 1; display: flex; align-items: center; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 3rem; align-items: center; }
.hero-text { text-align: center; }
.hero-text h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; margin: 0 0 1rem; }
.hero-text p { font-size: 1.125rem; color: var(--color-text-medium); margin-bottom: 2rem; }
.centered-page { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--color-bg-medium); padding: 1.5rem; }
.centered-page .form-container { width: 100%; max-width: 450px; }

/* =========================================================
   Dashboard Layout (sidebar + content)
   ========================================================= */
.dashboard-layout { display: flex; min-height: 100vh; background: var(--color-bg-medium); }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  padding: 1rem; flex-shrink: 0;
  transition: transform .25s ease;
}

.sidebar-header { padding: 1rem .5rem; border-bottom: 1px solid var(--color-border); margin-bottom: 1rem; }
.logo { text-decoration: none; color: var(--color-text-dark); font-weight: 700; }

.sidebar-user { padding: .75rem .5rem; border-bottom: 1px solid var(--color-border); margin-bottom: .75rem; }
.sidebar-user .user-chip { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.sidebar-user .user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--color-bg-medium);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.sidebar-user .user-name { font-weight: 600; }
.sidebar-user .logout-link { display: flex; align-items: center; gap: .6rem; padding: .5rem; border-radius: .5rem; color: var(--color-text-dark); text-decoration: none; }
.sidebar-user .logout-link:hover { background: var(--color-bg-medium); }

.sidebar-nav { flex-grow: 1; }
.sidebar-nav ul { margin: 0; padding: 0; list-style: none; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem; padding: .75rem;
  border-radius: .5rem; text-decoration: none; color: var(--color-text-medium);
  font-weight: 500; transition: background-color .2s, color .2s;
}
.sidebar-nav a:hover { background: var(--color-bg-medium); color: var(--color-text-dark); }
.sidebar-nav a.active { background: #eef2ff; color: var(--color-primary); }

.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--color-border); }
.sidebar-footer a {
  display: flex; align-items: center; gap: .75rem; padding: .75rem;
  border-radius: .5rem; text-decoration: none; color: var(--color-text-medium);
  transition: background-color .2s, color .2s;
}
.sidebar-footer a:hover { background: var(--color-bg-medium); }

.main-content {
  flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--color-bg-light);
  padding-bottom: 100px; /* prevent fixed bars from covering content */
}

.main-content-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 2rem;
}
.main-content-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-subtitle { margin: 0; font-size: 1rem; color: var(--color-text-light); font-family: 'Courier New', Courier, monospace; }

.content-grid { padding: 2rem; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem; margin-bottom: 2rem;
}
.stat-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; color: var(--color-text-medium); }
.icon-wrapper { display: inline-flex; padding: .5rem; border-radius: .5rem; }
.icon-wrapper.bg-blue   { background: #dbeafe; color: #2563eb; }
.icon-wrapper.bg-yellow { background: #fef9c3; color: #ca8a04; }
.icon-wrapper.bg-green  { background: #dcfce7; color: #16a34a; }
.icon-wrapper.bg-indigo { background: #e0e7ff; color: #4338ca; }
.stat-card-value { font-size: 2rem; font-weight: 700; margin: 0; }

/* --- Tables (global) --- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
thead th { font-size: .75rem; text-transform: uppercase; color: var(--color-text-light); font-weight: 500; }
th.sortable a { color: var(--color-text-dark); text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
th.sortable a:hover { color: var(--color-primary); }
th.vehicle-col { width: 25%; }

/* =========================================================
   Garage Page Enhancements
   ========================================================= */
.table-wrapper table.garage-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px; /* row gaps for “card” feel */
}
.garage-table thead th { background: transparent; font-weight: 600; white-space: nowrap; }
.garage-table tbody tr { background: var(--color-white); box-shadow: var(--shadow-sm); }
.garage-table tbody td { padding: 1rem 1.1rem; border-top: 1px solid var(--color-border); vertical-align: top; }
.garage-table tbody tr:hover { background: var(--color-bg-medium); }

/* Customer column — soft yellow */
.garage-table td.customer-col { background: #FFF6D6; }

/* Vehicle stacked info */
.vehicle-main { font-weight: 600; }
.vehicle-sub  { margin-top: .25rem; font-size: .9rem; opacity: .85; }

/* VIN slightly larger + bold last 8 */
.garage-table .vin {
  font-size: 1.08rem; letter-spacing: .03em; font-family: 'Courier New', Courier, monospace;
}
.garage-table .vin .vin-last8 { font-weight: 700; }

/* Date block (bold date over time) */
.date-cell .date-day { font-weight: 700; margin-bottom: .2rem; }
.date-cell .date-time { font-size: .9rem; opacity: .85; }

/* Status pill (not bold) */
.status-pill {
  display: inline-block;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 400; /* not bold */
}
.status-pill.status-green { background: #dcfce7; color: #166534; }
.status-pill.status-yellow { background: #fef9c3; color: #854d0e; }
.status-pill.status-blue { background: #dbeafe; color: #1e40af; }

/* Actions vertical centering */
.garage-table tbody td.vin-col,
.garage-table tbody td.customer-col,
.garage-table tbody td.status-col,
.garage-table tbody td.actions { vertical-align: middle; }
.garage-table td.actions .actions-inner { display: inline-flex; align-items: center; gap: .5rem; }

/* =========================================================
   VIN Scanner / Modal / Details Pages (unchanged structure)
   ========================================================= */
.vin-input-group { display: flex; gap: .5rem; }
.vin-input-group input { flex-grow: 1; }
#vin-scanner-container { margin-top: 1rem; padding: 1rem; border: 1px solid var(--color-border); border-radius: var(--border-radius); background: var(--color-bg-light); }
#vin-reader { width: 100%; border-radius: .5rem; overflow: hidden; margin-bottom: 1rem; }
#vin-reader video { width: 100% !important; height: auto !important; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 600px;
  transform: scale(.95);
  transition: transform .3s;
  /* ADD THESE TWO LINES */
  max-height: 90vh; /* Allow it to be 90% of the screen height */
  overflow-y: auto;   /* Make the entire card scroll if it's too tall */
}

.modal-content > form {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}

.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h2 { margin: 0; font-size: 1.5rem; }
.modal-header .close-btn { background: none; border: 0; cursor: pointer; color: var(--color-text-light); }
.modal-header .close-btn:hover { color: var(--color-text-dark); }
.modal-body .form-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 1rem; 
    margin: 1rem 0;
}
.modal-footer { margin-top: 1.5rem; display: flex; justify-content: flex-end; gap: 1rem; }
.modal-body {
  overflow-y: auto; /* Add vertical scrollbar ONLY when needed */
}
.vehicle-details-grid, .repair-estimate-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-bottom: 2rem; }
.details-list { list-style: none; padding: 0; margin: 0; }
.details-list li { display: flex; justify-content: space-between; padding: .75rem 0; border-bottom: 1px solid var(--color-border); }
.details-list li:last-child { border-bottom: 0; }
.details-list li strong { color: var(--color-text-medium); }
.details-list li span { font-weight: 600; text-align: right; }

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-header h3 { margin: 0; }

.hidden { display: none !important; }


.btn-sm-delete { background: none; border: 0; cursor: pointer; color: var(--color-text-light); padding: .25rem; }
.btn-sm-delete:hover { color: var(--color-danger); }

.vin-header { font-size: 1.75rem; margin-bottom: .25rem; }
.vin-display { font-size: 1.1rem; background: var(--color-bg-medium); padding: .25rem .5rem; border-radius: .25rem; display: inline-block; }
.vin-display strong { font-weight: 800; color: var(--color-text-dark); }

.checkbox-group { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .5rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; padding: .5rem; background: var(--color-bg-light); border-radius: .5rem; cursor: pointer; }
.table-input { width: 100px; padding: .25rem .5rem; border: 1px solid var(--color-border); border-radius: .25rem; }
.table-checkbox { transform: scale(1.2); }
.custom-part-input { display: flex; gap: .5rem; }
.custom-part-input input { flex-grow: 1; padding: .75rem 1rem; border: 1px solid var(--color-border); border-radius: .5rem; }


/* --- Invoice accordion --- */
.invoice-accordion .accordion-item:not(:last-child) { border-bottom: 1px solid var(--color-border); }
.accordion-header {
  background: none; border: 0; width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem .5rem; cursor: pointer; text-align: left;
}
.accordion-header:hover { background: var(--color-bg-light); }
.invoice-accordion .accordion-header > span {
  display: flex;
  flex-direction: column; /* UPDATED: Changed from column to row */
  align-items: baseline; /* Aligns the text nicely */
  gap: 0.75rem; /* Adds space between title and VIN */
}
.accordion-header .vin-snippet { font-size: .8rem; color: var(--color-text-light); font-family: 'Courier New', Courier, monospace; }
.accordion-header i { transition: transform .3s; }
.accordion-item.active .accordion-header i { transform: rotate(180deg); }
.invoice-item:not(:last-child) { border-bottom: 1px solid var(--color-bg-medium); }
.add-invoice-container { padding-bottom: 1rem; }
.add-invoice-form { padding-top: 1rem; border-top: 1px dashed var(--color-border); }

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet */
@media (min-width: 768px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-text { text-align: left; }
  .hero-text h1 { font-size: 3rem; }
  .vehicle-details-grid, .repair-estimate-grid { grid-template-columns: 1fr 1fr; }
  
}

/* Desktop behavior: sidebar stays static */
@media (min-width: 981px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none !important; }
}

/* Mobile: hamburger + slide-in sidebar + garage cards */
.hamburger {
  position: fixed; top: 12px; right: 12px; width: 40px; height: 40px;
  display: none; flex-direction: column; justify-content: center; gap: 6px;
  background: var(--color-white); border: 1px solid var(--color-border);
  border-radius: 10px; box-shadow: var(--shadow-sm); z-index: 1100;
}
.hamburger span { display: block; height: 2px; margin: 0 8px; background: var(--color-text-dark); border-radius: 2px; }

@media (max-width: 980px) {
  .hamburger { display: flex; }

  .sidebar {
    position: fixed !important; top: 0; left: 0; height: 100vh;
    width: var(--sidebar-width); max-width: 85vw;
    background: var(--color-white); border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%); transition: transform .25s ease; z-index: 1060;
  }
  .sidebar.is-open { transform: translateX(0) !important; }

  html.nav-open::before {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.28);
    z-index: 1050; pointer-events: auto;
  }

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

}

@media (max-width: 780px) {
  .content-grid { padding: 1rem; }
  /* Garage mobile “cards” */
  .garage-table thead { display: none; }
  .garage-table, .garage-table tbody, .garage-table tr, .garage-table td { display: block; width: 100%; }
  .garage-table tbody tr {
    border-radius: 12px; overflow: hidden; margin-bottom: 14px;
    box-shadow: var(--shadow-md); border: 1px solid var(--color-border); background: var(--color-white);
  }
  .garage-table tbody td { border: 0; border-top: 1px solid var(--color-border); padding: 1rem 1.1rem; }
  .garage-table tbody td:first-child { border-top: none; }
  /* Hide pseudo labels (“Vehicle”, “VIN”, etc.) for cleaner cards */
  .garage-table tbody td::before { display: none !important; }

  /* Customer subtle gradient on mobile to distinguish column content */
  .garage-table td.customer-col {
    background-image: linear-gradient(to right, rgba(255,246,214,.7), rgba(255,246,214,.2));
  }

  /* Bigger touch targets for actions */
  .garage-table td.actions a { display: inline-block; margin-right: .6rem; margin-bottom: .35rem; }
}

/* Very small phones */
@media (max-width: 360px) {
  .btn { padding: .55rem .875rem; }
  .btn-view { padding: .45rem .875rem; }
}
/* === Invoices page polish === */
.invoice-accordion .accordion-header {
  font-size: 1rem; /* slightly larger title */
}
.invoice-item { font-size: 0.98rem; }
.invoice-item .invoice-title { font-weight: 600; }
.invoice-item .invoice-meta { color: var(--color-text-medium); }

.vin-display { font-family: 'Courier New', Courier, monospace; }
.vin-display strong { font-weight: 800; }

/* Add-invoice form */
.add-invoice-container { padding-bottom: 1rem; }
.add-invoice-btn { margin-top: .5rem; }
.add-invoice-form.hidden { display: none; }

.invoice-items-group { margin: 1rem 0; }
.invoice-items-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.invoice-items [data-items] .invoice-item-row {
  display: grid; grid-template-columns: 1fr 160px 40px; gap: .5rem; align-items: center;
  margin-bottom: .5rem;
}
.invoice-items .form-control { width: 100%; }
.remove-item-btn { background: var(--color-bg-medium); }

.form-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* Mobile adjustments */
@media (max-width: 780px) {
  .invoice-items [data-items] .invoice-item-row {
    grid-template-columns: 1fr 1fr 40px;
  }
}
/* Native accordion styling for invoices */
.invoice-accordion details > summary.accordion-header {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem .5rem; border: 0;
}
.invoice-accordion details > summary::-webkit-details-marker { display: none; }
.invoice-accordion details[open] > summary i { transform: rotate(180deg); transition: transform .25s ease; }
.invoice-accordion details > summary i { transition: transform .25s ease; }

/* === Force full height for native <details> accordion on Invoices === */
.invoice-accordion,
.invoice-accordion * {
  overflow: visible !important; /* nuke any hidden overflow from old styles */
}

.invoice-accordion details.accordion-item {
  display: block;            /* ensure block context for content */
  border-bottom: 1px solid var(--color-border);
  margin-bottom: .75rem;
}

/* Kill legacy collapse rules completely */
.invoice-accordion .accordion-content {
  display: block !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0 1.25rem 1rem !important;  /* breathing room */
}

/* Make sure summary looks and behaves right */
.invoice-accordion details > summary.accordion-header {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem .5rem;
  border: 0;
}
.invoice-accordion details > summary::-webkit-details-marker { display: none; }
.invoice-accordion details > summary i { transition: transform .25s ease; }
.invoice-accordion details[open] > summary i { transform: rotate(180deg); }

/* Inside the dropdown */
.add-invoice-container { padding-bottom: 1rem; }
.add-invoice-form { margin-top: .75rem; }
.invoice-upload-form .form-grid { gap: .75rem; }
.invoice-items-group { margin: 1rem 0; }
.invoice-items-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.invoice-items [data-items] .invoice-item-row {
  display: grid; grid-template-columns: 1fr 160px 40px; gap: .5rem; align-items: center;
}
@media (max-width: 780px) {
  .invoice-items [data-items] .invoice-item-row { grid-template-columns: 1fr 1fr 40px; }
}
/* Invoices: ensure the form can show */
.add-invoice-form { display: block !important; }
.add-invoice-form.hidden { display: none !important; }


/* ---- Invoices: native details + CSS-only Add Invoice toggle ---- */

/* let the dropdown breathe */
.invoice-accordion .accordion-content {
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0 1.25rem 1rem !important;
}

/* chevron rotation */
.invoice-accordion details > summary.accordion-header { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 1.25rem .5rem; border: 0; }
.invoice-accordion details > summary::-webkit-details-marker { display: none; }
.invoice-accordion details > summary i { transition: transform .25s ease; }
.invoice-accordion details[open] > summary i { transform: rotate(180deg); }

/* CSS-only toggle:
   - form is hidden by default
   - when checkbox is checked, show the form */
.toggle-add-invoice + .add-invoice-form { display: none !important; }
.toggle-add-invoice:checked + .add-invoice-form { display: block !important; margin-top: .75rem; }

/* keep clicks on controls from closing the details accidentally */
.add-invoice-btn, .add-invoice-form { -webkit-tap-highlight-color: transparent; }

/* simple layout polish inside */
.invoice-upload-form .form-grid { gap: .75rem; }
.invoice-items-group { margin: 1rem 0; }
.invoice-items .invoice-item-row { display: grid; grid-template-columns: 1fr 160px; gap: .5rem; align-items: center; }
@media (max-width: 780px) {
  .invoice-items .invoice-item-row { grid-template-columns: 1fr 1fr; }
}
/* Camera-first uploader hinting */
.add-invoice-form .form-group label { font-weight: 600; }
.add-invoice-form small.text-light { display: block; margin-top: .25rem; }

/* Ensure the details dropdown can grow fully */
.invoice-accordion .accordion-content {
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0 1.25rem 1rem !important;
}

/* Toggle behavior for Add Invoice (CSS-only) */
.toggle-add-invoice + .add-invoice-form { display: none !important; }
.toggle-add-invoice:checked + .add-invoice-form { display: block !important; margin-top: .75rem; }
/* Invoices: ensure dropdown grows fully */
.invoice-accordion .accordion-content {
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0 1.25rem 1rem !important;
}

/* CSS-only toggle for Add Invoice panel */
.toggle-add-invoice + .add-invoice-form { display: none !important; }
.toggle-add-invoice:checked + .add-invoice-form { display: block !important; margin-top: .75rem; }

/* Parts checklist */
.parts-checklist { display: grid; gap: .35rem; margin-top: .25rem; }
.parts-row {
  display: grid; grid-template-columns: 20px 1fr auto; gap: .5rem; align-items: center;
  padding: .35rem .5rem; border: 1px dashed var(--color-border); border-radius: .5rem;
}
.parts-row .part-name { font-weight: 600; }
.parts-row .part-price { color: var(--color-text-medium); font-variant-numeric: tabular-nums; }

/* Ensure invoice dropdown expands fully */
.invoice-accordion .accordion-content {
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0 1.25rem 1rem !important;
}

/* CSS-only toggle for Add Invoice panel */
.toggle-add-invoice + .add-invoice-form { display: none !important; }
.toggle-add-invoice:checked + .add-invoice-form { display: block !important; margin-top: .75rem; }

/* Visually hide checkbox but keep it accessible */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 1px, 1px);
  white-space: nowrap; border: 0;
}

/* Parts checklist: full-row toggle style */
.parts-checklist { display: grid; gap: .5rem; margin-top: .25rem; }

.parts-row {
  display: block;
  cursor: pointer;
}

.parts-row .row-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  align-items: center;
  padding: .6rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: .6rem;
  background: var(--color-surface);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

/* hover/focus hint */
.parts-row:hover .row-content,
.parts-row:focus-within .row-content {
  background: var(--color-surface-raise);
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 0 0 3px rgba(0,0,0,0.03) inset;
}

/* selected state (checkbox checked) */
.parts-row .sr-only:checked + .row-content {
  background: #f0f9f4;                /* subtle green tint */
  border-color: #38a169;               /* green border */
  box-shadow: 0 0 0 2px rgba(56,161,105,0.18);
}

/* text styles */
.part-name { font-weight: 600; line-height: 1.3; }
.part-price { color: var(--color-text-medium); font-variant-numeric: tabular-nums; }

/* small screens: stack name and price */
@media (max-width: 640px) {
  .parts-row .row-content { grid-template-columns: 1fr; align-items: start; }
  .part-price { justify-self: start; }
}
/* Accessible hide */
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,1px,1px);white-space:nowrap;border:0}

/* Checkbox UI for Ordered/Received */
.toggle-check{display:inline-flex;align-items:center;cursor:pointer}
.toggle-check input{position:absolute;opacity:0;pointer-events:none}
.toggle-check .fake-box{
  width:18px;height:18px;border:2px solid var(--color-border);
  border-radius:6px;display:inline-block;position:relative;transition:all .2s ease;background:var(--color-surface);
}
.toggle-check input:checked + .fake-box{
  background:#10b981;border-color:#10b981;
  box-shadow:0 0 0 2px rgba(16,185,129,.18);
}

.table-modern .text-right{text-align:right}
.table-modern .text-center{text-align:center}
.totals-row{display:flex;justify-content:space-between;align-items:center;margin-top:.75rem;font-weight:700}
.totals-label{opacity:.8}
.totals-value{font-variant-numeric:tabular-nums}
.repair-estimate-grid { grid-template-columns: 1fr !important; }
.repair-estimate-grid .card { width: 100%; }

/* Vehicle thumbnail in Garage */
.photo-col { width: 88px; }
.vehicle-thumb { background: var(--color-surface-200); }
.vehicle-thumb.placeholder { display: block; border: 1px dashed var(--color-border); background: transparent; }
.garage-table .photo-col { text-align: left; }


/* View Vehicle: restore original flow on non-photo cards; only photo uses flex */
.vehicle-details-grid { align-items: start; padding-right: 1rem;}  /* critical for natural stacking */

.vehicle-details-grid > .card {                 /* non-photo cards go back to block */
  display: block;
  margin: 0 !important;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0.5rem;
}

.vehicle-details-grid > .card.photo-card {      /* keep photo filling behavior */
  display: flex;
  height: 100%;
}
.vehicle-details-grid > .card.photo-card .vehicle-photo-wrap {
  flex: 1;
  display: flex;
}
.vehicle-details-grid > .card.photo-card .vehicle-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: .5rem;
}

/* Ensure headers stack above content inside non-photo cards */
.vehicle-details-grid > .card:not(.photo-card) > .card-header {
  display: block;
}
.vehicle-details-grid > .card:not(.photo-card) > .card-header h3 {
  display: block;
  margin-bottom: .75rem; /* small breathing room above content */
}
/* Make the first content block after the header take full width */
.vehicle-details-grid > .card:not(.photo-card) > .card-header + * {
  display: block;
  width: 100%;
}


/* Three-column layout on wide screens */
@media (min-width: 1024px) {
  .vehicle-details-grid {
    /* wider photo column */
    grid-template-columns: 1fr 1fr;
    /* don't stretch sibling cards – restores their original look */
    align-items: start;
  }
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-100);
  padding: 20px;
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
}
.dropzone.dragover {
  background: var(--color-surface-200);
  border-color: var(--color-accent);
}
.dropzone .dz-instructions { display:flex; gap:.5rem; align-items:center; color: var(--muted); }
/* Garage photo column: tidy vertical spacing, fixed thumb height, wider column */
.garage-table th.photo-col,
.garage-table td.photo-col {
  width: 150px;       /* adjust: 140–170px to taste */
  padding-left: 0;
  padding-right: 0;
}

.garage-table td.photo-col { padding-top: 0; padding-bottom: 0; }

.garage-table td.photo-col .vehicle-thumb {
  display: block;
  width: 100%;
  height: 73px;       /* adjust: 56–72px if you prefer */
  object-fit: cover;
  margin: 0;          /* no top/bottom margins */
  border-radius: .5rem;
}
/* Chips & suggestions for Parts Estimate */
.chip-row { display:flex; gap:.5rem; flex-wrap: wrap; }
.chip { border:1px solid var(--color-border); background: var(--color-surface-100); padding: .35rem .6rem; border-radius: 999px; cursor: pointer; }
.chip.active { background: var(--color-accent-soft); border-color: var(--color-accent); }
#damage-suboptions .subgroup { margin:.5rem 0; padding:.5rem; border:1px dashed var(--color-border); border-radius:.5rem; }
#damage-suboptions .subgroup h4 { margin:0 0 .35rem 0; font-size: .95rem; color: var(--muted); }
.suggestions { position: relative; }
.suggestions .suggestion-list { position: absolute; z-index: 5; left:0; right:0; background: var(--color-surface); border:1px solid var(--color-border); border-radius:.5rem; max-height: 220px; overflow:auto; }
.suggestions .suggestion-item { padding:.4rem .6rem; cursor: pointer; }
.suggestions .suggestion-item:hover { background: var(--color-surface-100); }

/* --- Signup Chooser Page --- */
.chooser-container {
    width: 100%;
    max-width: 600px;
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
}

.chooser-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.option-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--color-text-dark);
    transition: all 0.2s ease-in-out;
}

.option-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.option-card .option-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eef2ff; /* indigo-100 */
    color: var(--color-primary);
    border-radius: 50%;
}

.option-card .option-icon svg {
    width: 24px;
    height: 24px;
}

.option-card .option-text {
    flex-grow: 1;
}

.option-card .option-text h2 {
    margin: 0 0 0.25rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.option-card .option-text p {
    margin: 0;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.option-card .option-arrow {
    color: var(--color-border);
    transition: color 0.2s;
}

.option-card:hover .option-arrow {
    color: var(--color-primary);
}


/* --- Parts List Table --- */
.parts-table th.photo-col,
.parts-table td.photo-col {
  width: 100px;
}
.part-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 0.5rem;
  background-color: var(--color-bg-medium);
}
.part-name {
  font-weight: 600;
}
.part-number {
  font-size: 0.8rem;
  font-family: 'Courier New', Courier, monospace;
}
.status-pill {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 9999px;
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
}
.status-pill.status-green { background: #dcfce7; color: #166534; }
.status-pill.status-yellow { background: #fef9c3; color: #854d0e; }


/* --- Add Part Form --- */
.add-part-form .form-grid-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: flex-start;
}
.add-part-form .form-column {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.add-part-form textarea {
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  font-family: var(--font-family-base);
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.add-part-form textarea:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(79,70,229,.3);
}
.add-part-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}


/* --- View Part Page --- */
.part-view-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: flex-start;
}
.part-gallery .primary-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
}
.part-gallery .thumbnail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1rem;
}
.part-gallery .thumbnail-photos img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: .5rem;
  cursor: pointer;
  border: 1px solid var(--color-border);
  opacity: 0.7;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.part-gallery .thumbnail-photos img:hover {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--color-primary);
}
.part-details .part-price-stock {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}
.part-details .price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-text-dark);
}
.part-details .stock-num {
  font-family: 'Courier New', Courier, monospace;
  background-color: var(--color-bg-medium);
  padding: .25rem .5rem;
  border-radius: .25rem;
  font-weight: 600;
}
.part-details hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1rem 0;
}
.part-details h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: .5rem;
}
.part-details p, .part-details .details-list {
  line-height: 1.6;
  color: var(--color-text-medium);
}
.details-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.details-list li {
  display: flex;
  justify-content: space-between;
  padding: .5rem 0;
}
.details-list li:not(:last-child) {
  border-bottom: 1px solid var(--color-bg-medium);
}
.details-list strong { color: var(--color-text-dark); }

/* Responsive adjustments for new features */
@media (max-width: 980px) {
  .add-part-form .form-grid-columns,
  .part-view-layout {
    grid-template-columns: 1fr;
  }
}

/* ... (all your existing CSS remains here) ... */

/* =========================================================
   NEW & REVISED STYLES FOR FITMENT & PHOTOS
   ========================================================= */

/* --- Fitment Suggester (Revised for Clickable Rows) --- */
.fitment-search-group {
    display: flex;
    gap: 0.5rem;
}
.photo-preview-grid {
    display: flex; /* Changed to flexbox for better control */
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.photo-preview-item {
    width: 120px; /* Fixed width */
    height: 120px; /* Fixed height */
    position: relative;
    border-radius: .5rem;
    overflow: hidden;
    border: 2px solid transparent;
    flex-shrink: 0;
}
.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the square area */
}
#fitment-suggestions-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
/* --- Fitment Suggester (Revised for Clickable Rows) --- */
.fitment-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: .5rem;
    padding: 0.5rem;
}
.fitment-option { /* This is the <label> tag */
    display: block; /* The label is the container */
    cursor: pointer;
    border-radius: .5rem;
}
.hidden-checkbox {
    /* Hide the actual checkbox completely */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.fitment-content {
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: .5rem;
    transition: background-color 0.2s, border-color 0.2s;
    background-color: var(--color-white);
}
.fitment-option:hover .fitment-content {
    background-color: var(--color-bg-light);
}
/* THIS IS THE CORRECTED SELECTOR */
/* When the hidden checkbox inside the label is checked, style the .fitment-content div that is its sibling. */
.hidden-checkbox:checked + .fitment-content {
    background-color: #eef2ff !important; /* indigo-100 */
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 1px var(--color-primary);
}
.fitment-content strong {
    font-weight: 600;
}
.fitment-options-master-container {
    display: none; /* Hidden by default, shown by JS */
}
.fitment-options-group {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.fitment-options-group h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-medium);
}

.fitment-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fitment-chip { /* This is the <label> */
    display: inline-block;
    cursor: pointer;
    border-radius: 9999px; /* Pill shape */
}

.fitment-chip span {
    display: block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background-color: var(--color-white);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease-in-out;
}

.fitment-chip:hover span {
    border-color: #a5b4fc; /* indigo-300 */
}

/* Style the span when the hidden checkbox inside the label is checked */
.fitment-chip .hidden-checkbox:checked + span {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.photo-actions {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4); /* Slightly lighter overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 1; /* Make visible by default */
    transition: background-color 0.2s;
}

/* Optional: a subtle hover effect can remain */
.photo-preview-item:hover .photo-actions {
    background: rgba(0, 0, 0, 0.6);
}
.photo-actions .btn-icon {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text-dark);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.photo-actions .btn-icon:hover {
    background: var(--color-white);
    transform: scale(1.1);
}

/* --- Primary Photo (Swipe Hint) --- */
.primary-photo img {
    /* Prevents the page from scrolling vertically while the user is swiping horizontally */
    touch-action: pan-y;
    /* You could also add a cursor hint for desktop users, though it's not swipable there */
    /* cursor: grab; */
}

/* --- Thumbnail Styles --- */
.thumbnail-photo {
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s ease-in-out, opacity 0.2s;
    opacity: 0.7;
}

.thumbnail-photo:hover {
    opacity: 1;
}

/* --- Active Thumbnail Highlight --- */
.thumbnail-photo.active-thumbnail {
    border-color: var(--color-primary);
    opacity: 1;
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.5);
}
/* The viewport that clips the content */
.gallery-viewport {
    position: relative;
    width: 100%;
    overflow: hidden; /* This is the key to the effect */
    aspect-ratio: 4 / 3;
    border-radius: var(--border-radius);
    background-color: var(--color-bg-medium);
}

/* The filmstrip that holds all images and slides */
.gallery-filmstrip {
    display: flex;
    height: 100%;
    /* The transition property enables the animation */
    transition: transform 0.3s ease-in-out;
}

/* Each individual image in the filmstrip */
.gallery-image {
    flex-shrink: 0; /* Prevents images from shrinking */
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Active Thumbnail Highlight (Unchanged but still needed) --- */
.thumbnail-photo.active-thumbnail {
    border-color: var(--color-primary);
    opacity: 1;
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.5);
}

/* =========================================================
   NEW: Modern Parts Estimator UI
   ========================================================= */

.estimator-ui {
  background: var(--color-white);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
}

.estimator-header .estimator-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.estimator-header .estimator-subtitle {
  margin: 0 0 1.5rem 0;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.damage-area-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.area-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-white);
  cursor: pointer;
  text-align: center;
  font-size: 0.9375rem; /* UPDATED from 1rem (15px) */
  font-weight: 600;
  color: var(--color-text-dark);
  transition: all 0.2s ease;
}

.area-btn svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
  color: var(--color-text-light);
  transition: color 0.2s ease, transform 0.2s ease;
}

.area-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.area-btn:hover svg {
  color: var(--color-primary);
}

.area-btn.active {
  background-color: #1e2e50; /* UPDATED to a darker shade of the subcategory color */
  border-color: #1e2e50;
  color: var(--color-white); /* White font for contrast */
  box-shadow: none; /* Remove the glow for a cleaner, solid look */
}

.area-btn.active svg {
  color: var(--color-white);
}

.selection-panel {
  display: grid;
  grid-template-columns: 220px 1fr; /* Sidebar and main content */
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.subcategory-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.subcategory-nav .subcat-btn {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 0;
  background: transparent;
  border-radius: 0.5rem;
  text-align: left;
  font-size: 0.9375rem; /* UPDATED from 1rem (15px) */
  font-weight: 500;
  color: var(--color-text-medium);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.subcategory-nav .subcat-btn:hover {
  background-color: var(--color-bg-medium);
  color: var(--color-text-dark);
}

.subcategory-nav .subcat-btn.active {
  background: #25375e; /* UPDATED to new dark blue */
  color: var(--color-white);
}area-btn.active

.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.parts-grid-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--color-text-light);
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
}

/* --- Responsive Adjustments for Estimator --- */
@media (max-width: 980px) {
  .selection-panel {
    grid-template-columns: 1fr;
  }
  .subcategory-nav {
    /* These properties are for the new vertical stack layout */
    display: flex;
    flex-direction: column; /* Ensures vertical stacking */
    gap: 0.5rem; /* Adds space between the stacked buttons */
  }

  .subcategory-nav .subcat-btn {
    white-space: nowrap;
    background: var(--color-white);
    border: 1px solid var(--color-border);
  }
}

@media (max-width: 767px) {
  .damage-area-grid {
    grid-template-columns: 1fr;
  }
  .area-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 1rem;
  }
}
/* --- Parts Estimator: Group Separator (Revised) --- */
.part-group-separator {
  grid-column: 1 / -1; /* Makes the element span all columns in the grid */
  border: 0;
  height: 0;
  border-top: 2px dashed #e2e8f0; /* slate-200, thicker and dashed */
  margin: 0.75rem 0;
}

/* ... (all your existing CSS remains here) ... */

/* =========================================================
   NEW STYLES FOR ESTIMATOR TABLES
   ========================================================= */
.estimator-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.estimator-table thead th {
    background-color: var(--color-bg-medium);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.estimator-table tbody td {
    padding: 0.25rem 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.estimator-table tbody tr:last-child td {
    border-bottom: none;
}

/* Style for the form inputs within the table */
.estimator-table .table-input {
    width: 100%;
    background-color: #f8fafc; /* slate-50 - very light gray */
    border: none;
    padding: 0.6rem;
    border-radius: 0.375rem; /* 6px */
    font-size: 0.9rem;
    outline: none;
    transition: box-shadow 0.2s;
}

.estimator-table .table-input:focus {
    box-shadow: 0 0 0 2px var(--color-primary);
}

.estimator-table .price-input {
    width: 120px; /* Give price inputs a fixed width */
    text-align: right;
}

/* Checkbox styling */
.estimator-table .check-col {
    width: 40px;
    text-align: center;
}

.estimator-table .table-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--color-primary); /* Modern way to style checkbox color */
}

/* Delete button */
.estimator-table .delete-col {
    width: 50px;
    text-align: center;
}

.btn-delete-row {
    background: transparent;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-delete-row:hover {
    background-color: #fee2e2; /* red-100 */
    color: var(--color-danger);
}
.estimator-table .part-name-col,
.estimator-table .task-name-col {
    min-width: 250px; /* Adjust this value as needed */
    width: 40%; /* Give it a percentage width as well */
}
/* --- Responsive Fixes for Small Screens --- */
@media (max-width: 768px) {

    /* --- Part Suggestion Tool --- */
    /* This makes the grid of damage areas stack vertically */
    #damage-chips {
        grid-template-columns: 1fr;
    }

    /* This makes the custom part/labor input fields stack */
    .custom-part-input {
        flex-direction: column;
    }
    .custom-part-input input {
        width: 100%;
    }

    /* --- Estimator Tables --- */
    /* Ensure the wrapper scrolls, preventing the page from overflowing */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smoother scrolling on iOS */
    }

    /* Force the table to not shrink below a certain width, which triggers the horizontal scroll on the wrapper */
    .estimator-table {
        min-width: 600px;
    }
    
    /* Increase the width of the name column by about 30% on mobile */
    .estimator-table .part-name-col,
    .estimator-table .task-name-col {
        min-width: 320px; /* Approx 250px * 1.3 */
    }
}

/* =========================================================
   NEW: Generic Photo Uploader Styles
   ========================================================= */
.photo-file-input {
  width: 0.1px; height: 0.1px; opacity: 0;
  overflow: hidden; position: absolute; z-index: -1;
}
.photo-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.5rem; text-align: center; cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.photo-dropzone:hover, .photo-dropzone.dragover {
  border-color: var(--color-primary);
  background-color: var(--color-bg-light);
}
.photo-instructions {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .75rem; color: var(--color-text-light);
}
.photo-instructions i { width: 32px; height: 32px; }
.photo-preview { position: relative; max-width: 100%; margin: 0 auto; }
.photo-preview-body img {
  width: 100%; height: auto; max-height: 300px;
  object-fit: contain; border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}
.photo-preview-actions {
  position: absolute; top: 0.5rem; right: 0.5rem; display: flex; gap: 0.5rem;
}
.photo-buttons { display: flex; gap: 0.5rem; margin-top: 1rem; justify-content: center; }
.form-group-separator {
    border: 0; height: 1px; background-color: var(--color-border);
}
.btn > [data-feather],
.btn > svg {
  pointer-events: none;
}
/* =========================================================
   NEW: Invoices Page Layout Overhaul
   ========================================================= */

/* --- Main Accordion Polish --- */
.invoice-accordion .accordion-item {
  border: 1px solid var(--color-border);
  border-radius: 7px;
  margin-bottom: 1rem;
  background-color: var(--color-white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.invoice-accordion .accordion-item:hover {
    box-shadow: var(--shadow-md);
}

.invoice-accordion details[open].accordion-item {
  border-color: #a5b4fc; /* indigo-300 */
}

.invoice-accordion .accordion-header {
  padding: 1rem 1.5rem;
}

.invoice-accordion .accordion-content {
  padding: 0 1.5rem 1.5rem !important; /* Override inline styles */
  border-top: 1px solid var(--color-border);
}

/* --- Individual Invoice Item Styling --- */
.invoice-list {
  display: flex;
  flex-direction: column;
  gap: 1rem; /* Space between each invoice item */
  padding: 1rem 0;
}

.invoice-item {
  border: 1px solid var(--color-border);
  border-radius: .6rem;
  padding: 1rem;
  background-color: var(--color-bg-light); /* Light background for each invoice */
}



.invoice-item .invoice-title {
  font-weight: 600;
  color: var(--color-text-dark);
}

.invoice-item .invoice-meta {
  text-align: right; /* UPDATED: Changed back to 'right' */
  flex-shrink: 0;
  color: var(--color-text-medium);
}

.invoice-parts-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.875rem;
}
.invoice-parts-list strong {
    color: var(--color-text-medium);
}

/* --- "Add Invoice" Form Styling --- */
.add-invoice-container {
    margin-top: 1rem;
}

.add-invoice-form {
  margin-top: 1rem;
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.add-invoice-form .form-group > label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Responsive adjustments for the new layout */
@media (max-width: 640px) {
  .invoice-item .invoice-meta {
    text-align: left;
    padding-top: 0.5rem;
  }
}

/* =========================================================
   FIX: Sticky "Save Estimate" Footer Bar
   ========================================================= */

/* --- Desktop Rule (screens wider than 980px) --- */
@media (min-width: 981px) {
  .form-footer-actions {
    position: fixed;
    left: var(--sidebar-width); /* Aligns with the sidebar */
    right: 0;
    bottom: 0;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .05);
    z-index: 100;
  }
}

/* --- Mobile Rule (screens 980px or narrower) --- */
@media (max-width: 980px) {
  .form-footer-actions {
    position: fixed;
    left: 0; /* Full width */
    right: 0;
    bottom: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(5px);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .05);
    z-index: 100;
  }
}
.small_input {
  width: auto !important;
}
.parts-row.received {
  opacity: 0.6;
  cursor: pointer;
  background-color: var(--color-bg-medium);
}

.parts-row.received .part-name {
  text-decoration: line-through;
}

.parts-row.received .row-content {
    border-style: dashed;
}.parts-notice {
  background-color: #fef9c3; /* yellow-100 */
  color: #713f12; /* yellow-800 */
  padding: 0.75rem;
  border-radius: .5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  border: 1px solid #fde047; /* yellow-300 */
} .btn-icon, .btn-icon-danger {
  background: none; border: none; cursor: pointer; color: var(--color-text-light);
  padding: 0.25rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all 0.2s;
}
.btn-icon:hover { color: var(--color-primary); background-color: #eef2ff; }
.btn-icon-danger:hover { color: var(--color-danger); background-color: #fee2e2; }
.invoice-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.invoice-item-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.invoice-total {
    font-weight: 600;
    color: var(--color-primary); /* Price is now the primary color */
}

.invoice-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Ensure parts list has top margin */
.invoice-parts-list {
    margin-top: 0.75rem;
}

/* --- Inventory Expense Dropdown --- */
.inventory-card .total-invested strong {
    font-size: 1.1rem;
    color: #166534; /* green-800 */
}

.expense-details-content {
    padding: 1rem 0 0 0;
    margin-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.expense-details-content h4 {
    margin: 0 0 1rem 0;
}
.expense-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}
.expense-list li {
    display: flex;
    justify-content: space-between;
    padding: .5rem;
    border-radius: .375rem;
  flex-wrap: wrap;
}
.expense-list li:nth-child(odd) {
    background-color: var(--color-bg-light);
}
.expense-parts {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: .25rem;
}
.add-expense-form {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.add-expense-form h5 {
    margin: 0 0 0.5rem 0;
}
.form-grid-small {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.5rem;
    align-items: center;
}/* =========================================================
   NEW: Modern Photo Placeholder for Inventory
   ========================================================= */

.inventory-card-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-light); /* Lighter, cleaner background */
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    border-bottom: 1px solid var(--color-border); /* Adds a subtle separator line */
    padding: 1rem;
}

.car-silhouette {
    width: 100px; /* Controls the size of the silhouette */
    height: auto;
    color: var(--color-border); /* A subtle light gray for the silhouette */
}


/* =========================================================
   NEW: Inventory Page Redesign
   ========================================================= */

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.inventory-card {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.inventory-card-photo {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden; /* Ensures image stays contained */
    background-color: var(--color-bg-light);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.inventory-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This is key: prevents image stretching */
    transition: transform 0.3s ease;
}

.inventory-card-photo:hover img {
    transform: scale(1.05);
}

.inventory-card-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--color-border);
}

.car-silhouette {
    width: 100px;
    height: auto;
    color: var(--color-border);
}

.status-pill-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    color: var(--color-white);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.status-pill-overlay.status-green { background-color: #16a34a; } /* green-600 */
.status-pill-overlay.status-yellow { background-color: #ca8a04; } /* yellow-600 */
.status-pill-overlay.status-blue { background-color: var(--color-primary); }
.status-pill-overlay.status-gray { background-color: var(--color-text-light); }

.inventory-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.inventory-card-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

.card-financials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1rem;
}
.card-financials div {
    display: flex;
    flex-direction: column;
}
.card-financials label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
}
.card-financials span {
    font-weight: 600;
    font-size: 1.1rem;
}
.card-financials .total-invested {
    color: var(--color-primary);
}

.expense-accordion {
    margin-bottom: 1rem;
}
.expense-accordion summary {
    width: 100%;
    justify-content: center;
}

.inventory-card-actions {
  margin-top: auto; /* Pushes this to the bottom */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  /* ADD THESE TWO LINES */
  padding: 1rem;
  border-top: 1px solid var(--color-border);
}
.inventory-card-actions .action-buttons {
    display: flex;
    gap: 0.5rem;
}
.inventory-card-actions .status-form-inline select {
  min-width: 150px;
  padding: .625rem 2.5rem .625rem 1rem; /* Matches button padding */
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  background-color: var(--color-white);
  font-weight: 600;
  font-size: .875rem;
  color: var(--color-text-medium);
  cursor: pointer;
  
  /* Removes default browser appearance */
  appearance: none;
  -webkit-appearance: none;

  /* Custom dropdown arrow */
  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='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;

  transition: border-color 0.2s, box-shadow 0.2s;
}.inventory-card-actions .status-form-inline select:hover {
  border-color: #cbd5e1; /* slate-300 */
}

.inventory-card-actions .status-form-inline select:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

/* =========================================================
   NEW: Modern Select Dropdown Style
   ========================================================= */

.form-select-modern {
  min-width: 150px;
  padding: .625rem 2.5rem .625rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: .5rem;
  background-color: var(--color-bg-light); /* UPDATED: from white to a light gray */
  font-weight: 600;
  font-size: .875rem;
  color: var(--color-text-medium);
  cursor: pointer;
  appearance: none;
  -webkit-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='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  transition: all 0.2s; /* UPDATED: transition all properties */
}

.form-select-modern:hover {
  border-color: #cbd5e1; /* slate-300 */
  background-color: var(--color-bg-medium); /* ADDED: subtle background change on hover */
}

.form-select-modern:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
/* =========================================================
   NEW: Garage Page Enhancements (Thumbnails & Icons)
   ========================================================= */

/* --- Thumbnail Styles --- */
.garage-table th.photo-col,
.garage-table td.photo-col {
  width: 120px; /* Adjust width as needed */
  padding: 0; /* Remove padding to fill the cell */
}

.vehicle-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 80px; /* Controls the row height */
  object-fit: cover; /* Ensures the image covers the area without stretching */
}

.vehicle-thumb.placeholder {
  background-color: var(--color-bg-medium);
}

.vehicle-thumb.placeholder i {
  color: #cbd5e1; /* slate-300 */
}

/* --- Action Icon Styles --- */
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 50%; /* Makes it a circle */
  color: var(--color-text-light);
  transition: all 0.2s;
}

.action-icon:hover {
  background-color: var(--color-bg-medium);
  color: var(--color-primary);
}

#estimate-form-container .invoice-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
#estimate-form-container .invoice-item { display: block; border: 1px solid var(--color-border); border-radius: .6rem; padding: 1rem; background-color: var(--color-bg-light); }
#estimate-form-container .invoice-item-top { display: flex; align-items: center; gap: 0.75rem; }
#estimate-form-container .invoice-title { flex-grow: 1; }
#estimate-form-container .invoice-title small.d-block { display: block; margin-top: 0.25rem; }
#estimate-form-container .invoice-total { font-weight: 600; color: var(--color-primary); font-size: 1.1rem; }
#estimate-form-container .invoice-parts-list { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--color-border); font-size: 0.875rem; color: var(--color-text-medium); }
#estimate-form-container .btn-icon-placeholder { width: 36px; height: 36px; flex-shrink: 0; }


/* This rule fixes the stacking issue on mobile / Safari */
@media (max-width: 980px) {
    .invoice-card-grid {
        grid-template-columns: 1fr;
    }
}
/* =========================================================
   NEW: Settings Page Redesign
   ========================================================= */

.settings-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Main content wider than the form */
    gap: 1.5rem;
    align-items: flex-start;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.user-list-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: .6rem;
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-border);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-role {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-medium);
}

.user-actions {
    display: flex;
    gap: 0.25rem;
}

/* Responsive: Stack the grid on smaller screens */
@media (max-width: 980px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
/* =========================================================
   NEW: Vehicle Detail Page Header Redesign
   ========================================================= */

.vehicle-header-card {
    padding: 1.5rem;
}

.vehicle-header-layout {
    display: flex;
    gap: 2rem;
}

.vehicle-header-photo {
    flex-basis: 40%;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
    background-color: var(--color-bg-light); /* Background for letterboxing */
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vehicle-header-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* This fits the whole image, leaving empty space */
}

.vehicle-header-photo .vehicle-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vehicle-header-photo .car-silhouette {
    width: 120px;
    height: auto;
    color: var(--color-border);
}

.vehicle-header-details {
    flex-basis: 60%;
    display: flex;
    flex-direction: column;
}

.vehicle-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.vehicle-main-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    line-height: 1.2;
}

.vehicle-specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.vehicle-specs-grid > div {
    display: flex;
    flex-direction: column;
}

.vehicle-specs-grid label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
}

.vehicle-specs-grid span {
    font-weight: 600;
}
.vehicle-specs-grid .spec-customer {
    grid-column: 1 / -1; /* Makes it span the full width */
    background-color: #fefce8; /* A very light yellow */
    padding: 0.75rem;
    border-radius: .5rem;
    border: 1px solid #fef08a;
}
.vehicle-specs-grid .spec-customer span {
    font-weight: 700;
    font-size: 1.1rem;
}
/* --- Responsive styles for the new header --- */
@media (max-width: 980px) {
    .vehicle-header-layout {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .vehicle-title-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .vehicle-specs-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   NEW: Calculator Page Styles
   ========================================================= */
.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.date-range-title {
    margin: 0;
    font-size: 1.125rem;
}
.date-filters {
    display: flex;
    gap: 0.5rem;
    background-color: var(--color-bg-medium);
    padding: 0.25rem;
    border-radius: 0.5rem;
}
.date-filters a {
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    color: var(--color-text-medium);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}
.date-filters a:hover {
    background-color: var(--color-white);
    color: var(--color-text-dark);
}
.date-filters a.active {
    background-color: var(--color-white);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.icon-wrapper.bg-danger { background: #fee2e2; color: #dc2626; }
.calculator-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}
.details-list li.unpaid span {
    font-weight: 700;
    color: var(--color-danger);
}
.details-list li.total {
    border-top: 2px solid var(--color-border);
    font-weight: 700;
}
@media(max-width: 768px) {
    .calculator-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .calculator-details-grid {
        grid-template-columns: 1fr;
    }
}/* --- Calculator Page: Add Expense Flyout --- */
.add-expense-flyout {
    position: relative;
    display: inline-block;
}
.add-expense-flyout summary {
    list-style: none; /* Hide default marker */
}
.add-expense-flyout summary::-webkit-details-marker {
    display: none;
}
.add-expense-form-inline {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 350px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.add-expense-form-inline input,
.add-expense-form-inline select {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid var(--color-border);
}/* Find and replace this old rule for .garage-table td.customer-col */
.customer-col {
  background-color: #fefce8; /* light yellow */
  font-weight: 500;
}/* --- Calculator Page: Breakdown Dropdown --- */
.vehicle-row.is-open {
    background-color: #eef2ff; /* Light blue highlight for the active row */
}
.vehicle-breakdown-details td {
    padding: 0 !important;
    border: none;
}
.breakdown-content-wrapper {
    padding: 1.5rem;
    background-color: var(--color-bg-light);
}
.breakdown-content-wrapper h4 {
    margin: 0 0 1rem 0;
    font-weight: 600;
}
.breakdown-table {
    width: 100%;
    max-width: 400px; /* Limit width for readability */
}
.breakdown-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}
.breakdown-table tr:last-child td {
    border-bottom: none;
}
.breakdown-table .total td {
    font-weight: 700;
    border-top: 2px solid var(--color-text-dark);
}
.breakdown-table .unpaid td {
    color: var(--color-danger);
    font-weight: 500;
}
/* =========================================================
   REVISED: Settings Page Layout
   ========================================================= */


/* When the side column is hidden, the main column takes up the full width */
.settings-grid.settings-grid-single {
    grid-template-columns: 1fr;
}

.settings-main-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Space between cards in the main column */
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.user-list-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: .6rem;
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-border);
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; }
.user-role { font-size: 0.875rem; font-weight: 500; color: var(--color-text-medium); }
.user-actions { display: flex; align-items: center; gap: 0.25rem; }

@media (max-width: 980px) {
    .settings-grid { grid-template-columns: 1fr; }
}/* =========================================================
   ADDITION: Mobile Optimizations for Settings Page
   ========================================================= */

@media (max-width: 640px) {

    /* Stack the password and confirm password fields vertically */
    .settings-grid .form-grid {
        grid-template-columns: 1fr;
    }

    /* Restructure the user list item for small screens.
      - The user's name/email will be on top.
      - The user's role and the action buttons will be on a second line below.
    */
    .user-list-item {
        grid-template-columns: 1fr auto; /* Switch to a two-column layout */
        grid-template-areas:
            "info info"
            "role actions";
        row-gap: 0.5rem; /* Add a little space between the rows */
        padding: 0.75rem; /* Slightly reduce padding on mobile */
    }

    /* Assign elements to their new grid areas */
    .user-list-item .user-info {
        grid-area: info;
    }
    .user-list-item .user-role {
        grid-area: role;
        /* Align to the start of its area */
        justify-self: start; 
    }
    .user-list-item .user-actions {
        grid-area: actions;
        /* Align to the end of its area */
        justify-self: end;
    }
}

/* =========================================================
   ADDITION: VIN/QR Scanner Buttons
   ========================================================= */

.scan-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.btn-scan-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background-color: var(--color-bg-light);
    color: var(--color-text-medium);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-scan-option:hover {
    border-color: var(--color-primary);
    background-color: var(--color-white);
    color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-scan-option svg {
    width: 28px;
    height: 28px;
}
/* =========================================================
   ADDITION: Mobile Placeholder Font Size
   ========================================================= */

@media (max-width: 640px) {
    .form-control::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
        font-size: 0.9rem;
    }

    .form-control::-webkit-input-placeholder { /* For older Safari and Chrome versions */
       font-size: 0.9rem;
    }
}/* =========================================================
   ADDITION: Button-Style Checkbox
   ========================================================= */

.btn-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: .625rem 1rem 1rem 1rem;
    border-radius: .5rem;
    border: 1px solid var(--color-border);
    background-color: var(--color-white);
    color: var(--color-text-medium);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none; /* Prevents text selection on click */
}
/* This is the new rule to add */
.btn-checkbox-label svg {
    position: relative;
    top: 6px;
}
.btn-checkbox-label:hover {
    border-color: #cbd5e1; /* slate-300 */
    background-color: var(--color-bg-light);
}

/* Logic to show/hide the correct icon */
.btn-checkbox-label .icon-checked {
    display: none;
}
.btn-checkbox-label .sr-only:checked ~ .icon-checked {
    display: inline-block;
}
.btn-checkbox-label .sr-only:checked ~ .icon-unchecked {
    display: none;
}

/* Style for the "checked" or "active" state */
.btn-checkbox-label.is-checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}/* Add this new rule */
.btn-checkbox-label > i {
    display: inline-flex; /* Helps contain the icon properly */
}/* =========================================================
   MODERN DESIGN LANGUAGE OVERHAUL (Apple-Inspired)
   ========================================================= */

/* --- Add Vertical Margin Between Form Groups --- */
.part-div > .card > .form-group {
    margin-bottom: 1.25rem; /* Adds space between inputs */
}
.part-div > .card > .form-grid > .form-group {
    margin-bottom: 1.25rem; /* Adds space between inputs */
}

/* --- Modernized Form Controls (Inputs, Selects, Textareas) --- */
.form-control,
.add-part-form textarea {
    font-size: 1rem;
    background-color: #f9fafb; /* Very light gray, almost white */
    border: 1px solid #d1d5db; /* Softer border color */
    border-radius: 0.75rem; /* More rounded corners (12px) */
    padding: 0.875rem 1rem; /* 14px vertical padding */
    transition: all 0.2s ease-in-out;
}

.form-control:focus,
.add-part-form textarea:focus {
    border-color: var(--color-primary);
    background-color: var(--color-white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

/* --- Modernized Cards --- */
.card {
    border-radius: 1rem; /* 16px, more pronounced rounding */
    border-color: #e5e7eb; /* Softer border */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* Softer shadow */
    padding: 1.75rem;
}

/* --- Modernized Section Headers in Cards --- */
.card h3 {
    font-size: 1.125rem; /* 18px */
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

/* --- Update the Photo Preview Grid --- */
.photo-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.photo-preview-item {
    border-radius: 0.75rem; /* Match new rounding */
}
.photo-preview-item.is-primary {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 30%, transparent);
}/* --- New Rule for Price Input --- */
.form-control.price-input {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 1.125rem; /* Make the price font slightly larger */
}/* --- Add Icons to Card Headers --- */
.card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Space between icon and text */
}

.card h3 > i[data-feather] {
    color: var(--color-primary);
    width: 20px;
    height: 20px;
    flex-shrink: 0; /* Prevents icon from shrinking */
}
/* =========================================================
   NEW: Styles for "List for Sale" Page
   ========================================================= */

/* --- Highlight for Missing/Editable Data --- */
.missing-data-highlight {
    background-color: #fefce8 !important; /* A very light, non-intrusive yellow */
    border-color: #fef08a !important;
}

/* --- Feature Chip Checkbox Toggle --- */
.feature-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.feature-chip { /* This is the <label> */
    display: inline-block;
    cursor: pointer;
    border-radius: 9999px;
}

.feature-chip span {
    display: block;
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background-color: var(--color-bg-light);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease-in-out;
}

.feature-chip:hover span {
    border-color: #a5b4fc; /* indigo-300 */
    background-color: var(--color-white);
}

/* Style for the span when the hidden checkbox is checked */
.feature-chip .sr-only:checked + span {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- Responsive Layout for the Form --- */
@media (max-width: 768px) {
    .list-for-sale-grid {
        grid-template-columns: 1fr;
    }
}/* =========================================================
   NEW: Multi-Step Form & Progress Bar ("List for Sale")
   ========================================================= */

.progress-nav {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.progress-nav .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    color: var(--color-text-light);
    flex-grow: 1;
    position: relative;
}

.progress-nav .step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px; /* Vertically center with the circle */
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: var(--color-border);
    z-index: 1;
}

.step-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-white);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2; /* Puts the circle above the connector line */
}

.step-icon-wrapper i {
    stroke-width: 2;
}

.step-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* --- Step States --- */
.progress-nav .step.active .step-icon-wrapper {
    border-color: var(--color-primary);
    background-color: var(--color-primary);
    color: var(--color-white);
}

.progress-nav .step.active .step-label {
    color: var(--color-primary);
}

.progress-nav .step.completed .step-icon-wrapper {
    border-color: #16a34a; /* green-600 */
    background-color: #16a34a;
    color: var(--color-white);
}

.progress-nav .step.completed .step-label {
    color: var(--color-text-dark);
}

.progress-nav .step.completed:not(:last-child)::after {
    background-color: #16a34a;
}

.form-step {
    display: none; /* Hide all steps by default */
}
.form-step.active {
    display: block; /* Show only the active step */
  border: none;
}

.step-navigation {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
}

/* --- Photo/Camera Capture --- */
.photo-method-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.camera-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.camera-modal-content {
    background: var(--color-white);
    padding: 1rem;
    border-radius: var(--border-radius);
    max-width: 90vw;
}
#camera-video {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: .6rem;
}
.camera-controls {
    text-align: center;
    margin-top: 1rem;
}fieldset {
    border: none;
}
.largebtn {
  font-size: 0.95rem;
    padding: 1rem 1.5rem;
}