/* ============================================
   PoolTechPro — Admin Dashboard Styles
   ============================================ */

/* --- Variables (inherits brand from main site) --- */
:root {
  --primary: #0b3d91;
  --primary-dark: #072a66;
  --primary-light: #1a5ec4;
  --accent: #00b4d8;
  --accent-dark: #0096b7;
  --white: #ffffff;
  --off-white: #f4f7fa;
  --light-gray: #e8ecf1;
  --gray: #6b7280;
  --dark: #1a1a2e;
  --text: #333333;
  --text-light: #555555;
  --sidebar-bg: #0a1628;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(0, 180, 216, 0.15);
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --transition: 0.25s ease;

  --border: #e0e4ea;
  --light-bg: #f0f3f8;
  --text-secondary: #6b7280;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
  --primary: #3b7ddb;
  --primary-dark: #2563a8;
  --primary-light: #5b9af0;
  --accent: #22d3ee;
  --accent-dark: #06b6d4;
  --white: #1e1e2e;
  --off-white: #161622;
  --light-gray: #2e2e44;
  --gray: #9ca3af;
  --dark: #e8eaf0;
  --text: #d4d4dc;
  --text-light: #a0a0b0;
  --sidebar-bg: #0e0e1a;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(34, 211, 238, 0.12);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);

  --border: #3a3a52;
  --light-bg: #252538;
  --text-secondary: #9ca3af;

  --success: #34d399;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #60a5fa;
  --info-bg: rgba(59, 130, 246, 0.12);

  color-scheme: dark;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background: var(--off-white);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

/* ============================================
   LOGIN SCREEN
   ============================================ */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  background: var(--primary-dark);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  margin: 0 auto 1.5rem;
  max-width: 220px;
}

.login-card h1 {
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--gray);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.form-group {
  text-align: left;
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
  background: var(--white);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
}

.btn-login {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}

.btn-login:hover {
  background: var(--accent-dark);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.forgot-password-link {
  margin-top: 1rem;
  font-size: 0.85rem;
  text-align: center;
}

.forgot-password-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.forgot-password-link a:hover {
  text-decoration: underline;
}

.form-success {
  background: #d4edda;
  color: #155724;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  text-align: left;
}

/* ============================================
   ADMIN SHELL LAYOUT
   ============================================ */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 1.25rem 1.25rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  max-width: 160px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
}

.sidebar-close:hover {
  color: var(--white);
}

/* --- Navigation --- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.sidebar-nav ul {
  padding: 0 0.75rem;
}

.sidebar-nav li {
  margin-bottom: 2px;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.5rem 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--accent);
}

.nav-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Main Wrapper --- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Bar --- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--light-gray);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 500;
}

.topbar-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.topbar-menu-btn span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dark);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- User Dropdown --- */
.topbar-user {
  position: relative;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.user-avatar:hover {
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.3);
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  border: 1px solid var(--light-gray);
  z-index: 600;
}

.user-dropdown.open {
  display: block;
}

.user-info {
  padding: 0.75rem 1rem;
}

.user-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--dark);
}

.user-info small {
  color: var(--gray);
  font-size: 0.8rem;
  text-transform: capitalize;
}

.user-dropdown hr {
  border: none;
  border-top: 1px solid var(--light-gray);
}

.dropdown-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--danger);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.dropdown-btn:hover {
  background: var(--danger-bg);
}

/* --- Content Area --- */
.content {
  flex: 1;
  padding: 1.5rem;
}

/* ============================================
   DASHBOARD WIDGETS
   ============================================ */

/* Widget Grid */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Stat Card */
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.cyan { background: rgba(0, 180, 216, 0.12); color: var(--accent); }

.stat-details {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

.stat-sub.positive { color: var(--success); }
.stat-sub.negative { color: var(--danger); }

/* --- Detail Panels Grid --- */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--light-gray);
}

.panel-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
}

.panel-badge {
  background: var(--info-bg);
  color: var(--info);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
}

.panel-badge.warning { background: var(--warning-bg); color: var(--warning); }
.panel-badge.danger { background: var(--danger-bg); color: var(--danger); }
.panel-badge.success { background: var(--success-bg); color: var(--success); }

.panel-body {
  padding: 1rem 1.25rem;
}

.panel-empty {
  padding: 2rem;
  text-align: center;
  color: var(--gray);
  font-size: 0.9rem;
}

/* Appointment List */
.appt-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.appt-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--off-white);
}

.appt-item:last-child {
  border-bottom: none;
}

.appt-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 60px;
}

.appt-info {
  flex: 1;
  min-width: 0;
}

.appt-customer {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
}

.appt-type {
  font-size: 0.78rem;
  color: var(--gray);
}

.appt-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  text-transform: capitalize;
  flex-shrink: 0;
}

.appt-status.scheduled { background: var(--info-bg); color: var(--info); }
.appt-status.in_progress { background: var(--warning-bg); color: var(--warning); }
.appt-status.completed { background: var(--success-bg); color: var(--success); }
.appt-status.cancelled { background: var(--light-gray); color: var(--gray); }
.appt-status.no_show { background: var(--danger-bg); color: var(--danger); }

/* Week schedule mini */
.week-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
}

.week-bar-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray);
  min-width: 80px;
}

.week-bar-track {
  flex: 1;
  height: 8px;
  background: var(--off-white);
  border-radius: 4px;
  overflow: hidden;
}

.week-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.week-bar-fill.completed { background: var(--success); }
.week-bar-fill.scheduled { background: var(--info); }
.week-bar-fill.total { background: var(--accent); }

.week-bar-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dark);
  min-width: 24px;
  text-align: right;
}

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: var(--white);
  border: 1.5px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.quick-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.quick-action-icon {
  font-size: 1.1rem;
}

/* Placeholder page */
.placeholder-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.placeholder-page h2 {
  font-size: 1.3rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.placeholder-page p {
  color: var(--gray);
  max-width: 400px;
}

/* Loading state */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--light-gray);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton Loading */
.skeleton-container {
  padding: 1.5rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--light-gray) 25%, #f0f3f7 50%, var(--light-gray) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
  width: 100%;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 85%; }

.skeleton-title {
  height: 22px;
  width: 50%;
  margin-bottom: 16px;
}

.skeleton-widget {
  height: 100px;
  border-radius: var(--radius);
}

.skeleton-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 100px;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--light-gray);
}

.skeleton-table-row .skeleton-text {
  margin-bottom: 0;
}

.skeleton-widget-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1100px) {
  .skeleton-widget-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .skeleton-widget-grid { grid-template-columns: 1fr; }
  .skeleton-table-row { grid-template-columns: 1fr 1fr; }
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1100px) {
  .widget-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .panels-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .topbar-menu-btn {
    display: flex;
  }

  .widget-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .sidebar-overlay.active {
    display: block;
  }
}

@media (max-width: 480px) {
  .widget-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }
}

/* ============================================
   Phase 4: Page & Content Management Styles
   ============================================ */

/* ── Pages List ── */
.pages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.pages-header h2 {
  font-size: 1.5rem;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--light-gray);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--gray);
  color: var(--white);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #dc2626;
}

/* ── Data Table ── */
.pages-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--light-gray);
  font-size: 0.9rem;
}

.data-table th {
  background: var(--off-white);
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}

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

.data-table tr:hover {
  background: var(--off-white);
}

.td-title {
  font-weight: 600;
  color: var(--primary);
}

.td-slug code {
  background: var(--off-white);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--gray);
}

.td-actions {
  white-space: nowrap;
}

.table-empty {
  text-align: center;
  color: var(--gray);
  padding: 40px 16px !important;
}

/* ── Status Badges ── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.published {
  background: var(--success-bg);
  color: var(--success);
}

.status-badge.draft {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-badge.estimate {
  background: #e8daef;
  color: #6c3483;
}

/* ── Icon Buttons ── */
.btn-icon {
  background: none;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
  color: var(--text-light);
}

.btn-icon:hover {
  background: var(--off-white);
  border-color: var(--gray);
}

.btn-icon.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Multi-select / Bulk Actions ── */
.th-checkbox,
.td-checkbox {
  width: 40px;
  text-align: center;
  padding-left: 12px !important;
  padding-right: 4px !important;
}

.th-checkbox input,
.td-checkbox input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.data-table tr.row-selected {
  background: rgba(0, 86, 179, 0.06);
}

.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 12px;
  animation: slideDown .2s ease;
}

.bulk-actions-bar .bulk-count {
  font-weight: 600;
  font-size: 0.9rem;
  margin-right: auto;
}

.bulk-actions-bar .btn {
  border: 1px solid rgba(255,255,255,0.3);
}

.bulk-actions-bar .btn-danger {
  background: var(--danger);
  color: #fff;
}

.bulk-actions-bar .btn-secondary {
  background: transparent;
  color: #fff;
}

