/* ============================================
   MBOS - Modern Business Operating System
   Global Stylesheet
   ============================================ */

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

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-light: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3B82F6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.15);
  --agreement-color: #8b5cf6;
  --agreement-bg: rgba(139, 92, 246, 0.15);
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
  --transition: 150ms ease;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

img { max-width: 100%; }

/* Loading fallback — visible before JS renders */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--text-secondary);
  font-size: 15px;
  gap: 10px;
}
.page-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pl-spin 0.6s linear infinite;
}
@keyframes pl-spin { to { transform: rotate(360deg); } }

/* Error state that replaces loading spinner on timeout */
.page-load-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.page-load-error::before { display: none; }

/* ============================================
   Layout — Sidebar + Main
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width var(--transition);
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: normal;
  line-height: 1.3;
  word-break: break-word;
}

.sidebar-logo .logo-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.sidebar-search {
  padding: 8px 12px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.sidebar-search .search-icon {
  position: absolute;
  left: 20px;
  font-size: 13px;
  opacity: 0.5;
  pointer-events: none;
}
.sidebar-search input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
}
.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.nav-item .nav-label {
  font-size: 14px;
  font-weight: 500;
}

.nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item .coming-soon-badge {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.sidebar-footer .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer .user-info {
  overflow: hidden;
}

.sidebar-footer .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .user-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-footer .logout-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  transition: color var(--transition);
}

.sidebar-footer .logout-btn:hover {
  color: var(--danger);
}

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

/* Top Bar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-right: auto;
}

.topbar-search {
  position: relative;
  width: 280px;
}

.topbar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus { border-color: var(--accent); }

.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

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

.topbar-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  font-size: 18px;
  position: relative;
  transition: all var(--transition);
}

.topbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* Page Content */
.page-content {
  flex: 1;
  padding: 24px;
  padding-bottom: 48px;
}

/* ============================================
   Components
   ============================================ */

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stats-grid .stat-card:nth-child(n+5) {
  grid-column: span 2;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 100px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

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

.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.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-info { flex: 1; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--border-light);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn-warning {
  background: var(--warning);
  color: #000;
  border-color: var(--warning);
}
.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
  color: #000;
}

.btn-info {
  background: var(--info);
  color: #000;
  border-color: var(--info);
}
.btn-info:hover {
  background: #0891b2;
  border-color: #0891b2;
  color: #000;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 4px 8px;
}
.btn-ghost:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

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

table th,
table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

