/* ═══════════════════════════════════════════════
   GrindLeader CRM — Admin Stylesheet
   Brand: Charcoal #1E1E1E + Electric Blue #1B78FF
   ═══════════════════════════════════════════════ */

:root {
  /* GrindLeader brand palette */
  --navy:       #1E1E1E;
  --navy-light: #252525;
  --navy-dark:  #0D0D0D;
  --amber:      #1B78FF;
  --amber-lt:   #5BA3FF;
  --blue:       #5BA3FF;
  --white:      #ffffff;
  --gray-50:    #2a2a2a;
  --gray-100:   #2e2e2e;
  --gray-200:   #3a3a3a;
  --gray-400:   #888888;
  --gray-600:   #aaaaaa;
  --gray-800:   #e8e8e8;
  --green:      #22c55e;
  --red:        #ef4444;
  --orange:     #f97316;
  --purple:     #8b5cf6;

  /* Semantic aliases */
  --surface:    #252525;
  --border:     #333333;
  --text:       #ffffff;
  --text-muted-color: #888888;
  --text-off:   #e8e8e8;

  --sidebar-w:  260px;
  --topbar-h:   64px;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.5), 0 4px 6px rgba(0,0,0,0.3);
}

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

html { font-size: 16px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--navy);
  color: var(--text-off);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-name {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--white);
  line-height: 1;
}

.sidebar-brand-sub {
  display: block;
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.15s;
  position: relative;
  border-radius: 8px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--white);
}

.nav-item.active {
  background: rgba(245,166,35,0.15);
  color: var(--amber);
}

.nav-icon { width: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--amber);
  color: var(--white);
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.nav-badge--red   { background: var(--red);   color: white; }
.nav-badge--green { background: #16a34a;       color: white; }
.nav-badge:empty  { display: none; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  min-width: 0;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--amber);
}

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

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 8px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(239,68,68,0.2);
  color: var(--red);
}

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

/* ─── TOPBAR ─── */
.topbar {
  height: var(--topbar-h);
  background: var(--navy-light);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gray-600);
  padding: 4px;
}

.topbar-title {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--white);
  flex: 1;
}

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

