/* =============================================================================
 * vAutoWorkshop — App stylesheet
 * Skinned to the LANDING palette: deep-navy structure + warm amber/copper
 * CTA/accent, amber-soft tints, slate inks, paper content area. System fonts.
 * (Cloned from the vAutoHire SPA shell — token + brand re-skin only; layout,
 *  structure and class names are unchanged so the page-module contract holds.
 *  The legacy --teal* variable names are KEPT as aliases that now carry the
 *  amber accent, so every page module / ui.js hook recolours automatically.)
 * =========================================================================== */
:root {
  /* --- Landing brand palette --------------------------------------------- */
  --navy: #102a43;            /* structure / sidebar / headings */
  --navy-dark: #0a1d30;
  --amber-brand: #e08a2e;     /* PRIMARY action / CTA + accent */
  --amber-brand-dark: #bf6f1c;
  --amber-soft: #fdf1e3;

  /* canonical brand var (legacy name retained — value is now amber) */
  --primary-green: #e08a2e;
  --primary-green-dark: #bf6f1c;
  --green-bg: rgba(224, 138, 46, 0.12);

  /* Gray scale (neutral surfaces, tuned to landing line/ink) */
  --gray-100: #f8fafb;
  --gray-200: #eef1f4;
  --gray-300: #dce2e8;
  --gray-400: #c0cad3;
  --gray-500: #97a4ae;
  --gray-600: #7c8a99;
  --gray-700: #44566a;
  --gray-800: #1b2733;
  --gray-900: #102a43;

  /* Dark surfaces (login backdrop) — navy family */
  --dark-bg: #0a1d30;
  --dark-surface: #102a43;
  --dark-elevated: #1b2733;
  --dark-text-secondary: #7c8a99;

  /* --- Legacy brand aliases (kept so existing JS/CSS hooks recolor safely) -
   * --teal is a legacy alias that now holds the brand amber; many page modules
   * and ui.js reference --teal/--accent/--primary for the brand accent. */
  --teal-brand: var(--amber-brand);
  --teal-brand-dark: var(--amber-brand-dark);
  --teal-soft: var(--amber-soft);
  --teal: var(--amber-brand);
  --teal-dark: var(--amber-brand-dark);
  --teal-bg: var(--amber-soft);

  --primary: var(--amber-brand);
  --primary-hover: var(--amber-brand-dark);
  --accent: var(--amber-brand);

  /* Surfaces / text (light content area) */
  --bg: #f8fafb;
  --surface: #ffffff;
  --elevated: #f5f7f9;
  --text: #1b2733;
  --text-secondary: #44566a;
  --text-muted: #7c8a99;

  /* Aliases consumed as fallback vars in injected page styles
   * (checkin.js / reports.js) — defined so off-palette fallbacks never apply. */
  --bg-card: var(--surface);
  --card-bg: var(--surface);
  --bg-hover: var(--elevated);
  --bg-sidebar: var(--sidebar-bg);
  --border-color: var(--border);

  /* Semantic colors (landing-aligned). --success stays a calm green so
   * "ready / completed / collected" reads distinctly from the amber CTA;
   * --warning is the brand amber/copper family. */
  --success: #2f9e6b;
  --success-bg: rgba(47, 158, 107, 0.12);
  --warning: #bf6f1c;
  --warning-bg: rgba(224, 138, 46, 0.14);
  --danger: #c0392b;
  --danger-bg: rgba(192, 57, 43, 0.10);
  --info: #2b6fb8;
  --info-bg: rgba(43, 111, 184, 0.10);

  --border: #dce2e8;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(16, 42, 67, 0.08);
  --shadow-lg: 0 8px 28px rgba(16, 42, 67, 0.16);

  --sidebar-w: 248px;
  --topbar-h: 60px;

  /* Deep-navy sidebar with amber active accent + white active text */
  --sidebar-bg: #102a43;
  --sidebar-text: #b6c4d2;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: var(--amber-brand);
  --sidebar-border: rgba(255, 255, 255, 0.10);

  --tap: 44px; /* minimum tablet tap target */
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

.hidden { display: none !important; }

/* =============================================================================
 * LOGIN
 * =========================================================================== */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-surface) 55%, var(--gray-800) 100%);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.login-logo { color: var(--gray-900); }
