/* ============================================================
   VRM Live Monitor - Stylesheet
   Black/grey theme, taken from the T-ERP Mobile App design tokens.
   ============================================================ */

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

:root {
  --bg:            #111113;
  --surface:       #1C1D1F;
  --surface-alt:   #232426;
  --surface-hi:    #2A2B2E;
  --accent:        #34C759;
  --accent-light:  #5DD87D;
  --accent-soft:   rgba(52,199,89,0.14);
  --accent-glow:   rgba(52,199,89,0.28);
  --accent-2:      #808080;
  --text-1:        #E8E6E2;
  --text-2:        #8A8A8E;
  --text-3:        #5A5A5E;
  --warn:          #E8850C;
  --danger:        #E84040;
  --info:          #3B8CD4;
  --glass-surface: rgba(255,255,255,0.045);
  --glass-border:  rgba(255,255,255,0.08);
  --radius:         10px;
  --radius-sm:      6px;
}

html { font-size: 14px; }

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

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

code { font-family: "SF Mono", "Fira Code", monospace; font-size: 12px; background: var(--surface-alt); padding: 1px 5px; border-radius: 3px; }

/* ---- Nav ---- */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .brand {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--text-1);
  text-decoration: none;
  margin-right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
nav .brand .brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
nav .brand .brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}


nav a.nav-link {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
nav a.nav-link:hover { color: var(--text-1); background: var(--surface-alt); }
nav a.nav-link.active { color: var(--text-1); background: var(--surface-alt); }

nav .spacer { flex: 1; }
nav .nav-user { color: var(--text-2); font-size: 12px; margin-right: 12px; }
nav .nav-role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-light);
  margin-right: 12px;
}

/* ---- Page layout ---- */
.page-content { padding: 28px 32px; max-width: 1400px; margin: 0 auto; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-subtitle { color: var(--text-2); font-size: 13px; margin-top: 2px; display: block; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ---- Buttons ---- */
.btn-primary {
  background: var(--accent);
  color: #0d0f10;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-light); }
.btn-primary.btn-full { width: 100%; justify-content: center; padding: 11px; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--surface-hi);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text-1); border-color: var(--text-2); }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.btn-danger-ghost:hover { background: rgba(232,64,64,0.1); }

.btn-sm {
  background: var(--surface-alt);
  color: var(--text-2);
  border: 1px solid var(--surface-hi);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.btn-sm:hover { color: var(--text-1); }

.btn-xs {
  background: var(--surface-alt);
  color: var(--text-2);
  border: 1px solid var(--surface-hi);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
}
.btn-xs:hover { color: var(--text-1); }
.btn-xs.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-xs.btn-danger:hover { background: rgba(232,64,64,0.1); }
.btn-xs.btn-approve, .btn-xs.btn-accent {
  color: var(--accent-light);
  border-color: rgba(52,199,89,0.45);
  font-weight: 700;
}
.btn-xs.btn-approve:hover, .btn-xs.btn-accent:hover {
  color: var(--accent-light);
  background: var(--accent-soft);
  border-color: var(--accent);
}


.btn-link { background: none; border: none; color: var(--text-2); font-size: 13px; cursor: pointer; padding: 6px; }
.btn-link:hover { color: var(--text-1); }

/* ---- Tab bar (admin sections, job detail tabs) ---- */
.job-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 24px;
}
.job-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.job-tab:hover { color: var(--text-1); }
.job-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}


/* ---- Cards / panels ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.card-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-2);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header-actions { display: flex; align-items: center; gap: 8px; }

/* ---- Step-template section groups (Job Category Templates tab) ---- */
.st-section { margin-bottom: 24px; }
.st-section:last-child { margin-bottom: 0; }
.st-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}
.st-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ---- Gallery ---- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.gallery-item {
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 1;
}
.gallery-item img, .gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-item .gallery-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 8px 8px 6px;
  font-size: 10px;
  color: var(--text-1);
}
.gallery-empty { color: var(--text-2); font-size: 13px; padding: 20px 0; text-align: center; }