table th {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

table th:hover {
  color: var(--text-primary);
}

table th .sort-icon {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
}

table th.sorted .sort-icon {
  opacity: 1;
  color: var(--accent);
}

table tbody tr {
  transition: background var(--transition);
}

table tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

table tbody tr:hover {
  background: var(--bg-hover);
}

table tbody tr.clickable {
  cursor: pointer;
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active, .badge-paid, .badge-accepted { background: var(--success-bg); color: var(--success); }
.badge-sent { background: var(--accent-light); color: var(--accent); }
.badge-draft { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge-prospect { background: var(--warning-bg); color: var(--warning); }
.badge-inactive, .badge-declined { background: var(--danger-bg); color: var(--danger); }
.badge-overdue { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

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

.form-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  gap: 0;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

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

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Activity Feed */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.activity-icon.blue { background: var(--accent-light); color: var(--accent); }
.activity-icon.green { background: var(--success-bg); color: var(--success); }
.activity-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.activity-icon.red { background: var(--danger-bg); color: var(--danger); }

.activity-body { flex: 1; }

.activity-text {
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.6;
}

.activity-time {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

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

.page-toolbar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 8px 12px 8px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.page-toolbar .search-input:focus { border-color: var(--accent); }
.page-toolbar .search-input::placeholder { color: var(--text-muted); }

.page-toolbar .search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.page-toolbar .search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.filter-select {
  padding: 8px 32px 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--accent); }

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #d1d5db;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* Client Detail Header */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.detail-info { flex: 1; }

.detail-info h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 14px;
}

.detail-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

/* Print-friendly invoice / quote */
.document-view {
  background: #fff;
  color: #1a1a1a;
  border-radius: var(--radius);
  padding: 40px;
  max-width: 800px;
}

.document-view .doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid #e5e7eb;
}

.document-view .doc-company h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}

.document-view .doc-company p {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.document-view .doc-title {
  text-align: right;
}

.document-view .doc-title h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.document-view .doc-title p {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.document-view .doc-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.document-view .doc-party h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #4b5563;
  font-weight: 600;
  margin-bottom: 8px;
}

.document-view .doc-party p {
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
}

.document-view table {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.document-view table th {
  background: #f9fafb;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.document-view table td {
  color: #374151;
  font-size: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.document-view table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.document-view table tbody tr:hover {
  background: #f3f4f6;
}

.document-view .doc-totals {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 32px;
}

.document-view .doc-totals table {
  width: 280px;
  border: none;
}

.document-view .doc-totals table td {
  border: none;
  padding: 6px 16px;
}

.document-view .doc-totals .total-row td {
  font-weight: 700;
  font-size: 16px;
  color: #1a1a1a;
  border-top: 2px solid #e5e7eb;
  padding-top: 12px;
}

.document-view .doc-notes {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 16px;
}

.document-view .doc-notes h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #4b5563;
  font-weight: 600;
  margin-bottom: 8px;
}

.document-view .doc-notes p {
  font-size: 13px;
  color: #374151;
}

/* Warning banner */
.warning-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

/* Line Items Editor */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.line-items-table th {
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.line-items-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.line-items-table input {
  width: 100%;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.line-items-table input:focus {
  border-color: var(--accent);
}

.line-items-table .row-total {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  white-space: nowrap;
}

.line-items-table .remove-row {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: color var(--transition);
}

.line-items-table .remove-row:hover {
  color: var(--danger);
}

.totals-section {
  display: flex;
  justify-content: flex-end;
}

.totals-table {
  width: 300px;
}

.totals-table tr td {
  padding: 8px 12px;
  font-size: 14px;
  border: none;
}

.totals-table tr td:first-child {
  color: var(--text-secondary);
  text-align: right;
}

.totals-table tr td:last-child {
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
}

.totals-table .total-final td {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  border-top: 2px solid var(--border-color);
  padding-top: 12px;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 24px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .login-logo .logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  margin-bottom: 12px;
}

.login-card .login-logo h1 {
  font-size: 24px;
  font-weight: 700;
}

.login-card .login-logo p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.demo-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demo-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
}

.demo-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.demo-btn .demo-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.demo-btn .demo-info {
  text-align: left;
}

.demo-btn .demo-name {
  font-weight: 600;
  font-size: 13px;
}

.demo-btn .demo-role {
  font-size: 11px;
  color: #b0b8c4;
}

/* Public Quote Request */
.public-page {
  min-height: 100vh;
  background: var(--bg-primary);
}

.public-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-header .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}

.public-header h1 {
  font-size: 18px;
  font-weight: 700;
}

.public-content {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 24px;
}

.public-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.public-content .subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  margin-bottom: 32px;
}

.public-footer {
  text-align: center;
  padding: 24px;
  margin-top: 48px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
.public-footer a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.public-footer a:hover {
  text-decoration: underline;
}

.success-message {
  text-align: center;
  padding: 48px 24px;
}

.success-message .success-icon {
  width: 64px;
  height: 64px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
}

.success-message h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.success-message p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Responsive */
/* ============================================
   Mobile Hamburger Button (hidden on desktop)
   ============================================ */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  line-height: 1;
}
.mobile-hamburger:hover {
  background: var(--bg-hover);
}

/* Sidebar close button (hidden on desktop) */
.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-close-btn:hover {
  color: var(--text-primary);
}

/* Sidebar overlay (hidden on desktop) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
}
.sidebar-overlay.active {
  display: block;
}

/* Mobile card layout for tables (hidden on desktop) */
.mobile-cards {
  display: none;
}

/* Desktop defaults: hide mobile-only elements */
.mobile-assign-btn,
.mobile-assign-select,
.settings-users-cards,
.cal-month-cell-dots,
.cal-day-mobile-list,
.touch-drag-clone {
  display: none;
}

/* ============================================
   Responsive: Tablet (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Responsive: Mobile (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

  /* -- Sidebar: fully hidden, hamburger toggleable overlay -- */
  .mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 250ms ease;
    width: 260px;
    z-index: 9999;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: block;
  }

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

  /* -- Topbar -- */
  .topbar {
    padding: 0 10px;
    gap: 8px;
  }
  .topbar-title {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .topbar-search {
    display: none;
  }
  .topbar-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  .clock-btn .clock-label {
    display: none;
  }
  .clock-btn {
    padding: 6px 8px;
  }

  /* -- Page content -- */
  .page-content {
    padding: 12px;
    padding-bottom: 32px;
  }

  /* -- Stat cards: 2 columns -- */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }
  .stats-grid .stat-card:nth-child(n+5) {
    grid-column: span 1;
  }
  .stat-card {
    padding: 12px;
    min-height: auto;
    gap: 10px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .stat-value {
    font-size: 1.2rem;
  }
  .stat-label {
    font-size: 0.7rem;
  }

  /* -- Tables: hide on mobile, show cards -- */
  .table-wrapper {
    display: none;
  }
  .mobile-cards {
    display: block;
  }
  .mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
  }
  .mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
  }
  .mobile-card-header strong {
    font-size: 15px;
    color: var(--text-primary);
  }
  .mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
    color: var(--text-secondary);
    gap: 8px;
  }
  .mobile-card-row .mcr-label {
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .mobile-card-row .mcr-value {
    color: var(--text-primary);
    text-align: right;
  }

  /* -- Quick actions: 2-column grid -- */
  .quick-actions,
  .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .quick-actions .btn,
  .quick-actions a.btn {
    flex: 1 1 calc(50% - 4px);
    min-height: 44px;
    justify-content: center;
    font-size: 13px;
    padding: 10px 8px;
  }

  /* -- Grids -- */
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* -- Detail pages -- */
  .detail-header {
    flex-direction: column;
    gap: 12px;
  }

  /* -- Document views (quotes, invoices) -- */
  .document-view {
    padding: 16px;
  }
  .document-view .doc-header {
    flex-direction: column;
    gap: 12px;
  }
  .document-view .doc-title {
    text-align: left;
  }
  .document-view .doc-parties {
    grid-template-columns: 1fr;
  }

  /* -- Forms -- */
  .form-group input,
  .form-group select,
  .form-group textarea,
  .form-control {
    width: 100%;
  }
  .form-row,
  .form-inline {
    flex-direction: column;
  }

  /* -- Modals -- */
  .modal-overlay .modal,
  .email-modal {
    width: calc(100% - 16px) !important;
    max-width: none !important;
    margin: 8px;
  }

  /* -- Buttons stack / wrap -- */
  .detail-actions,
  .page-toolbar .btn-group {
    flex-wrap: wrap;
  }
  .detail-actions .btn,
  .page-toolbar .btn {
    min-height: 44px;
  }

  /* -- Page toolbar -- */
  .page-toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .page-toolbar input[type="text"],
  .page-toolbar input[type="search"],
  .page-toolbar select {
    width: 100%;
  }
  .page-toolbar .search-wrapper {
    max-width: none;
    min-width: 0;
  }
  .page-toolbar .search-input {
    max-width: none;
    min-width: 0;
  }
  .page-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  /* -- Status tabs: horizontal scroll -- */
  .status-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .status-tabs::-webkit-scrollbar {
    display: none;
  }
  .status-tab {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 12px;
  }

  /* -- Dispatch board: vertical stack -- */
  .dispatch-layout {
    flex-direction: column;
  }
  .dispatch-unassigned {
    width: 100%;
    min-width: unset;
  }
  .dispatch-tech-columns,
  .dispatch-techs {
    flex-direction: column;
  }
  .dispatch-tech-col {
    width: 100%;
  }
  .job-info-grid {
    grid-template-columns: 1fr;
  }
  /* Touch drag clone */
  .touch-drag-clone {
    position: fixed;
    z-index: 9999;
    opacity: 0.85;
    pointer-events: none;
    transform: rotate(2deg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    max-width: 280px;
  }
  /* Mobile assign button on job cards */
  .mobile-assign-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
  }
  .mobile-assign-btn:hover { filter: brightness(1.1); }
  .mobile-assign-select {
    display: none;
    width: 100%;
    margin-top: 6px;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
  }
  .mobile-assign-select.show { display: block; }

  /* -- Schedule/Calendar -- */
  .calendar-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .calendar-toolbar .cal-nav {
    order: 1;
    flex-shrink: 0;
  }
  .calendar-toolbar .cal-nav button {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 36px;
  }
  .calendar-toolbar .cal-title {
    order: 3;
    width: 100%;
    font-size: 14px;
    text-align: center;
  }
  .calendar-toolbar .cal-views {
    order: 2;
    margin-left: auto;
  }
  .calendar-toolbar .cal-views button {
    padding: 6px 10px;
    font-size: 12px;
  }
  .calendar-toolbar .filter-select {
    order: 4;
    width: calc(50% - 4px);
  }
  .cal-week-grid .cal-header-cell .cal-day-num {
    font-size: 16px;
  }
  /* Week view horizontal scroll */
  .cal-week-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cal-week-grid .cal-header-row,
  .cal-week-grid .cal-body-row {
    min-width: 840px;
  }
  .cal-week-grid .cal-day-col {
    min-width: 120px;
  }
  /* Month view mobile: compact cells */
  .cal-month-grid .cal-month-cell {
    min-height: 44px;
    padding: 2px;
  }
  .cal-month-grid .cal-month-cell .cal-job {
    display: none;
  }
  .cal-month-cell-dots {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2px;
  }
  .cal-month-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }
  /* Day view mobile: full-width stacked cards */
  .cal-day-view .cal-hour-row {
    flex-direction: column;
  }
  .cal-day-view .cal-hour-label {
    width: 100%;
    min-width: unset;
    padding: 6px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
  }
  .cal-day-view .cal-hour-content {
    padding: 4px 8px;
  }
  .cal-day-view .cal-job {
    padding: 10px 12px !important;
  }
  /* Mobile day job card details */
  .cal-job-tech {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
  }
  .cal-job-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    margin-top: 4px;
  }
  /* Mobile day list view (alternative to hour grid) */
  .cal-day-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .cal-day-mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
  }
  .cal-day-mobile-card:active { background: var(--bg-hover); }
  .cal-day-mobile-card .cdmc-time {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 4px;
  }
  .cal-day-mobile-card .cdmc-client {
    font-size: 14px;
    color: var(--text-primary);
  }
  .cal-day-mobile-card .cdmc-service {
    font-size: 13px;
    color: var(--text-secondary);
  }
  .cal-day-mobile-card .cdmc-tech {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
  }
  .cal-day-mobile-card .cdmc-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    margin-top: 6px;
  }

  /* -- Mini map (dashboard) -- */
  .mini-map {
    height: 200px;
  }
  .job-mini-map {
    height: 180px;
  }

  /* -- Map -- */
  .map-container {
    height: calc(100vh - 56px);
    border-radius: 0;
    border: none;
  }
  .map-legend {
    font-size: 13px;
    padding: 10px 14px;
    bottom: 16px;
    left: 8px;
  }

  /* -- Employees -- */
  .emp-stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* -- Reports -- */
  .reports-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .reports-header select {
    width: 100%;
  }
  .reports-grid {
    grid-template-columns: 1fr !important;
  }
  .report-chart-card {
    min-height: 250px;
    width: 100% !important;
    max-width: 100% !important;
  }
  .report-chart-card canvas {
    height: 250px !important;
    max-height: 250px;
    width: 100% !important;
  }
  .reports-stats-row {
    grid-template-columns: 1fr !important;
  }
  .reports-stats-col {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .reports-stats-col .report-stat-card {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }
  .reports-section-title {
    font-size: 15px;
    margin-bottom: 12px;
    margin-top: 8px;
  }

  /* -- Settings -- */
  .settings-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    gap: 0;
  }
  .settings-sidebar {
    position: static;
    width: 100% !important;
    max-width: 100%;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    overflow-x: hidden !important;
    white-space: normal !important;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-bottom: 16px;
    height: auto !important;
    box-sizing: border-box;
  }
  .settings-content {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  /* scrollbar now visible — see rules above */
  .settings-sidebar-title { display: none; }
  .settings-nav-item {
    padding: 6px 10px;
    font-size: 11px;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 20px;
    background: var(--bg-hover);
    gap: 4px;
  }
  .settings-nav-item.active {
    background: var(--accent);
    color: #fff;
  }
  .settings-nav-item .settings-nav-icon { font-size: 14px; width: auto; }
  .export-grid { grid-template-columns: 1fr; }
  .export-grid .btn { width: 100%; }
  .settings-section {
    padding: 16px;
  }
  .settings-demo-notice {
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 12px !important;
  }
  .settings-section .form-row {
    flex-direction: column;
  }
  .settings-section .form-group {
    width: 100%;
  }
  .settings-section .form-control {
    width: 100%;
  }
  .color-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .color-picker-row input[type="color"] {
    width: 48px;
    height: 42px;
    flex-shrink: 0;
  }
  .color-picker-row .color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .logo-upload-area {
    width: 100%;
  }
  .logo-upload-area input[type="file"] {
    width: 100%;
  }
  .logo-preview img {
    max-width: 100%;
    height: auto;
  }
  /* User table → cards on mobile */
  .settings-users-table { display: none; }
  .settings-users-cards { display: block !important; }
  .settings-user-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
  }
  .settings-user-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }
  .settings-user-card-header .user-avatar-sm {
    flex-shrink: 0;
  }
  .settings-user-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
  }
  /* Business hours → stacked cards */
  .hours-row {
    flex-wrap: wrap;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
  }
  .hours-day {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
  }
  .hours-row-times {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .hours-input {
    flex: 1 !important;
    width: auto !important;
  }

  /* -- Date filter -- */
  .date-filter {
    flex-wrap: wrap;
    gap: 6px;
  }
  .date-filter input[type="date"] {
    flex: 1;
    min-width: 0;
  }

  /* -- Toast -- */
  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  /* -- Notification dropdown -- */
  .notification-dropdown {
    width: 280px;
    right: -40px;
  }

  /* -- Line items table in edit pages -- */
  .line-items-table {
    display: block;
  }
  .line-items-table thead {
    display: none;
  }
  .line-items-table tbody,
  .line-items-table tr,
  .line-items-table td {
    display: block;
    width: 100%;
  }
  .line-items-table tr {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
  }
  .line-items-table td {
    padding: 4px 0;
    border: none;
  }
  .line-items-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .line-items-table td input,
  .line-items-table td select,
  .line-items-table td textarea {
    width: 100% !important;
  }

  /* -- Check-in section -- */
  .checkin-section {
    padding: 12px;
  }
  .checkin-entry {
    flex-wrap: wrap;
  }

  /* -- Body when sidebar open: prevent scroll -- */
  body.sidebar-open {
    overflow: hidden;
  }
}