.bulk-actions-bar .btn-secondary:hover {
  background: rgba(255,255,255,0.15);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Page Editor
   ============================================ */
.page-editor {
  max-width: 1200px;
}

.page-editor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-editor-header h2 {
  flex: 1;
  font-size: 1.4rem;
  color: var(--text);
}

.editor-actions {
  display: flex;
  gap: 8px;
}

/* ── Two-column layout ── */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

.editor-main {
  min-width: 0;
}

.editor-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

/* ── Form fields ── */
.editor-field {
  margin-bottom: 16px;
}

.editor-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  transition: var(--transition);
  background: var(--white);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.12);
}

textarea.form-input {
  resize: vertical;
}

.form-select {
  padding: 8px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
}

.form-control {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  transition: border-color var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.12);
}

textarea.form-control {
  resize: vertical;
}

select.form-control {
  cursor: pointer;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: 4px;
}

/* ── Slug field ── */
.slug-input-wrap {
  display: flex;
  align-items: center;
}

.slug-prefix {
  background: var(--off-white);
  border: 1px solid var(--light-gray);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--gray);
}

.slug-input-wrap .form-input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Sidebar panels ── */
.sidebar-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.sidebar-panel h4 {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--light-gray);
}

/* ── Status toggle ── */
.status-toggle {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--light-gray);
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.toggle-label input:checked + .toggle-switch {
  background: var(--success);
}

.toggle-label input:checked + .toggle-switch::after {
  left: 23px;
}

.toggle-text {
  font-weight: 600;
}

/* ============================================
   Content Sections Editor
   ============================================ */
.editor-sections {
  margin-top: 24px;
}

.sections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.sections-header h3 {
  font-size: 1.1rem;
  color: var(--text);
}

.add-section-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sections-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
  border: 2px dashed var(--light-gray);
  border-radius: var(--radius);
}

/* ── Section Block ── */
.section-block {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.section-block-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--off-white);
  border-bottom: 1px solid var(--light-gray);
}

.section-drag-handle {
  cursor: grab;
  color: var(--gray);
  font-size: 1.1rem;
}

.section-type-label {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.section-block-actions {
  display: flex;
  gap: 4px;
}

.section-block-actions .btn-icon {
  padding: 4px 6px;
  font-size: 0.85rem;
}

.section-block-body {
  padding: 20px;
}

/* ── CTA button rows ── */
.cta-button-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.cta-button-row .form-input {
  flex: 1;
}

/* ── Card edit rows ── */
.card-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.card-edit-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  gap: 8px;
}

.card-edit-fields input:nth-child(4) {
  grid-column: 1 / -1;
}

/* ── Accordion edit rows ── */
.accordion-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.accordion-edit-fields {
  flex: 1;
}

.accordion-edit-fields .form-input {
  margin-bottom: 8px;
}

/* ── Quill Overrides ── */
.quill-container {
  background: var(--white);
  border-radius: var(--radius-sm);
}

.quill-container .ql-toolbar {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-color: var(--light-gray);
}

.quill-container .ql-container {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-color: var(--light-gray);
  min-height: 160px;
  font-family: inherit;
  font-size: 0.95rem;
}

.quill-sm .ql-container {
  min-height: 80px;
}

/* ============================================
   Revisions Panel
   ============================================ */
.revisions-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.revisions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.revisions-header h3 {
  font-size: 1.2rem;
}

.revision-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--light-gray);
  gap: 16px;
}

.revision-item:last-child {
  border-bottom: none;
}

.revision-info strong {
  display: block;
  margin-bottom: 4px;
}

.revision-meta {
  font-size: 0.82rem;
  color: var(--gray);
}

.text-muted {
  color: var(--gray);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  max-width: 400px;
}

.toast-success { background: var(--success); }
.toast-danger, .toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #000; }
.toast-info { background: var(--info); }

.toast-hide {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   Responsive: Page Editor
   ============================================ */
@media (max-width: 1100px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .page-editor-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .card-edit-fields {
    grid-template-columns: 1fr;
  }

  .cta-button-row {
    flex-direction: column;
  }

  .sections-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================
   SERVICES MODULE
   ============================================ */

.services-hint {
  color: var(--gray);
  font-size: 0.85rem;
  margin: -8px 0 16px;
}

/* Drag & drop rows */
.service-row {
  cursor: grab;
  transition: background var(--transition), opacity var(--transition);
}

.service-row:active {
  cursor: grabbing;
}

.service-row.dragging {
  opacity: 0.4;
  background: var(--info-bg);
}

.service-row.drag-over {
  border-top: 3px solid var(--accent);
}

.td-drag-handle {
  cursor: grab;
  color: var(--gray);
  font-size: 1.1rem;
  text-align: center;
  user-select: none;
}

.td-order {
  text-align: center;
  color: var(--gray);
  font-size: 0.85rem;
  min-width: 50px;
}

/* Visibility toggle button */
.btn-visibility {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-visibility.is-visible {
  color: var(--success);
  border-color: var(--success);
  background: var(--success-bg);
}

.btn-visibility.is-hidden {
  color: var(--gray);
  border-color: var(--light-gray);
  background: var(--off-white);
}

.btn-visibility:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Service editor field row (side by side) */
.editor-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .editor-field-row {
    grid-template-columns: 1fr;
  }
}

/* Sidebar hint text */
.sidebar-hint {
  display: block;
  margin-top: 8px;
  color: var(--gray);
  font-size: 0.8rem;
  line-height: 1.4;
}

/* ============================================
   MEDIA LIBRARY MODULE
   ============================================ */

/* Drop Zone */
.media-dropzone {
  border: 2px dashed var(--light-gray);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  margin-bottom: 24px;
  transition: all var(--transition);
  background: var(--white);
  position: relative;
}

.media-dropzone.drag-active {
  border-color: var(--accent);
  background: var(--info-bg);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

.dropzone-text {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.dropzone-browse {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}

.dropzone-browse:hover {
  color: var(--accent-dark);
}

.dropzone-hint {
  font-size: 0.8rem;
  color: var(--gray);
}

.dropzone-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
}

.dropzone-progress .spinner {
  width: 24px;
  height: 24px;
}

/* Media Toolbar */
.media-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.media-search {
  flex: 1;
  min-width: 200px;
}

.media-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

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

.media-filters select {
  padding: 10px 14px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  cursor: pointer;
}

.media-count {
  color: var(--gray);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.media-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.media-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.media-card-thumb {
  width: 100%;
  height: 140px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--off-white);
}

.media-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card-info {
  padding: 10px 12px;
}

.media-card-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-meta {
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: 2px;
}

/* Media Detail Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--light-gray);
}

.modal-header h3 {
  font-size: 1.1rem;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--off-white);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.media-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.media-detail-preview {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 250px;
}

.media-detail-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 4px;
}

.media-detail-form .form-group {
  margin-bottom: 16px;
}

.media-detail-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.media-detail-form input,
.media-detail-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.media-detail-form input:focus,
.media-detail-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.media-url-row {
  display: flex;
  gap: 8px;
}

.media-url-input {
  flex: 1;
  background: var(--off-white) !important;
  color: var(--gray);
  font-size: 0.8rem !important;
}

.media-detail-meta {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  line-height: 1.8;
}

.media-detail-meta div {
  color: var(--text-light);
}

.media-detail-meta strong {
  color: var(--text);
}

.media-detail-actions {
  display: flex;
  gap: 12px;
}

/* Media Input Row (Browse button next to image URL fields) */
.media-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.media-input-row input {
  flex: 1;
}

.media-input-row .btn-browse-media {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Media Picker Modal */
.media-picker-modal-content {
  max-width: 800px;
}

.media-picker-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.media-picker-search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
}

.media-picker-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.media-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.media-picker-item {
  background: var(--white);
  border: 2px solid var(--light-gray);
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition);
}

.media-picker-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.media-picker-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
}

.media-picker-item-name {
  padding: 6px 8px;
  font-size: 0.75rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive: Media */
@media (max-width: 768px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .media-detail-layout {
    grid-template-columns: 1fr;
  }

  .media-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .media-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ═══════════════════════════════════════════
   Contact Submissions Module
   ═══════════════════════════════════════════ */

.submission-count {
  font-weight: 400;
  color: var(--gray);
  font-size: 1rem;
}

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

.contact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.contact-filters {
  display: flex;
  gap: 4px;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--light-gray);
  border-radius: 20px;
  background: var(--white);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.contact-search input {
  padding: 7px 14px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  min-width: 220px;
  font-family: inherit;
}

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

.contact-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #eef2ff;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--primary);
}

.th-check {
  width: 36px;
}

.submission-unread {
  background: #f0f7ff;
}

.submission-unread td {
  font-weight: 600;
}

/* Status badge variants for contact */
.status-badge.unread {
  background: var(--info-bg);
  color: var(--info);
}

.status-badge.read {
  background: var(--off-white);
  color: var(--gray);
}

.status-badge.replied {
  background: var(--success-bg);
  color: var(--success);
}

.status-badge.archived {
  background: var(--off-white);
  color: var(--gray);
}

/* Sortable columns */
.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--primary);
}

/* ── Submission Detail View ── */
.submission-detail {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 800px;
}

.submission-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--light-gray);
}

.submission-detail-header h3 {
  font-size: 1.25rem;
  color: var(--text);
  margin: 0;
}

.submission-meta {
  margin-bottom: 1.5rem;
}