/* ─── NOTIFICATION BELL ─── */
.notif-bell {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-bell:hover { background: var(--surface); color: var(--white); }
.notif-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 900;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ─── NOTIFICATION PANEL ─── */
.notif-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1099;
}
.notif-panel {
  display: none;
  position: fixed;
  top: var(--topbar-h);
  right: 12px;
  width: 360px;
  max-height: 520px;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 1100;
  flex-direction: column;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-list {
  overflow-y: auto;
  flex: 1;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread { background: rgba(27,120,255,0.1); }
.notif-item.unread:hover { background: rgba(27,120,255,0.15); }
.notif-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13px; color: var(--white); margin-bottom: 2px; }
.notif-body  { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time  { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.notif-empty { padding: 40px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }

@media (max-width: 480px) {
  .notif-panel { right: 0; left: 0; width: 100%; border-radius: 0 0 12px 12px; }
}

/* ─── PAGE CONTENT ─── */
.page-content {
  flex: 1;
  padding: 24px;
  padding-bottom: 80px;
}

/* ─── CARDS ─── */
.card {
  background: var(--navy-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.card-title {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: var(--white);
}

.card-body { padding: 20px; }

/* ─── STAT CARDS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
}

.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  letter-spacing: 1px;
  color: var(--white);
  line-height: 1;
}

.stat-value--amber { color: var(--amber); }
.stat-value--green { color: var(--green); }
.stat-value--blue  { color: var(--blue); }

.stat-sub {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 600;
}

.stat-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

/* ─── GRID LAYOUTS ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }

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

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-600);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}

tbody tr:hover { background: rgba(255,255,255,0.04); }
tbody tr:last-child { border-bottom: none; }

td {
  padding: 14px 16px;
  vertical-align: middle;
}

/* ─── BADGES / STATUS ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge--new       { background: rgba(58,168,224,0.15);  color: var(--blue); }
.badge--contacted { background: rgba(139,92,246,0.15);  color: var(--purple); }
.badge--quoted    { background: rgba(245,166,35,0.15);  color: #d97706; }
.badge--booked    { background: rgba(34,197,94,0.15);   color: #16a34a; }
.badge--lost      { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge--scheduled { background: rgba(58,168,224,0.15);  color: var(--blue); }
.badge--progress  { background: rgba(245,166,35,0.15);  color: #d97706; }
.badge--complete  { background: rgba(34,197,94,0.15);   color: #16a34a; }
.badge--invoiced  { background: rgba(139,92,246,0.15);  color: var(--purple); }
.badge--paid      { background: #16a34a;                 color: #ffffff; font-weight: 700; }
.badge--draft     { background: rgba(148,163,184,0.2);  color: var(--gray-600); }
.badge--sent      { background: rgba(58,168,224,0.15);  color: var(--blue); }
.badge--accepted  { background: rgba(34,197,94,0.15);   color: #16a34a; }
.badge--expired   { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge--overdue   { background: rgba(239,68,68,0.15);   color: var(--red); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.1px;
}

.btn--primary {
  background: var(--amber);
  color: var(--white);
}
.btn--primary:hover { background: var(--amber-lt); transform: translateY(-1px); }

.btn--navy {
  background: #1E1E1E;
  color: #ffffff;
}
.btn--navy:hover { background: #2d2d2d; }

.btn--outline {
  background: transparent;
  color: #374151;
  border: 2px solid #d1d5db;
}
.btn--outline:hover { border-color: #1B78FF; color: #1B78FF; }

.topbar .btn--outline {
  color: #e5e7eb;
  border-color: #4b5563;
}
.topbar .btn--outline:hover { border-color: #60a5fa; color: #60a5fa; }
.topbar .btn--outline.btn--navy {
  background: #1B78FF;
  color: #ffffff;
  border-color: #1B78FF;
}

.btn--ghost {
  background: transparent;
  color: var(--gray-600);
  padding: 8px 12px;
}
.btn--ghost:hover { background: var(--gray-200); color: var(--white); }

.btn--danger {
  background: var(--red);
  color: white;
}
.btn--danger:hover { opacity: 0.9; }

.btn--green { background: var(--green); color: white; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--lg { padding: 14px 24px; font-size: 15px; }
.btn--block { width: 100%; justify-content: center; }

/* ─── TOGGLE SWITCH ─── */
.toggle-wrap { display:flex; align-items:center; gap:10px; cursor:pointer; }
.toggle-wrap input[type="checkbox"] { display:none; }
.toggle-track {
  width:44px; height:24px; background:#d1d5db; border-radius:24px;
  position:relative; transition:background 0.2s; flex-shrink:0;
}
.toggle-wrap input:checked + .toggle-track { background:#1B78FF; }
.toggle-thumb {
  position:absolute; width:18px; height:18px; background:#fff;
  border-radius:50%; top:3px; left:3px; transition:left 0.2s;
}
.toggle-wrap input:checked + .toggle-track .toggle-thumb { left:23px; }

/* ─── FORMS ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-off);
  background: var(--navy);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(27,120,255,0.15);
}

.form-input::placeholder { color: var(--gray-400); }

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ─── SEARCH BAR ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-off);
  background: var(--navy);
  outline: none;
  transition: border-color 0.15s;
}

.search-input::placeholder { color: var(--gray-400); }
.search-input:focus { border-color: var(--amber); }

/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--navy-light);
  z-index: 1;
}

.modal-title {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--white);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--red); }

.modal-body { padding: 20px 24px 24px; }

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

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  min-width: 220px;
}

.toast--success { background: var(--green); color: white; }
.toast--error   { background: var(--red); color: white; }
.toast--info    { background: var(--navy); color: white; }

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

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-title { font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; margin-bottom: 20px; }

/* ─── LOADING ─── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--gray-400);
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── FILTER TABS ─── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--navy-dark);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--gray-400);
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tab.active {
  background: var(--navy-light);
  color: var(--amber);
  box-shadow: var(--shadow);
}

/* ─── DETAIL PANEL ─── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-item label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  margin-bottom: 3px;
}

.detail-item span {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}

/* ─── PHOTO UPLOAD ─── */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.photo-upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.photo-upload-zone:hover {
  border-color: var(--amber);
  background: rgba(27,120,255,0.05);
}

.photo-upload-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* ─── CALENDAR ─── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-header {
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gray-400);
}

.cal-day {
  min-height: 80px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.15s;
}

.cal-day:hover { background: #f9fafb; }
.cal-day--today { border-color: var(--amber); background: #fffbeb; }
.cal-day--other-month { opacity: 0.4; }

.cal-date {
  font-size: 12px;
  font-weight: 800;
  color: #6b7280;
  margin-bottom: 4px;
}

.cal-date--today {
  background: var(--amber);
  color: var(--white);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-job-dot {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--navy);
  color: white;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

/* ─── QUOTE/INVOICE BUILDER ─── */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.line-items-table th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 8px;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

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

.line-item-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: var(--navy);
  color: var(--text-off);
}

.totals-box {
  background: var(--navy-dark);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: right;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}

.totals-row--total {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--white);
  border-top: 2px solid var(--gray-200);
  margin-top: 8px;
  padding-top: 8px;
}

/* ─── ROUTE MAP ─── */
.route-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  height: calc(100vh - 130px);
}

.route-list { overflow-y: auto; }
.route-map { border-radius: var(--radius); overflow: hidden; }
.route-map iframe { width: 100%; height: 100%; border: none; }

.route-job-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}

.route-job-card:hover { background: var(--gray-50); }

.route-job-number {
  width: 32px;
  height: 32px;
  background: var(--navy);
  color: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── MOBILE BOTTOM NAV ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy-light);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 0 env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px 8px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  gap: 3px;
  transition: color 0.2s;
  min-height: 56px;
}

.bottom-nav-item span:first-child { font-size: 22px; }
.bottom-nav-item.active { color: var(--amber); }

/* ─── SIDEBAR BACKDROP ─── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

/* ─── MORE MENU (mobile) ─── */
.more-menu-overlay {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}
.more-menu-overlay.open { display: block; }

.more-menu {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy-light);
  border-radius: 20px 20px 0 0;
  z-index: 151;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}
.more-menu.open { display: block; }

.more-menu-handle {
  width: 40px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin: 12px auto 0;
}

.more-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.more-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 12px 20px;
  gap: 4px;
}

.more-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  color: var(--white);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  text-align: center;
}
.more-menu-item:active { background: var(--gray-100); }
.more-menu-item span:first-child { font-size: 30px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .route-container { grid-template-columns: 1fr; }
  .route-map { height: 300px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; }

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

  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn { padding: 8px 12px; font-size: 12px; }

  .page-content {
    padding: 12px;
    padding-bottom: 100px;
  }

  /* Modal slides up from bottom */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }

  /* Calendar */
  .calendar-grid { grid-template-columns: repeat(7, 1fr); }
  .cal-day { min-height: 48px; padding: 4px; }
  .cal-job-dot { display: none; }
  .cal-day.has-jobs::after { content: '•'; color: var(--amber); font-size: 18px; display: block; text-align: center; }

  /* Filter tabs scroll horizontally */
  .filter-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; }
  .filter-tabs::-webkit-scrollbar { display: none; }

  /* Table: smooth horizontal scroll */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* Larger tap targets for table action buttons */
  .btn--sm { padding: 8px 12px; font-size: 12px; }

  /* Route */
  .route-container { grid-template-columns: 1fr; height: auto; }
  .route-map { height: 260px; }

  /* Reports: stack chart pairs on mobile */
  .reports-chart-row { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-title { font-size: 20px; }
}