/* ============================================
   Responsive: Small phone (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
  .topbar-title {
    font-size: 13px;
  }
  .stats-grid {
    gap: 6px;
  }
  .stat-card {
    padding: 10px;
    gap: 8px;
  }
  .stat-icon {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  .stat-value {
    font-size: 1.1rem;
  }
  .stat-label {
    font-size: 0.65rem;
  }
  .page-content {
    padding: 8px;
  }
  .mobile-card {
    padding: 12px;
  }
  .quick-actions .btn {
    flex: 1 1 100%;
  }
  .document-view {
    padding: 12px;
  }
  .settings-section {
    padding: 12px;
  }
  .pos-content {
    padding: 12px;
  }
  .notification-dropdown {
    width: 260px;
    right: -60px;
  }
}

/* Print */
@media print {
  .sidebar, .topbar, .page-toolbar, .detail-actions, .btn-group {
    display: none !important;
  }

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

  .document-view {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
}

.notification-dropdown.active {
  display: block;
}

.notification-dropdown .notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
}

.notification-dropdown .notif-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition);
}

.notification-dropdown .notif-item:hover {
  background: var(--bg-hover);
}

.notification-dropdown .notif-item:last-child {
  border-bottom: none;
}

/* Helper classes */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* ============================================
   Phase 2 — Job Status Badges
   ============================================ */