.meta-row {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.meta-row strong {
  display: inline-block;
  min-width: 60px;
  color: var(--text);
}

.meta-row a {
  color: var(--primary);
  text-decoration: none;
}

.meta-row a:hover {
  text-decoration: underline;
}

.submission-message {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

.submission-notes {
  margin-bottom: 1.5rem;
}

.submission-notes h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.submission-notes textarea {
  width: 100%;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}

.submission-notes textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.submission-quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-status-select {
  padding: 6px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.detail-status-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Responsive: Contact */
@media (max-width: 768px) {
  .contact-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-filters {
    flex-wrap: wrap;
  }

  .contact-search input {
    min-width: unset;
    width: 100%;
  }

  .submission-detail {
    padding: 1.25rem;
  }

  .submission-quick-actions {
    flex-direction: column;
  }
}

/* ============================================
   SITE SETTINGS MODULE
   ============================================ */

.settings-page {
  max-width: 960px;
}

.settings-header-actions {
  display: flex;
  gap: 10px;
}

/* Tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 6px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.settings-tab {
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.settings-tab:hover {
  background: var(--off-white);
  color: var(--text);
}

.settings-tab.active {
  background: var(--primary);
  color: var(--white);
}

.tab-icon {
  margin-right: 4px;
}

/* Toast */
.settings-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--success);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
}

.settings-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Cards */
.settings-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.settings-card h3 {
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.settings-hint {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 1rem;
}

/* Form Grid */
.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
}

.settings-field.full-width {
  grid-column: 1 / -1;
}

.settings-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.settings-field input[type="text"],
.settings-field input[type="tel"],
.settings-field input[type="email"],
.settings-field input[type="url"],
.settings-field input[type="number"],
.settings-field textarea,
.settings-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
}

.settings-field input:focus,
.settings-field textarea:focus,
.settings-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 61, 145, 0.1);
}

.settings-field textarea {
  resize: vertical;
}

.settings-field-hint {
  font-size: 0.78rem;
  color: var(--gray);
  margin-top: 4px;
}

.code-textarea {
  font-family: 'Courier New', monospace !important;
  font-size: 0.82rem !important;
  line-height: 1.4;
}

/* Color Picker */
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-input-wrap input[type="color"] {
  width: 48px;
  height: 40px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  padding: 2px;
  cursor: pointer;
  background: none;
}

.color-hex-input {
  width: 100px !important;
  font-family: monospace;
  font-size: 0.9rem;
}

/* Upload Areas (Logo/Favicon) */
.settings-upload-area {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.settings-upload-preview {
  width: 200px;
  height: 100px;
  border: 2px dashed var(--light-gray);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--off-white);
  overflow: hidden;
}

.settings-upload-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.settings-upload-preview.favicon-preview {
  width: 80px;
  height: 80px;
}

.upload-placeholder {
  font-size: 0.82rem;
  color: var(--gray);
  text-align: center;
  padding: 10px;
}

.settings-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Navigation Links List */
.nav-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--light-gray);
  transition: var(--transition);
}

.nav-link-row.dragging {
  opacity: 0.5;
}

.nav-link-row.drag-over {
  border-color: var(--primary);
  background: var(--info-bg);
}

.nav-link-drag-handle {
  cursor: grab;
  color: var(--gray);
  font-size: 1.1rem;
  user-select: none;
  padding: 0 4px;
}

.nav-link-label,
.nav-link-url {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.nav-link-label:focus,
.nav-link-url:focus {
  outline: none;
  border-color: var(--primary);
}

.nav-link-newtab-label {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.nav-link-remove {
  flex-shrink: 0;
}

/* Business Hours Grid */
.business-hours-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hours-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.hours-day {
  width: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.hours-open,
.hours-close {
  padding: 7px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  width: 130px;
}

.hours-open:focus,
.hours-close:focus {
  outline: none;
  border-color: var(--primary);
}

.hours-open:disabled,
.hours-close:disabled {
  background: var(--off-white);
  color: var(--gray);
}

.hours-separator {
  font-size: 0.85rem;
  color: var(--gray);
}

.hours-closed-label {
  font-size: 0.82rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* Responsive: Settings */
@media (max-width: 768px) {
  .settings-tabs {
    gap: 2px;
    padding: 4px;
  }

  .settings-tab {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-upload-area {
    flex-direction: column;
    align-items: flex-start;
  }

  .hours-row {
    flex-wrap: wrap;
  }

  .hours-day {
    width: 100%;
  }

  .nav-link-row {
    flex-wrap: wrap;
  }

  .nav-link-label,
  .nav-link-url {
    flex: 1 1 100%;
  }
}

/* ============================================
   CUSTOMERS CRM MODULE
   ============================================ */

/* Customer Detail */
.customer-detail {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.customer-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--light-gray);
}

.customer-detail-header h2 {
  font-size: 1.5rem;
  margin: 0;
}

.customer-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Customer Quick Actions */
.customer-quick-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--off-white);
  border-bottom: 1px solid var(--light-gray);
  flex-wrap: wrap;
}

/* Customer Tabs */
.customer-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--light-gray);
  padding: 0 1rem;
  overflow-x: auto;
}

.customer-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition);
}

.customer-tab:hover {
  color: var(--primary);
}

.customer-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.customer-tab-content {
  padding: 1.5rem 2rem;
}

/* Info Grid */
.customer-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.info-card {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

.info-card.full {
  grid-column: 1 / -1;
}

.info-card h4 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--light-gray);
  padding-bottom: 0.5rem;
}

.info-row {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.info-row strong {
  color: var(--text-light);
  min-width: 100px;
  display: inline-block;
}

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

.equipment-list {
  list-style: disc;
  padding-left: 1.25rem;
}

.equipment-list li {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

/* Customer Form */
.customer-form {
  max-width: 900px;
}

.form-section {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-section legend {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0 0.5rem;
}

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

.form-grid .full-width {
  grid-column: 1 / -1;
}

.customer-form .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 4px;
}

.customer-form .form-group input,
.customer-form .form-group select,
.customer-form .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}

.customer-form .form-group input:focus,
.customer-form .form-group select:focus,
.customer-form .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 61, 145, 0.1);
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500 !important;
}

.checkbox-label input[type="checkbox"] {
  width: auto !important;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 0;
}

/* Customer Notes */
.customer-notes-section {
  max-width: 800px;
}

.note-composer {
  background: var(--off-white);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.note-type-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 0.75rem;
}

.note-type-btn {
  padding: 6px 14px;
  border: 1px solid var(--light-gray);
  border-radius: 20px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--transition);
}

.note-type-btn:hover {
  border-color: var(--primary);
}

.note-type-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.note-composer textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 0.5rem;
}

.note-composer textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Notes Timeline */
.notes-timeline {
  position: relative;
}

.note-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--light-gray);
}

.note-item:last-child {
  border-bottom: none;
}

.note-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--info-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.note-item.call .note-icon { background: var(--success-bg); }
.note-item.email .note-icon { background: var(--warning-bg); }
.note-item.status_change .note-icon { background: var(--danger-bg); }
.note-item.system .note-icon { background: var(--light-gray); }

.note-body {
  flex: 1;
  min-width: 0;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.note-meta strong {
  color: var(--text);
}

.note-type-label {
  background: var(--light-gray);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  text-transform: capitalize;
}

.note-date {
  color: var(--gray);
}

.note-content {
  font-size: 0.9rem;
  line-height: 1.5;
}

.note-delete {
  margin-left: auto;
}

/* Customer empty tab */
.customer-empty-tab {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray);
}

.customer-appt-sections h4 {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.td-small {
  font-size: 0.82rem;
}

.text-muted {
  color: var(--gray);
  font-size: 0.9rem;
}

/* Status badge additions */
.status-badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Responsive: Customers */
@media (max-width: 768px) {
  .customer-detail-header {
    padding: 1rem;
  }

  .customer-quick-actions {
    padding: 0.5rem 1rem;
  }

  .customer-tab-content {
    padding: 1rem;
  }

  .customer-info-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .customer-tabs {
    padding: 0;
  }

  .customer-tab {
    padding: 10px 14px;
    font-size: 0.82rem;
  }

  .note-type-btns {
    flex-wrap: wrap;
  }
}

/* ════════════════════════════════════════════
   Service Plans & Subscriptions Module
   ════════════════════════════════════════════ */

.sp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stat-card-clickable {
  cursor: pointer;
  position: relative;
}

.stat-card-clickable::after {
  content: '→';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 600;
  transition: opacity var(--transition);
}

.stat-card-clickable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}

.stat-card-clickable:hover::after {
  opacity: 1;
}

.sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.sp-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sp-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(11, 61, 145, 0.1);
}

.sp-card.archived {
  opacity: 0.65;
  border-style: dashed;
}

.sp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.sp-card-header h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary);
}

.sp-card-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sp-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}

.sp-badge.freq {
  background: var(--info-bg);
  color: var(--info);
}

.sp-badge.seasonal {
  background: var(--warning-bg);
  color: var(--warning);
}

.sp-card-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.sp-card-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: #888;
}