.login-logo-accent { color: var(--primary-green); }
.login-tagline { color: var(--text-secondary); margin: 4px 0 24px; font-size: 14px; }

.login-step { display: flex; flex-direction: column; }
.login-hint { color: var(--text-secondary); font-size: 13px; margin-bottom: 14px; }

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255, 59, 48, 0.25);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}

.form-group textarea { resize: vertical; min-height: 88px; }
.form-group select { cursor: pointer; appearance: auto; }

/* Standalone .form-control inputs (used outside .form-group, e.g. compact rows) */
input.form-control, select.form-control, textarea.form-control {
  width: 100%;
  min-height: var(--tap);
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-sizing: border-box;
}
input.form-control:focus, select.form-control:focus, textarea.form-control:focus {
  outline: none;
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  min-height: var(--tap);
}
.checkbox-label input[type="checkbox"] {
  width: 20px; height: 20px; min-height: 0; flex: 0 0 auto; cursor: pointer;
}

.field-help { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1 1 200px; }

/* =============================================================================
 * BUTTONS
 * =========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

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

/* Secondary = neutral gray-700 per design system (primary stays green) */
.btn-secondary { background: var(--gray-700); color: #fff; }
.btn-secondary:hover { background: var(--gray-800); }

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

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

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

.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* =============================================================================
 * APP SHELL LAYOUT
 * =========================================================================== */
#app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.sidebar-header .logo-main { color: #fff; }
.sidebar-header .logo-accent { color: var(--teal); }

#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 20px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); text-decoration: none; }
.nav-item.active {
  color: #fff;
  background: var(--sidebar-hover);
  border-left-color: var(--sidebar-active);
}
.nav-item .nav-icon { font-size: 18px; width: 22px; height: 20px; display: inline-flex; align-items: center; justify-content: center; text-align: center; flex: 0 0 auto; }
.nav-item .nav-icon .vh-icon { display: block; }

/* Inline SVG icon — inherits text colour, sits with the baseline of text */
.vh-icon { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 12px;
  color: var(--text-muted);
}

/* Main column */
#app-body {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
#topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

#hamburger-btn {
  display: none;
  width: var(--tap); height: var(--tap);
  border: none; background: none;
  font-size: 22px; cursor: pointer; color: var(--gray-900);
  border-radius: var(--radius);
}
#hamburger-btn:hover { background: var(--elevated); }

#topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#topbar-context { text-align: right; line-height: 1.25; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.context-label { font-size: 13px; font-weight: 600; color: var(--text); }
.context-sub { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Super-admin View-As control (rendered in topbar context) */
.viewas-control { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; justify-content: flex-end; }
.viewas-input {
  width: 92px; min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
.viewas-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }

/* User menu */
#topbar-user { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 5px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
}
.user-btn:hover { background: var(--elevated); border-color: var(--border); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: 0 0 auto;
}
.user-btn-label { display: flex; flex-direction: column; text-align: left; }
.user-btn-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-btn-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.user-btn-caret { color: var(--text-muted); font-size: 11px; }

.user-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 300;
}
.user-menu-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.user-menu-name { font-weight: 600; font-size: 14px; }
.user-menu-email { font-size: 12px; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  min-height: var(--tap);
  padding: 11px 16px;
  background: none;
  border: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.user-menu-item:hover { background: var(--elevated); }

/* Main scroll area */
#app-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.page-content { max-width: 1280px; }

/* Mobile sidebar overlay */
#sidebar-overlay {
  visibility: hidden;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#sidebar-overlay.active { visibility: visible; opacity: 1; pointer-events: auto; }

/* =============================================================================
 * PAGE HEADER
 * =========================================================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Page toolbar (list search row) + pager + header actions */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.toolbar-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 280px; min-width: 0; }
.toolbar-search input { flex: 1 1 200px; min-width: 0; }
.pager-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* DL photo grid (modal) — wraps + scales thumbs on narrow screens */
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-thumb-link { display: inline-flex; }
.photo-thumb { max-width: 160px; max-height: 120px; }
@media (max-width: 480px) {
  .photo-grid { gap: 8px; }
  .photo-thumb { max-width: 46vw; }
}

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary); font-size: 13px;
  background: none; border: none; cursor: pointer;
  margin-bottom: 14px; min-height: 34px; font-family: inherit;
}
.back-btn:hover { color: var(--gray-900); }