/* ═══════════════════════════════════════════════
   CONTENT AREA — WHITE + ELECTRIC BLUE THEME
   Sidebar and topbar stay dark charcoal.
   Page interior, cards, tables, modals → white/blue.
   ═══════════════════════════════════════════════ */

/* Page background */
.main { background: #F0F4FF; }
.page-content { background: #F0F4FF; color: #111827; }

/* ── Cards ── */
.card {
  background: #FFFFFF;
  border: 1px solid #D1DCF5;
  box-shadow: 0 1px 4px rgba(27,120,255,0.07);
  color: #111827;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(27,120,255,0.12);
}
.card-header { border-bottom: 1px solid #E8EEFF; }
.card-title { color: #1B78FF; font-weight: 700; }

/* ── Stat cards ── */
.stat-card {
  background: #FFFFFF;
  border: 1px solid #D1DCF5;
  box-shadow: 0 1px 4px rgba(27,120,255,0.07);
}
.stat-label { color: #6B7280; }
.stat-value { color: #1B78FF; }
.stat-compare { color: #6B7280; }
.stat-icon { color: #1B78FF; }

/* ── Tables ── */
thead th {
  color: #1B78FF;
  background: #EEF3FF;
  border-bottom: 2px solid #D1DCF5;
}
tbody tr { border-bottom-color: #F3F4F6; color: #111827; }
tbody td { color: #111827; }
tbody tr:hover { background: #F5F8FF; }

/* ── Search ── */
.search-input {
  background: #FFFFFF;
  color: #111827;
  border-color: #D1DCF5;
}
.search-input::placeholder { color: #9CA3AF; }

/* ── Filter tabs ── */
.filter-tabs { background: transparent; border: none; padding: 0; }
.filter-tab { color: #374151; background: #FFFFFF; border: 1.5px solid #C8D6F0; }
.filter-tab:hover { background: #EEF3FF; border-color: #1B78FF; color: #1B78FF; }
.filter-tab.active { background: #1B78FF; color: #FFFFFF; border-color: #1B78FF; }

/* ── Forms ── */
.form-input, .form-select, .form-textarea {
  background: #FFFFFF;
  color: #111827;
  border-color: #D1D5DB;
}
.form-input::placeholder { color: #9CA3AF; }
.form-label { color: #374151; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #1B78FF;
  box-shadow: 0 0 0 3px rgba(27,120,255,0.12);
}

/* ── Modals ── */
.modal {
  background: #FFFFFF;
  border: 1px solid #D1DCF5;
  color: #111827;
  box-shadow: 0 20px 60px rgba(27,120,255,0.15);
  /* re-scope dark vars so inner elements using them go light */
  --navy:       #FFFFFF;
  --navy-light: #F8FAFF;
  --navy-dark:  #EEF3FF;
  --gray-50:    #F8FAFF;
  --gray-100:   #F0F4FF;
  --gray-200:   #E8EEFF;
  --border:     #E2E8FF;
  --text-off:   #374151;
  --surface:    #F8FAFF;
}
.modal-header {
  background: #1B78FF;
  border-bottom: none;
}
.modal-title { color: #FFFFFF; }
.modal-close { color: rgba(255,255,255,0.8); }
.modal-close:hover { color: #FFFFFF; background: rgba(255,255,255,0.15); }
.modal-body { color: #374151; }
.modal-body p, .modal-body label { color: #374151; }
.modal-body td, .modal-body th { color: #111827; }

.modal .form-input,
.modal .form-select,
.modal .form-textarea {
  background: #FFFFFF;
  color: #111827;
  border-color: #D1D5DB;
}
.modal .form-label { color: #374151; }

/* totals box (quotes, invoices, jobs) */
.modal .totals-box { background: #EEF3FF; }
.modal .totals-row { color: #374151; }
.modal .totals-row--total { color: #111827; border-top-color: #C8D6F0; }

/* detail-item (phone, email, address rows) */
.modal .detail-item span { color: #111827; }
.modal .detail-item label { color: #6B7280; }

/* line-items table inside modal */
.modal .line-items-table th { color: #6B7280; background: #F0F4FF; }
.modal .line-items-table td { color: #111827; }

/* total row */
.modal .invoice-total { color: #111827; border-top-color: #E5E7EB; }

/* stat/info spans */
.modal span { color: inherit; }

/* ── Text utilities in content ── */
.text-muted { color: #6B7280; }
.page-content .text-muted { color: #6B7280; }

/* ─── UTILITIES ─── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-400); font-size: 13px; }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-amber { color: var(--amber); }
.font-mono { font-family: monospace; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-bold { font-weight: 800; }
.w-full { width: 100%; }