.sp-card-desc {
  font-size: 0.88rem;
  color: #555;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.sp-card-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.sp-task-tag {
  font-size: 0.75rem;
  background: var(--success-bg);
  color: var(--success);
  padding: 2px 8px;
  border-radius: 8px;
}

.sp-task-more {
  font-size: 0.75rem;
  color: #888;
  padding: 2px 6px;
}

.sp-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #666;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
}

.sp-task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sp-task-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.sp-task-list li:last-child {
  border-bottom: none;
}

/* Task editor in plan form */
.sp-tasks-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sp-task-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8f9fa;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.sp-task-drag {
  cursor: grab;
  color: #aaa;
  font-size: 1.1rem;
  user-select: none;
}

.sp-task-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  padding: 0.3rem;
  outline: none;
}

.sp-task-input:focus {
  background: #fff;
  border-radius: 4px;
}

.sp-task-remove {
  color: var(--danger);
  font-size: 0.85rem;
}

.sp-task-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.sp-task-add-row input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Button styles for subscription actions */
.btn-warning {
  background: var(--warning);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-warning:hover {
  opacity: 0.85;
}

.btn-success {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-success:hover {
  opacity: 0.85;
}

@media (max-width: 768px) {
  .sp-grid {
    grid-template-columns: 1fr;
  }

  .sp-stats {
    grid-template-columns: 1fr;
  }

  .sp-task-add-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ════════════════════════════════════════════
   Scheduling Module
   ════════════════════════════════════════════ */

.sched-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  background: var(--white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.sched-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sched-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-left: 0.5rem;
}

.sched-views {
  display: flex;
  gap: 2px;
  background: var(--bg-dark);
  border-radius: 6px;
  padding: 2px;
}

.sched-views .btn {
  border-radius: 4px;
  font-size: 0.8rem;
  padding: 4px 12px;
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.sched-views .btn.active {
  background: var(--primary);
  color: #fff;
}

.sched-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.sched-filter select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}

/* Calendar Grid */
.cal-grid {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 2px solid var(--border);
}

.cal-header-cell {
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cal-header-cell.today {
  color: var(--primary);
}

.cal-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.sched-day-cell {
  min-height: 100px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  cursor: pointer;
  transition: background 0.15s;
  overflow: hidden;
}

.sched-day-cell:hover {
  background: #f0f4ff;
}

.sched-day-cell:nth-child(7n) {
  border-right: none;
}

.sched-day-cell.today {
  background: #e8f0fe;
}

.sched-day-cell.outside {
  background: #fafbfc;
}

.sched-day-cell.outside .cal-day-num {
  color: #bbb;
}

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.sched-day-cell.today .cal-day-num {
  color: #fff;
  background: var(--primary);
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
}

/* Appointment chips */
.sched-appt {
  font-size: 0.72rem;
  padding: 2px 4px;
  margin-bottom: 2px;
  background: #f0f4ff;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s;
}

.sched-appt:hover {
  background: #dce6f8;
}

.sched-appt.completed {
  background: #e8f5e9;
  text-decoration: line-through;
  opacity: 0.7;
}

.sched-appt.cancelled {
  background: #fafafa;
  text-decoration: line-through;
  opacity: 0.5;
}

/* ── Customer Picker (scheduling form) ── */
.customer-picker {
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  background: var(--white);
  overflow: hidden;
}
.customer-picker-search {
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--light-gray);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
.customer-picker-search:focus {
  border-bottom-color: var(--accent);
}
.customer-picker-list {
  max-height: 200px;
  overflow-y: auto;
}
.customer-picker-item {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background var(--transition);
}
.customer-picker-item:last-child {
  border-bottom: none;
}
.customer-picker-item:hover {
  background: #f0f7ff;
}
.customer-picker-item.selected {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.customer-picker-empty {
  padding: 12px;
  text-align: center;
  color: var(--gray);
  font-size: 0.85rem;
}

/* ── Appointment Form ── */
.appt-form-container {
  max-width: 720px;
}

.appt-form-container form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.appt-form-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.appt-form-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--light-gray);
}

.appt-form-container .form-group {
  margin-bottom: 0.85rem;
}

.appt-form-container .form-group:last-child {
  margin-bottom: 0;
}

.appt-form-container .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.appt-form-container .form-group label .required {
  color: var(--danger);
}

.appt-form-container .form-input,
.appt-form-container select.form-input,
.appt-form-container textarea.form-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.appt-form-container .form-input:focus,
.appt-form-container select.form-input:focus,
.appt-form-container textarea.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.12);
}

.appt-form-container textarea.form-input {
  resize: vertical;
}

.appt-form-container .form-row {
  display: flex;
  gap: 1rem;
}

.appt-form-container .form-row > .form-group {
  flex: 1;
}

.appt-form-container .form-row-3 > .form-group {
  flex: 1;
}

.appt-rate-fields {
  margin-bottom: 0.85rem;
}

.appt-quantity-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.appt-quantity-input {
  width: 140px !important;
  flex: none !important;
}

.appt-unit-hint {
  color: var(--gray);
  font-size: 0.85rem;
  white-space: nowrap;
}

.appt-cost-display {
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.75rem;
  background: var(--info-bg);
  border: 1px solid var(--info);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
}

.appt-recurring-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.appt-recurring-row .checkbox-label {
  font-size: 0.9rem;
  margin: 0;
  white-space: nowrap;
}

.appt-recurring-row .checkbox-label input[type="checkbox"] {
  width: auto;
}

.appt-recurrence-select {
  min-width: 160px;
  margin-bottom: 0 !important;
}

.gcal-busy-panel {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #e88d1a;
  border-radius: var(--radius-sm);
  background: #fff8f0;
}

.gcal-busy-title {
  color: #e88d1a;
}

.gcal-busy-list {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.appt-form-container .form-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

@media (max-width: 768px) {
  .appt-form-container .form-row {
    flex-direction: column;
    gap: 0;
  }

  .appt-recurring-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .appt-recurrence-select {
    width: 100%;
  }
}

.sched-appt.in-progress {
  background: #fff3e0;
}

.appt-time {
  font-weight: 600;
  color: var(--text-dark);
}

.appt-name {
  color: var(--text-muted);
}

.cal-more {
  font-size: 0.7rem;
  color: var(--primary);
  cursor: pointer;
  padding: 1px 4px;
}

/* Week view */
.cal-week .sched-day-cell.week-cell {
  min-height: 300px;
}

.sched-appt.week-appt {
  padding: 6px 8px;
  margin-bottom: 4px;
  font-size: 0.78rem;
  white-space: normal;
}

.sched-appt.week-appt .appt-time {
  display: block;
  font-size: 0.72rem;
}

.sched-appt.week-appt .appt-service {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sched-appt.week-appt .appt-tech {
  font-size: 0.68rem;
  color: var(--accent);
}

/* Day view */
.cal-day-view h3 {
  margin-bottom: 0.5rem;
}

.day-summary {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.day-tech-group {
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}

.day-tech-header {
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.day-tech-appts {
  padding: 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.sched-appt.day-appt {
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  white-space: normal;
}

.day-appt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.appt-time-lg {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.day-appt-body {
  font-size: 0.8rem;
}

.day-appt-body .text-muted {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Google Calendar Personal Events */
.gcal-event {
  padding: 2px 4px;
  font-size: 0.72rem;
  border-left: 3px dashed #9b59b6;
  background: rgba(155, 89, 182, 0.08);
  border-radius: 2px;
  margin-bottom: 1px;
  cursor: default;
  font-style: italic;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gcal-event .gcal-badge {
  display: inline-block;
  font-size: 0.6rem;
  background: rgba(155, 89, 182, 0.2);
  color: #7d3c98;
  padding: 0 3px;
  border-radius: 2px;
  margin-right: 3px;
  font-style: normal;
  vertical-align: middle;
}

.gcal-event.week-appt {
  padding: 4px 6px;
  font-size: 0.75rem;
  white-space: normal;
}

.gcal-event.week-appt .gcal-time {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7d3c98;
  font-style: normal;
}

.gcal-event.week-appt .gcal-summary {
  font-size: 0.72rem;
}

.gcal-event.day-appt {
  padding: 0.5rem 0.75rem;
  background: rgba(155, 89, 182, 0.06);
  border: 1px dashed rgba(155, 89, 182, 0.3);
  border-left: 3px dashed #9b59b6;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  white-space: normal;
}

.gcal-event.day-appt .day-appt-header {
  margin-bottom: 0;
}

.gcal-event.day-appt .appt-time-lg {
  color: #7d3c98;
  font-size: 0.9rem;
}

.gcal-event.allday {
  border-left-style: solid;
  background: rgba(155, 89, 182, 0.12);
}

.gcal-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gcal-toggle-wrap label {
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.gcal-toggle-wrap input[type="checkbox"] {
  accent-color: #9b59b6;
}

/* Popover */
.appt-popover {
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  min-width: 280px;
  max-width: 360px;
  border: 1px solid var(--border);
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.appt-pop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.appt-pop-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
}

.appt-pop-body {
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.appt-pop-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.appt-status-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-card h3 {
  margin-bottom: 0.75rem;
}

.modal-card .form-actions {
  margin-top: 1rem;
}

.auto-result-box {
  background: #e8f5e9;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

/* Status badges */
.badge-active, .badge-scheduled {
  background: #3498db;
  color: #fff;
}

.badge-inactive {
  background: #95a5a6;
  color: #fff;
}

.badge-seasonal_hold {
  background: #f39c12;
  color: #fff;
}

/* Form rows */
.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .sched-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .sched-nav, .sched-views {
    justify-content: center;
  }

  .cal-header-cell {
    font-size: 0.65rem;
    padding: 0.3rem;
  }

  .sched-day-cell {
    min-height: 60px;
    font-size: 0.7rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .cal-week .sched-day-cell.week-cell {
    min-height: 150px;
  }
}

/* ════════════════════════════════════════════
   Phase 12: Service Visits Styles (Modern)
   ════════════════════════════════════════════ */

/* Service Visit Form Container */
.sv-form-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 920px;
}

.sv-form-container .panel {
  padding: 1.25rem 1.5rem;
}

.sv-form-container .panel h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--light-gray);
  letter-spacing: 0.01em;
}

/* Customer Info Banner */
.sv-info-banner {
  background: var(--off-white);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
}

.sv-banner-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text);
}

.sv-banner-note {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--warning);
  font-weight: 500;
}

/* ── Task Checklist ── */
.sv-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sv-check-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  color: var(--text);
}

.sv-check-item:hover {
  background: var(--off-white);
}

.sv-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  border-radius: 4px;
  flex-shrink: 0;
}

.sv-check-item input[type="checkbox"]:checked + span {
  text-decoration: line-through;
  opacity: 0.55;
}

/* Task list (detail view) */
.sv-task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sv-task-list li {
  padding: 0.5rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.sv-task-list li:nth-child(even) {
  background: var(--off-white);
}

.sv-task-list li.completed .sv-task-check {
  color: var(--success);
}

.sv-task-list li.incomplete .sv-task-check {
  color: var(--danger);
}

.sv-task-check {
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Chemical Reading Cards ── */
.chem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.chem-card {
  padding: 0.85rem 0.75rem;
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid var(--light-gray);
  background: var(--white);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chem-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.chem-card.chem-ok {
  border-color: var(--success);
  background: var(--success-bg);
}

.chem-card.chem-low,
.chem-card.chem-high {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.chem-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.chem-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
}

.chem-range {
  font-size: 0.7rem;
  color: var(--gray);
  margin-top: 0.2rem;
}

/* Chemical Form Grid */
.sv-chem-form {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.sv-chem-form .form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
}

/* Section sub-headings inside chemical form */
.sv-form-container .panel h5 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding-bottom: 0.3rem;
}

/* Chemicals Used / Issue Rows */
.sv-chem-row,
.sv-issue-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.6rem;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--light-gray);
}

.sv-chem-row .form-control,
.sv-issue-row .form-control {
  flex: 1;
  min-width: 120px;
}

/* ── Equipment Issues (detail view) ── */
.sv-issue {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--warning);
  background: var(--warning-bg);
  margin-bottom: 0.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}

.sv-issue-high {
  border-color: #fd7e14;
  background: var(--warning-bg);
}

.sv-issue-critical {
  border-color: var(--danger);
  background: var(--danger-bg);
}

/* ── Photo Gallery ── */
.sv-photos {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sv-photo-thumb {
  width: 120px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--light-gray);
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sv-photo-thumb:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

.sv-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Actions Row */
.sv-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem 0 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  border-top: 1px solid var(--light-gray);
  margin-top: 0.25rem;
}

/* Inventory Usage Row */
.sv-inv-row {
  padding: 0.4rem 0.65rem;
  background: var(--off-white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text);
}

/* Low Stock Alert */
.sv-low-stock-alert {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  margin-bottom: 1rem;
}

.sv-low-stock-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Timeline ── */
.sv-timeline {
  position: relative;
  padding-left: 1.5rem;
}

.sv-timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--light-gray);
}

.sv-timeline-item {
  position: relative;
  padding: 0 0 1.25rem 1rem;
}

.sv-timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--primary);
}