/* ---- Scope checklist ---- */
.scope-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
}
.scope-item:last-child { border-bottom: none; }
.scope-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid var(--surface-hi);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.scope-checkbox.checked { background: var(--accent); border-color: var(--accent); }
.scope-checkbox.checked::after {
  content: '';
  position: absolute;
  top: 3px; left: 6px;
  width: 5px; height: 9px;
  border: solid #0d0f10;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.scope-desc { flex: 1; font-size: 13px; }
.scope-desc.done { color: var(--text-2); text-decoration: line-through; }

/* ---- Status badges ---- */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-enquiry, .status-no_quote_no_availability { background: rgba(128,128,128,0.15); color: var(--accent-2); }
.status-quoted_awaiting_go_ahead { background: rgba(232,133,12,0.15); color: var(--warn); }
.status-in_progress { background: rgba(59,140,212,0.15); color: var(--info); }
.status-completed { background: var(--accent-soft); color: var(--accent-light); }

/* ---- Job search dropdown ---- */
.job-search-wrap { position: relative; max-width: 480px; margin-bottom: 28px; }
.job-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-1);
  padding: 12px 16px;
  font-size: 14px;
  outline: none;
}
.job-search-input:focus { border-color: var(--accent); }
.job-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.job-search-results.open { display: block; }
.job-search-result {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
}
.job-search-result:last-child { border-bottom: none; }
.job-search-result:hover { background: var(--surface-hi); }
.job-search-result-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.job-search-result-meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group select option { background: var(--surface-alt); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.checkbox-row input { width: auto; }

/* ---- Auth pages ---- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); background-image: radial-gradient(circle at 50% 0%, rgba(52,199,89,0.08), transparent 60%); }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.auth-logo {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #0d0f10;
  margin: 0 auto 22px;
}
.auth-logo-img {
  display: block;
  width: 180px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 22px;
}

.auth-title { font-size: 21px; font-weight: 700; text-align: center; margin-bottom: 4px; letter-spacing: 0.3px; }

.auth-subtitle { font-size: 13px; color: var(--text-2); text-align: center; margin-bottom: 30px; }
.auth-error { background: rgba(232,64,64,0.1); border: 1px solid rgba(232,64,64,0.3); color: var(--danger); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.auth-notice { background: var(--accent-soft); border: 1px solid rgba(52,199,89,0.3); color: var(--accent-light); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-footer { text-align: center; margin-top: 22px; font-size: 12px; color: var(--text-2); }
.otp-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: 10px;
  font-weight: 700;
}
.mock-otp-hint { text-align: center; font-size: 12px; color: var(--warn); margin-bottom: 16px; }

/* ---- Flash / notices ---- */
.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 13px; }
.flash-error { background: rgba(232,64,64,0.1); border: 1px solid rgba(232,64,64,0.3); color: var(--danger); }
.flash-success { background: var(--accent-soft); border: 1px solid rgba(52,199,89,0.3); color: var(--accent-light); }

/* ---- Data table ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2);
  border-bottom: 1px solid var(--glass-border);
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--glass-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-alt); }

/* ---- Detail rows ---- */
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--glass-border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: var(--text-2); flex-shrink: 0; margin-right: 16px; }

/* ---- Lightbox ---- */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 40px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img, .lightbox-overlay video { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); }
.lightbox-close { position: absolute; top: 24px; right: 32px; color: var(--text-1); font-size: 28px; cursor: pointer; background: none; border: none; }

/* ---- Utilities ---- */
.muted { color: var(--text-2); }
.muted3 { color: var(--text-3); }
.mono { font-family: "SF Mono", "Fira Code", monospace; font-size: 12px; }
.small { font-size: 11px; }
.empty-state { color: var(--text-2); font-size: 13px; padding: 24px 0; text-align: center; }
.section-divider { height: 1px; background: var(--glass-border); margin: 20px 0; }

