/* ============================================================
   GarageMS — Main Stylesheet
   ============================================================ */

/* ── 1. Variables & Reset ──────────────────────────────────── */
:root {
  --sidebar-w:       240px;
  --sidebar-bg:      #0f172a;
  --sidebar-text:    #94a3b8;
  --sidebar-hover:   rgba(255,255,255,.06);
  --sidebar-active:  #4f46e5;
  --topbar-h:        60px;

  --accent:          #4f46e5;
  --accent-hover:    #4338ca;
  --accent-light:    #eef2ff;

  --bg:              #f1f5f9;
  --white:           #ffffff;
  --border:          #e2e8f0;
  --border-dark:     #cbd5e1;

  --text:            #0f172a;
  --text-muted:      #64748b;
  --text-light:      #94a3b8;

  --radius-sm:       6px;
  --radius:          10px;
  --radius-lg:       14px;

  --shadow-sm:       0 1px 2px rgba(0,0,0,.06);
  --shadow:          0 1px 4px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.05);
  --shadow-md:       0 4px 12px rgba(0,0,0,.10);

  /* Status */
  --s-unassigned:    #94a3b8;
  --s-scheduled:     #3b82f6;
  --s-inprogress:    #f59e0b;
  --s-waiting:       #ef4444;
  --s-completed:     #10b981;
  --s-paid:          #8b5cf6;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ── 2. Admin Layout ───────────────────────────────────────── */
.admin-layout { overflow: hidden; }

.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: width .25s ease, transform .25s ease;
  z-index: 200;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  flex-shrink: 0;
}

.brand-name  { display: block; color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.brand-tagline { display: block; color: var(--sidebar-text); font-size: .7rem; }

/* Sidebar logo */
.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  text-decoration: none;
  overflow: hidden;
}
.sidebar-logo {
  width: 148px;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  mix-blend-mode: screen;   /* dissolves black bg into the dark sidebar */
  transition: width .25s ease, opacity .15s;
  display: block;
  flex-shrink: 0;
}
.sidebar-logo:hover { opacity: .85; }
.app-wrapper.sidebar-collapsed .sidebar-logo-wrap { justify-content: center; }
.app-wrapper.sidebar-collapsed .sidebar-logo {
  width: 42px;
  max-height: 42px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  display: block;
  color: var(--text-light);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
  text-decoration: none;
}

.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: .9em; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.nav-badge--overdue {
  background: #f59e0b;
  margin-left: 4px;
}
.nav-badge--schedule {
  background: #3b82f6;
  margin-left: auto;
}

/* Sidebar user footer */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
}

.user-details { flex: 1; overflow: hidden; }
.user-name  { display: block; color: #fff; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; color: var(--sidebar-text); font-size: .7rem; }

.user-logout {
  color: var(--sidebar-text);
  padding: 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
  text-decoration: none;
  flex-shrink: 0;
}
.user-logout:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }

.sidebar-support {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
  font-size: .68rem;
  color: var(--sidebar-text);
  opacity: .6;
  line-height: 1.4;
}
.sidebar-support i { font-size: .75rem; flex-shrink: 0; }
.sidebar-support a { color: inherit; text-decoration: underline; opacity: .85; }
.sidebar-support a:hover { opacity: 1; }
.app-wrapper.sidebar-collapsed .sidebar-support { display: none; }

/* Collapsed sidebar */
.app-wrapper.sidebar-collapsed .sidebar { width: 60px; }
.app-wrapper.sidebar-collapsed .brand-text,
.app-wrapper.sidebar-collapsed .nav-item span,
.app-wrapper.sidebar-collapsed .nav-label,
.app-wrapper.sidebar-collapsed .nav-badge,
.app-wrapper.sidebar-collapsed .nav-badge--overdue,
.app-wrapper.sidebar-collapsed .nav-badge--schedule,
.app-wrapper.sidebar-collapsed .user-details,
.app-wrapper.sidebar-collapsed .user-logout { display: none; }
.app-wrapper.sidebar-collapsed .nav-item { justify-content: center; padding: 9px; }
.app-wrapper.sidebar-collapsed .nav-item i { width: auto; }
.app-wrapper.sidebar-collapsed .sidebar-brand { justify-content: center; }
.app-wrapper.sidebar-collapsed .sidebar-user { justify-content: center; }