.sv-timeline-date {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.sv-timeline-body {
  background: var(--off-white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.sv-timeline-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--text);
}

.sv-timeline-tasks {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.sv-task-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 12px;
  font-weight: 500;
}

.sv-timeline-chems {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.sv-mini-chem {
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  background: var(--info-bg);
  color: var(--info);
  border-radius: 4px;
  font-weight: 500;
}

/* ── Chemical Alerts ── */
.sv-chem-alerts {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  margin-bottom: 1rem;
}

.sv-chem-alert {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
}

.sv-chem-alert-low {
  background: var(--info-bg);
  border-left: 3px solid var(--info);
}

.sv-chem-alert-high {
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
}

/* ── Bar Charts (CSS-based) ── */
.sv-chart-section {
  margin-top: 1rem;
}

.sv-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.sv-chart-card {
  padding: 0.85rem;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  background: var(--white);
}

.sv-chart-card h5 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--dark);
}

.sv-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 100px;
  position: relative;
  padding: 0;
  background: var(--off-white);
  border-radius: 4px;
  overflow: hidden;
}

.sv-chart-ideal {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(40, 167, 69, 0.1);
  border-top: 1px dashed var(--success);
  border-bottom: 1px dashed var(--success);
  z-index: 0;
  pointer-events: none;
}

.sv-bar {
  flex: 1;
  min-width: 4px;
  max-width: 20px;
  border-radius: 2px 2px 0 0;
  z-index: 1;
  transition: opacity 0.2s;
  cursor: default;
}

.sv-bar:hover {
  opacity: 0.8;
}

/* ── Equipment Inspection Checklist ── */
.sv-equip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.sv-equip-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--light-gray);
  background: var(--white);
  font-size: 0.85rem;
  transition: box-shadow 0.15s ease;
  color: var(--text);
}

.sv-equip-item:hover {
  box-shadow: var(--shadow);
}

.sv-equip-item.sv-equip-ok {
  border-color: var(--success);
  background: var(--success-bg);
}

.sv-equip-item.sv-equip-attention {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.sv-equip-item.sv-equip-na {
  border-color: var(--light-gray);
  background: var(--off-white);
  opacity: 0.7;
}

.sv-equip-item.sv-equip-pending {
  border-color: var(--light-gray);
  background: var(--off-white);
}

.sv-equip-icon {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 1.2rem;
  text-align: center;
}

.sv-equip-ok .sv-equip-icon { color: var(--success); }
.sv-equip-attention .sv-equip-icon { color: var(--warning); }
.sv-equip-na .sv-equip-icon { color: var(--gray); }

.sv-equip-detail {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* Equipment Checklist Form */
.sv-equip-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sv-equip-form-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
  transition: background var(--transition);
}

.sv-equip-form-item:hover {
  background: var(--off-white);
}

.sv-equip-form-item:last-child {
  border-bottom: none;
}

.sv-equip-form-item .sv-check-item {
  min-width: 220px;
}

.sv-equip-inputs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}

.sv-equip-inputs .form-control {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
}

/* Chemical Frequency Badge */
.chem-freq {
  font-size: 0.6rem;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  font-weight: 600;
  background: var(--info-bg);
  color: var(--info);
}

/* ── LSI Display ── */
.sv-lsi-card {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--text);
}

.sv-lsi-card.lsi-ok {
  background: var(--success-bg);
  border: 1px solid var(--success);
}

.sv-lsi-card.lsi-low {
  background: var(--info-bg);
  border: 1px solid var(--info);
}

.sv-lsi-card.lsi-high {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
}

.sv-lsi-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.lsi-badge-ok {
  background: var(--success);
  color: #fff;
}

.lsi-badge-low {
  background: var(--info);
  color: #fff;
}

.lsi-badge-high {
  background: var(--danger);
  color: #fff;
}

.sv-lsi-preview {
  min-height: 1rem;
}

/* ── Detail View Panels ── */
.sv-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.customer-detail .panel {
  padding: 1.25rem 1.5rem;
}

.customer-detail .panel h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--light-gray);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sv-banner-row {
    flex-direction: column;
    gap: 0.3rem;
  }

  .chem-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sv-chem-form {
    grid-template-columns: 1fr 1fr;
  }

  .sv-charts-grid {
    grid-template-columns: 1fr;
  }

  .sv-chem-row,
  .sv-issue-row {
    flex-direction: column;
  }

  .sv-actions {
    flex-direction: column;
  }

  .sv-actions .btn {
    width: 100%;
  }

  .sv-photo-thumb {
    width: 80px;
    height: 60px;
  }

  .sv-form-container .panel {
    padding: 1rem;
  }
}

/* ══════════════════════════════════════════
   Invoicing Module
   ══════════════════════════════════════════ */

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
  padding: 0;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Invoice form line items table */
#invf-lines-table .form-control {
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
}

#invf-lines-table td {
  vertical-align: middle;
}

/* Success button variant */
.btn-success {
  background: var(--success);
  color: var(--white);
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
}

.btn-success:hover {
  opacity: 0.9;
}

