/* CFCRM - Mobile-first CSS. Speed over style. */

:root {
  --primary: #ed8b68;
  --primary-dark: #d2846b;
  --bg: #121212;
  --bg-card: #1e1e1e;
  --bg-input: #2a2a2a;
  --text: #e8e8df;
  --text-muted: #9a9a92;
  --border: #3a3a3a;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --accent: #60A5FA;
  --brand-hover: #F59E0B;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;
  --font-utility: 'DM Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; width: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
}

/* Custom scrollbar styling - Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Custom scrollbar for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  background: var(--nav-bg, var(--bg-card));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  max-width: 100vw;
  box-sizing: border-box;
}
.nav-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--nav-text, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* View-As impersonation banner */
.view-as-banner {
  background: var(--warning, #D97706);
  color: #fff;
  text-align: center;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  position: sticky;
  top: 49px;
  z-index: 99;
}
.view-as-banner button {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
}
.view-as-banner button:hover {
  background: rgba(255,255,255,0.3);
}

/* View-As select dropdown in nav */
#view-as-select {
  background: rgba(255,255,255,0.08);
  color: var(--nav-text, var(--text));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  font-family: var(--font-display);
  font-weight: 600;
  max-width: 200px;
  cursor: pointer;
}

/* Role badge */
.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
.nav-links { display: flex; gap: 0.25rem; overflow-x: auto; }
.nav-links a {
  color: var(--sidebar-text, var(--text-muted));
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}
.nav-links a.active, .nav-links a:hover { color: var(--nav-text, var(--text)); background: rgba(255,255,255,0.1); }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--nav-text, var(--text));
  font-size: 1.4rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* App container */
.app {
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  max-width: 800px;
  margin: 0 auto;
}

/* Loading spinner */
.loading { display: flex; justify-content: center; padding: 3rem; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton screens */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton { padding: 1rem; max-width: 800px; margin: 0 auto; }
.skel {
  background: var(--bg-input);
  background-image: linear-gradient(90deg, var(--bg-input) 0%, #353535 40%, var(--bg-input) 80%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius);
}
.skel-line { height: 0.875rem; margin-bottom: 0.5rem; width: 100%; }
.skel-line-lg { height: 1.5rem; width: 40%; }
.skel-line-sm { height: 0.75rem; width: 60%; }
.skel-card { height: 5rem; border-radius: var(--radius); }
.skel-input { height: 2.5rem; border-radius: var(--radius); }
.skel-btn { height: 2.25rem; width: 6rem; border-radius: var(--radius); display: inline-block; }
.skel-badge { height: 1.5rem; width: 4rem; border-radius: 999px; display: inline-block; }
.skel-list-item { display: flex; gap: 1rem; padding: 0.875rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.skel-list-item .skel-lines { flex: 1; }
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-75 { width: 75%; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.card-title { font-family: var(--font-display); font-weight: 600; margin-bottom: 0.5rem; }

/* Forms */
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px; /* Prevents iOS zoom on focus */
  font-family: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }

/* Date inputs - prevent overflow on mobile */
input[type="date"] {
  max-width: 100%;
  min-width: 0;
}

/* Recurring options container */
#est-recurring-options {
  padding: 0.75rem;
}

/* Less padding on small screens to prevent date input overflow */
@media (max-width: 600px) {
  #est-recurring-options {
    padding: 0.5rem;
  }
  #est-recurring-options input[type="date"] {
    font-size: 15px;
    padding: 0.5rem 0.6rem;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn + .btn { margin-left: 0.5rem; }

/* Lists */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.list-item:hover { border-color: var(--primary); }
.list-item-title { font-weight: 500; }
.list-item-sub { font-size: 0.8rem; color: var(--text-muted); }

/* Search */
.search-bar {
  position: relative;
  margin-bottom: 1rem;
}
.search-bar input { padding-left: 0.75rem; }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.page-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(237,139,104,0.15); color: var(--primary); }
.badge-primary { background: var(--primary); color: #fff; }

/* Toast */
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 999; }
.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-top: 0.5rem;
  font-size: 0.85rem;
  animation: slideIn 0.2s ease;
}
.toast-success { background: var(--success); color: #000; }
.toast-error { background: var(--danger); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Offline bar */
.offline-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem;
  padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  background: var(--warning);
  color: #000;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 998;
}

/* Login page - Design Guide overhaul */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
  background: #0F172A;
  font-family: var(--font-body);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #1E293B;
  border-radius: 16px;
  border: 1px solid #334155;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.login-branding {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo {
  margin-bottom: 0.75rem;
}
.login-logo img {
  border-radius: 12px;
}
.login-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: #F8FAFC;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.01em;
}
.login-subtitle {
  color: #94A3B8;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}
.login-google-container {
  margin-bottom: 0.75rem;
}
.login-company-selector {
  margin-bottom: 1rem;
}
.login-divider {
  display: flex;
  align-items: center;
  margin: 1rem 0 1.25rem;
  color: #64748B;
  font-size: 0.8rem;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #334155;
}
.login-divider span { padding: 0 0.75rem; white-space: nowrap; }
.login-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #CBD5E1;
  margin-bottom: 0.4rem;
}
.login-field {
  margin-bottom: 1rem;
}
.login-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: #0F172A;
  color: #F8FAFC;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  min-height: 44px;
}
.login-input:focus {
  outline: none;
  border-color: #D97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}
.login-input::placeholder {
  color: #475569;
}
.login-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
  cursor: pointer;
}
.login-forgot-row {
  text-align: right;
  margin-bottom: 1rem;
}
.login-forgot-link {
  color: #60A5FA;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s;
}
.login-forgot-link:hover {
  color: #93C5FD;
}
.login-btn-primary {
  display: block;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: #D97706;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s;
  min-height: 48px;
}
.login-btn-primary:hover {
  background: #F59E0B;
}
.login-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.login-btn-ghost {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: #94A3B8;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-top: 0.75rem;
  min-height: 44px;
}
.login-btn-ghost:hover {
  color: #F8FAFC;
  border-color: #475569;
}
.login-turnstile {
  margin-bottom: 0.75rem;
}
.login-message {
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 1rem;
}
.login-message-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22C55E;
}
.login-message-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #EF4444;
}
.login-back-home {
  display: inline-block;
  margin-top: 1.25rem;
  color: #64748B;
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s;
}
.login-back-home:hover {
  color: #94A3B8;
}

/* Login responsive */
@media (max-width: 480px) {
  .login-card {
    padding: 2rem 1.25rem;
    border-radius: 12px;
  }
  .login-title {
    font-size: 1.5rem;
  }
}

/* Legacy login class compat */
.login-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80dvh; padding: 2rem; }
.login-box { width: 100%; max-width: 360px; }

/* Tabs - scrollable on mobile */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  font-family: var(--font-body);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Utility */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.85rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }

/* ---- Schedule View ---- */
.sched-customer-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(237,139,104,0.1);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.sched-week { display: flex; flex-direction: column; gap: 0.5rem; }
.sched-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sched-day-today { border-color: var(--primary); }
.sched-day-holiday { opacity: 0.5; }
.sched-day-weekend { opacity: 0.5; }
.sched-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
.sched-day-label { font-weight: 600; font-size: 0.9rem; }
.sched-day-stats { display: flex; gap: 0.35rem; }
.sched-timeline { display: flex; flex-direction: column; }
.sched-slot {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  min-height: 44px;
}
.sched-slot:last-child { border-bottom: none; }
.sched-slot-time {
  font-family: var(--font-utility);
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 70px;
  color: var(--text-muted);
}
.sched-slot-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  flex: 1;
  font-size: 0.8rem;
  min-width: 0;
}
.sched-slot-booked { background: rgba(237,139,104,0.05); cursor: pointer; }
.sched-slot-booked .sched-slot-time { color: var(--primary); }
.sched-slot-best-match {
  border-left: 3px solid #ffd700 !important;
  background: rgba(255,215,0,0.08) !important;
}
.sched-slot-best-match:hover {
  background: rgba(255,215,0,0.15) !important;
}
.sched-slot-status-scheduled { border-left: 3px solid var(--success); }
.sched-slot-status-completed { border-left: 3px solid var(--text-muted); background: rgba(0,0,0,0.02); }
.sched-slot-status-requested { border-left: 3px solid var(--warning); background: rgba(245,158,11,0.06); }
.sched-slot-status-pending {
  border-left: 3px dashed var(--warning, #f59e0b);
  background: rgba(245,158,11,0.08);
  border-top: 1px dashed rgba(245,158,11,0.3);
  border-bottom: 1px dashed rgba(245,158,11,0.3);
  border-right: 1px dashed rgba(245,158,11,0.3);
}
.sched-slot-status-pending .sched-slot-time { color: var(--warning, #f59e0b); }
.sched-slot-status-reschedule_requested { border-left: 3px solid #f97316; background: rgba(249,115,22,0.06); }
.sched-slot-status-in_progress { border-left: 3px solid var(--info, #3b82f6); background: rgba(59,130,246,0.05); }
.sched-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
  flex-shrink: 0;
}
.sched-status-dot-scheduled { background: var(--success); }
.sched-status-dot-pending { background: var(--warning, #f59e0b); }
.sched-status-dot-on_the_way { background: #8b5cf6; }
.sched-status-dot-in_progress { background: var(--info, #3b82f6); }
.sched-status-dot-completed { background: var(--text-muted); }
.sched-status-dot-cancelled { background: var(--danger, #ef4444); }
.sched-status-dot-no_show { background: #dc2626; }
.sched-status-dot-unscheduled { background: #6b7280; }
.sched-tracking-row { display:flex; align-items:center; gap:4px; padding:2px 0 2px 8px; min-height:20px; }
.sched-tracking-dot { width:14px; height:14px; border-radius:50%; border:2px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,0.3); flex-shrink:0; cursor:default; }
.sched-appt-detail { margin: 0.25rem 0; padding: 0.6rem; border-left: 3px solid var(--primary); font-size: 0.85rem; }
.sched-appt-detail a.sched-action-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
}
.sched-appt-detail a.sched-action-link:active { background: var(--bg-input); }
.sched-slot-customer { font-weight: 500; color: var(--text); }
.sched-slot-area {
  font-family: var(--font-utility);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.sched-slot-avail { color: var(--success); font-weight: 500; }
.sched-slot-bookable { cursor: pointer; }
.sched-slot-bookable:hover { background: rgba(34,197,94,0.08); }
.sched-slot-book-btn { margin-left: auto; cursor: pointer; }
.sched-proximity {
  font-family: var(--font-utility);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}
.sched-drive {
  font-family: var(--font-utility);
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 500;
}
.sched-drive-great { background: rgba(34,197,94,0.15); color: var(--success); }
.sched-drive-good { background: rgba(34,197,94,0.1); color: #6dd89e; }
.sched-drive-ok { background: rgba(245,158,11,0.15); color: var(--warning); }
.sched-drive-far { background: rgba(239,68,68,0.15); color: var(--danger); }
.sched-best-match {
  font-family: var(--font-utility);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  background: rgba(255,215,0,0.2);
  color: #ffd700;
  border: 1px solid rgba(255,215,0,0.4);
}
.sched-day-areas {
  display: flex;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.sched-area-tag {
  font-family: var(--font-utility);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg-input);
  color: var(--text-muted);
  border-radius: 4px;
}
.sched-sort-toggle {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sched-sort-toggle .btn {
  flex: 1;
  font-size: 0.8rem;
}
.sched-quick-picks {
  margin-bottom: 1rem;
}
.sched-quick-pick {
  padding: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.sched-quick-pick:hover {
  background: rgba(255,215,0,0.1);
  border-color: #ffd700;
}
@keyframes highlight-slot {
  0% { background: rgba(255,215,0,0.3); }
  100% { background: transparent; }
}
.sched-history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}
.sched-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.sched-history-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sched-efficiency-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}
.sched-efficiency-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.sched-efficiency-item {
  text-align: center;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1.5px solid;
}
.sched-efficiency-great {
  background: rgba(34,197,94,0.1);
  border-color: var(--success);
}
.sched-efficiency-good {
  background: rgba(34,197,94,0.05);
  border-color: #6dd89e;
}
.sched-efficiency-ok {
  background: rgba(245,158,11,0.1);
  border-color: var(--warning);
}
.sched-efficiency-far {
  background: rgba(239,68,68,0.1);
  border-color: var(--danger);
}
.sched-efficiency-count {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}
.sched-efficiency-great .sched-efficiency-count { color: var(--success); }
.sched-efficiency-good .sched-efficiency-count { color: #6dd89e; }
.sched-efficiency-ok .sched-efficiency-count { color: var(--warning); }
.sched-efficiency-far .sched-efficiency-count { color: var(--danger); }
.sched-efficiency-label {
  font-family: var(--font-utility);
  font-size: 0.65rem;
  margin-top: 0.25rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Mobile: stack efficiency grid */
@media (max-width: 640px) {
  .sched-efficiency-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Google Places Autocomplete dropdown styling */
.pac-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  z-index: 9999;
}
.pac-item {
  padding: 0.5rem 0.75rem;
  color: var(--text);
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.pac-item:hover, .pac-item-selected { background: var(--bg-input); }
.pac-item-query { color: var(--text); font-weight: 500; }
.pac-matched { color: var(--primary); }
.pac-icon { display: none; }

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 1002;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  min-width: 44px;
  min-height: 44px;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius);
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  z-index: 1001;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.lightbox-prev { left: 0.5rem; }
.lightbox-next { right: 0.5rem; }
.lightbox-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  color: #ccc;
  font-size: 0.85rem;
}
.lightbox-download {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}
.lightbox-download:hover { background: var(--primary-dark); }

/* Sub-tabs (nested inside a main tab) */
.sub-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  padding: 0.4rem 0.9rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}
.sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.sub-tab:hover { color: var(--text); }

/* Rule cards */
.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.rule-card:hover { border-color: var(--primary); }
.rule-inactive { opacity: 0.5; }

/* Markdown editor */
.md-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0.35rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
}
.md-toolbar button {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.78rem;
  min-width: 28px;
  min-height: 28px;
  text-align: center;
}
.md-toolbar button:hover { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.md-editor textarea {
  border: none;
  border-radius: 0;
  font-family: var(--font-utility);
  font-size: 0.85rem;
  line-height: 1.5;
  min-height: 200px;
  resize: vertical;
}
.md-editor textarea:focus { border: none; box-shadow: none; }

/* Markdown preview */
.md-preview {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}
.md-preview h1 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin: 0.5rem 0; }
.md-preview h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin: 0.4rem 0; }
.md-preview h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin: 0.3rem 0; }
.md-preview hr { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }
.md-preview a { color: var(--primary); }
.md-preview code { font-family: var(--font-utility); background: var(--bg-card); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.82rem; }
.md-preview pre { font-family: var(--font-utility); background: var(--bg-card); padding: 0.75rem; border-radius: var(--radius); overflow-x: auto; margin: 0.5rem 0; }
.md-preview li { margin-left: 1.2rem; }

/* Variable reference chips */
.var-ref-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.var-chip {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: rgba(237,139,104,0.12);
  color: var(--primary);
  border: 1px solid rgba(237,139,104,0.25);
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-utility);
  cursor: pointer;
}
.var-chip:hover { background: rgba(237,139,104,0.25); }

/* ---- Responsive: Small phones ---- */
@media (max-width: 380px) {
  .page-header { flex-wrap: wrap; }
  .page-title { font-size: 1.1rem; }
  .sched-slot { gap: 0.4rem; }
  .sched-slot-time { min-width: 50px; font-size: 0.75rem; }
  .sched-slot-area { max-width: 100px; }
  .btn { padding: 0.5rem 0.8rem; font-size: 0.85rem; }
  .btn-sm { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
  .login-title { font-size: 1.6rem; }
}

/* ---- Nav Right (bell icon area, always visible) ---- */
.nav-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ---- Bell Icon in Nav ---- */
.nav-bell-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0 !important;
  border-radius: var(--radius);
  color: var(--sidebar-text, var(--text-muted));
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.15s, color 0.15s;
}
.nav-bell-link:hover, .nav-bell-link.active {
  color: var(--nav-text, var(--text));
  background: rgba(255,255,255,0.15);
}
.notif-bell-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 99px;
  padding: 0 3px;
  pointer-events: none;
}

/* ---- Notifications Page ---- */
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.notif-header h2 { margin: 0; }
.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.notif-unread-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger, #ef4444);
}
.notif-list {
  display: flex;
  flex-direction: column;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover {
  background: var(--bg-input);
}
.notif-item.notif-unread {
  border-left: 4px solid var(--primary);
  background: rgba(217, 119, 6, 0.04);
}
.notif-item-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-input);
}
.notif-icon {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
}
.notif-icon-payment { stroke: var(--success, #22c55e); }
.notif-icon-estimate { stroke: var(--primary); }
.notif-icon-appointment { stroke: #8b5cf6; }
.notif-icon-customer { stroke: #06b6d4; }
.notif-item-content {
  flex: 1;
  min-width: 0;
}
.notif-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.15rem;
}
.notif-item-body {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.notif-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
.notif-item-type {
  font-family: var(--font-utility);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.notif-item-time {
  font-family: var(--font-utility);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.notif-item-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.notif-item:hover .notif-item-dismiss {
  opacity: 1;
}
.notif-item-dismiss:hover {
  background: var(--danger, #ef4444);
  color: #fff;
}
.notif-empty {
  text-align: center;
  padding: 3rem 1rem;
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 640px) {
  .nav-links {
    display: none;
    overflow: visible;
  }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
  .nav-links.open a {
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    border-radius: var(--radius);
  }
  .nav-toggle { display: flex; }
  /* Bell always visible next to hamburger */
  .nav-right { margin-right: 0.5rem; }
  /* Notification items - always show dismiss on mobile (no hover) */
  .notif-item-dismiss { opacity: 1; }
  .notif-item { padding: 0.75rem; }
  .notif-item-icon { width: 32px; height: 32px; }
  .notif-icon { width: 16px; height: 16px; }
  .app { padding: 0.75rem; padding-bottom: max(0.75rem, env(safe-area-inset-bottom)); }
  .page-title { font-size: 1.15rem; }
  .card { padding: 0.75rem; }
  .list-item { padding: 0.6rem 0.75rem; }
  .sched-customer-banner { flex-direction: column; align-items: flex-start; }
  .sched-slot-time { min-width: 55px; font-size: 0.75rem; }
  .sched-day-header { padding: 0.4rem 0.6rem; }

  /* Toast centered at bottom on mobile */
  .toast-container { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; }
  .toast { text-align: center; }

  /* Markdown editor smaller */
  .md-editor textarea { min-height: 150px; font-size: 0.8rem; }
  .md-preview { max-height: 200px; }
}

/* ---- Responsive: Tablet ---- */
@media (min-width: 641px) and (max-width: 1024px) {
  .app { max-width: 720px; }
}

/* ---- Responsive: Desktop ---- */
@media (min-width: 1025px) {
  .app { max-width: 900px; }
}

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

/* Focus visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Report Item Picker ---- */
.item-pick {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  background: var(--bg-card);
  overflow: hidden;
}
.item-pick-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.item-pick-header:hover { background: rgba(255,255,255,0.04); }
.item-pick-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.item-pick-title { font-size: 0.9rem; }
.item-pick-body {
  padding: 0 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
}
.item-pick-body textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem;
  font-size: 0.85rem;
  resize: vertical;
}
/* NFPA Code Search */
.nfpa-results {
  max-height: 500px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.nfpa-result-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.4rem;
  background: var(--bg-card);
}
.nfpa-result-item:hover {
  border-color: var(--primary);
}
.nfpa-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.nfpa-result-text {
  line-height: 1.4;
}
.nfpa-add-btn {
  font-size: 0.75rem;
}
.badge-outline {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.badge-sm {
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
}
.correction-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0;
  cursor: pointer;
  user-select: none;
}
.correction-toggle input[type="checkbox"] {
  accent-color: #e53e3e;
  width: 16px;
  height: 16px;
}
.correction-label { font-family: var(--font-utility); font-size: 0.8rem; color: #e53e3e; font-weight: 600; }

/* ---- PASS/FAIL Banner ---- */
.inspection-result-banner {
  font-family: var(--font-display);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-align: center;
  letter-spacing: 0.03em;
}
.result-pass {
  background: #064e3b;
  color: #34d399;
  border: 1.5px solid #34d399;
}
.result-fail {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1.5px solid #f87171;
}
.card-correction { border-left: 3px solid #e53e3e !important; }
.card-correction .badge-danger { margin-right: 0.5rem; }

/* Reschedule requested badge */
.badge-reschedule {
  background: rgba(245,158,11,0.2);
  color: var(--warning);
  font-weight: 600;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Workflow page */
.wf-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wf-card-done {
  border-left-color: var(--border);
  opacity: 0.7;
}
.wf-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.wf-time {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.wf-dur {
  font-family: var(--font-utility);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
}
.wf-customer {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.wf-address {
  font-size: 0.95rem;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  margin-bottom: 0.35rem;
  display: block;
  padding: 0.15rem 0;
}
.wf-phone {
  font-size: 1rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.wf-notes {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  margin-top: 0.25rem;
}
.wf-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
/* Big, finger-friendly workflow buttons */
.wf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  min-height: 44px;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 0.15s;
}
.wf-btn:active { opacity: 0.75; }
.wf-btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.wf-btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.wf-btn-green {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.wf-btn-orange {
  background: #f97316;
  color: #fff;
  border-color: #f97316;
}
.wf-btn-danger-outline {
  background: transparent;
  border-color: #ef4444;
  color: #ef4444;
}
/* No-show pending countdown notice */
.wf-noshow-countdown {
  font-size: 0.9rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  width: 100%;
}
.wf-noshow-ready {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}
/* Section divider between active and completed */
.wf-section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.wf-section-divider::before,
.wf-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Table styles for audit log */
.table-simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-simple thead {
  background: var(--bg-input);
}

.table-simple th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table-simple td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table-simple tbody tr:hover {
  background: rgba(237, 139, 104, 0.05);
}

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

/* ---------------------------------------------------------------------------
 * Utility Classes - Replace inline styles
 * ---------------------------------------------------------------------------*/

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font weight */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* Embed code block (settings page) */
.embed-code-block {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ---------------------------------------------------------------------------
 * Settings Accordion UI (VS Code-inspired)
 * ---------------------------------------------------------------------------*/

.settings-search {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.settings-search input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.settings-search input:focus {
  outline: none;
  border-color: var(--primary);
}

.settings-section {
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}

.settings-section.hidden {
  display: none;
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.settings-section-header:hover {
  background: rgba(237, 139, 104, 0.05);
}

.settings-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.settings-section-icon {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.settings-section.expanded .settings-section-icon {
  transform: rotate(90deg);
}

.settings-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.settings-section.expanded .settings-section-content {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}

.settings-section-inner {
  padding: 0 1rem 1rem 1rem;
}

.setting-row {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.setting-row:first-child {
  border-top: none;
  padding-top: 0;
}

.setting-row-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.setting-label {
  font-weight: 500;
  color: var(--text);
}

.setting-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.setting-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .setting-row-header {
    margin-bottom: 0;
  }

  .setting-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
  }
}

/* ---- Staff Dashboard ---- */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.dash-header h2 { margin: 0; }

/* Widget grid - responsive masonry-like layout */
.dash-widgets-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .dash-widgets-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .dash-widgets-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Widget sizes */
.dash-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.dash-widget-sm {
  grid-column: span 1;
  padding: 1.25rem;
  text-align: center;
  border-top: 4px solid var(--border);
}
.dash-widget-md {
  grid-column: span 1;
}
@media (min-width: 640px) {
  .dash-widget-md { grid-column: span 1; }
}
@media (min-width: 960px) {
  .dash-widget-md { grid-column: span 2; }
}
.dash-widget-lg {
  grid-column: span 1;
}
@media (min-width: 640px) {
  .dash-widget-lg { grid-column: span 2; }
}
@media (min-width: 960px) {
  .dash-widget-lg { grid-column: span 3; }
}
.dash-widget-xl {
  grid-column: 1 / -1;
}

.dash-widget-header {
  padding: 1rem 1.25rem 0;
}
.dash-widget-body {
  padding: 0.75rem 1.25rem 1.25rem;
}

/* Stat card widget */
.dash-widget-stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}
.dash-widget-stat-label {
  font-family: var(--font-utility);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.dash-trend {
  display: block;
  font-family: var(--font-utility);
  font-size: 0.75rem;
  margin-top: 0.35rem;
  color: var(--text-muted);
}
.dash-trend-up { color: var(--success, #22c55e); }
.dash-trend-down { color: var(--danger, #ef4444); }

/* Panel title */
.dash-panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

/* Revenue bar chart */
.dash-chart {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.dash-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.dash-bar-label {
  font-family: var(--font-utility);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 70px;
  text-align: right;
}
.dash-bar-track {
  flex: 1;
  height: 24px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.dash-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 2px;
}
.dash-bar-value {
  font-family: var(--font-utility);
  font-size: 0.8rem;
  color: var(--text);
  min-width: 80px;
  text-align: right;
  font-weight: 500;
}

/* Breakdown widget (payments by method, status breakdowns, top customers) */
.dash-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.dash-breakdown-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.dash-breakdown-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 120px;
  flex-shrink: 0;
}
.dash-breakdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-breakdown-name {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-breakdown-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.dash-breakdown-rank {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 20px;
}
.dash-breakdown-bar-wrap {
  flex: 1;
  height: 20px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.dash-breakdown-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.5s ease;
  min-width: 2px;
}
.dash-breakdown-bar-success { background: var(--success, #22c55e); }
.dash-breakdown-bar-warning { background: var(--warning, #f59e0b); }
.dash-breakdown-bar-danger { background: var(--danger, #ef4444); }
.dash-breakdown-bar-primary { background: var(--primary); }
.dash-breakdown-bar-muted { background: var(--text-muted); }
.dash-breakdown-value {
  font-family: var(--font-utility);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
  text-align: right;
  white-space: nowrap;
}

/* List widget (upcoming jobs, recent payments, recent activity) */
.dash-list {
  display: flex;
  flex-direction: column;
}
.dash-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover {
  background: var(--bg-input);
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.dash-list-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}
.dash-list-name {
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-list-tag {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.dash-list-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}
.dash-list-value {
  font-family: var(--font-utility);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.dash-list-meta {
  font-family: var(--font-utility);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Dashboard Tech List ---- */
.dash-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.dash-tech-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-input, #f5f5f5);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.dash-tech-chip.active {
  border-color: var(--success, #22c55e);
  background: rgba(34,197,94,0.08);
}
.dash-tech-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-tech-chip.active .dash-tech-dot {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.3);
}
.dash-tech-name {
  font-weight: 600;
  color: var(--text);
}
.dash-tech-ago {
  font-size: 0.75rem;
}
.dash-map-label {
  background: rgba(255,255,255,0.85);
  padding: 1px 5px;
  border-radius: 3px;
  margin-top: -30px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.theme-dark .dash-map-label {
  background: rgba(30,30,30,0.85);
}

/* ---- Customize Modal ---- */
.dash-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.dash-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.dash-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.dash-modal-header h3 { margin: 0; font-size: 1.1rem; }
.dash-modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.dash-modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: right;
}
.dash-modal-section {
  margin-bottom: 1.25rem;
}
.dash-modal-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.dash-modal-category {
  margin-bottom: 0.75rem;
}
.dash-modal-category h5 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

/* Sortable items */
.dash-sortable {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.dash-sortable-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  transition: opacity 0.15s, border-color 0.15s;
}
.dash-sortable-item.dash-dragging {
  opacity: 0.4;
}
.dash-sortable-item.dash-drag-over {
  border-color: var(--primary);
  border-style: dashed;
}
.dash-sortable-handle {
  color: var(--text-muted);
  font-size: 1rem;
  cursor: grab;
  user-select: none;
}
.dash-sortable-title {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
}
.dash-size-select {
  font-size: 0.78rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
}
.dash-sortable-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  line-height: 1;
}
.dash-sortable-remove:hover {
  background: var(--danger, #ef4444);
  color: #fff;
}

/* Available widget items */
.dash-available-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
}
.dash-available-item .btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
}

/* Per-technician schedule sections (legacy - kept for reference) */
.sched-tech-section { margin: 0.15rem 0; }
.sched-tech-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0.6rem; cursor: pointer; font-family: var(--font-body); font-size: 0.85rem;
  font-weight: 600; background: var(--bg-input);
  border-radius: 4px; user-select: none;
}
.sched-tech-header:hover { opacity: 0.85; }
.sched-tech-slots.collapsed { display: none; }

/* Tech Grid View - dispatch board style */
.sched-grid {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.25rem 0;
}
.sched-grid-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  min-width: fit-content;
}
.sched-grid-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-width: fit-content;
  transition: background 0.1s;
}
.sched-grid-row:last-child { border-bottom: none; }
.sched-grid-row:hover { background: rgba(59, 130, 246, 0.03); }
.sched-grid-time-col {
  min-width: 70px;
  max-width: 70px;
  padding: 0.35rem 0.4rem;
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
  background: var(--bg-input);
}
.sched-grid-tech-col {
  flex: 1;
  min-width: 85px;
  padding: 0.4rem 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
}
.sched-grid-tech-col:last-child { border-right: none; }
.sched-grid-tech-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sched-grid-tech-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-grid-cell {
  flex: 1;
  min-width: 85px;
  padding: 0.3rem 0.35rem;
  font-family: var(--font-utility);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.2rem;
  border-right: 1px solid var(--border);
  min-height: 44px;
}
.sched-grid-cell:last-child { border-right: none; }
.sched-grid-cell-open {
  color: var(--success, #22c55e);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.sched-grid-cell-open:hover {
  background: rgba(34, 197, 94, 0.15);
}
.sched-grid-cell-open:active {
  background: rgba(34, 197, 94, 0.25);
}
.sched-grid-cell-best {
  background: rgba(255, 215, 0, 0.15) !important;
  border: 2px solid rgba(255, 215, 0, 0.5);
  font-weight: 600;
}
.sched-grid-cell-best:hover {
  background: rgba(255, 215, 0, 0.25) !important;
}
.sched-grid-best-label {
  font-family: var(--font-utility);
  font-size: 0.7rem;
  color: #ffd700;
  font-weight: 700;
}
.sched-grid-cell-booked {
  background: rgba(59, 130, 246, 0.06);
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
}
.sched-grid-cell-booked:hover {
  background: rgba(59, 130, 246, 0.12);
}
.sched-grid-cell-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 0.72rem;
}
.sched-grid-cell-status-pending {
  background: rgba(245, 158, 11, 0.08);
}
.sched-grid-cell-status-pending:hover {
  background: rgba(245, 158, 11, 0.15);
}
.sched-grid-cell-continuation {
  background: rgba(59, 130, 246, 0.04);
  position: relative;
  cursor: pointer;
}
.sched-grid-cell-continuation:hover {
  background: rgba(59, 130, 246, 0.1);
}
.sched-grid-cont-marker {
  display: block;
  width: 3px;
  height: 16px;
  background: var(--primary, #3b82f6);
  opacity: 0.3;
  border-radius: 2px;
}
.sched-grid-cell-past {
  color: var(--text-muted);
  opacity: 0.35;
  font-size: 0.7rem;
}
.sched-grid-cell-na {
  color: var(--text-muted);
  opacity: 0.25;
}
.sched-grid-cell-stacked, .sched-slot-stacked {
  flex-direction: column;
  gap: 0;
  padding: 0.15rem;
}
.sched-grid-stacked-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.25rem;
  font-size: 0.7rem;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-grid-stacked-item:hover {
  background: rgba(59, 130, 246, 0.12);
}
.sched-grid-stacked-item .sched-status-dot {
  flex-shrink: 0;
}
.sched-grid-stacked-item .sched-grid-cell-name {
  font-size: 0.68rem;
}
/* Panel within grid needs full width */
.sched-grid > .sched-appt-detail,
.sched-grid > .sched-book-panel,
.sched-grid > .sched-appt-edit {
  min-width: 100%;
  width: 100%;
}
@media (max-width: 600px) {
  .sched-grid-time-col { min-width: 58px; max-width: 58px; font-size: 0.68rem; padding: 0.25rem 0.3rem; }
  .sched-grid-tech-col { min-width: 72px; font-size: 0.7rem; padding: 0.3rem 0.2rem; }
  .sched-grid-cell { min-width: 72px; font-size: 0.68rem; padding: 0.25rem 0.2rem; min-height: 44px; }
  .sched-grid-cell-name { font-size: 0.65rem; }
}

/* Crew checkbox chip */
.sched-crew-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.5rem; border-radius: 12px; cursor: pointer;
  font-size: 0.8rem; border: 1px solid var(--border);
  background: var(--bg-input); user-select: none; transition: all 0.15s;
}
.sched-crew-chip:hover { border-color: var(--primary); }
.sched-crew-chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.sched-crew-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ---- Schedule Controls Bar ---- */
.sched-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.sched-controls-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.sched-controls-spacer {
  flex: 1;
  min-width: 0.5rem;
}

/* Segmented control - view/sort toggle */
.sched-segment {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sched-segment-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.sched-segment-btn + .sched-segment-btn {
  border-left: 1px solid var(--border);
}
.sched-segment-btn:hover {
  background: var(--bg-input);
  color: var(--text);
}
.sched-segment-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Navigation buttons - 44px touch targets */
.sched-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.sched-nav-btn:hover { background: var(--bg-input); }
.sched-nav-btn:active { opacity: 0.8; }

/* Tech filter select - 44px height */
.sched-tech-select {
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  cursor: pointer;
}

/* ---- Booking Panel ---- */
.sched-book-field {
  margin-bottom: 0.5rem;
}
.sched-field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.sched-duration-picker {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.sched-duration-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.sched-duration-btn:hover { background: var(--bg-input); }
.sched-duration-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.sched-duration-custom {
  width: 80px;
  min-height: 44px;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sched-duration-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}
.sched-duration-summary strong {
  color: var(--text);
}

/* ---- Detail Panel ---- */
.sched-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.sched-detail-name {
  font-size: 0.95rem;
  font-weight: 600;
}
.sched-detail-status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0;
}
.sched-status-select {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input, var(--bg-card));
  color: var(--text);
  font-size: 0.85rem;
  min-height: 36px;
}
.sched-detail-field {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.sched-detail-field strong {
  color: var(--text);
}
.sched-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.sched-detail-actions a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  min-height: 44px;
}
.sched-detail-actions a:active { background: var(--bg-input); }
.sched-detail-actions .sched-action-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 55px;
}
.sched-detail-actions .sched-action-value {
  text-decoration: underline;
  color: var(--primary);
}
.sched-detail-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.sched-detail-buttons .btn {
  min-height: 44px;
  font-size: 0.85rem;
}
.sched-detail-buttons-row {
  margin-bottom: 0.5rem;
}
.sched-detail-buttons-row .btn { min-height: 44px; }
.sched-detail-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.sched-detail-buttons-grid .btn,
.sched-detail-buttons-grid a.btn {
  min-height: 44px;
  font-size: 0.82rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sched-detail-notes {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  white-space: pre-line;
}
.sched-detail-mileage {
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-input);
  border-radius: var(--radius);
}
.sched-detail-mileage .text-muted { display: block; margin-bottom: 0.25rem; }
.sched-detail-mileage-row { margin-left: 1rem; }

/* ---- Edit Form ---- */
.sched-edit-form {
  margin: 0.25rem 0;
  padding: 0.75rem;
  border-left: 3px solid var(--primary);
  font-size: 0.85rem;
}
.sched-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.sched-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 480px) {
  .sched-edit-grid { grid-template-columns: 1fr; }
}
.sched-edit-field {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.sched-edit-grid .sched-edit-field {
  margin-bottom: 0;
}
.sched-edit-field input,
.sched-edit-field select,
.sched-edit-field textarea {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
}
.sched-edit-field textarea {
  min-height: 60px;
  resize: vertical;
}
.sched-edit-field-full {
  grid-column: 1 / -1;
}
.sched-edit-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.sched-edit-actions .btn {
  min-height: 44px;
  font-size: 0.85rem;
}
.sched-edit-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.sched-edit-more-toggle:hover { text-decoration: underline; }
.sched-edit-more {
  display: none;
}
.sched-edit-more.open {
  display: block;
}

/* ---- Month View ---- */
.sched-month-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.sched-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}
.sched-month-dayname {
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}
.sched-month-cell {
  min-height: 100px;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.sched-month-cell:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-color: var(--primary);
}
.sched-month-cell-today {
  border-color: var(--primary);
}
.sched-month-cell-dim {
  opacity: 0.5;
}
.sched-month-cell-date {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}
.sched-month-cell-stats {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
}
.sched-month-cell-appt {
  font-size: 0.65rem;
  padding: 0.2rem;
  background: var(--bg-input);
  border-radius: 3px;
}
.sched-month-appt-list {
  margin-top: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sched-month-more {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Week View ---- */
.sched-week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.sched-week-day-card {
  padding: 0.75rem;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.sched-week-day-card-today {
  border-color: var(--primary);
}
.sched-week-day-header {
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}
.sched-week-day-title {
  font-weight: 700;
  font-size: 1rem;
}
.sched-week-day-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sched-week-day-badges {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.3rem;
}
.sched-week-day-slots {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sched-week-slot {
  padding: 0.4rem;
  font-size: 0.8rem;
}
.sched-week-slot-time {
  font-weight: 600;
  font-size: 0.75rem;
  margin-bottom: 0.1rem;
}
.sched-week-slot-info {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
}
.sched-week-slot-disabled {
  padding: 0.4rem;
  font-size: 0.8rem;
  opacity: 0.5;
}

/* ---- Pending Modal ---- */
.sched-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sched-modal {
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  margin: 1rem;
}
.sched-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.75rem;
}
.sched-modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}
.sched-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sched-pending-card {
  padding: 0.875rem;
  border-left: 3px solid var(--primary);
  background: var(--bg-input);
}
.sched-pending-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.625rem;
}
.sched-pending-name {
  font-size: 1.05rem;
  font-weight: 600;
}
.sched-pending-contact {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.sched-pending-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem 1rem;
  font-size: 0.825rem;
  margin-bottom: 0.625rem;
}
.sched-pending-grid-full {
  grid-column: 1 / -1;
}
.sched-pending-notes {
  font-size: 0.85rem;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.625rem;
  white-space: pre-line;
}
.sched-pending-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.sched-pending-actions .btn {
  min-height: 44px;
}

/* ---- Misc Schedule ---- */
.btn-touch {
  min-height: 44px;
}
.badge-xs {
  font-size: 0.6rem;
  padding: 0.05rem 0.2rem;
}
.sched-mileage-inline {
  color: var(--success);
  font-size: 0.8rem;
}
.sched-slot-disabled {
  opacity: 0.5;
}
.sched-match-badge {
  font-size: 0.65rem;
  margin-left: 0.3rem;
}
.sched-banner-warning {
  border-left: 4px solid var(--warning, #f59e0b);
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}
.sched-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sched-cust-search-card .text-sm {
  margin-bottom: 0.4rem;
}
.sched-cust-search-hint {
  margin-top: 0.4rem;
}
.sched-cust-search-hint a {
  color: var(--primary);
}
.sched-tech-filter-wrap {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.sched-tech-filter-label {
  font-size: 0.9rem;
  font-weight: 600;
}
/* Quick picks improvements */
.sched-quick-picks-card {
  border-left: 3px solid #ffd700;
  background: rgba(255,215,0,0.05);
  margin-top: 0.75rem;
}
.sched-quick-picks-title {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.sched-quick-picks-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sched-quick-pick-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Touch target fixes */
.sched-grid-cell { min-height: 44px; }
.sched-slot { min-height: 44px; }

/* ---- Unscheduled Queue Panel ---- */
.sched-queue-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius, 0.5rem);
  background: var(--bg-card, #fff);
  overflow: hidden;
  margin-bottom: 1rem;
}
.sched-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  user-select: none;
}
.sched-queue-header:hover {
  background: var(--bg-input, rgba(0,0,0,0.03));
}
.sched-queue-title {
  font-family: var(--font-display, 'Barlow Condensed', sans-serif);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sched-queue-toggle {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}
.sched-queue-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
}
.sched-queue-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 0.5rem);
  gap: 0.75rem;
}
.sched-queue-card-info {
  flex: 1;
  min-width: 0;
}
.sched-queue-card-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-queue-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.2rem;
  font-size: 0.8rem;
}
.sched-queue-area {
  font-family: var(--font-mono, 'DM Mono', monospace);
  color: var(--text-muted);
  font-size: 0.75rem;
}
.sched-queue-age {
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.sched-queue-age-warn {
  color: #D97706;
}
.sched-queue-age-urgent {
  color: #DC2626;
  font-weight: 600;
}
.sched-queue-scheduling-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary, #D97706);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
}
#unsched-cust-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input, rgba(0,0,0,0.03));
  border-radius: var(--radius, 0.5rem);
}

@media (max-width: 600px) {
  .sched-grid-cell { min-height: 44px; }
  .sched-controls { gap: 0.35rem; padding: 0.4rem 0.5rem; }
  .sched-segment-btn { padding: 0.35rem 0.5rem; font-size: 0.75rem; }
  .sched-month-cell { min-height: 80px; padding: 0.35rem; }
  .sched-month-grid { gap: 0.25rem; }
  .sched-pending-grid { grid-template-columns: 1fr; }
  .sched-queue-card {
    flex-direction: column;
    align-items: stretch;
  }
  .sched-queue-card .btn {
    width: 100%;
    min-height: 44px;
  }
}
@media (max-width: 480px) {
  .sched-week-grid { grid-template-columns: 1fr; }
}

/* Theme Gallery */
.theme-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.theme-card {
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1rem; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; position: relative;
}
.theme-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.theme-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.theme-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.theme-card-name { font-weight: 600; font-size: 0.95rem; }
.theme-card-badge {
  font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 600;
}
.theme-card-badge.locked {
  background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border);
}
.theme-card-desc { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; font-style: italic; }
.font-stack-preview { display: flex; flex-direction: column; gap: 2px; margin-top: 0.5rem; }
.font-stack-sample { color: var(--text); line-height: 1.4; font-size: 0.85rem; }
.theme-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0;
}
.theme-card-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; justify-content: flex-end; }
.theme-card-actions .btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.theme-form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
@media (max-width: 500px) {
  .theme-gallery { grid-template-columns: 1fr; }
  .theme-form-grid { grid-template-columns: 1fr; }
}
.theme-color-field { display: flex; align-items: center; gap: 0.5rem; }
.theme-color-field input[type="color"] {
  width: 44px; height: 36px; padding: 2px; cursor: pointer; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-input);
}
.theme-color-field label { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }
.theme-color-field .hex-val { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-utility); }

/* Font Preview */
.font-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.font-section-title { font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; }
.font-preview-text {
  padding: 0.75rem; background: var(--bg-input); border-radius: 6px;
  margin-top: 0.5rem; min-height: 48px;
}
.font-controls { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.font-controls .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.font-controls select { min-width: 80px; }

/* ---- Intake Form ---- */
.intake-divider {
  text-align: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  position: relative;
}
.intake-divider::before,
.intake-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 100px);
  height: 1px;
  background: var(--border);
}
.intake-divider::before { left: 0; }
.intake-divider::after { right: 0; }
.intake-type-toggle {
  display: flex;
  gap: 0.5rem;
}
.field-feedback {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  min-height: 1.2rem;
}
.field-feedback.error { color: var(--danger); }
.field-feedback.success { color: var(--success); }
input.field-valid { border-color: var(--success); }
input.field-error { border-color: var(--danger); }

/* ---- Reports ---- */

/* Reusable empty state */
.empty-state { text-align:center; padding:3rem 1.5rem; background:var(--bg-card); border:1px dashed var(--border); border-radius:var(--radius); }
.empty-state-title { font-family:var(--font-display); font-size:1.15rem; font-weight:700; margin-bottom:0.5rem; }
.empty-state-body { color:var(--text-muted); font-size:0.9rem; margin-bottom:1.25rem; max-width:320px; margin-left:auto; margin-right:auto; }
.empty-state-secondary { display:block; margin-top:0.75rem; font-size:0.85rem; color:var(--text-muted); }
.empty-state-secondary a { color:var(--primary); text-decoration:underline; }

/* Back navigation link (44px touch target) */
.back-nav { display:inline-flex; align-items:center; gap:0.35rem; color:var(--text-muted); text-decoration:none; font-size:0.85rem; margin-bottom:0.75rem; min-height:44px; padding:0.25rem 0; }
.back-nav:hover { color:var(--text); }

/* Report badges */
.report-badges { display:flex; gap:0.4rem; align-items:center; flex-shrink:0; }
.badge-result { font-size:0.7rem; padding:0.15rem 0.45rem; font-weight:700; letter-spacing:0.03em; }

/* Report action buttons */
.report-actions { display:flex; gap:0.5rem; flex-wrap:wrap; margin-bottom:0.75rem; }
.report-actions .btn { min-height:44px; flex:1; min-width:0; }
@media (min-width:601px) { .report-actions .btn { flex:0 1 auto; } }

/* Report photo grid */
.report-photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:0.5rem; }
.report-photo-wrapper { position:relative; }
.report-photo-grid img { width:100%; border-radius:var(--radius); cursor:pointer; aspect-ratio:1; object-fit:cover; }
.photo-remove-btn { position:absolute; top:4px; right:4px; width:28px; height:28px; border-radius:50%; background:rgba(0,0,0,0.6); color:#fff; border:none; font-size:18px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0; }
.photo-remove-btn:hover { background:rgba(220,38,38,0.9); }

/* Report note quote */
.report-note-quote { border-left:3px solid var(--primary); padding-left:0.5rem; margin-top:0.25rem; white-space:pre-wrap; }
.report-item-desc { white-space:pre-wrap; }

/* Communication status bar */
.comm-status-bar { margin-top:0.5rem; }
.comm-latest { display:flex; flex-direction:column; gap:0.25rem; padding:0.5rem 0.75rem; border-radius:var(--radius); border:1px solid var(--border); }
.comm-sent { border-left:3px solid var(--warning, #f59e0b); }
.comm-opened { border-left:3px solid var(--success, #10b981); }
.comm-open-status { font-weight:600; }
.comm-sent .comm-open-status { color:var(--text-muted); }
.comm-opened .comm-open-status { color:var(--success, #10b981); }
.comm-history { margin-top:0.5rem; }
.comm-history summary { cursor:pointer; }
.comm-history > div { padding:0.15rem 0; }

/* Photo upload zone (replaces bare file input) */
.photo-upload-zone { position:relative; border:2px dashed var(--border); border-radius:var(--radius); padding:1.5rem; text-align:center; cursor:pointer; transition:border-color 0.15s,background 0.15s; min-height:80px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0.5rem; }
.photo-upload-zone:hover, .photo-upload-zone.drag-over { border-color:var(--primary); background:rgba(237,139,104,0.05); }
.photo-upload-zone input[type="file"] { position:absolute; width:1px; height:1px; opacity:0; overflow:hidden; }
.photo-upload-zone .upload-label { font-size:0.85rem; color:var(--text-muted); }
.photo-upload-zone .upload-cta { color:var(--primary); font-weight:600; font-size:0.9rem; }
.photo-upload-zone.uploading { pointer-events:none; opacity:0.7; border-color:var(--primary); background:rgba(237,139,104,0.05); }
.photo-upload-zone.uploading .upload-cta { animation:pulse-text 1.5s ease-in-out infinite; }
@keyframes pulse-text { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* Sticky action bar for forms */
.sticky-action-bar { position:sticky; bottom:0; background:var(--bg); padding:0.75rem 0; border-top:1px solid var(--border); margin-top:1rem; z-index:10; }
.sticky-action-bar .btn { min-height:48px; }

/* Selected items summary (sticky below nav) */
.selected-summary { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:0.75rem 1rem; margin-bottom:0.75rem; position:sticky; top:56px; z-index:10; }
.selected-summary-count { font-family:var(--font-display); font-weight:700; font-size:1rem; }
.selected-summary-list { font-size:0.8rem; color:var(--text-muted); margin-top:0.25rem; max-height:40px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---- Customers / Detail Actions ---- */

/* Reusable detail-page action bar (44px touch targets, flex:1 on mobile) */
.detail-actions { display:flex; gap:0.5rem; flex-wrap:wrap; margin-bottom:0.75rem; }
.detail-actions .btn { min-height:44px; }
@media (max-width:600px) { .detail-actions .btn { flex:1; min-width:0; } }

/* Address group sections (commercial customers) */
.address-group { border-left:3px solid var(--border); padding-left:0.5rem; min-height:60px; margin-top:0.5rem; transition:background 0.2s; }
.address-group-title { font-weight:600; color:var(--text-muted); font-size:0.85rem; margin-bottom:0.25rem; }
.address-group-empty { padding:1rem 0; }

/* Contact links (phone, email, address) */
.contact-link { color:var(--primary); text-decoration:underline; }
.contact-link-plain { color:var(--primary); text-decoration:none; }

/* Two-column name grid (collapses on small screens) */
.name-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.5rem; }

/* History section headers */
.history-title { font-family:var(--font-display); font-size:1rem; font-weight:600; margin-top:1.5rem; margin-bottom:0.5rem; }

/* Inline edit panel (appointments) */
.inline-edit-panel { margin-top:-0.5rem; margin-bottom:0.5rem; border-top:none; border-top-left-radius:0; border-top-right-radius:0; }

/* ---------------------------------------------------------------------------
 * Estimates/Invoices
 * ---------------------------------------------------------------------------*/
.est-section-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; margin: 1.5rem 0 0.5rem; }
.est-line-item { border-left: 3px solid var(--border); position: relative; }
.est-line-item.surcharge { border-left-color: var(--warning); }
.est-line-item.tip { border-left-color: var(--success); }
.est-totals { text-align: right; }
.est-totals .row { display: flex; justify-content: space-between; padding: 0.15rem 0; font-size: 0.9rem; }
.est-totals .row.total { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-top: 0.25rem; }
.est-totals .row.paid { color: var(--success); }
.est-totals .row.balance { color: var(--danger); }
.est-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.est-grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0.5rem; }
.est-item-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (min-width: 481px) { .est-item-grid { grid-template-columns: 1fr 1fr 0.7fr 1fr; } }
.est-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.5rem; }
.est-actions .spacer { flex: 1; }
.skeleton-row { height: 56px; border-radius: var(--radius); background: var(--bg-input); animation: skeleton-pulse 1.5s ease-in-out infinite; margin-bottom: 0.5rem; }
.skeleton-row:nth-child(2) { animation-delay: 0.15s; }
.skeleton-row:nth-child(3) { animation-delay: 0.3s; }
@keyframes skeleton-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.8; } }
.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.confirm-dialog { max-width: 400px; width: 90%; }
.btn-full { width: 100%; min-height: 48px; font-size: 1rem; }

/* Parts */
.parts-tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1rem; }
.parts-tab { padding: 0.6rem 1.2rem; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -2px; min-height: 44px; }
.parts-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.parts-margin { font-family: var(--font-utility); font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 4px; }
.parts-margin-good { background: rgba(34,197,94,0.15); color: var(--success); }
.parts-margin-low { background: rgba(245,158,11,0.15); color: var(--warning); }
.parts-margin-none { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ---- In-App Navigation (nav-app style, CFCRM UX guide) ---- */
#mapsnav-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: #09090B;
}
.mapsnav-map {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* Step banner: dark premium bg, amber accent */
.mapsnav-step-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  background: rgba(9, 9, 11, 0.92);
  color: #fff;
  min-height: 72px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid #D97706;
}
.mapsnav-banner-arrow {
  min-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #D97706;
  background: rgba(217, 119, 6, 0.12);
  border-radius: 10px;
  flex-shrink: 0;
}
.mapsnav-arrow-svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}
.mapsnav-banner-text { flex: 1; min-width: 0; }
.mapsnav-banner-instruction {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mapsnav-banner-dist {
  font-size: 0.9rem;
  color: #D97706;
  font-weight: 600;
  margin-top: 2px;
}
/* Reroute toast */
.mapsnav-reroute-toast {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  background: #D97706;
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: mapsnav-pulse 1s ease-in-out infinite;
}
@keyframes mapsnav-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
/* ETA bar */
.mapsnav-eta-bar {
  position: absolute;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(217, 119, 6, 0.25);
  color: #fff;
}
.mapsnav-eta-left {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.mapsnav-eta-time {
  font-size: 1.4rem;
  font-weight: 700;
  color: #D97706;
}
.mapsnav-eta-dist {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}
.mapsnav-dest-name {
  flex: 1;
  text-align: right;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50%;
}
/* Bottom button bar */
.mapsnav-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  background: #09090B;
}
.mapsnav-bottom-bar button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.mapsnav-btn-close {
  background: #27272a;
  color: #fff;
}
.mapsnav-btn-close:active { background: #3f3f46; }
.mapsnav-btn-steps {
  background: #27272a;
  color: #fff;
}
.mapsnav-btn-steps:active { background: #3f3f46; }
.mapsnav-btn-recenter {
  background: #D97706;
  color: #fff;
}
.mapsnav-btn-recenter:active { background: #b45309; }
.mapsnav-btn-external {
  background: #27272a;
  color: #fff;
}
.mapsnav-btn-external:active { background: #3f3f46; }
/* Steps drawer */
.mapsnav-steps-drawer {
  position: absolute;
  bottom: calc(56px + 44px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 3;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: #09090B;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.mapsnav-steps-drawer.open {
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mapsnav-steps-list { padding: 0.25rem 0; }
.mapsnav-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem;
  color: #fff;
}
.mapsnav-step-active {
  background: rgba(217, 119, 6, 0.1);
  border-left: 3px solid #D97706;
}
.mapsnav-step-done {
  opacity: 0.4;
}
.mapsnav-step-arrow {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
}
.mapsnav-step-active .mapsnav-step-arrow { color: #D97706; }
.mapsnav-step-arrow .mapsnav-arrow-svg { width: 20px; height: 20px; }
.mapsnav-step-inst { line-height: 1.3; }
.mapsnav-step-dist { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin-top: 2px; }
.mapsnav-no-gps {
  padding: 1.5rem;
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
}