/* ── Main Wrapper ── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top Bar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
}

.topbar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.topbar-toggle:hover { background: var(--bg); }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-date {
  color: var(--text-muted);
  font-size: .8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── 3. Auth Layout ────────────────────────────────────────── */
.auth-layout { background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%); min-height: 100vh; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  width: 380px;
  max-width: 90vw;
  margin: 0 auto 0;
  display: block;
}
.auth-logo img {
  width: 100%;
  display: block;
  mix-blend-mode: screen;
}

.auth-title    { text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--text); }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: .875rem; margin: 6px 0 24px; }
.auth-footer   { color: rgba(255,255,255,.4); font-size: .8rem; margin-top: 24px; }

/* ── 4. Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--white); color: var(--text); border-color: var(--border-dark); }
.btn-secondary:hover { background: var(--bg); }

.btn-success   { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger    { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-warning   { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-outline   { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-light); }

.btn-ghost     { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm  { padding: 5px 11px; font-size: .8rem; }
.btn-lg  { padding: 11px 22px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── 5. Forms ─────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-row    { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.form-label  { display: block; font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.4;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint  { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: #dc2626; margin-top: 4px; }

/* Input with icon */
.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: .8em; pointer-events: none;
}
.input-with-icon { padding-left: 34px; }
.input-addon-btn {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px 10px; border-radius: 4px;
}
.input-addon-btn:hover { color: var(--text); }

/* Search input */
.search-box { position: relative; }
.search-box input { padding-left: 34px; }
.search-box::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: .8em; pointer-events: none;
}