/* Invoice table footer totals */
.data-table tfoot td {
  border-top: 2px solid var(--border);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

/* Aging report stat icons with text */
.stat-icon {
  font-weight: 700;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   Mobile-Optimized Technician Interface
   ============================================ */

/* Quick Action Bar — fixed bottom on mobile for techs */
.tech-quick-actions {
  display: none;
}

/* Tech "My Schedule" Card View */
.tech-schedule-cards {
  display: none;
}

.tech-appt-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  margin-bottom: 0.75rem;
}

.tech-appt-card.status-in_progress {
  border-left-color: var(--warning);
}

.tech-appt-card.status-completed {
  border-left-color: var(--success);
  opacity: 0.75;
}

.tech-appt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tech-appt-card-header .time {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

.tech-appt-card-customer {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--dark);
}

.tech-appt-card-address {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 0.5rem;
}

.tech-appt-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tech-appt-card-actions .btn {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.85rem;
  min-width: 0;
  text-align: center;
}

/* Mobile-only tech interface */
@media (max-width: 768px) {
  /* Show tech card schedule, hide full calendar on mobile for technicians */
  body.is-technician .tech-schedule-cards {
    display: block;
  }

  body.is-technician .sched-calendar {
    display: none;
  }

  body.is-technician .sched-toolbar .sched-views,
  body.is-technician .contact-header-actions {
    display: none;
  }

  /* Make tech quick action bar visible at bottom */
  .tech-quick-actions {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    gap: 0.5rem;
    z-index: 900;
  }

  .tech-quick-actions .btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    border-radius: var(--radius-sm);
  }

  .tech-quick-actions .btn-icon {
    font-size: 1.2rem;
  }

  body.is-technician .content {
    padding-bottom: 5rem;
  }

  /* Service visit form mobile optimizations */
  .sv-form-container {
    max-width: 100%;
  }

  .sv-form-container .panel {
    padding: 0.75rem;
    margin: 0;
    border-radius: var(--radius-sm);
  }

  .sv-form-container .panel h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .sv-banner-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .sv-check-item {
    padding: 0.6rem 0;
    font-size: 1rem;
    min-height: 44px;
  }

  .sv-check-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  .sv-chem-form {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .sv-chem-form .form-group label {
    font-size: 0.8rem;
  }

  .sv-chem-form .form-control {
    padding: 0.6rem;
    font-size: 1rem;
  }

  .sv-chem-row,
  .sv-issue-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .sv-chem-row .form-control,
  .sv-issue-row .form-control {
    min-width: unset;
    width: 100%;
  }

  .sv-actions {
    flex-direction: column;
    position: sticky;
    bottom: 0;
    background: var(--white);
    padding: 0.75rem 0;
    border-top: 1px solid var(--light-gray);
    z-index: 10;
  }

  .sv-actions .btn {
    width: 100%;
    padding: 0.9rem;
    font-size: 1rem;
  }

  .sv-actions #btn-sv-checkout {
    order: -1;
  }

  /* Ensure touch targets are large enough (44px min) */
  .sv-form-container .btn {
    min-height: 44px;
  }

  .sv-form-container .form-control {
    min-height: 44px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .sv-form-container select.form-control {
    font-size: 16px;
  }

  /* Task add area mobile */
  .sv-form-container #sv-new-task {
    font-size: 16px;
  }

  /* Photo grid */
  .sv-photo-thumb {
    width: calc(33.333% - 0.5rem);
    height: 80px;
  }

  /* Calendar mobile */
  .chem-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Pages header stack on mobile */
  .pages-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .sv-chem-form {
    grid-template-columns: 1fr;
  }

  .chem-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sv-photo-thumb {
    width: calc(50% - 0.25rem);
    height: 80px;
  }

  .tech-appt-card-actions {
    flex-direction: column;
  }

  .tech-appt-card-actions .btn {
    flex: unset;
    width: 100%;
  }
}

/* ============================================
   DARK MODE — Theme Toggle & Overrides
   ============================================ */

/* Theme toggle button */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--light-gray);
  background: transparent;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all var(--transition);
  color: var(--text);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--off-white);
  border-color: var(--accent);
  color: var(--accent);
}

/* Show/hide sun & moon icons */
.theme-icon-dark { display: none; }
.theme-icon-light { display: inline; }
[data-theme="dark"] .theme-icon-dark { display: inline; }
[data-theme="dark"] .theme-icon-light { display: none; }

/* Dark mode overrides for hardcoded colors */
[data-theme="dark"] .btn-danger:hover {
  background: #dc2626;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--light-gray) 25%, #363650 50%, var(--light-gray) 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .toast-warning {
  color: #1a1a2e;
}

[data-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #070e1f 0%, #0e1b3d 50%, #1a3066 100%);
}

[data-theme="dark"] .sidebar-overlay.active {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .customer-quick-actions {
  background: var(--off-white);
}

/* Quill editor in dark mode */
[data-theme="dark"] .ql-toolbar {
  background: var(--off-white);
  border-color: var(--light-gray) !important;
}

[data-theme="dark"] .ql-toolbar .ql-stroke {
  stroke: var(--text-light);
}

[data-theme="dark"] .ql-toolbar .ql-fill {
  fill: var(--text-light);
}

[data-theme="dark"] .ql-toolbar .ql-picker-label {
  color: var(--text-light);
}

[data-theme="dark"] .ql-container {
  border-color: var(--light-gray) !important;
  color: var(--text);
}

[data-theme="dark"] .ql-editor {
  color: var(--text);
}

[data-theme="dark"] .ql-editor.ql-blank::before {
  color: var(--gray);
}

/* ── Service Request Detail (dark-mode aware) ── */
.sr-appt-box {
  margin-top: 1.5rem;
  background: var(--off-white);
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--light-gray);
}

.sr-appt-box h4 {
  color: var(--text);
}

.sr-appt-box label {
  color: var(--text);
}

.sr-proposal-banner {
  padding: 0.5rem 0.75rem;
  background: var(--warning-bg);
  color: var(--text);
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-meta {
  color: var(--text);
}

.detail-meta strong {
  color: var(--text);
}

.detail-section h4 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.status-select {
  padding: 6px 12px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
}

.status-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Service Plans & Scheduling dark-mode overrides */
[data-theme="dark"] .sp-card {
  background: var(--white);
}

[data-theme="dark"] .sp-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sp-card-price span {
  color: var(--gray);
}

[data-theme="dark"] .sp-card-desc {
  color: var(--text-light);
}

[data-theme="dark"] .sp-task-more {
  color: var(--gray);
}

[data-theme="dark"] .sp-card-footer {
  color: var(--text-light);
}

[data-theme="dark"] .sp-task-list li {
  border-color: var(--light-gray);
}

[data-theme="dark"] .sp-task-row {
  background: var(--off-white);
}

[data-theme="dark"] .sp-task-drag {
  color: var(--gray);
}

[data-theme="dark"] .sp-task-input {
  color: var(--text);
}

[data-theme="dark"] .sp-task-input:focus {
  background: var(--white);
}

[data-theme="dark"] .sched-toolbar {
  background: var(--white);
}

/* Calendar & scheduling hardcoded overrides */
[data-theme="dark"] .sched-day-appt,
[data-theme="dark"] .fc-event {
  border-color: var(--light-gray);
}

[data-theme="dark"] .cal-grid {
  background: var(--white);
}

[data-theme="dark"] .sched-day-cell:hover {
  background: rgba(59, 125, 219, 0.1);
}

[data-theme="dark"] .sched-day-cell.today {
  background: rgba(59, 125, 219, 0.15);
}

[data-theme="dark"] .sched-day-cell.outside {
  background: var(--off-white);
}

[data-theme="dark"] .sched-day-cell.outside .cal-day-num {
  color: var(--gray);
}

[data-theme="dark"] .sched-appt {
  background: rgba(59, 125, 219, 0.15);
  color: var(--text);
}

[data-theme="dark"] .sched-appt:hover {
  background: rgba(59, 125, 219, 0.25);
}

[data-theme="dark"] .sched-appt.completed {
  background: rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .sched-appt.cancelled {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sched-appt.in-progress {
  background: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .gcal-event {
  background: rgba(155, 89, 182, 0.15);
  color: var(--text-muted);
}
[data-theme="dark"] .gcal-event .gcal-badge {
  background: rgba(155, 89, 182, 0.3);
  color: #c39bd3;
}
[data-theme="dark"] .gcal-event.day-appt {
  background: rgba(155, 89, 182, 0.1);
  border-color: rgba(155, 89, 182, 0.3);
}
[data-theme="dark"] .gcal-event.allday {
  background: rgba(155, 89, 182, 0.2);
}

/* Customer picker dark theme */
[data-theme="dark"] .customer-picker {
  border-color: var(--light-gray);
  background: var(--white);
}
[data-theme="dark"] .customer-picker-search {
  background: var(--white);
  color: var(--text);
  border-bottom-color: var(--light-gray);
}
[data-theme="dark"] .customer-picker-item {
  border-bottom-color: rgba(255,255,255,0.05);
  color: var(--text);
}
[data-theme="dark"] .customer-picker-item:hover {
  background: rgba(59, 125, 219, 0.15);
}
[data-theme="dark"] .customer-picker-item.selected {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .appt-time {
  color: var(--text);
}

[data-theme="dark"] .day-tech-group {
  background: var(--white);
}

[data-theme="dark"] .day-tech-header {
  background: var(--off-white);
}

[data-theme="dark"] .sched-appt.day-appt {
  background: var(--off-white);
}

[data-theme="dark"] .appt-popover {
  background: var(--white);
  color: var(--text);
}

[data-theme="dark"] .modal-card {
  background: var(--white);
  color: var(--text);
}

[data-theme="dark"] .auto-result-box {
  background: var(--success-bg);
  color: var(--text);
}

/* Override miscellaneous hardcoded backgrounds */
[data-theme="dark"] .modal {
  background: var(--white);
  color: var(--text);
}

[data-theme="dark"] .modal-header {
  border-color: var(--light-gray);
}

[data-theme="dark"] .modal-footer {
  border-color: var(--light-gray);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--off-white);
  color: var(--text);
  border-color: var(--light-gray);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--gray);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

/* Dropdown menus in dark mode */
[data-theme="dark"] .user-dropdown {
  background: var(--white);
  border-color: var(--light-gray);
}

[data-theme="dark"] .dropdown-btn:hover {
  background: var(--danger-bg);
}

/* ── Users Management ── */
.user-row-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.detail-card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  max-width: 720px;
}

.form-info-row {
  padding: 0.75rem 0;
  border-top: 1px solid var(--light-gray);
  margin-top: 0.5rem;
}

.form-group .required {
  color: var(--danger);
}

[data-theme="dark"] .detail-card {
  background: var(--white);
  border-color: var(--light-gray);
}

/* ── Equipment Scanner ── */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.card-header-row h4 { margin: 0; }

.equip-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.equip-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.equip-photo-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--light-gray);
}
.equip-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.equip-photo-placeholder {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--medium-gray);
  background: var(--light-bg);
  border-radius: 6px;
  border: 1px dashed var(--light-gray);
}