.badge-scheduled { background: var(--accent-light); color: var(--accent); }
.badge-dispatched { background: var(--warning-bg); color: var(--warning); }
.badge-on-the-way { background: var(--warning-bg); color: var(--warning); }
.badge-arrived { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-in-progress { background: var(--success-bg); color: var(--success); }
.badge-complete { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-cancelled { background: var(--danger-bg); color: var(--danger); }

/* Dispatch board job card status colors for new statuses */
.job-card.status-on-the-way { border-left-color: var(--warning); }
.job-card.status-arrived { border-left-color: #60a5fa; }

/* ============================================
   Phase 2 — Calendar / Schedule
   ============================================ */
.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.calendar-toolbar .cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-toolbar .cal-nav button {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
}

.calendar-toolbar .cal-nav button:hover {
  background: var(--border-light);
}

.calendar-toolbar .cal-title {
  font-size: 18px;
  font-weight: 600;
  min-width: 200px;
}

.calendar-toolbar .cal-views {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  margin-left: auto;
}

.calendar-toolbar .cal-views button {
  background: var(--bg-secondary);
  border: none;
  border-right: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition);
}

.calendar-toolbar .cal-views button:last-child { border-right: none; }
.calendar-toolbar .cal-views button:hover { background: var(--bg-hover); color: var(--text-primary); }
.calendar-toolbar .cal-views button.active { background: var(--accent); color: #fff; }

/* Week/Day view grid */
.cal-week-grid {
  display: grid;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--bg-card);
  min-width: 0;
}

.cal-week-grid .cal-header-row {
  display: grid;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  min-width: 700px;
}

.cal-week-grid .cal-header-cell {
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-color);
}

.cal-week-grid .cal-header-cell:last-child { border-right: none; }
.cal-week-grid .cal-header-cell.today { color: var(--accent); background: var(--accent-light); }

.cal-week-grid .cal-header-cell .cal-day-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-top: 2px;
}

.cal-week-grid .cal-header-cell.today .cal-day-num { color: var(--accent); }

.cal-week-grid .cal-body-row {
  display: grid;
  min-height: 480px;
  min-width: 700px;
}