/* ── 6. Cards ─────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: .9rem; font-weight: 600; color: var(--text); }
.card-body  { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 500px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ── Dashboard two-column grid ───────────────────────────── */
.dash-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.dash-col-left {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-col-right {
  flex: 0 0 300px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 720px) {
  .dash-col-left, .dash-col-right {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }
}
.jobs-stat-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.jobs-stat-grid .stat-card {
  padding: 14px;
  gap: 10px;
}
.jobs-stat-grid .stat-icon {
  width: 36px; height: 36px;
  font-size: .9rem;
}
.jobs-stat-grid .stat-value { font-size: 1.1rem; }
.jobs-stat-grid .stat-label { font-size: .75rem; }
@media (max-width: 900px) { .jobs-stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .jobs-stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
  container-type: inline-size;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.amber  { background: #fffbeb; color: #d97706; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }
.stat-icon.purple { background: #faf5ff; color: #7c3aed; }
.stat-icon.indigo { background: #eef2ff; color: #4f46e5; }

.stat-body { flex: 1; min-width: 0; overflow: hidden; }
.stat-value {
  font-size: clamp(.75rem, 2.5cqi, 1.5rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; overflow-wrap: break-word; }
a.stat-card {
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .1s;
}
a.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ── 7. Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
a.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
a.th-sort:hover { color: var(--accent); }
.sort-arrow { font-style: normal; font-size: .75em; line-height: 1; }
.sort-arrow--idle  { opacity: .35; }
.sort-arrow--asc,
.sort-arrow--desc  { opacity: 1; color: var(--accent); }
.th-filter-col { padding: 6px 10px !important; }
.th-filter-select {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 22px 3px 7px;
  cursor: pointer;
  appearance: auto;
  max-width: 130px;
}
.th-filter-select:focus { outline: 2px solid var(--accent); border-color: var(--accent); color: var(--text); }
.th-filter-select option { font-weight: 600; text-transform: none; letter-spacing: 0; }
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.table-actions { display: flex; gap: 6px; align-items: center; }
.table-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: .875rem; }

/* ── 8. Badges & Status ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; }
.badge-amber  { background: #fffbeb; color: #b45309; }
.badge-red    { background: #fef2f2; color: #b91c1c; }
.badge-green  { background: #f0fdf4; color: #15803d; }
.badge-purple { background: #faf5ff; color: #6d28d9; }
.badge-indigo { background: #eef2ff; color: #3730a3; }

.status-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, box-shadow .15s;
  white-space: nowrap;
}
.status-toggle-btn:hover { opacity: .75; }
.status-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-toggle-btn.is-active   { background: #f0fdf4; color: #15803d; }
.status-toggle-btn.is-inactive { background: #f1f5f9; color: #64748b; }

/* ── Payments page ────────────────────────────────────────── */
.pay-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); }
.pay-tab  { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: .875rem; font-weight: 500; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 4px 4px 0 0; transition: color .15s, border-color .15s; }
.pay-tab:hover { color: var(--text); }
.pay-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pay-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; font-size: .7rem; font-weight: 700; background: #e2e8f0; color: #64748b; }
.pay-tab-count-red { background: #fee2e2; color: #dc2626; }

.pay-method-strip { display: flex; flex-wrap: wrap; gap: 12px; }
.pay-method-chip  { display: flex; align-items: center; gap: 10px; }
.pay-method-icon  { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.pay-method-label { font-size: .8rem; font-weight: 600; color: var(--text); line-height: 1; }
.pay-method-value { font-size: .85rem; font-weight: 700; margin-top: 2px; color: var(--text); }
.pay-method-value .text-muted { font-weight: 400; font-size: .78rem; }

.pay-method-pill  { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: color-mix(in srgb, var(--pm-color) 12%, transparent); color: var(--pm-color); white-space: nowrap; }

.pay-method-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pay-method-radio { cursor: pointer; }
.pay-method-radio input[type=radio] { display: none; }
.pay-method-radio-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 8px; border: 2px solid var(--border); font-size: .78rem; font-weight: 600; color: var(--text); transition: border-color .15s, background .15s; }
.pay-method-radio-inner i { font-size: 1.1rem; color: var(--pm-color, var(--accent)); }
.pay-method-radio input:checked + .pay-method-radio-inner { border-color: var(--pm-color, var(--accent)); background: color-mix(in srgb, var(--pm-color, var(--accent)) 8%, transparent); color: var(--pm-color, var(--accent)); }

.age-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.age-new  { background: #f0fdf4; color: #15803d; }
.age-mid  { background: #fff7ed; color: #c2410c; }
.age-old  { background: #fef2f2; color: #b91c1c; }

/* ── Settings logo upload ─────────────────────────────────── */
.logo-settings-wrap   { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.logo-preview-block   { flex-shrink: 0; }
.logo-preview-bg      { background: #0f172a; border-radius: 10px; padding: 14px 20px; display: inline-flex; align-items: center; justify-content: center; min-width: 180px; min-height: 80px; }
.logo-preview-img     { max-width: 180px; max-height: 80px; width: auto; height: auto; object-fit: contain; mix-blend-mode: screen; display: block; }

/* ── 9. Alerts ────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── 10. Tabs ─────────────────────────────────────────────── */
.tabs { margin-bottom: 20px; }

.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 18px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .15s;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn .tab-count {
  background: var(--bg);
  border-radius: 999px;
  font-size: .7rem;
  padding: 1px 6px;
  font-weight: 600;
  color: var(--text-muted);
}
.tab-btn.active .tab-count { background: var(--accent-light); color: var(--accent); }

/* Overdue tab button */
.tab-btn--overdue { color: #dc2626; }
.tab-btn--overdue:hover { color: #b91c1c; }
.tab-btn--overdue.active { color: #dc2626; border-bottom-color: #dc2626; }
.tab-count--overdue { background: #fef2f2 !important; color: #dc2626 !important; }
.tab-btn--overdue.active .tab-count--overdue { background: #fee2e2 !important; }

.tab-pane { display: none; }
.tab-pane.active { display: block; padding-top: 20px; }

/* ── 11. Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px) scale(.97);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; padding: 4px 8px;
  border-radius: 4px; line-height: 1;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body   { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── 12. Page header bar ──────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header-left h2 { font-size: 1.1rem; font-weight: 600; }
.page-header-left p  { color: var(--text-muted); font-size: .85rem; margin-top: 2px; }

/* Filter bar */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar .form-group { margin: 0; }

/* Period preset pills (invoices / payments / expenses filter bars) */
.period-pills {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-dark);
}
.period-pill {
  padding: 7px 13px;
  font-size: .78rem;
  font-weight: 600;
  border: none;
  border-right: 1px solid var(--border-dark);
  background: var(--white);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  line-height: 1;
  white-space: nowrap;
}
.period-pill:last-child { border-right: none; }
.period-pill:hover:not(.active) { background: var(--bg); color: var(--text); }
.period-pill.active { background: var(--accent); color: #fff; }
@media (max-width: 640px) {
  .period-pills { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .period-pills::-webkit-scrollbar { display: none; }
}

/* ── 13. Calendar ─────────────────────────────────────────── */
.cal-wrapper { display: flex; gap: 16px; height: calc(100vh - 160px); min-height: 600px; }

.cal-main {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.cal-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav-title { font-weight: 600; font-size: .9rem; min-width: 140px; text-align: center; }

.cal-view-btns .btn { padding: 5px 12px; font-size: .8rem; }
.cal-view-btns .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.cal-scroll { flex: 1; overflow: auto; }

.cal-scroll-hint {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: .78rem;
  color: #0369a1;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cal-grid-wrap { display: flex; min-width: 100%; }

/* Time axis */
.cal-time-axis {
  width: 60px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  background: var(--white);
  z-index: 5;
  border-right: 1px solid var(--border);
}
.cal-time-header { height: 40px; border-bottom: 1px solid var(--border); }
.cal-time-slot {
  height: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 3px 8px 0 0;
  font-size: .68rem;
  color: var(--text-muted);
  border-bottom: 1px solid #f1f5f9;
}
.cal-time-slot.hour {
  border-bottom-color: var(--border);
  font-weight: 600;
  font-size: .72rem;
  color: var(--text);
}
.cal-time-slot.half {
  font-size: .65rem;
  color: var(--text-muted);
  opacity: .75;
}

/* Mechanic columns */
.cal-columns { display: flex; flex: 1; }

.cal-col {
  flex: 1;
  min-width: 200px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.cal-col:last-child { border-right: none; }

.cal-col-header {
  height: 40px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 4;
}

.mech-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-col-body {
  position: relative;
  flex: 1;
}

.cal-slot-bg {
  position: absolute;
  left: 0; right: 0;
  height: 40px;
  border-bottom: 1px solid #f1f5f9;
}
.cal-slot-bg.hour { border-bottom-color: var(--border); }
.cal-slot-bg.drop-hover { background: var(--accent-light); }

/* Job blocks */
.cal-job {
  position: absolute;
  left: 4px; right: 4px;
  border-radius: 6px;
  padding: 4px 7px;
  font-size: .73rem;
  line-height: 1.3;
  cursor: grab;
  overflow: hidden;
  z-index: 2;
  border-left: 3px solid rgba(255,255,255,.5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .1s;
}
.cal-job:active { cursor: grabbing; box-shadow: var(--shadow-md); }
.cal-job.dragging { opacity: .5; }
.cal-job-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-job-meta  { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-job-time  { font-size: .72em; font-weight: 700; opacity: .9; }
.cal-job-ramp  { display: inline-flex; align-items: center; gap: 4px; margin-left: 5px; padding: 2px 7px; font-size: .82em; font-weight: 700; background: #f59e0b; color: #1c0a00; border-radius: 5px; white-space: nowrap; vertical-align: middle; letter-spacing: .01em; }

/* Job status → background colours */
.cal-job.s-unassigned       { background: #e2e8f0; color: #374151; }
.cal-job.s-scheduled        { background: #dbeafe; color: #1e3a8a; }
.cal-job.s-in_progress      { background: #fef3c7; color: #78350f; }
.cal-job.s-waiting_parts,
.cal-job.s-waiting_mechanic,
.cal-job.s-waiting_ramp     { background: #fee2e2; color: #7f1d1d; }
.cal-job.s-completed        { background: #d1fae5; color: #064e3b; z-index: 1; opacity: .75; cursor: default; }
.cal-job.s-paid             { background: #ede9fe; color: #3b0764; z-index: 1; opacity: .75; cursor: default; }

/* Week view */
.cal-week-grid { display: grid; grid-template-columns: 60px repeat(7,1fr); }
.cal-week-day-header {
  padding: 10px 6px;
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.cal-week-day-header.today { background: var(--accent-light); color: var(--accent); }
.cal-week-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid #f1f5f9;
  padding: 4px;
  min-height: 80px;
  vertical-align: top;
  position: relative;
}
.cal-week-cell.today { background: #fefce8; }

/* ── 14. Queue ────────────────────────────────────────────── */
.queue-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  font-weight: 600;
}

/* Unschedule drop zone */
.unschedule-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px;
  padding: 10px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  transition: all .15s;
  pointer-events: none; /* enabled via JS only when a cal-job is dragged */
}
.unschedule-zone.drag-active {
  pointer-events: all;
  border-color: #f97316;
  background: #fff7ed;
  color: #c2410c;
}
.unschedule-zone.drag-over {
  border-color: #ea580c;
  background: #ffedd5;
  color: #9a3412;
  transform: scale(1.02);
}

.queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-job {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  background: #fafafa;
  transition: box-shadow .15s, background .15s;
  font-size: .8rem;
}
.queue-job:hover { background: var(--white); box-shadow: var(--shadow); }
.queue-job:active { cursor: grabbing; }
.queue-job .qj-title { font-weight: 600; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-job .qj-meta  { color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }
.queue-job.qj-needs-time { border-color: #fbbf24; background: #fffbeb; }
.queue-job.qj-needs-time:hover { background: #fef3c7; }
.qj-needs-time-note { margin-top: 5px; font-size: .72rem; color: #b45309; font-weight: 600; display: flex; align-items: center; gap: 4px; }

/* ── Overdue jobs panel (calendar sidebar) ─────────────── */
.overdue-section      { border-top: 2px solid #fecaca; flex-shrink: 0; }
.overdue-header       { width: 100%; display: flex; align-items: center; gap: 7px; padding: 9px 14px;
                        font-size: .82rem; font-weight: 600; cursor: pointer; background: #fff7f7;
                        color: #b91c1c; border: none; text-align: left; user-select: none; }
.overdue-header:hover { background: #fee2e2; }
.overdue-chevron      { margin-left: auto; transition: transform .2s; }
.overdue-header.open .overdue-chevron { transform: rotate(180deg); }
.overdue-list         { max-height: 260px; overflow-y: auto; padding: 6px 8px;
                        display: flex; flex-direction: column; gap: 5px; }
.overdue-list.collapsed { display: none; }
.overdue-item         { border: 1px solid #fecaca; border-radius: 6px; padding: 8px 10px;
                        background: #fffafa; font-size: .78rem; }
.overdue-item-head    { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; margin-bottom: 3px; }
.overdue-item-title   { font-weight: 600; color: var(--text); text-decoration: none; flex: 1;
                        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.overdue-item-title:hover { color: var(--accent); }
.overdue-edit-btn     { color: var(--text-muted); flex-shrink: 0; padding: 2px 4px; border-radius: 4px;
                        font-size: .78rem; text-decoration: none; }
.overdue-edit-btn:hover { color: var(--accent); background: var(--bg); }
.overdue-item-meta    { color: var(--text-muted); display: flex; gap: 6px; align-items: center;
                        font-size: .72rem; margin-bottom: 4px; }
.overdue-reg          { font-weight: 600; color: var(--text); background: #f1f5f9;
                        padding: 1px 5px; border-radius: 3px; }
.overdue-item-footer  { display: flex; align-items: center; justify-content: space-between; }
.overdue-days-badge   { font-size: .68rem; font-weight: 700; background: #fee2e2; color: #b91c1c;
                        padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.overdue-date-text    { font-size: .7rem; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }

/* ── 15. Job card (queue page list) ──────────────────────── */
.job-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow .15s;
}
.job-card:hover { box-shadow: var(--shadow); }
.job-card-body { flex: 1; min-width: 0; }
.job-card-title { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.job-card-meta  { color: var(--text-muted); font-size: .8rem; display: flex; gap: 14px; flex-wrap: wrap; }
.job-card-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }

/* ── 16. Misc Utilities ───────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }

.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: .8rem; }
.text-xs      { font-size: .72rem; }
.font-600     { font-weight: 600; }
.font-700     { font-weight: 700; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.section-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* Search dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
}
.search-result-item {
  padding: 9px 14px;
  font-size: .85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--accent-light); color: var(--accent); }
.search-result-item .sr-title { font-weight: 600; }
.search-result-item .sr-meta  { color: var(--text-muted); font-size: .75rem; }

/* Ramp indicator */
.ramp-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .7rem;
  background: #fef9c3;
  color: #713f12;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 600;
}

/* Step wizard (job create) */
.step-wizard {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step.active .step-num { background: var(--accent); color: #fff; }
.step.done  .step-num  { background: #10b981; color: #fff; }
.step.active { color: var(--accent); }
.step.done   { color: #10b981; }
.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 20px;
}

/* Profit indicator */
.profit-positive { color: #16a34a; font-weight: 600; }
.profit-negative { color: #dc2626; font-weight: 600; }

/* Parts table total row */
.parts-total-row td { font-weight: 600; background: #f8fafc; }

/* ── 17a. Queue page cards ────────────────────────────────── */
.queue-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.queue-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow .15s;
}
.queue-card:hover { box-shadow: var(--shadow); }
.qc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 8px;
}
.qc-title {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  flex: 1;
  min-width: 0;
}
.qc-title:hover { color: var(--accent); }
.qc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.qc-meta i { color: var(--accent); }
.qc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Notification bell ───────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.notif-bell-btn:hover,
.notif-bell-btn.active { background: #fff1f1; color: #dc2626; }
.notif-badge {
  position: absolute;
  top: 0; right: 0;
  background: #dc2626;
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  animation: bellPulse 2s ease-in-out infinite;
}
@keyframes bellPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-height: 520px;
  background: var(--white);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}
.notif-dropdown.open { display: flex; }
.notif-header {
  background: #fff7f7;
  padding: 12px 16px 8px;
  font-weight: 700;
  font-size: .85rem;
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #fee2e2;
}
.notif-subtext {
  padding: 8px 16px;
  font-size: .75rem;
  color: #7f1d1d;
  background: #fff7f7;
  border-bottom: 1px solid #fecaca;
  line-height: 1.5;
}
.notif-list {
  overflow-y: auto;
  flex: 1;
}
.notif-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.notif-item:last-child { border-bottom: none; }
.notif-item-main { display: flex; flex-direction: column; gap: 2px; }
.notif-item-title { font-size: .82rem; font-weight: 600; color: var(--text); }
.notif-item-meta  { font-size: .72rem; color: var(--text-muted); }
.notif-when { color: #dc2626; font-weight: 600; }
.notif-section-label {
  padding: 6px 16px 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
}
.notif-section-label--overdue  { color: #dc2626; background: #fef2f2; }
.notif-section-label--clock    { color: #92400e; background: #fffbeb; }
.notif-section-label--waiting  { color: #6d28d9; background: #f5f3ff; }
.notif-item--clock  { border-left: 3px solid #f59e0b; background: #fffdf5; }
.notif-item--clock:hover { background: #fef9ec; }
.notif-item--waiting { border-left: 3px solid #a78bfa; background: #faf8ff; }
.notif-item--waiting:hover { background: #f3f0ff; }
.notif-item--stuck  { border-left-color: #ef4444 !important; background: #fff8f8 !important; }
.notif-item--stuck:hover { background: #fef2f2 !important; }
.notif-stuck-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  background: #fee2e2;
  color: #dc2626;
  vertical-align: middle;
}
.notif-action-clock   { background: #fef3c7; color: #92400e; }
.notif-action-clock:hover { background: #fde68a; }
.notif-item-actions { display: flex; gap: 6px; }
.notif-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  transition: background .15s;
}
.notif-action-view { background: var(--accent-light); color: var(--accent); }
.notif-action-view:hover { background: #dde3ff; }
.notif-action-cal  { background: #f0fdf4; color: #16a34a; }
.notif-action-cal:hover { background: #dcfce7; }
.notif-footer {
  padding: 9px 16px;
  border-top: 1px solid #fee2e2;
  background: #fff7f7;
  font-size: .78rem;
  text-align: center;
}
.notif-footer a { color: #dc2626; font-weight: 600; }

/* ── Overdue banner (dashboard top) ─────────────────────── */
.overdue-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff7f7;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: .82rem;
  color: #7f1d1d;
  line-height: 1.5;
}
.overdue-banner i { color: #dc2626; font-size: 1rem; flex-shrink: 0; }
.overdue-banner strong { color: #dc2626; }
.overdue-banner-link {
  margin-left: 4px;
  color: #dc2626;
  font-weight: 700;
  text-decoration: underline;
}
.overdue-banner-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #dc2626;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.overdue-banner-close:hover { background: #fee2e2; }

/* ── Unpaid-jobs bell & banner (amber theme) ─────────────── */
.notif-bell-btn--unpaid:hover,
.notif-bell-btn--unpaid.active { background: #fffbeb; color: #d97706; }
.notif-badge--unpaid { background: #d97706; animation: unpaidPulse 2s ease-in-out infinite; }
@keyframes unpaidPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(217,119,6,0); }
}
.notif-dropdown--unpaid { border-color: #fde68a; }
.notif-header--unpaid { background: #fffbeb; color: #b45309; border-bottom-color: #fde68a; }
.notif-subtext--unpaid { background: #fffbeb; color: #78350f; border-bottom-color: #fde68a; }
.notif-footer--unpaid { background: #fffbeb; border-top-color: #fde68a; }
.notif-footer--unpaid a { color: #b45309; }
.notif-when--unpaid { color: #d97706; font-weight: 600; }
.notif-action-pay { background: #fffbeb; color: #d97706; }
.notif-action-pay:hover { background: #fef3c7; }
.overdue-banner--unpaid {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}
.overdue-banner--unpaid i { color: #d97706; }
.overdue-banner--unpaid strong { color: #d97706; }
.overdue-banner--unpaid .overdue-banner-link { color: #b45309; }
.overdue-banner--unpaid .overdue-banner-close { color: #d97706; }
.overdue-banner--unpaid .overdue-banner-close:hover { background: #fef3c7; }

/* ── Overdue job rows (dashboard card) ───────────────────── */
.overdue-card { border-color: #fca5a5 !important; }
.overdue-job-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid #fee2e2;
}
.overdue-job-row:last-child { border-bottom: none; }
.overdue-job-info  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.overdue-job-title { font-size: .82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overdue-job-meta  { font-size: .72rem; color: var(--text-muted); }
.overdue-job-btns  { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Queue enhancements ──────────────────────────────────── */
.queue-summary {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.queue-summary-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  color: var(--text-muted);
  transition: background .15s;
}
.queue-summary-item:hover { background: var(--bg); }
.queue-summary-item.has-items .qs-count { color: var(--s-waiting); }
.queue-summary-item--overdue .qs-count { color: #dc2626 !important; font-weight: 700; }
.queue-summary-item--overdue .qs-label { color: #dc2626; }
.queue-summary-item--overdue { background: #fff7f7; border-radius: var(--radius-sm); }
.qs-count { font-weight: 700; font-size: 1.05rem; color: var(--text); line-height: 1; }
.qs-label { font-size: .75rem; }
.queue-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 16px;
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.qc-age-row { margin: 6px 0 8px; }
.qc-age-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
}
.qc-age--fresh { background: #f0fdf4; color: #16a34a; }
.qc-age--warn  { background: #fffbeb; color: #b45309; }
.qc-age--old   { background: #fef2f2; color: #dc2626; }
.qc-overdue {
  border-left-color: var(--s-waiting) !important;
  background: #fff8f8;
}
.qc-needs-assign {
  border-left-color: #f59e0b !important;
  background: #fffbeb;
}
.qc-assign-notice {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  color: #92400e;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-yellow {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ── 17b. Stat mini cards ─────────────────────────────────── */
.stat-mini-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: .8rem;
}
.stat-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.stat-mini:last-child { border-bottom: none; }
.text-accent { color: var(--accent); }

/* ── 18. Mode Toggle (Quick/Full form) ───────────────────── */
.mode-toggle {
  display: inline-flex;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.mode-btn {
  padding: 7px 20px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.mode-btn:hover { color: var(--text-primary); }
.mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(59,130,246,.35);
}
.job-mode-panel { max-width: 800px; }

/* ── Job template picker ─────────────────────────────────── */
.template-picker { max-width: 800px; }
.template-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.template-pick-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tpl-color, #4f46e5) 10%, #fff);
  color: var(--tpl-color, #4f46e5);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  min-width: 72px;
  line-height: 1.2;
}
.template-pick-btn i { font-size: 1.1rem; }
.template-pick-btn:hover {
  background: color-mix(in srgb, var(--tpl-color, #4f46e5) 18%, #fff);
  border-color: color-mix(in srgb, var(--tpl-color, #4f46e5) 40%, transparent);
}
.template-pick-btn.active {
  background: var(--tpl-color, #4f46e5);
  color: #fff;
  border-color: var(--tpl-color, #4f46e5);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--tpl-color, #4f46e5) 45%, transparent);
}
.template-clear-btn { --tpl-color: #64748b; }

/* Template edit grid responsive */
.tpl-edit-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
  .tpl-edit-grid { grid-template-columns: 1fr; }
}

/* Quick entry rows */
.quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}
.quick-row .form-group { margin-bottom: 0; }
.form-section-label {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.mt-12 { margin-top: 12px; }

/* ── 19. Global Search ───────────────────────────────────── */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 380px;
  margin: 0 16px;
  display: flex;
  align-items: center;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: .85rem;
}
.topbar-search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s;
}
.topbar-search-input:focus {
  border-color: var(--accent);
  background: var(--bg-primary);
}
.global-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 500;
  max-height: 400px;
  overflow-y: auto;
}
.global-result-group { padding: 8px 0 4px; }
.global-result-label {
  padding: 4px 14px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.global-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: .875rem;
  transition: background .1s;
}
.global-result-item:hover { background: var(--bg-hover); }
.global-result-sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-left: auto;
}
.global-no-results {
  padding: 16px 14px;
  color: var(--text-muted);
  font-size: .875rem;
  text-align: center;
}

/* ── 20. Customer/Vehicle view grid ─────────────────────── */
.customer-view-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: flex-start;
}
@media (max-width: 860px) {
  .customer-view-grid { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .quick-row { grid-template-columns: 1fr 1fr; }
}

/* ── 21. Job Notes ───────────────────────────────────────── */
.job-note {
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
}
.note-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
  font-size: .82rem;
}
.note-meta strong { color: var(--text-primary); }
.note-meta .text-muted { font-size: .78rem; }
.note-body {
  font-size: .875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── 22. Reg badge variants ─────────────────────────────── */
.reg-badge {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  font-weight: 700;
  padding: 3px 8px;
  background: #fef08a;
  color: #1a1a1a;
  border: 1px solid #ca8a04;
  border-radius: 4px;
  text-decoration: none;
}
.reg-badge:hover { background: #fde047; }
.reg-badge-sm {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  font-weight: 700;
  padding: 1px 6px;
  background: #fef9c3;
  color: #1a1a1a;
  border: 1px solid #eab308;
  border-radius: 3px;
}

/* ── 23. Pagination ─────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 12px 16px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-secondary);
  transition: all .15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── 24. Settings pages ─────────────────────────────────── */
.settings-grid { max-width: 820px; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.settings-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .82rem;
  color: #1e40af;
  margin-bottom: 18px;
  line-height: 1.5;
}
.settings-info i { flex-shrink: 0; margin-top: 2px; }
.settings-info code {
  background: #dbeafe;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .8rem;
}

/* Input prefix/suffix (£, %) */
.input-prefix-wrap,
.input-suffix-wrap {
  display: flex;
  align-items: center;
}
.input-prefix,
.input-suffix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .9rem;
  height: 38px;
  white-space: nowrap;
}
.input-prefix { border-right: none; border-radius: 6px 0 0 6px; }
.input-suffix { border-left:  none; border-radius: 0 6px 6px 0; }
.input-has-prefix { border-radius: 0 6px 6px 0 !important; }
.input-has-suffix { border-radius: 6px 0 0 6px !important; }
.input-has-prefix, .input-has-suffix { flex: 1; }

/* Required field marker */
.req { color: #dc2626; }

/* ── 17. Print / Invoice ──────────────────────────────────── */
@media print {
  body { background: #fff; font-size: 12pt; }
  .no-print { display: none !important; }
  .invoice-wrap { max-width: none; box-shadow: none; border: none; }
  a { color: inherit; text-decoration: none; }
}

.invoice-wrap {
  max-width: 780px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.invoice-header {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 32px 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.invoice-logo { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.invoice-logo i { font-size: 1.6rem; color: var(--accent); }
.invoice-meta { text-align: right; font-size: .85rem; }
.invoice-meta .inv-number { font-size: 1.2rem; font-weight: 700; }
.invoice-body { padding: 32px 36px; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.inv-party h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }
.inv-party p  { font-size: .875rem; line-height: 1.6; }
.invoice-table thead th { background: #f8fafc; }
.invoice-total-section { margin-top: 20px; display: flex; justify-content: flex-end; }
.invoice-totals { min-width: 260px; }
.inv-total-row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
}
.inv-total-row.grand { font-weight: 700; font-size: 1rem; border-bottom: 2px solid var(--text); }
.invoice-footer-note { margin-top: 32px; font-size: .8rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 16px; }

/* ── 18. Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .app-wrapper.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .page-content { padding: 16px; }
  .cal-wrapper { flex-direction: column; height: auto; }
  .queue-sidebar { width: 100%; height: 220px; }
  .form-row { grid-template-columns: 1fr; }
  .invoice-parties { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar-date { display: none; }
}