/* Scan Modal */
.scan-modal {
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}
.scan-steps {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--light-gray);
}
.scan-step {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0.25rem;
  font-size: 0.8rem;
  color: var(--medium-gray);
  border-bottom: 2px solid transparent;
}
.scan-step.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.scan-step.done {
  color: var(--success);
}

/* Step 1: Type Selector */
.scan-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.scan-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.5rem;
  border: 2px solid var(--light-gray);
  border-radius: 10px;
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
}
.scan-type-btn:hover,
.scan-type-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light, #e8f0fe);
}
.scan-type-icon { font-size: 1.8rem; }
.scan-type-label { font-size: 0.85rem; font-weight: 500; }

/* Step 2: Capture */
.scan-instruction {
  text-align: center;
  margin-bottom: 1rem;
  color: var(--dark-gray);
}
.scan-capture-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.scan-capture-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
  border: 2px dashed var(--medium-gray);
  border-radius: 12px;
  cursor: pointer;
  color: var(--dark-gray);
  background: var(--light-bg);
  transition: all 0.15s;
  width: 100%;
  text-align: center;
}
.scan-capture-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light, #e8f0fe);
}
.scan-capture-icon { font-size: 2.5rem; }
#scan-preview {
  text-align: center;
}
#scan-preview-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.scan-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Step 3: Processing */
.scan-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
  gap: 1rem;
}
.scan-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--light-gray);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: scan-spin 0.8s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }
.scan-subtext { font-size: 0.85rem; color: var(--medium-gray); }

/* Step 4: Review */
.scan-review {
  display: flex;
  gap: 1.25rem;
}
.scan-review-photo {
  flex-shrink: 0;
  width: 160px;
}
.scan-review-photo img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--light-gray);
}
.scan-review-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.scan-review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.scan-review-header h5 { margin: 0; }
.scan-confidence {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}
.conf-high { background: #d4edda; color: #155724; }
.conf-med { background: #fff3cd; color: #856404; }
.conf-low { background: #f8d7da; color: #721c24; }
.scan-notes {
  font-size: 0.85rem;
  color: var(--dark-gray);
  background: var(--light-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

@media (max-width: 600px) {
  .scan-type-grid { grid-template-columns: repeat(2, 1fr); }
  .scan-review { flex-direction: column; }
  .scan-review-photo { width: 100%; }
  .scan-review-photo img { max-height: 200px; object-fit: contain; }
}

/* ── Webmail ── */
.email-layout {
  display: flex;
  gap: 1.25rem;
  min-height: 600px;
}
.email-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.email-sidebar h3 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.email-folder-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  flex: 1;
}
.email-folder-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.email-folder-item:hover {
  background: var(--light-bg);
}
.email-folder-item.active {
  background: var(--primary);
  color: #fff;
}
.email-folder-item.active .email-folder-badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.email-folder-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}
.email-folder-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-folder-badge {
  background: var(--info-bg);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  min-width: 1.25rem;
  text-align: center;
  margin-left: auto;
}
.btn-block {
  display: block;
  width: 100%;
}
.email-main {
  flex: 1;
  min-width: 0;
}
.email-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.email-toolbar .btn { font-size: 0.85rem; }
.email-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.email-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.email-search,
.email-search-input {
  flex: 1;
  min-width: 180px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--text);
}
.email-search:focus,
.email-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 61, 145, 0.1);
}
.email-page-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.email-message-list {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.email-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  font-size: 0.9rem;
  color: var(--text);
}
.email-row:last-child { border-bottom: none; }
.email-row:hover { background: var(--light-bg); }
.email-row.unread {
  font-weight: 600;
  background: var(--info-bg);
}
.email-row .email-star {
  cursor: pointer;
  color: var(--gray);
  font-size: 1.1rem;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}
.email-row .email-star.flagged { color: #f5a623; }
/* Support both class naming conventions */
.email-row .email-from,
.email-row .email-row-from {
  width: 180px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-row .email-subject,
.email-row .email-row-subject {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.email-row .email-subject .email-snippet,
.email-row .email-row-subject .email-snippet {
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 0.35rem;
}
.email-attach-icon {
  opacity: 0.6;
  font-size: 0.85em;
}
.email-row .email-date,
.email-row .email-row-date {
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  white-space: nowrap;
}
.email-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.email-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}
.email-empty span {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Email Read View */
.email-read-view {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.email-read-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--light-bg);
}
.email-read-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.email-read-header h2,
.email-read-header .email-read-subject {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--text);
}
.email-read-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.email-meta-row {
  line-height: 1.5;
}
.email-meta-row strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 0.25rem;
}
.email-read-meta .email-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}
.email-read-meta .email-meta-info {
  flex: 1;
}
.email-read-meta .email-meta-from {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}
.email-read-meta .email-meta-date {
  float: right;
  font-size: 0.8rem;
}
.email-read-meta .email-meta-to {
  margin-top: 0.15rem;
}
.email-attachments {
  padding: 0.75rem 1.5rem;
  background: var(--light-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.email-attachment-chip,
.email-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s;
}
.email-attachment-chip:hover,
.email-attachment-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.email-read-body {
  min-height: 200px;
}
.email-body-frame {
  width: 100%;
  min-height: 250px;
  border: none;
  display: block;
}
.email-body-text {
  padding: 1.5rem;
  margin: 0;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: var(--text);
  background: transparent;
}
.email-read-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--light-bg);
  flex-wrap: wrap;
}

/* Email Compose View */
.email-compose-view {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.email-compose-form {
  display: flex;
  flex-direction: column;
}
.email-compose-field {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.email-compose-field label {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 70px;
  flex-shrink: 0;
}
.email-compose-field input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.6rem 0.5rem;
  font-size: 0.9rem;
  background: transparent;
  color: var(--text);
}
.email-compose-field input::placeholder {
  color: var(--text-secondary);
  opacity: 0.65;
}
.email-compose-body {
  min-height: 300px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  overflow-y: auto;
}
.email-compose-body #compose-editor {
  min-height: 300px;
  padding: 1rem;
  outline: none;
  line-height: 1.6;
  font-size: 0.9rem;
  color: var(--text);
}
.email-compose-body #compose-editor:empty::before {
  content: 'Write your message...';
  color: var(--text-secondary);
  opacity: 0.6;
}
.email-compose-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--light-bg);
  border-bottom: 1px solid var(--border);
}
.email-compose-toolbar h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.email-compose-toolbar .btn { font-size: 0.85rem; }
.email-compose-attachments {
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.email-compose-attachments label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 0.25rem;
}
.email-compose-attachments input[type="file"] {
  font-size: 0.8rem;
  color: var(--text);
}
.email-compose-attachments .attachment-tag {
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.email-compose-attachments .attachment-tag .remove-attachment {
  cursor: pointer;
  color: var(--danger);
  font-weight: 700;
}
.email-compose-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--light-bg);
}

/* Webmail dark mode overrides */
[data-theme="dark"] .email-row.unread {
  background: rgba(59, 125, 219, 0.08);
}
[data-theme="dark"] .email-folder-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .email-search:focus,
[data-theme="dark"] .email-search-input:focus {
  box-shadow: 0 0 0 2px rgba(59, 125, 219, 0.2);
}