.cal-week-grid .cal-day-col {
  border-right: 1px solid var(--border-color);
  padding: 6px 12px 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  min-width: 120px;
  overflow: hidden;
}
.cal-week-grid .cal-day-col .cal-job {
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
}
.cal-week-grid .cal-day-col .cal-job .cal-job-client,
.cal-week-grid .cal-day-col .cal-job .cal-job-service {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-week-grid .cal-day-col:last-child { border-right: none; overflow: visible; }
.cal-week-grid .cal-day-col.today { background: rgba(59, 130, 246, 0.03); }

/* Calendar job card */
.cal-job {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid;
  line-height: 1.4;
}

.cal-job:hover { filter: brightness(1.2); transform: translateY(-1px); }

.cal-job .cal-job-time { font-weight: 600; }
.cal-job .cal-job-client { opacity: 0.9; }
.cal-job .cal-job-service { opacity: 0.7; font-size: 11px; }

.cal-job.status-scheduled {
  background: var(--accent-light);
  border-left-color: var(--accent);
  color: var(--accent);
}

.cal-job.status-dispatched {
  background: var(--warning-bg);
  border-left-color: var(--warning);
  color: var(--warning);
}

.cal-job.status-in-progress {
  background: var(--success-bg);
  border-left-color: var(--success);
  color: var(--success);
}

.cal-job.status-complete {
  background: rgba(139, 92, 246, 0.1);
  border-left-color: #8b5cf6;
  color: #8b5cf6;
}

/* Month view */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.cal-month-grid .cal-month-header {
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.cal-month-grid .cal-month-header:last-child { border-right: none; }

.cal-month-grid .cal-month-cell {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition);
}

.cal-month-grid .cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-grid .cal-month-cell:hover { background: var(--bg-hover); }
.cal-month-grid .cal-month-cell.other-month { opacity: 0.35; }
.cal-month-grid .cal-month-cell.today { background: rgba(59, 130, 246, 0.05); }

.cal-month-grid .cal-month-cell .cell-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.cal-month-grid .cal-month-cell.today .cell-date { color: var(--accent); }

.cal-month-grid .cal-month-cell .cal-job {
  font-size: 11px;
  padding: 3px 6px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Day view */
.cal-day-view {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.cal-day-view .cal-hour-row {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  min-height: 60px;
}

.cal-day-view .cal-hour-row:last-child { border-bottom: none; }

.cal-day-view .cal-hour-label {
  width: 70px;
  padding: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
}

.cal-day-view .cal-hour-content {
  flex: 1;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.cal-day-view .cal-hour-content:hover { background: var(--bg-hover); }

/* ============================================
   Phase 2 — Dispatch Board
   ============================================ */
.dispatch-layout {
  display: flex;
  gap: 20px;
  min-height: calc(100vh - var(--topbar-height) - 120px);
}

.dispatch-unassigned {
  min-width: 320px;
  width: 320px;
  flex-shrink: 0;
}
.dispatch-unassigned .card > div:last-child {
  padding: 8px;
}

.dispatch-techs {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  display: flex;
  gap: 12px;
  padding-right: 24px;
  padding-bottom: 24px;
  flex-wrap: nowrap;
}

/* Visible scrollbar hint */
.dispatch-techs::-webkit-scrollbar {
  height: 8px;
}
.dispatch-techs::-webkit-scrollbar-track {
  background: var(--bg-secondary, #f1f1f1);
  border-radius: 4px;
}
.dispatch-techs::-webkit-scrollbar-thumb {
  background: var(--text-muted, #999);
  border-radius: 4px;
}
.dispatch-techs::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary, #666);
}

.dispatch-tech-col {
  min-width: 280px;
  width: auto;
  flex: 1 0 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.dispatch-tech-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.dispatch-tech-header .tech-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.dispatch-tech-header .tech-info { flex: 1; }
.dispatch-tech-header .tech-name { font-size: 14px; font-weight: 600; }
.dispatch-tech-header .tech-meta { font-size: 12px; color: #94a3b8; line-height: 1.6; }

.dispatch-tech-body {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

/* Drag and drop */
.job-card[draggable="true"] {
  cursor: grab;
}
.job-card[draggable="true"]:active {
  cursor: grabbing;
}
.job-card.dragging {
  opacity: 0.4;
}
.dispatch-tech-col.drag-over {
  outline: 2px solid var(--accent, #4f6df5);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent, #4f6df5) 6%, var(--bg-card));
}
.dispatch-tech-body.drag-over-body {
  background: color-mix(in srgb, var(--accent, #4f6df5) 4%, transparent);
}

/* Job card (shared in dispatch + list) */
.job-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid var(--border-color);
}

.job-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.job-card.status-scheduled { border-left-color: var(--accent); }
.job-card.status-dispatched { border-left-color: var(--warning); }
.job-card.status-in-progress { border-left-color: var(--success); }
.job-card.status-complete { border-left-color: #64748b; }

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

.job-card .job-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.job-card .job-card-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.job-card .job-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.job-card .job-card-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Assign dropdown in dispatch */
.assign-dropdown {
  position: relative;
  display: inline-block;
}

.assign-dropdown select {
  padding: 4px 8px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
}

/* ============================================
   Phase 2 — Job Detail
   ============================================ */
.job-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.job-info-grid .info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.job-info-grid .info-card h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.job-info-grid .info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

.job-info-grid .info-row:last-child { border-bottom: none; }
.job-info-grid .info-row .info-label { color: var(--text-secondary); }
.job-info-grid .info-row .info-value { color: var(--text-primary); font-weight: 500; }

.map-placeholder {
  background: var(--bg-primary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.map-placeholder .map-icon { font-size: 32px; margin-bottom: 8px; }

.notes-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.notes-form input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.notes-form input:focus { border-color: var(--accent); }

/* Status filter tabs */
.status-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.status-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.status-tab:hover { color: var(--text-primary); }
.status-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.status-tab .count {
  background: var(--bg-hover);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 6px;
}

.status-tab.active .count { background: var(--accent-light); color: var(--accent); }

/* Responsive dispatch — handled in main mobile block */

/* ============================================
   Phase 3 — Clock In/Out Button (Topbar)
   ============================================ */
.clock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.clock-btn.clocked-in {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
}
.clock-btn.clocked-in:hover {
  background: rgba(34, 197, 94, 0.25);
}
.clock-btn.clocked-out {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.clock-btn.clocked-out:hover {
  background: var(--border-light);
  color: var(--text-primary);
}
/* Clock label hide — handled in main mobile block */

/* ============================================
   Phase 3 — Employee Status Dots
   ============================================ */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}
.status-dot.green { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.gray { background: var(--text-muted); }

.badge-on-job { background: var(--warning-bg); color: var(--warning); }
.badge-off-duty { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

/* ============================================
   Phase 3 — Check-In / Check-Out Section
   ============================================ */
.checkin-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}
.checkin-section .checkin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.checkin-section .checkin-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.checkin-history {
  margin-top: 16px;
}
.checkin-history .checkin-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.checkin-history .checkin-entry:last-child { border-bottom: none; }
.checkin-history .checkin-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ============================================
   Phase 3 — Map Page
   ============================================ */
.map-container {
  width: 100%;
  height: calc(100vh - var(--topbar-height) - 48px);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  z-index: 1;
  position: relative;
}

/* Ensure Leaflet map stays below sidebar overlay */
.leaflet-container {
  z-index: 1 !important;
}
.map-legend {
  position: absolute;
  bottom: 30px;
  left: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 18px;
  z-index: 1000;
  font-size: 14px;
  color: var(--text-primary);
}
.map-legend h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.map-legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mini-map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.job-mini-map {
  width: 100%;
  height: 250px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* ============================================
   Phase 3 — Field View (Mobile)
   ============================================ */
.field-layout {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}
.field-topbar {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.field-topbar .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}
.field-topbar .field-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.field-hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}
.field-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
}
.field-clock-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 0 16px;
}
.field-clock-bar .field-clock-btn {
  width: 100%;
  max-width: 400px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}
.field-clock-btn.clocked-in {
  background: var(--danger);
  color: #fff;
}
.field-clock-btn.clocked-out {
  background: var(--success);
  color: #fff;
}
.field-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
.field-menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.field-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  z-index: 201;
  transition: left 200ms ease;
  display: flex;
  flex-direction: column;
}
.field-menu.active { left: 0; }
.field-menu-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}
.field-menu-nav {
  padding: 12px 8px;
  flex: 1;
}
.field-menu-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}
.field-menu-nav a:hover, .field-menu-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}
.field-menu-nav a .menu-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.field-job-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 4px solid var(--border-color);
}
.field-job-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.field-job-card.priority-high { border-left-color: var(--warning); }
.field-job-card.priority-emergency { border-left-color: var(--danger); }
.field-job-card.priority-normal { border-left-color: var(--accent); }
.field-job-card.priority-low { border-left-color: var(--text-muted); }
.field-job-card .fjc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.field-job-card .fjc-client {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.field-job-card .fjc-time {
  font-size: 13px;
  color: var(--text-muted);
}
.field-job-card .fjc-address {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field-job-card .fjc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.field-detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.field-detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.field-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
.field-detail-row:last-child { border-bottom: none; }
.field-detail-row .fdr-label { color: var(--text-secondary); }
.field-detail-row .fdr-value { color: var(--text-primary); font-weight: 500; }
.field-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.field-action-buttons .btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  justify-content: center;
}
.phone-link, .address-link {
  color: var(--accent);
  text-decoration: none;
}
.phone-link:hover, .address-link:hover {
  text-decoration: underline;
}

/* ============================================
   Status Rail — Tech Job Progression
   ============================================ */
.status-rail {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 8px;
  margin: 12px 0 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  position: relative;
}

.status-rail-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

.status-rail-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
}

.status-rail-label {
  font-size: 11px;
  text-align: center;
  color: var(--text-secondary);
  max-width: 60px;
  line-height: 1.2;
}

/* Pending step */
.status-rail-step.pending .status-rail-circle {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 2px solid var(--border-color);
}
.status-rail-step.pending .status-rail-label {
  color: var(--text-muted);
}

/* Done step */
.status-rail-step.done .status-rail-circle {
  background: var(--success);
  color: #fff;
  border: 2px solid var(--success);
}
.status-rail-step.done .status-rail-label {
  color: var(--success);
}

/* Active step */
.status-rail-step.active .status-rail-circle {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
  animation: status-pulse 1.5s ease-in-out infinite;
}
.status-rail-step.active .status-rail-label {
  color: var(--accent);
  font-weight: 600;
}

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.15); }
}

/* Connecting line between steps */
.status-rail-line {
  flex: 1;
  height: 3px;
  background: var(--border-color);
  margin-top: 14px;
  min-width: 12px;
}
.status-rail-line.done {
  background: var(--success);
}

/* Status action button wrapper */
.status-action-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.status-action-btn {
  width: 100%;
  padding: 16px 24px !important;
  font-size: 16px !important;
  justify-content: center;
}

/* Secondary actions (check-in/out) */
.field-secondary-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.field-secondary-actions .btn {
  flex: 1;
  font-size: 13px;
}

/* Outline button variants */
.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
}

.btn-outline-warning {
  background: transparent;
  border: 1px solid var(--warning);
  color: var(--warning);
}
.btn-outline-warning:hover {
  background: var(--warning-bg);
}

/* Mobile status rail adjustments */
@media (max-width: 480px) {
  .status-rail {
    padding: 12px 4px;
  }
  .status-rail-circle {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .status-rail-label {
    font-size: 10px;
    max-width: 50px;
  }
  .status-rail-line {
    margin-top: 10px;
    min-width: 8px;
  }
  .status-action-btn {
    padding: 14px 20px !important;
    font-size: 15px !important;
  }
}

/* ============================================
   Status History List — Job Detail
   ============================================ */
.status-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.status-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.status-history-item:last-child {
  border-bottom: none;
}

.status-history-badge {
  flex-shrink: 0;
}

.status-history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-history-time {
  font-size: 13px;
  color: var(--text-primary);
}

.status-history-tech {
  font-size: 12px;
  color: var(--text-muted);
}

/* Dispatch clock indicator */
.dispatch-clock-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dispatch-clock-dot.online { background: var(--success); }
.dispatch-clock-dot.offline { background: var(--text-muted); }

/* Employee tab styles */
.emp-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
/* emp-stats-grid responsive — handled in main mobile block */

/* ============================================
   Phase 4 — Payments & POS
   ============================================ */

/* Payment status badges */
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-refunded { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-partial { background: var(--warning-bg); color: var(--warning); }
.badge-unpaid { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

/* Payment method labels */
.method-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Success banner (paid) */
.success-banner {
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--success);
  font-size: 14px;
  font-weight: 500;
}

/* Refund banner */
.refund-banner {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid #a78bfa;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #a78bfa;
  font-size: 14px;
  font-weight: 500;
}

/* Card input styling */
.card-inputs {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

/* Processing overlay */
.processing-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.processing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
.processing-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.processing-success {
  width: 64px;
  height: 64px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--success);
  margin: 0 auto 16px;
}

/* Receipt print view */
.receipt-view {
  background: #fff;
  color: #1a1a1a;
  border-radius: var(--radius);
  padding: 40px;
  max-width: 500px;
}
.receipt-view .receipt-header {
  text-align: center;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.receipt-view .receipt-header h2 {
  font-size: 20px;
  color: #1a1a1a;
}
.receipt-view .receipt-header p {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}
.receipt-view .receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  color: #374151;
}
.receipt-view .receipt-row.total {
  border-top: 2px solid #e5e7eb;
  margin-top: 12px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 18px;
  color: #1a1a1a;
}
.receipt-view .receipt-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed #d1d5db;
  font-size: 13px;
  color: #6b7280;
}

/* POS layout — mobile-first */
.pos-layout {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}
.pos-topbar {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.pos-topbar .pos-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.pos-topbar .pos-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.pos-content {
  flex: 1;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.pos-step-indicator {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  align-items: center;
}
.pos-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pos-step-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}
.pos-step-label.active {
  color: var(--accent);
  font-weight: 600;
}
.pos-step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
}
.pos-step-dot.active {
  background: var(--accent);
  width: 32px;
  border-radius: 6px;
  border-color: var(--accent);
}
.pos-step-dot.completed {
  background: var(--success);
  border-color: var(--success);
}

/* POS selectable cards */
.pos-select-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.pos-select-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.pos-select-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.pos-select-card .psc-name {
  font-size: 16px;
  font-weight: 600;
}
.pos-select-card .psc-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.pos-select-card .psc-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
}

/* POS method buttons */
.pos-method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.pos-method-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: inherit;
  color: var(--text-primary);
}
.pos-method-btn:hover {
  border-color: var(--accent);
}
.pos-method-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.pos-method-btn .method-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}
.pos-method-btn .method-name {
  font-size: 14px;
  font-weight: 600;
}

/* POS charge button */
.pos-charge-btn {
  width: 100%;
  padding: 18px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: var(--success);
  color: #fff;
  cursor: pointer;
  margin-top: 24px;
  font-family: inherit;
  transition: all var(--transition);
}
.pos-charge-btn:hover {
  background: #16a34a;
}
.pos-charge-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* POS search input */
.pos-search {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  margin-bottom: 16px;
}
.pos-search:focus { border-color: var(--accent); }
.pos-search::placeholder { color: var(--text-muted); }

/* Auto-invoice modal */
.auto-invoice-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.auto-invoice-modal .aim-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}
.auto-invoice-modal .aim-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}
.auto-invoice-modal .aim-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.auto-invoice-modal .aim-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Date range filter */
.date-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-filter input[type="date"] {
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.date-filter input[type="date"]:focus { border-color: var(--accent); }

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 300ms ease;
  max-width: 400px;
}
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Email Modal */
.email-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}
.email-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.email-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.email-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}
.email-modal-header h3 { font-size: 16px; font-weight: 600; }
.email-modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px;
}
.email-modal-close:hover { color: var(--text-primary); }
.email-modal-body { padding: 20px; }
.email-modal-body .form-group { margin-bottom: 14px; }
.email-modal-body .form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 4px;
}
.email-modal-body .form-group input,
.email-modal-body .form-group textarea {
  width: 100%; padding: 8px 12px;
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 14px; font-family: inherit;
}
.email-modal-body .form-group textarea { min-height: 160px; resize: vertical; }
.email-modal-body .form-group input:focus,
.email-modal-body .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.email-modal-body .pay-link-box {
  margin-top: 8px; padding: 10px 12px;
  background: var(--bg-primary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: space-between; gap: 8px;
}
.email-modal-body .pay-link-box a {
  color: var(--accent); font-size: 13px; word-break: break-all;
}
.email-modal-body .pay-link-box button {
  white-space: nowrap;
}
.email-modal-body .pay-link-note {
  font-size: 12px; color: var(--text-muted); margin-top: 6px; font-style: italic;
}
.email-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border-color);
}