/* ---- KPI strip ---- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-tile::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.kpi-tile.brand::before { background: var(--accent); }
.kpi-tile.warn::before { background: var(--warn); }
.kpi-tile.info::before { background: var(--info); }
.kpi-tile.danger::before { background: var(--danger); }
.kpi-tile.neutral::before { background: var(--accent-2); }
.kpi-tile-number { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.kpi-tile-label { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-2); }

/* ---- Job grid ---- */
.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.job-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  display: flex;
  gap: 14px;
  align-items: center;
}
.job-card:hover { border-color: var(--accent); }
.job-card-body { flex: 1; min-width: 0; }
.job-card-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.job-card-meta { font-size: 11px; color: var(--text-2); margin-bottom: 8px; }
.job-card-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.job-card-updated { font-size: 10px; color: var(--text-3); }
.job-card-blocked { color: var(--danger); font-weight: 700; }

/* ---- Donut (fleet-style conic-gradient, no chart library) ---- */
.donut-wrap { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.donut {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  position: relative;
}
.donut-hole {
  position: absolute;
  top: 8px; left: 8px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-number { font-size: 13px; font-weight: 800; line-height: 1; color: var(--text-1); }

/* ---- Job detail layout - left sidebar + main content ---- */
.job-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.job-sidebar {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 72px;
}
.sidebar-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  position: relative;
}
.sidebar-item:hover { color: var(--text-1); border-color: var(--text-2); }
.sidebar-item.active { color: var(--accent-light); border-color: rgba(52,199,89,0.35); background: var(--accent-soft); }
.sidebar-item.staff-only::before {
  content: 'STAFF';
  font-size: 8px;
  font-weight: 700;
  color: var(--info);
  background: rgba(59,140,212,0.15);
  padding: 1px 5px;
  border-radius: 8px;
  margin-right: 6px;
  flex-shrink: 0;
}
.sidebar-item-label { display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item-progress { font-size: 11px; color: var(--text-3); font-weight: 700; flex-shrink: 0; }
.sidebar-item.active .sidebar-item-progress { color: var(--accent-light); }

.job-main { flex: 1; min-width: 0; }

.sidebar-toggle {
  display: none;
  margin-bottom: 16px;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  color: var(--text-1);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}

/* ---- Section progress bar (redesigned, sits at top of each section) ---- */
.section-progress {
  margin-bottom: 20px;
}
.section-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-progress-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-2); }
.section-progress-pct { font-size: 12px; font-weight: 800; color: var(--accent-light); }
.section-progress-track {
  display: flex;
  gap: 4px;
}
.section-progress-seg {
  flex: 1;
  height: 6px;
  border-radius: 100px;
  background: var(--surface-hi);
  transition: background 0.2s;
}
.section-progress-seg.complete { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }

/* ---- Mark As Complete button (per card) - prominent green states ---- */
.btn-mark-complete {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid rgba(52,199,89,0.45);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-mark-complete:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-mark-complete.done {
  color: #0d0f10;
  border-color: var(--accent);
  background: var(--accent);
}
.btn-mark-complete.done:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-mark-complete .mark-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}
.btn-mark-complete.done .mark-dot { background: currentColor; border-color: currentColor; }

/* ---- Edit Steps modal (Add / Remove steps for a section) ---- */
.edit-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
}
.edit-step-row:last-of-type { border-bottom: none; }
.edit-step-label { font-size: 13px; color: var(--text-1); flex: 1; }
.edit-step-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.step-no-count-tag { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.3px; }
.edit-step-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}
.edit-step-add input[type="text"] {
  flex: 1;
  min-width: 160px;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}
.edit-step-add input[type="text"]:focus { border-color: var(--accent); }

.btn-ghost-danger {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--surface-hi);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost-danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---- Excel preview table (in-page document viewing) ---- */
.preview-table-wrap { max-height: 70vh; overflow: auto; background: var(--surface); border-radius: var(--radius-sm); padding: 12px; }
.preview-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.preview-table td { border: 1px solid var(--surface-hi); padding: 4px 8px; white-space: nowrap; color: var(--text-1); }
.pdf-viewer-frame { width: 80vw; height: 85vh; border: none; border-radius: var(--radius-sm); background: #fff; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .page-content { padding: 16px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .job-grid { grid-template-columns: 1fr; }

  .job-layout { flex-direction: column; }
  .sidebar-toggle { display: flex; }
  .job-sidebar {
    display: none;
    position: fixed;
    inset: 0;
    top: 56px;
    background: var(--bg);
    z-index: 200;
    padding: 20px;
    overflow-y: auto;
    width: auto;
  }
  .job-sidebar.open { display: flex; }
}