@media (max-width: 768px) {
  .email-layout {
    flex-direction: column;
  }
  .email-sidebar {
    width: 100%;
  }
  .email-folder-list {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
  }
  .email-folder-item {
    white-space: nowrap;
  }
  .email-row .email-from,
  .email-row .email-row-from {
    width: 100px;
  }
  .email-read-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .email-read-actions {
    flex-wrap: wrap;
  }
}

/* ════════════════════════════════════════════
   Appointment Wizard Steps
   ════════════════════════════════════════════ */

.appt-wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}

.appt-wizard-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0.5;
  user-select: none;
}
.appt-wizard-step:hover {
  background: rgba(11, 61, 145, 0.05);
}
.appt-wizard-step.active {
  opacity: 1;
}
.appt-wizard-step.completed {
  opacity: 0.85;
}
.appt-wizard-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  background: #d0d5dd;
  color: #fff;
  transition: background 0.3s, transform 0.2s;
  flex-shrink: 0;
}
.appt-wizard-step.active .appt-wizard-step-number {
  background: #0b3d91;
  transform: scale(1.1);
}
.appt-wizard-step.completed .appt-wizard-step-number {
  background: #2e7d32;
}
.appt-wizard-step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475467;
  white-space: nowrap;
}
.appt-wizard-step.active .appt-wizard-step-label {
  color: #0b3d91;
}
.appt-wizard-step.completed .appt-wizard-step-label {
  color: #2e7d32;
}
.appt-wizard-connector {
  width: 32px;
  height: 2px;
  background: #d0d5dd;
  flex-shrink: 0;
  transition: background 0.3s;
}
.appt-wizard-connector.done {
  background: #2e7d32;
}

/* Wizard step panels */
.appt-wizard-panel {
  display: none;
  animation: wizardFadeIn 0.25s ease;
}
.appt-wizard-panel.active {
  display: block;
}
@keyframes wizardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Wizard navigation buttons */
.appt-wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}
.appt-wizard-nav .btn {
  min-width: 100px;
}

/* Duration auto-calc hint */
.appt-duration-hint {
  font-size: 0.75rem;
  color: #667085;
  margin-top: 0.25rem;
  font-style: italic;
}

/* Find Next Available button */
.btn-find-available {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #0b3d91 0%, #1a5fc9 100%);
  color: #fff;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  margin-top: 0.5rem;
}
.btn-find-available:hover {
  box-shadow: 0 4px 12px rgba(11, 61, 145, 0.3);
  transform: translateY(-1px);
}
.btn-find-available:active {
  transform: translateY(0);
}
.btn-find-available:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-find-available .spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Next Available Popup Overlay */
.next-avail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.next-avail-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  max-width: 420px;
  width: 90%;
  overflow: hidden;
  animation: popIn 0.25s ease;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.next-avail-header {
  background: linear-gradient(135deg, #0b3d91 0%, #1a5fc9 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.next-avail-body {
  padding: 1.25rem;
}
.next-avail-detail {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.next-avail-detail:last-child {
  border-bottom: none;
}
.next-avail-detail-icon {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.next-avail-detail-label {
  font-size: 0.78rem;
  color: #667085;
}
.next-avail-detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d2939;
}
.next-avail-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e9ecef;
  background: #fafbfc;
}
.next-avail-actions .btn {
  flex: 1;
  text-align: center;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.next-avail-actions .btn-confirm {
  background: #2e7d32;
  color: #fff;
}
.next-avail-actions .btn-confirm:hover {
  background: #256d29;
}
.next-avail-actions .btn-edit {
  background: #e9ecef;
  color: #344054;
}
.next-avail-actions .btn-edit:hover {
  background: #d0d5dd;
}
.next-avail-actions .btn-skip {
  background: #0b3d91;
  color: #fff;
}
.next-avail-actions .btn-skip:hover {
  background: #09316f;
}
.next-avail-none {
  text-align: center;
  padding: 1.5rem 1.25rem;
  color: #667085;
  font-size: 0.9rem;
}

/* Schedule step date/time + button row */
.appt-schedule-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.appt-schedule-row .form-group {
  flex: 1;
  min-width: 140px;
}
.appt-schedule-or {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.75rem 0;
  color: #98a2b3;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.appt-schedule-or::before,
.appt-schedule-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e9ecef;
}

@media (max-width: 600px) {
  .appt-wizard-steps {
    gap: 0;
    padding: 0 0.25rem;
  }
  .appt-wizard-step {
    padding: 0.4rem;
  }
  .appt-wizard-step-label {
    display: none;
  }
  .appt-wizard-connector {
    width: 18px;
  }
  .next-avail-actions {
    flex-direction: column;
  }
}

/* ════════════════════════════════════════════
   Reports & Expenses Module Styles
   ════════════════════════════════════════════ */

/* Report tabs */
.report-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}
.report-tab {
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.report-tab:hover { color: var(--text); }
.report-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Report filters toolbar */
.report-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.report-filters label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* Report section */
.report-section {
  margin-bottom: 2rem;
}
.report-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

/* P&L detail grid */
.pnl-detail-grid {
  max-width: 480px;
}
.pnl-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}
.pnl-row.pnl-total {
  border-top: 2px solid var(--border);
  margin-top: 0.3rem;
  padding-top: 0.5rem;
  font-weight: 700;
}

/* Expense category bars */
.expense-category-bars {
  max-width: 600px;
}
.category-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.category-bar-label {
  width: 140px;
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
}
.category-bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-alt, #f0f0f0);
  border-radius: 4px;
  overflow: hidden;
}
.category-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  min-width: 2px;
  transition: width 0.3s;
}
.category-bar-value {
  font-size: 0.8rem;
  color: var(--muted);
  width: 130px;
  text-align: right;
  flex-shrink: 0;
}

/* Value color helpers */
.stat-value.negative, .negative { color: var(--danger, #e74c3c); }

/* Badge variants for expense categories */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.75rem; font-weight: 600; }
.badge-fuel { background: #ffeaa7; color: #6c5200; }
.badge-vehicle { background: #dfe6e9; color: #2d3436; }
.badge-insurance { background: #a29bfe; color: #fff; }
.badge-chemicals_supplies { background: #55efc4; color: #00352a; }
.badge-equipment { background: #fab1a0; color: #6b2d1a; }
.badge-subcontractor { background: #fd79a8; color: #fff; }
.badge-office { background: #74b9ff; color: #003566; }
.badge-marketing { background: #e17055; color: #fff; }
.badge-utilities { background: #00cec9; color: #003333; }
.badge-labor { background: #6c5ce7; color: #fff; }
.badge-other { background: #b2bec3; color: #2d3436; }

/* Module header with actions */
.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.module-header h2 { margin: 0; }
.module-actions { display: flex; gap: 0.5rem; }

/* Print styles for reports */
@media print {
  .sidebar, .topbar, .report-tabs, .report-filters, .module-actions, .sched-toolbar { display: none !important; }
  .main-wrapper { margin: 0; padding: 0; }
  .content { padding: 0; }
  .stat-card { border: 1px solid #ccc; break-inside: avoid; }
  .data-table { font-size: 0.8rem; }
}

@media (max-width: 768px) {
  .report-tabs { gap: 0; }
  .report-tab { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .report-filters { flex-direction: column; align-items: stretch; }
  .category-bar-label { width: 100px; }
  .category-bar-value { width: 100px; }
  .module-header { flex-direction: column; align-items: flex-start; }
  .pnl-detail-grid { max-width: 100%; }
}

/* ═══════════════════════════════════════════
   Customer Map View
   ═══════════════════════════════════════════ */
.view-toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-left: 0.5rem;
}
.view-toggle-btn {
  padding: 0.35rem 0.75rem;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}
.view-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}
.view-toggle-btn:hover:not(.active) {
  background: var(--bg-hover);
}

#customer-map-container {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 400px;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 1;
}

.map-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.map-info-bar .geocode-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.geocode-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.geocode-progress .spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.leaflet-popup-content {
  margin: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  line-height: 1.5;
}
.map-popup-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}
.map-popup-address {
  color: var(--text-muted);
  margin-bottom: 6px;
}
.map-popup-meta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.map-popup-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.map-popup-link:hover {
  text-decoration: underline;
}

/* Status color legend */
.map-legend {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Communications (BCMX Embed) ── */
.communications-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.communications-toolbar h2 {
  margin: 0;
  font-size: 1.25rem;
}
.communications-toolbar .toolbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.communications-toolbar .toolbar-actions a {
  font-size: 0.85rem;
  color: var(--accent, #00b4d8);
  text-decoration: none;
}
.communications-toolbar .toolbar-actions a:hover {
  text-decoration: underline;
}
.communications-frame {
  width: 100%;
  height: calc(100vh - 140px);
  min-height: 500px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius, 12px);
  background: var(--white, #fff);
}
[data-theme="dark"] .communications-frame {
  border-color: var(--border-color, #334155);
  background: var(--white, #1e1e2e);
}