/* Email icon button for table rows */
.btn-email-icon {
  background: none; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  width: 30px; height: 30px; display: inline-flex;
  align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; padding: 0;
  transition: all var(--transition);
}
.btn-email-icon:hover {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-light);
}

@media print {
  .pos-topbar, .pos-step-indicator, .field-topbar, .field-clock-bar, .field-menu, .field-menu-overlay {
    display: none !important;
  }
  .receipt-view {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 100%;
  }
  .email-modal-overlay { display: none !important; }
}

.sidebar-logo-img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: contain;
  flex-shrink: 0;
}

/* ============================================
   Settings Page
   ============================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  min-height: calc(100vh - var(--topbar-height) - 48px);
}

.settings-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 8px;
  height: fit-content;
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}

.settings-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px 8px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.settings-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.settings-nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.settings-nav-item.locked {
  opacity: 0.5;
}

.settings-nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.settings-content {
  min-width: 0;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.settings-subsection-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  margin-top: 4px;
}

.settings-demo-notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--warning);
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .settings-layout *,
  .settings-content *,
  .settings-section * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  body:has(.settings-layout) {
    overflow-x: hidden !important;
  }
  body:has(.settings-layout) .main-content {
    overflow-x: hidden;
    max-width: 100vw;
  }
  body:has(.settings-layout) .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  .settings-content {
    overflow-x: hidden;
    max-width: 100vw;
    padding: 12px;
    box-sizing: border-box;
  }
  .settings-demo-notice {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .settings-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
}

/* Logo upload */
.logo-upload-area {
  padding: 16px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.logo-preview img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  padding: 4px;
}