/* ---- Lightbox toolbar (Download / Open in New Tab) ---- */
.lightbox-toolbar {
  position: absolute;
  top: 24px;
  right: 76px;
  display: flex;
  gap: 8px;
  z-index: 10;
}
.lightbox-tool-btn {
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  color: var(--text-1);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.lightbox-tool-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-light); }

/* ---- Custom date/time picker ---- */
.date-picker-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.date-picker-text-input {
  flex: 1;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.date-picker-text-input:focus { border-color: var(--accent); }
.date-picker-icon-btn {
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.date-picker-icon-btn:hover { color: var(--accent-light); }

.date-picker-panel {
  position: absolute;
  display: none;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  padding: 14px;
  width: 260px;
  z-index: 2000;
}
.date-picker-panel.open { display: block; }
.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.date-picker-month-label { font-size: 13px; font-weight: 700; color: var(--text-1); }
.date-picker-nav {
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  color: var(--text-1);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.date-picker-nav:hover { border-color: var(--accent); color: var(--accent-light); }
.date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 4px;
}
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.date-picker-day {
  text-align: center;
  padding: 6px 0;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-1);
}
.date-picker-day.empty { cursor: default; }
.date-picker-day:not(.empty):hover { background: var(--surface-alt); }
.date-picker-day.today { color: var(--accent-light); font-weight: 700; }
.date-picker-day.selected { background: var(--accent); color: #0d0f10; font-weight: 700; }
.date-picker-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
}
.date-picker-time-row label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.3px; }
.date-picker-time-input {
  flex: 1;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}
.date-picker-time-input:focus { border-color: var(--accent); }
.date-picker-footer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
}

/* ---- Mandatory Parts bulk edit ---- */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-alt);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.bulk-action-bar select {
  background: var(--surface);
  border: 1px solid var(--surface-hi);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  padding: 6px 10px;
  font-size: 12px;
}

/* ---- Job layout: mobile toggle row (Sections + Timeline buttons) ---- */
.mobile-toggle-row { display: flex; gap: 10px; }

/* ---- Right-hand Job Timeline panel ---- */
.job-timeline {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 96px);
}
.timeline-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-2);
}
.timeline-pin {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  flex-shrink: 0;
}
.timeline-pin-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.timeline-pin-date { font-size: 14px; font-weight: 700; color: var(--text-1); }
.timeline-pin-top .timeline-pin-date { color: var(--accent-light); }

.timeline-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  padding-left: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-hi) transparent;
}
.timeline-scroll::-webkit-scrollbar { width: 6px; }
.timeline-scroll::-webkit-scrollbar-track { background: transparent; }
.timeline-scroll::-webkit-scrollbar-thumb { background: var(--surface-hi); border-radius: 3px; }
.timeline-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.timeline-line {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 5px;
  width: 2px;
  background: var(--surface-hi);
}
.timeline-entry {
  position: relative;
  padding: 0 0 18px 14px;
}
.timeline-entry:last-child { padding-bottom: 2px; }
.timeline-dot {
  position: absolute;
  left: -18px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--surface);
}
.timeline-entry-body { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.timeline-entry-title { font-size: 12px; font-weight: 700; color: var(--text-1); }
.timeline-entry-meta { font-size: 10px; color: var(--text-2); margin-top: 2px; }
.timeline-entry-detail { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* ---- Responsive additions (timeline drawer, lightbox toolbar) ---- */
@media (max-width: 900px) {
  .job-timeline {
    display: none;
    position: fixed;
    inset: 0;
    left: auto;
    top: 56px;
    width: 85vw;
    max-width: 340px;
    max-height: none;
    background: var(--bg);
    z-index: 200;
    padding: 20px;
    box-shadow: -8px 0 32px rgba(0,0,0,0.5);
  }
  .job-timeline.open { display: flex; }

  .lightbox-toolbar { top: 16px; right: 56px; }
  .lightbox-tool-btn { padding: 5px 10px; font-size: 11px; }
}

/* ---- Scope of Work item cards ---- */
.scope-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.scope-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.scope-item-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--text-3);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.scope-item-checkbox:hover { border-color: var(--accent); }
.scope-item-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.scope-item-checkbox.checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.scope-item-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  background: var(--surface-hi);
  border: 1px solid var(--glass-border);
}
.scope-item-thumb-empty {
  cursor: default;
  border: 1px dashed var(--surface-hi);
  background: transparent;
}
.scope-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scope-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  overflow-wrap: anywhere;
}
.scope-item-label.done {
  text-decoration: line-through;
  color: var(--text-2);
  font-weight: 500;
}
.scope-item-comment {
  font-size: 11px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.scope-item-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- Homescreen "Now: <stage>" chip ---- */
.job-card-stage-chip {
  margin-left: 6px;
}

/* ---- Job Completion section (checklist + report packs) ---- */
.completion-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.completion-step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.completion-step-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--text-3);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.completion-step-check:hover { border-color: var(--accent); }
.completion-step-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.completion-step-check.checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.completion-step-label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  overflow-wrap: anywhere;
}
.completion-step-label.done {
  text-decoration: line-through;
  color: var(--text-2);
  font-weight: 500;
}