/* =============================================================================
 * CARDS / KPI
 * =========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
}
.kpi-card .kpi-value { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--gray-900); }
.kpi-card .kpi-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 6px; }
.kpi-card.kpi-warning { border-left-color: var(--warning); }
.kpi-card.kpi-danger { border-left-color: var(--danger); }
.kpi-card.kpi-info { border-left-color: var(--info); }

/* Quick-link cards (dashboard) */
.quicklink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.quicklink-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.quicklink-card:hover { border-color: var(--teal); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.quicklink-card.disabled { cursor: default; opacity: 0.6; }
.quicklink-card.disabled:hover { border-color: var(--border); box-shadow: var(--shadow); transform: none; }
.quicklink-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  background: var(--teal-bg);
  color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex: 0 0 auto;
}
.quicklink-icon .vh-icon { width: 24px; height: 24px; }
.quicklink-title { font-weight: 700; font-size: 15px; color: var(--gray-900); }
.quicklink-desc { font-size: 13px; }

/* =============================================================================
 * TABLES
 * =========================================================================== */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
/* Tables can be wider than the viewport on narrow screens — scroll the table
 * body horizontally inside its rounded container rather than break layout. */
.table-container > table { min-width: 100%; }
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }

.search-input, .filter-select {
  min-height: var(--tap);
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}
.search-input { min-width: 220px; }
.search-input:focus, .filter-select:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-bg); }
.filter-select { cursor: pointer; }

table { width: 100%; border-collapse: collapse; }
table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  background: var(--elevated);
  white-space: nowrap;
}
table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table tbody tr { transition: background 0.12s; }
table tbody tr:hover { background: var(--elevated); }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr.clickable { cursor: pointer; }

.table-empty { text-align: center; padding: 48px 16px; color: var(--text-secondary); }

/* =============================================================================
 * BADGES & STATUS PILLS
 * =========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  background: var(--elevated);
  color: var(--text-secondary);
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--amber-soft); color: var(--amber-brand-dark); }
.badge-vip     { background: #fff3cd; color: #7c5a00; }

/* Settings tab bar: wraps to multiple rows on narrow screens. row-gap:0 +
   padding-bottom keeps each row's active-tab underline aligned to the border. */
.vh-settings-tabs { row-gap: 0; padding-bottom: 2px; }

/* Status pills — auto-classed by VH.ui.statusPill(); generic fallback + known */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--elevated);
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.status-pill::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: 0.85;
}
/* Common workshop / booking lifecycle states.
 * "ready / collected / completed" → green (job done, distinct from amber CTA).
 * "in_progress / open / booked" → amber (live work).
 * "cancelled / overdue / off_road" → red. */
.status-pill--ready,
.status-pill--collected,
.status-pill--available,
.status-pill--active,
.status-pill--approved,
.status-pill--passed,
.status-pill--paid,
.status-pill--complete,
.status-pill--completed { background: var(--success-bg); color: var(--success); }

.status-pill--open,
.status-pill--pending,
.status-pill--booked,
.status-pill--reserved,
.status-pill--awaiting,
.status-pill--due,
.status-pill--due_in,
.status-pill--review_required,
.status-pill--in_progress { background: var(--warning-bg); color: var(--warning); }

.status-pill--overdue,
.status-pill--cancelled,
.status-pill--failed,
.status-pill--expired,
.status-pill--rejected,
.status-pill--damaged,
.status-pill--off_road { background: var(--danger-bg); color: var(--danger); }

.status-pill--draft,
.status-pill--returned,
.status-pill--closed,
.status-pill--archived,
.status-pill--unknown { background: var(--elevated); color: var(--text-secondary); }

.status-pill--scheduled,
.status-pill--info,
.status-pill--quoted { background: var(--info-bg); color: var(--info); }

/* =============================================================================
 * MODAL
 * =========================================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-lg { width: 760px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 26px; line-height: 1; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--radius);
}
.modal-close:hover { color: var(--text); background: var(--elevated); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* =============================================================================
 * TOASTS
 * =========================================================================== */
.toast-container {
  position: fixed; top: 18px; right: 18px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: vh-slidein 0.25s ease;
  min-width: 260px;
  max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }
@keyframes vh-slidein { from { transform: translateX(90px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =============================================================================
 * SPINNER / LOADING / EMPTY
 * =========================================================================== */
.loading { display: flex; align-items: center; justify-content: center; padding: 56px; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: vh-spin 0.8s linear infinite;
}
@keyframes vh-spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; color: var(--text); }
.empty-state p { margin-bottom: 20px; }

/* =============================================================================
 * WIZARD STEPPER
 * =========================================================================== */
.wizard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--elevated);
  overflow-x: auto;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.wizard-step:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
  min-width: 24px;
}
.wizard-step.completed:not(:last-child)::after { background: var(--teal); }
.wizard-step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-muted);
}
.wizard-step.active .wizard-step-circle { border-color: var(--teal); color: var(--teal); }
.wizard-step.completed .wizard-step-circle { background: var(--teal); border-color: var(--teal); color: #fff; }
.wizard-step-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.wizard-step.active .wizard-step-label { color: var(--gray-900); }
.wizard-step.completed .wizard-step-label { color: var(--text); }
.wizard-body { padding: 24px 20px; }
.wizard-footer { display: flex; justify-content: space-between; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* =============================================================================
 * DETAIL PAGE
 * =========================================================================== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 22px; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.detail-card h3 { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-secondary); font-size: 13px; }
.detail-row .value { font-weight: 600; font-size: 14px; text-align: right; }

/* Detail page sections (customer detail: Drivers, etc.) */
.detail-section { margin-bottom: 22px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }

/* Forms: stacked field grid + actions row (shared by customer/driver forms) */
.detail-form { display: block; }
.form-grid { display: flex; flex-direction: column; gap: 0; }
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Driver cards (customer detail) */
.drivers-body { display: flex; flex-direction: column; gap: 14px; }
.driver-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
}
.driver-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.driver-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 15px;
  color: var(--text);
}
.driver-card-title strong { font-weight: 700; }
.driver-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.driver-meta { margin: 4px 0 2px; }

/* Licence check history (collapsible inside driver card) */
.check-history { margin-top: 10px; border-top: 1px solid var(--border); }
.check-history-toggle { color: var(--text-secondary); }
.check-history-toggle:hover { color: var(--teal); }
.check-history-toggle .toggle-arrow { color: var(--teal); }
.check-history-body { margin-top: 8px; }

/* DL photo URL list (driver modal) */
.url-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.url-row { display: flex; align-items: center; gap: 8px; }
.url-row input { flex: 1 1 auto; min-width: 0; }

/* Pager label */
.pager-info { font-size: 13px; color: var(--text-secondary); }

/* =============================================================================
 * UTILITIES
 * =========================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.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; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.clickable { cursor: pointer; }

/* =============================================================================
 * RESPONSIVE — sidebar collapses to off-canvas drawer under 800px
 * =========================================================================== */
/* Tablet — sidebar collapses to off-canvas drawer */
@media (max-width: 800px) {
  #sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  #sidebar.open { transform: translateX(0); }
  #app-body { margin-left: 0; }
  #hamburger-btn { display: flex; align-items: center; justify-content: center; }
  /* Keep the dealer/context label but drop the secondary View-As control to
   * avoid topbar overflow; full View-As stays available on desktop. */
  .context-sub { display: none; }
  .viewas-control { display: none; }
  .user-btn-label { display: none; }
  #app-main { padding: 16px; }
  .detail-row .value { text-align: left; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }

  /* Dashboard quick-links: 2 columns on tablet */
  .quicklink-grid { grid-template-columns: 1fr 1fr; }

  /* Wizard: let the stepper scroll, keep step content + footer reachable */
  .wizard-steps { padding: 14px 14px; }
  .wizard-body { padding: 18px 16px; }
  .wizard-footer { padding: 14px 16px; }
}