/* Color picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.color-picker-row input[type="color"] {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--bg-input);
  cursor: pointer;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}
.color-value {
  font-size: 13px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Toggle switch */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}
.toggle-label input { display: none; }
.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--bg-hover);
  border-radius: 11px;
  position: relative;
  transition: background var(--transition);
}
.toggle-switch::after {
  content: '';
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
}
.toggle-label input:checked + .toggle-switch {
  background: var(--accent);
}
.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(18px);
}

/* Categories */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius);
}
.category-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-name {
  flex: 1;
  font-size: 14px;
}

/* User management */
.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}

/* Business hours */
.business-hours-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hours-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.hours-day {
  width: 100px;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}
.hours-row-times {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hours-input {
  width: 120px !important;
  padding: 6px 8px !important;
  font-size: 13px !important;
}
.toggle-sm .toggle-switch {
  width: 34px;
  height: 18px;
}
.toggle-sm .toggle-switch::after {
  width: 14px;
  height: 14px;
}
.toggle-sm input:checked + .toggle-switch::after {
  transform: translateX(16px);
}
.closed-label {
  font-size: 13px;
  color: var(--danger);
  font-weight: 500;
}

/* Desktop defaults: hide mobile-only elements — kept here but overridden via !important in media queries */

/* Export grid */
.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.export-btn {
  justify-content: flex-start !important;
  padding: 12px 16px !important;
}

/* Locked overlay */
.settings-locked-overlay {
  text-align: center;
  padding: 48px 24px;
}
.locked-content {
  color: var(--text-muted);
}
.locked-content h3 {
  font-size: 18px;
  margin: 12px 0 8px;
  color: var(--text-secondary);
}
.locked-content p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* ============================================
   Reports Page
   ============================================ */
.reports-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.reports-section {
  margin-bottom: 32px;
}

.reports-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.report-chart-card {
  min-height: 340px;
  position: relative;
}
.report-chart-card canvas {
  max-height: 300px;
  min-height: 240px;
}

.reports-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.reports-stats-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.report-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.report-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.reports-header ~ .reports-section {
  min-width: 0;
}

#pageContent:has(.reports-header) {
  min-width: 900px;
}

/* Invoice footer */
.doc-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

/* Settings responsive — handled in main mobile block */
@media (max-width: 768px) {
  .settings-layout {
    min-height: unset !important;
    gap: 50px !important;
  }
  .settings-sidebar {
    margin-bottom: 50px !important;
    min-height: unset !important;
    height: auto !important;
  }
}

/* ============================================
   Phase 10: Reviews & Reputation Styles
   ============================================ */

/* Star Display */
.star-display {
  display: inline-flex;
  gap: 2px;
  font-size: 18px;
  line-height: 1;
}

.star-filled {
  color: var(--warning);
}

.star-empty {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Clickable star rating input */
.star-rating-input {
  display: flex;
  gap: 8px;
  font-size: 32px;
}

.star-rating-input .star-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  opacity: 0.5;
  transition: all var(--transition);
}

.star-rating-input .star-btn:hover,
.star-rating-input .star-btn.active {
  color: var(--warning);
  opacity: 1;
  transform: scale(1.1);
}

/* Review Section on Job Detail */
.review-section {
  border-top: 3px solid var(--warning);
}

.review-prompt {
  text-align: center;
  padding: 32px 16px;
}

.review-prompt-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.review-prompt p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.review-display {
  padding: 16px 0;
}

.review-rating-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.review-rating-display .star-display {
  font-size: 24px;
}

.review-rating-num {
  font-size: 18px;
  font-weight: 600;
  color: var(--warning);
}

.review-text {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.6;
  font-style: italic;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.review-meta {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.review-pending {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}

.review-pending-info p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text-primary);
}

.review-pending-info .review-meta {
  margin-top: 4px;
}