.report-pack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13px;
}
.report-pack-row:last-child { border-bottom: none; }
.report-pack-meta { color: var(--text-2); overflow-wrap: anywhere; }
.report-pack-link {
  flex-shrink: 0;
  color: var(--accent-light);
  font-weight: 600;
}


/* ============================================================
   Parts section (rework)
   Batch blocks, per-batch visibility selector + dates, PO/invoice
   upload area, wide scrollable inline-editable table, and the
   read-only customer summary cards. Black/grey palette, ASCII only.
   ============================================================ */

/* Horizontal scroll wrapper for the wide parts table so narrow
   viewports do not squash the columns. */
.parts-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* One titled block per batch (and one for unbatched parts). */
.parts-batch-block {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  padding: 12px;
  background: var(--glass-surface);
}
.parts-batch-block:first-child { margin-top: 6px; }

.parts-batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.parts-batch-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.parts-batch-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

/* Row of batch-level controls: visibility selector + the two dates
   + the Save Dates button. */
.parts-batch-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 10px;
}
.parts-batch-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.parts-batch-field > span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-2);
}
.parts-batch-field select {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 12px;
  min-width: 200px;
}

/* PO / Invoice upload area for a batch. */
.parts-batch-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.parts-doc-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.parts-doc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

/* Wide internal parts table: tighter, aligned, sticky header. */
.parts-table th, .parts-table td {
  white-space: nowrap;
}
.parts-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  z-index: 1;
}
.parts-table td { vertical-align: middle; }

/* Inline edit inputs inside table cells. */
.parts-table .inline-edit,
.inline-edit {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  font-size: 12px;
  min-width: 120px;
  width: 100%;
}
.parts-table .inline-edit:focus,
.inline-edit:focus {
  outline: none;
  border-color: var(--accent);
}
.parts-table select {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  font-size: 12px;
}

/* Bulk edit bar: allow wrapping when the extra selectors/date inputs
   push it past one line. */
.parts-bulk-bar {
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.parts-bulk-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
}

/* Customer-facing summary cards (opt-in view). */
.parts-cust-card { margin-bottom: 14px; }
.parts-cust-status {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.parts-cust-summary {
  font-size: 13px;
  color: var(--text-2);
}
.parts-cust-names {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}
.parts-cust-names li {
  padding: 7px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13px;
  color: var(--text-1);
}
.parts-cust-names li:last-child { border-bottom: none; }

/* ---------------------------------------------------------------------
   Studio Product Shots (Job Completion "Final Images")
   Source photo + generated studio shot shown side by side for staff.
   --------------------------------------------------------------------- */
.studio-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #2A2B2E);
}
.studio-pair:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.studio-col { display: flex; flex-direction: column; gap: 8px; }
.studio-col-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2, #8A8A8E);
  font-weight: 600;
}
.studio-col .gallery-item {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
}
.studio-col .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.studio-col-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .studio-pair { grid-template-columns: 1fr; }
}