/* Phone */
@media (max-width: 480px) {
  #topbar { gap: 8px; padding: 0 12px; }
  #topbar-title { font-size: 16px; }
  /* Hide the textual context entirely on phone — title + user menu only */
  #topbar-context { display: none; }
  .page-header h1 { font-size: 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .search-input { min-width: 0; width: 100%; }

  /* Dashboard quick-links: single column on phone */
  .quicklink-grid { grid-template-columns: 1fr; }

  /* Forms: multi-column rows collapse to a single column; inputs full-width */
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group { flex: 1 1 100%; width: 100%; }

  /* Wizard: stepper scrolls horizontally; hide step labels to fit circles;
   * footer buttons stack full-width and stay tappable (≥44px). */
  .wizard-step-label { display: none; }
  .wizard-step:not(:last-child)::after { margin: 0 6px; min-width: 14px; }
  .wizard-footer { flex-direction: column-reverse; gap: 8px; }
  .wizard-footer .btn { width: 100%; }

  /* Modal padding tightens; internal scroll preserved via max-height */
  .modal { max-height: 92vh; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }

  /* Detail + toolbar: full width controls */
  .toolbar-search { flex: 1 1 100%; }
  .toolbar-search input { width: 100%; max-width: none; }
  .page-toolbar { gap: 10px; }
  .page-toolbar .btn-primary { width: 100%; }

  /* Driver cards: header + actions stack; buttons full-width and tappable */
  .driver-card { padding: 16px; }
  .driver-card-header { flex-direction: column; gap: 10px; }
  .driver-card-actions { width: 100%; }
  .driver-card-actions .btn { flex: 1 1 100%; min-height: var(--tap); }
  .section-header { flex-direction: column; align-items: stretch; }
  .section-header .btn { width: 100%; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .url-row .btn { flex: 0 0 auto; }
}

/* ===========================================================================
   Bookings — List/Calendar view toggle + resource-timeline calendar
   (DEV-154 Amend 5)
   =========================================================================== */
.vh-view-toggle { display: inline-flex; gap: 4px; }

/* Horizontal scroll on small screens; the vehicle column stays pinned left. */
.vh-cal { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.vh-cal-inner { min-width: 760px; }

.vh-cal-head,
.vh-cal-row { display: flex; align-items: stretch; }
.vh-cal-head { position: sticky; top: 0; z-index: 3; background: var(--elevated); border-bottom: 1px solid var(--border); }
.vh-cal-row { border-bottom: 1px solid var(--border); }
.vh-cal-row:last-child { border-bottom: 0; }

/* Pinned vehicle column. */
.vh-cal-veh {
  flex: 0 0 180px; width: 180px; box-sizing: border-box;
  padding: 8px 12px; border-right: 1px solid var(--border);
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  display: flex; flex-direction: column; justify-content: center;
}
.vh-cal-head .vh-cal-veh { background: var(--elevated); }
.vh-cal-veh-head { font-weight: 700; color: var(--text-secondary); font-size: 13px; }
.vh-cal-veh-reg { font-weight: 700; color: var(--text); font-size: 14px; }
.vh-cal-veh-mm { font-size: 12px; color: var(--text-muted); }

/* Day columns area — flex row of equal cells; bars overlay absolutely. */
.vh-cal-days { position: relative; display: flex; flex: 1 1 auto; min-height: 44px; }
.vh-cal-day-head { flex: 1 1 0; min-width: 44px; text-align: center; padding: 6px 2px; border-left: 1px solid var(--border); }
.vh-cal-day-head .vh-cal-dow { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.vh-cal-day-head .vh-cal-dom { font-size: 14px; font-weight: 600; color: var(--text); }
.vh-cal-day-head.is-today { background: var(--teal-bg); }
.vh-cal-day-head.is-today .vh-cal-dom { color: var(--teal-dark); }

.vh-cal-cell { flex: 1 1 0; min-width: 44px; border-left: 1px solid var(--border); }
.vh-cal-cell.is-today { background: rgba(31, 158, 143, 0.06); }
.vh-cal-cell.is-bookable { cursor: pointer; }
.vh-cal-cell.is-bookable:hover { background: var(--teal-bg); box-shadow: inset 0 0 0 1px var(--teal); }

/* Booking bars positioned by left%/width% over the day cells. */
.vh-cal-bar {
  position: absolute; top: 5px; bottom: 5px; box-sizing: border-box;
  margin: 0 2px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; line-height: 1; color: #fff; cursor: pointer;
  display: flex; align-items: center; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; z-index: 1;
}
.vh-cal-bar:hover { filter: brightness(1.05); }
.vh-cal-bar--active    { background: var(--teal); }
.vh-cal-bar--draft     { background: var(--text-muted); }
.vh-cal-bar--returned  { background: var(--navy); }

/* ===========================================================================
   vAutoWorkshop — page-specific components
   (Calendar day/list grouped by ECD, process pills, job cards, booking +
    customer detail panels, comms/process timeline, search results.)
   =========================================================================== */

/* ---- Calendar: week strip + day columns ---------------------------------- */
.vw-cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.vw-cal-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vw-cal-range-label { font-weight: 700; font-size: 15px; color: var(--text); }
.vw-cal-nav { display: inline-flex; gap: 4px; }

.vw-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.vw-cal-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vw-cal-colhead {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--elevated);
  text-align: center;
}
.vw-cal-colhead.is-today { background: var(--amber-soft); }
.vw-cal-dow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 700; }
.vw-cal-dom { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2; }
.vw-cal-colhead.is-today .vw-cal-dom { color: var(--amber-brand-dark); }
.vw-cal-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.vw-cal-colbody { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.vw-cal-empty-day { color: var(--text-muted); font-size: 12px; text-align: center; padding: 14px 6px; }

/* ---- Job card (calendar + lists) ----------------------------------------- */
.vw-job-card {
  text-align: left;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gray-400);
  border-radius: var(--radius);
  padding: 9px 11px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex; flex-direction: column; gap: 5px;
}
.vw-job-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-left-color: var(--amber-brand); }
.vw-job-card.is-unbooked { border-left-color: var(--warning); }
.vw-job-reg { font-weight: 800; font-size: 14px; letter-spacing: 0.5px; color: var(--text); }
.vw-job-mm { font-size: 12px; color: var(--text-secondary); }
.vw-job-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vw-job-cust { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.vw-job-advisor { font-size: 11px; color: var(--text-muted); }
.vw-job-addbooking {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--amber-brand-dark);
  background: var(--amber-soft); border-radius: 10px; padding: 2px 8px;
}

/* ---- Process pill (current_process, colour-keyed by hash) ----------------- */
.vw-proc-pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--elevated);
  color: var(--text-secondary);
  border: 1px solid transparent;
}
/* Deterministic colour buckets — picked by a hash of the process name in JS. */
.vw-proc--c0 { background: rgba(43, 111, 184, 0.12);  color: #2b6fb8; }
.vw-proc--c1 { background: rgba(47, 158, 107, 0.13);  color: #248055; }
.vw-proc--c2 { background: rgba(224, 138, 46, 0.15);  color: #a85f12; }
.vw-proc--c3 { background: rgba(155, 89, 182, 0.13);  color: #7d3da3; }
.vw-proc--c4 { background: rgba(192, 57, 43, 0.11);   color: #b5392c; }
.vw-proc--c5 { background: rgba(22, 128, 116, 0.13);  color: #137065; }
.vw-proc--c6 { background: rgba(193, 124, 22, 0.14);  color: #8a6010; }
.vw-proc--c7 { background: rgba(60, 90, 130, 0.13);   color: #3c5a82; }

/* ---- Two-column detail layout (job/booking) ------------------------------ */
.vw-detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.vw-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}
.vw-panel h3 { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.vw-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.vw-panel-head h3 { margin-bottom: 0; }

/* ---- Process timeline (events) ------------------------------------------- */
.vw-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.vw-timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.vw-tl-item { position: relative; padding: 0 0 16px 28px; }
.vw-tl-item:last-child { padding-bottom: 0; }
.vw-tl-dot {
  position: absolute; left: 0; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--amber-brand);
  box-sizing: border-box;
}
.vw-tl-item.is-muted .vw-tl-dot { border-color: var(--gray-400); }
.vw-tl-main { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vw-tl-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.vw-tl-arrow { color: var(--text-muted); font-size: 12px; }

/* ---- Customer search results (typeahead) --------------------------------- */
.vw-cust-results {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.vw-cust-result {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; background: var(--surface);
  border: none; border-bottom: 1px solid var(--border);
  cursor: pointer; font-family: inherit;
}
.vw-cust-result:last-child { border-bottom: none; }
.vw-cust-result:hover { background: var(--elevated); }
.vw-cust-result-name { font-weight: 600; font-size: 14px; color: var(--text); }
.vw-cust-result-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ---- Selected customer chip ---------------------------------------------- */
.vw-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--amber-soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 8px 6px 14px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.vw-chip-x {
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(16,42,67,0.08); cursor: pointer;
  font-size: 15px; line-height: 1; color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.vw-chip-x:hover { background: rgba(16,42,67,0.16); }

/* ---- Channel segmented control ------------------------------------------- */
.vw-segment { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.vw-segment button {
  min-height: 38px; padding: 8px 16px; border: none; background: none;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  color: var(--text-secondary); border-right: 1px solid var(--border);
}
.vw-segment button:last-child { border-right: none; }
.vw-segment button.is-active { background: var(--amber-brand); color: #fff; }

/* ---- Settings read-only key/value tiles ---------------------------------- */
.vw-kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.vw-kv {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.vw-kv-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 700; }
.vw-kv-value { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 4px; word-break: break-word; }
.vw-managed-note {
  display: flex; align-items: center; gap: 8px;
  background: var(--amber-soft); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 18px;
}

/* ---- Login wordmark (SVG mark + text) ------------------------------------ */
.vw-login-mark { display: flex; align-items: center; gap: 12px; }
.vw-login-mark svg { flex: 0 0 auto; }
.vw-login-wordmark { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.vw-login-wordmark .w1 { color: var(--gray-900); }
.vw-login-wordmark .w2 { color: var(--amber-brand); }

/* ---- Sidebar + topbar wordmark ------------------------------------------- */
.vw-brand { display: flex; align-items: center; gap: 9px; }
.vw-brand svg { flex: 0 0 auto; }
.vw-brand-text { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.vw-brand-text .w1 { color: #fff; }
.vw-brand-text .w2 { color: var(--amber-brand); }

/* ==========================================================================
 * Phase 2 — Tasks page + Communications timeline + template list
 * ========================================================================== */

/* Inline link-style button (e.g. the reg cell in the tasks table). */
.vw-link-btn {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--amber-brand-dark);
  text-decoration: underline; text-underline-offset: 2px;
}
.vw-link-btn:hover { color: var(--amber-brand); }

/* Overdue due-time emphasis in the tasks list. */
.vw-task-overdue { color: var(--danger); font-weight: 700; }

/* ---- CitNow button (job detail) ----------------------------------------- */
.vw-citnow-btn { display: inline-flex; align-items: center; gap: 7px; }

/* ---- Communications timeline -------------------------------------------- */
.vw-comms { display: flex; flex-direction: column; gap: 10px; }
.vw-comm {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 11px 13px;
}
.vw-comm-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 5px;
}
.vw-comm-channel {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-secondary);
}
.vw-comm-dir {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px;
}
.vw-comm-time { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.vw-comm-subject { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.vw-comm-body { font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
.vw-comm-body.is-clamped {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.vw-comm-toggle {
  background: none; border: none; padding: 0; margin-top: 4px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--amber-brand-dark);
}
.vw-comm-toggle:hover { color: var(--amber-brand); }

/* Comm status badges — derive from the raw status string via .vw-comm-status--*. */
.vw-comm-status {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 20px; text-transform: capitalize;
  background: var(--elevated); color: var(--text-secondary);
}
.vw-comm-status--sent { background: var(--success-bg); color: var(--success); }
.vw-comm-status--logged { background: var(--info-bg); color: var(--info); }
.vw-comm-status--stubbed { background: var(--warning-bg); color: var(--warning); }
.vw-comm-status--failed { background: var(--danger-bg); color: var(--danger); }
.vw-comm-status--suppressed,
.vw-comm-status--skipped_no_channel { background: var(--elevated); color: var(--text-secondary); }

/* ---- Notification templates (settings, read-only) ----------------------- */
.vw-tpl { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.vw-tpl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.vw-tpl-key { font-weight: 700; font-size: 14px; color: var(--text); }
.vw-tpl-subject { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.vw-tpl-sms { font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word; background: var(--elevated); border-radius: 6px; padding: 8px 10px; }
.vw-tpl-sms-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 3px; }

/* ---- Responsive: detail + calendar collapse ------------------------------ */
@media (max-width: 900px) {
  .vw-detail-cols { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  /* Calendar becomes a vertical stack of day groups (list view). */
  .vw-cal-grid { grid-template-columns: 1fr; gap: 12px; }
  .vw-cal-col { min-height: 0; }
  .vw-cal-colhead { text-align: left; display: flex; align-items: baseline; gap: 10px; }
  .vw-cal-dom { font-size: 16px; }
}