@media (max-width: 600px) {
  .review-pending {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Reviews Admin Page */
.reviews-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.reviews-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.reviews-header .avg-rating {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
}

.reviews-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.review-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.review-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.review-stat-value.stars {
  color: var(--warning);
}

.review-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Star distribution chart */
.star-distribution {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.star-distribution h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.star-dist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.star-dist-label {
  width: 30px;
  font-size: 14px;
  font-weight: 600;
  color: var(--warning);
  text-align: right;
}

.star-dist-bar-wrap {
  flex: 1;
  height: 20px;
  background: var(--bg-primary);
  border-radius: 10px;
  overflow: hidden;
}

.star-dist-bar {
  height: 100%;
  background: var(--warning);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.star-dist-count {
  width: 40px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
}

/* Recent reviews list */
.reviews-list {
  margin-bottom: 24px;
}

.reviews-list h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.review-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.review-item-client {
  font-weight: 600;
  color: var(--text-primary);
}

.review-item-stars {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-item-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.review-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.review-item-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

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

/* Pending requests section (collapsible) */
.pending-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.pending-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  user-select: none;
}

.pending-section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-count {
  background: var(--warning-bg);
  color: var(--warning);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.pending-toggle-icon {
  font-size: 18px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.pending-section.collapsed .pending-toggle-icon {
  transform: rotate(-90deg);
}

.pending-section-content {
  padding: 0 16px 16px;
  display: block;
}

.pending-section.collapsed .pending-section-content {
  display: none;
}

.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

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

.pending-item-info {
  flex: 1;
  min-width: 200px;
}

.pending-item-client {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pending-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

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

/* Customer Portal Review Prompt */
.review-prompt-card {
  background: linear-gradient(135deg, var(--warning) 0%, #f97316 100%);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  color: #fff;
  text-align: center;
}

.review-prompt-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.review-prompt-card .job-info {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 20px;
}

.review-prompt-card .star-rating-input .star-btn {
  color: #fff;
  opacity: 0.6;
}

.review-prompt-card .star-rating-input .star-btn:hover,
.review-prompt-card .star-rating-input .star-btn.active {
  color: #fff;
  opacity: 1;
}

.review-prompt-card textarea {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  margin: 16px 0;
}

.review-prompt-card .btn-submit-review {
  background: #fff;
  color: var(--warning);
  border: none;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.review-prompt-card .btn-submit-review:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.review-thank-you {
  text-align: center;
  padding: 32px;
}

.review-thank-you h3 {
  font-size: 24px;
  color: var(--success);
  margin-bottom: 12px;
}

.review-thank-you p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.google-review-prompt {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
}

.google-review-prompt h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.google-review-prompt p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.google-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #4285f4;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
}

.google-review-btn:hover {
  background: #3367d6;
}

/* Dashboard Reputation Widget */
.reputation-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

.reputation-widget h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reputation-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.reputation-avg {
  font-size: 36px;
  font-weight: 700;
  color: var(--warning);
}

.reputation-stars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reputation-count {
  font-size: 13px;
  color: var(--text-muted);
}

.recent-reviews-mini {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-review-mini {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
}

.recent-review-mini .star-display {
  font-size: 12px;
}

.recent-review-mini-content {
  flex: 1;
  min-width: 0;
}

.recent-review-mini-client {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.recent-review-mini-text {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reputation-widget-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

/* Review Settings Stats */
.review-settings-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.review-settings-stat {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.review-settings-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.review-settings-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Utility class */
.mt-24 {
  margin-top: 24px;
}

.mb-24 {
  margin-bottom: 24px;
}

/* ============================================
   Phase 11: Job Costing Styles
   ============================================ */

/* Job Costing Section */
.job-costing-section {
  background: var(--bg-card);
}

.job-costing-section .card-header {
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}

.job-costing-section .card-title {
  font-size: 16px;
  font-weight: 600;
}

/* Costing Stats Grid */
.costing-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.costing-stat {
  text-align: center;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius);
}

.costing-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.costing-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

/* Margin color classes */
.margin-green { color: var(--success); }
.margin-amber { color: var(--warning); }
.margin-red { color: var(--danger); }

/* Revenue vs Cost Bar */
.costing-bar-container {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.costing-bar {
  height: 24px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
}

.costing-bar-cost {
  background: var(--danger);
  height: 100%;
  transition: width 0.3s ease;
}

.costing-bar-profit {
  background: var(--success);
  height: 100%;
  transition: width 0.3s ease;
}

.costing-bar-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
}

/* Costing Table */
.costing-table-wrapper {
  padding: 0 20px 16px;
  overflow-x: auto;
}

.costing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.costing-table th,
.costing-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.costing-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.costing-table td.text-right,
.costing-table th.text-right {
  text-align: right;
}

.costing-table .empty-costs {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

.costing-total-row td {
  border-top: 2px solid var(--border-light);
  border-bottom: none;
  padding-top: 12px;
}

/* Cost type badges */
.badge-labor { background: #3b82f633; color: #60a5fa; }
.badge-material { background: #22c55e33; color: #4ade80; }
.badge-part { background: #06b6d433; color: #22d3ee; }
.badge-equipment { background: #f59e0b33; color: #fbbf24; }
.badge-subcontractor { background: #8b5cf633; color: #a78bfa; }
.badge-other { background: #64748b33; color: #94a3b8; }

/* Add Cost Form */
.add-cost-form {
  padding: 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.add-cost-form h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.cost-form-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 80px 120px;
  gap: 12px;
  margin-bottom: 12px;
}

.cost-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.add-cost-btn-wrapper {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

/* Field View Costs */
.field-costs-list {
  margin-bottom: 12px;
}

.field-cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

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

.field-cost-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-cost-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.field-cost-desc {
  color: var(--text-primary);
}

.field-cost-amount {
  font-weight: 600;
  color: var(--text-primary);
}

.field-cost-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius);
}

.field-cost-form .form-control-sm {
  padding: 6px 8px;
  font-size: 13px;
}

/* Profitability Stats Row */
.profitability-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* Dashboard Low Margin Alert */
.low-margin-alert {
  display: block;
  font-size: 11px;
  color: var(--warning);
  margin-top: 4px;
  text-decoration: none;
}

.low-margin-alert:hover {
  color: var(--danger);
  text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .costing-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
    gap: 12px;
  }

  .costing-stat-value {
    font-size: 18px;
  }

  .cost-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .profitability-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .costing-table {
    font-size: 13px;
  }

  .costing-table th,
  .costing-table td {
    padding: 8px 6px;
  }
}

@media (max-width: 480px) {
  .costing-stats-grid {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    gap: 8px;
  }

  .costing-stat {
    padding: 10px 8px;
  }

  .costing-stat-value {
    font-size: 16px;
  }

  .costing-stat-label {
    font-size: 10px;
  }

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

  .field-cost-form {
    flex-direction: column;
  }

  .field-cost-form .form-control-sm {
    width: 100%;
  }

  .profitability-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}