/* === TOKENS === */
:root {
  /* CALM UI 2026 tokens (REFACTOR_SPEC.md) */
  --crm-bg:#F8FAFC;        /* App Canvas (Slate-50) */
  --crm-surface:#FFFFFF;   /* Surface (Cards/Rows) */
  --crm-muted:#FFFFFF;     /* Header/neutral surface */
  --crm-text:#0F172A;      /* Primary text (Slate-900) */
  --crm-subtle:#64748B;    /* Secondary text (Slate-500) */

  /* Existing utility scale */
  --s-0:0; --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px; --s-6:24px;

  /* Shapes & borders */
  --radius:12px;           /* 12px corners */
  --radius-sm:10px;
  --border:1px solid #E2E8F0; /* 1px border */
  --ring:0 0 0 2px rgba(226,232,240,.75);

  /* Layout */
  --sidebar-w:240px; --sidebar-w-compact:72px; --page-pad-x:20px; --page-pad-y:16px;
}

/* Dark theme override (keep existing behavior) */
body.dark-theme{
  --crm-bg:#0b1220;
  --crm-surface:#0f172a;
  --crm-muted:#111827;
  --crm-text:#e5e7eb;
  --crm-subtle:#94a3b8;
  --border:1px solid #1f2937;
  --ring:0 0 0 2px rgba(148,163,184,.25);
}

/* Ensure CSS variables are applied to body and override any conflicts */
body.appShell {
  --sidebar-w: 240px !important;
  --sidebar-w-compact: 72px !important;
  --page-pad-x: 20px !important;
  --page-pad-y: 16px !important;
}

/* === LIGHT RESET === */
*{box-sizing:border-box}
html,body{height:100%; overflow:hidden}
body{background:var(--crm-bg);color:var(--crm-text)}

/* Header (CALM UI 2026) */
#app-navbar{
  background: #FFFFFF !important;
  border-bottom: 1px solid #E2E8F0 !important;
  min-height: 56px;
}
#app-navbar .navbar-brand,
#app-navbar .nav-link{
  color: #0F172A !important;
}
#app-navbar .nav-link.active{
  font-weight: 700;
}
#app-navbar .nav-link{
  color: #64748B !important;
}
#app-navbar .nav-link.active,
#app-navbar .nav-link:hover{
  color: #0F172A !important;
}
#app-navbar .form-control{
  border: 1px solid #E2E8F0;
  border-radius: 12px;
}

/* Header search: subtle (not dark) */
#app-navbar .search-container .form-control{
  background: #F8FAFC !important;
  color: #0F172A !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 9999px !important;
  box-shadow: none !important;
}
#app-navbar .search-container .form-control::placeholder{
  color: #94A3B8 !important; /* slate-400 */
}

/* Desktop: keep header layout unchanged (flatten wrappers) */
@media (min-width: 769px){
  #app-navbar .nav-actions .nav-quick-actions{
    display: contents;
  }
  #app-navbar .nav-qab-newjob{
    min-width: 160px !important;
  }
}

/* Mobile header layout: 3-row wrap (brand, search, actions) */
@media (max-width: 768px){
  #app-navbar .container-fluid{
    gap: 8px;
    align-items: stretch;
    overflow: visible !important; /* do not clip dropdown menus */
  }
  #app-navbar.navbar {
    overflow: visible !important;
  }
  #app-navbar .navbar-brand{
    margin-right: 0 !important;
  }
  /*
   * IMPORTANT: overflow-x:auto on nav rows clips Bootstrap dropdown menus
   * (More, Follow-up, Notifications). Use visible overflow + wrap instead.
   */
  #app-navbar .navbar-nav{
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    gap: 6px;
  }
  #app-navbar .navbar-nav .nav-link{
    white-space: nowrap;
    padding: 6px 8px;
  }
  /* Dropdowns must paint above page content */
  #app-navbar .dropdown-menu{
    z-index: 1080 !important;
  }
  /* Actions: allow wrap and make search full width */
  #app-navbar .nav-actions{
    flex-wrap: wrap;
    width: 100%;
    gap: 8px !important;
    overflow: visible !important;
  }
  #app-navbar .nav-actions .nav-search{
    flex: 1 1 100% !important;
    max-width: none !important;
  }
  #app-navbar .nav-actions .nav-search .form-control{
    height: 40px !important;
    font-size: 0.95rem;
  }
  /* Quick actions: wrap rows so dropdowns stay visible (no clipping) */
  #app-navbar .nav-actions .nav-quick-actions{
    width: 100%;
    flex-wrap: wrap !important;
    overflow: visible !important;
    padding-bottom: 4px;
    gap: 6px !important;
  }
  #app-navbar .nav-actions .nav-quick-actions > *{
    flex: 0 0 auto;
  }
  /* Remove desktop min-widths so icons don't waste space */
  #app-navbar .nav-actions .btn{
    min-width: auto !important;
  }
  /* Follow-up / notifications: fit narrow screens (position fixed via JS when open) */
  #followupDropdownMenu,
  #notificationDropdownMenu{
    width: min(520px, calc(100vw - 1rem)) !important;
    max-width: calc(100vw - 1rem) !important;
  }

  /* ── Compact header: target ~2 compact rows instead of ~40% viewport ── */
  #app-navbar{
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    min-height: 0 !important;
  }
  #app-navbar .navbar-brand{
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    padding: 2px 0 !important;
    margin-right: 0.5rem !important;
    line-height: 1.2 !important;
  }
  #app-navbar .navbar-nav .nav-link{
    padding: 3px 6px !important;
    font-size: 0.78rem !important;
  }
  #app-navbar .nav-actions{
    gap: 4px !important;
  }
  #app-navbar .nav-actions .nav-search .form-control{
    height: 32px !important;
    font-size: 0.82rem !important;
    padding: 4px 10px !important;
  }
  #app-navbar .nav-actions .nav-quick-actions{
    gap: 4px !important;
    padding-bottom: 2px !important;
  }
  #app-navbar .nav-actions .btn-sm,
  #app-navbar .nav-actions .nav-qab{
    padding: 4px 7px !important;
    min-height: 0 !important;
    line-height: 1 !important;
  }
  #app-navbar .nav-actions a.nav-qab[href*="new_job"],
  #app-navbar .nav-actions .nav-qab{
    min-width: 0 !important;
  }
  #app-navbar .navbar-nav.ms-3 .nav-link{
    padding: 2px 4px !important;
    font-size: 0.78rem !important;
  }
  #app-navbar .navbar-nav.ms-3 .nav-link span:not(.badge){
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }
}

/*
 * Schedule + Dashboard: slim single-row bar on small tablets (769–992px).
 * Phones: dashboard keeps wrapped header; schedule (calendar) uses a compact 2-row bar below.
 */
@media (min-width: 769px) and (max-width: 991.98px) {
  body.schedule-page #app-navbar .container-fluid,
  body.dashboard-page #app-navbar .container-fluid {
    flex-wrap: nowrap !important;
    align-items: center !important;
    align-content: center !important;
    gap: 4px !important;
    row-gap: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
  }
  body.schedule-page #app-navbar,
  body.dashboard-page #app-navbar {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    min-height: 0 !important;
  }
  body.schedule-page #app-navbar .navbar-brand,
  body.dashboard-page #app-navbar .navbar-brand {
    flex: 0 0 auto;
    margin-right: 0 !important;
    padding: 2px 4px !important;
    font-size: 0.72rem !important;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body.schedule-page #app-navbar .navbar-nav.me-3,
  body.dashboard-page #app-navbar .navbar-nav.me-3 {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
    gap: 0 !important;
  }
  body.schedule-page #app-navbar .navbar-nav .nav-item,
  body.dashboard-page #app-navbar .navbar-nav .nav-item {
    flex: 0 0 auto;
  }
  body.schedule-page #app-navbar .navbar-nav .nav-link,
  body.dashboard-page #app-navbar .navbar-nav .nav-link {
    padding: 2px 5px !important;
    font-size: 0.7rem !important;
  }
  body.schedule-page #app-navbar .nav-actions,
  body.dashboard-page #app-navbar .nav-actions {
    flex: 1 1 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    min-width: 0 !important;
    width: auto !important;
    gap: 4px !important;
  }
  body.schedule-page #app-navbar .nav-actions .nav-search,
  body.dashboard-page #app-navbar .nav-actions .nav-search {
    flex: 1 1 0 !important;
    min-width: 64px !important;
    max-width: none !important;
    width: auto !important;
  }
  body.schedule-page #app-navbar .nav-actions .nav-search .form-control,
  body.dashboard-page #app-navbar .nav-actions .nav-search .form-control {
    height: 28px !important;
    font-size: 0.72rem !important;
    padding: 2px 8px !important;
  }
  body.schedule-page #app-navbar .nav-actions .nav-quick-actions,
  body.dashboard-page #app-navbar .nav-actions .nav-quick-actions {
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    gap: 2px !important;
    padding-bottom: 0 !important;
  }
  body.schedule-page #app-navbar .nav-actions .btn-sm,
  body.schedule-page #app-navbar .nav-actions .nav-qab,
  body.dashboard-page #app-navbar .nav-actions .btn-sm,
  body.dashboard-page #app-navbar .nav-actions .nav-qab {
    padding: 2px 5px !important;
    font-size: 0.7rem !important;
    min-height: 28px !important;
    line-height: 1 !important;
  }
  body.schedule-page #app-navbar .navbar-nav.ms-3,
  body.dashboard-page #app-navbar .navbar-nav.ms-3 {
    flex: 0 0 auto !important;
    margin-left: 2px !important;
  }
  body.schedule-page #app-navbar #navbarDropdown,
  body.dashboard-page #app-navbar #navbarDropdown {
    padding: 2px !important;
    gap: 4px !important;
  }
  body.schedule-page #app-navbar .nav-user-display-name,
  body.dashboard-page #app-navbar .nav-user-display-name {
    display: none !important;
  }
  body.schedule-page #app-navbar #navbarDropdown img,
  body.schedule-page #app-navbar #navbarDropdown > span.d-inline-flex,
  body.dashboard-page #app-navbar #navbarDropdown img,
  body.dashboard-page #app-navbar #navbarDropdown > span.d-inline-flex {
    width: 22px !important;
    height: 22px !important;
    font-size: 10px !important;
  }
}

/*
 * Phones: same compact 2-row global header as Schedule everywhere (appShell, not embed).
 * Top: brand + primary nav + user; next row: search + quick actions on one line.
 */
@media (max-width: 768px) {
  body.appShell:not(.embed) #app-navbar {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    min-height: 0 !important;
  }
  body.appShell:not(.embed) #app-navbar .container-fluid {
    flex-wrap: wrap !important;
    align-items: center !important;
    align-content: flex-start !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    gap: 4px 6px !important;
    row-gap: 4px !important;
  }
  body.appShell:not(.embed) #app-navbar .navbar-brand {
    flex: 0 0 auto !important;
    padding: 1px 0 !important;
    font-size: 0.72rem !important;
    font-weight: 800 !important;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.35rem !important;
    line-height: 1.15 !important;
  }
  body.appShell:not(.embed) #app-navbar .navbar-nav.me-3 {
    flex: 1 1 auto !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
    min-width: 0 !important;
    gap: 2px !important;
  }
  body.appShell:not(.embed) #app-navbar .navbar-nav.me-3 .nav-link {
    padding: 2px 5px !important;
    font-size: 0.72rem !important;
  }
  body.appShell:not(.embed) #app-navbar .navbar-nav.ms-3 {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }
  body.appShell:not(.embed) #app-navbar .nav-user-display-name {
    display: none !important;
  }
  body.appShell:not(.embed) #app-navbar #navbarDropdown {
    padding: 2px !important;
    gap: 2px !important;
  }
  body.appShell:not(.embed) #app-navbar #navbarDropdown img,
  body.appShell:not(.embed) #app-navbar #navbarDropdown > span.d-inline-flex {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
  }
  body.appShell:not(.embed) #app-navbar .nav-actions {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 5px !important;
    overflow: visible !important;
  }
  body.appShell:not(.embed) #app-navbar .nav-actions .nav-search {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
  }
  body.appShell:not(.embed) #app-navbar .nav-actions .nav-search .form-control {
    height: 30px !important;
    font-size: 0.78rem !important;
    padding: 3px 10px !important;
  }
  body.appShell:not(.embed) #app-navbar .nav-actions .nav-quick-actions {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    gap: 3px !important;
    padding-bottom: 0 !important;
    overflow: visible !important;
  }
  body.appShell:not(.embed) #app-navbar .nav-actions .btn-sm,
  body.appShell:not(.embed) #app-navbar .nav-actions .nav-qab {
    padding: 3px 6px !important;
    min-height: 30px !important;
    line-height: 1 !important;
  }
}

/* CALM UI 2026: card-list primitives */
.calm-card{
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}
.calm-card:hover{
  box-shadow: 0 4px 6px rgba(15,23,42,0.10), 0 2px 4px rgba(15,23,42,0.08);
}
.calm-title{ color:#0F172A; font-weight:600; }
.calm-subtle{ color:#64748B; font-weight:400; }
.calm-pill{
  border-radius: 9999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* === APP LAYOUT PRIMITIVES === */
/* Ensure grid layout works */
.appShell {
  display: grid !important;
  grid-template-columns: var(--sidebar-w) 1fr !important;
  grid-template-rows: auto 1fr !important;
  min-height: 100dvh;
  transition: grid-template-columns 0.3s ease;
}

/* AppShell pages: lock document scrolling and use internal scroll areas */
body.appShell{
  height: 100dvh;
  overflow: hidden;
}
body.appShell > main.main{
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#app-navbar{
  flex: 0 0 auto;
}
#mainContent{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto; /* default: internal scrolling for long pages */
  padding: 0.5rem 0.75rem;
}
/* Schedule + Dashboard: the page itself should not scroll; only inner widgets should */
body.schedule-page #mainContent,
body.dashboard-page #mainContent{
  overflow: hidden;
  padding: 0 !important;
}

/* Mobile dashboard: scroll page for filters; inner carousel/panel bodies scroll too */
@media (max-width: 768px){
  body.dashboard-page #mainContent{
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    /* Tight to global header — avoid double padding with .dash-v2 */
    padding: 0.2rem 0.5rem 0.5rem !important;
  }
  body.dashboard-page #mainContent.container-fluid {
    padding-top: 0.2rem !important;
  }
}
/* ≤767: flex column so horizontal carousel can fill remaining height */
@media (max-width: 767px){
  body.dashboard-page #mainContent{
    display: flex !important;
    flex-direction: column !important;
  }
  body.dashboard-page .dash-v2{
    flex: 1 1 auto;
    min-height: 0;
  }
}

/* Schedule: add breathing room at bottom without page scroll */
body.schedule-page #mainContent{
  padding: 0.5rem 0.75rem 24px !important;
}

/* Phone: vertical scroll for tall week calendar (must follow schedule #mainContent rules) */
@media (max-width: 768px){
  body.schedule-page #mainContent{
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 0.35rem 16px !important;
  }
}

/* ── Global header: match calendar card toolbar (light, compact) everywhere ── */
body.crm-header-lite:not(.embed) #app-navbar.top-bar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
  padding: 4px 10px !important;
  min-height: 0 !important;
}
body.crm-header-lite:not(.embed) .top-bar .navbar-brand {
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
}
body.crm-header-lite:not(.embed) .top-bar .navbar-nav .nav-link {
  color: #334155 !important;
  font-weight: 600 !important;
  font-size: 0.8125rem !important;
  padding: 0.35rem 0.5rem !important;
}
body.crm-header-lite:not(.embed) .top-bar .navbar-nav .nav-link:hover,
body.crm-header-lite:not(.embed) .top-bar .navbar-nav .nav-link.active {
  color: #0f172a !important;
}
/* Username sits inside #navbarDropdown (dark pill in base.html) — not navbar link grey */
body.crm-header-lite:not(.embed) .top-bar #navbarDropdown .nav-user-display-name {
  color: #f8fafc !important;
}
body.dark-theme.crm-header-lite:not(.embed) .top-bar #navbarDropdown .nav-user-display-name {
  color: #ffffff !important;
}
body.crm-header-lite:not(.embed) .top-bar .form-control {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}
body.crm-header-lite:not(.embed) .top-bar .form-control::placeholder {
  color: #64748b !important;
}
body.crm-header-lite:not(.embed) .top-bar .form-control:focus {
  background: #fff !important;
  border-color: #93c5fd !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
}
body.dark-theme.crm-header-lite:not(.embed) #app-navbar.top-bar {
  background: var(--bg-header) !important;
  border-bottom-color: var(--border-light) !important;
}
body.dark-theme.crm-header-lite:not(.embed) .top-bar .navbar-brand,
body.dark-theme.crm-header-lite:not(.embed) .top-bar .navbar-nav .nav-link {
  color: var(--text-primary) !important;
}
body.crm-header-lite:not(.embed) .nav-quick-actions .btn {
  border-color: #e2e8f0 !important;
}
body.crm-header-lite:not(.embed) .nav-quick-actions .btn-outline-secondary,
body.crm-header-lite:not(.embed) .nav-quick-actions .btn-outline-light {
  background: #f8fafc !important;
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}
body.crm-header-lite:not(.embed) .navbar-toggler {
  border-color: #cbd5e1;
}

/* Job detail: always allow vertical scroll (appShell uses overflow:hidden on body) */
body.appShell.job-detail-page #mainContent {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1.5rem !important;
  max-width: 100vw;
}
body.appShell.job-detail-page #jobDetailPage {
  max-width: 100%;
}
@media (max-width: 768px) {
  body.appShell.job-detail-page #mainContent {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  body.appShell.job-detail-page .job-info-card .card-body,
  body.appShell.job-detail-page .card-body {
    font-size: 0.9rem;
    padding: 0.65rem 0.75rem;
  }
  body.appShell.job-detail-page .page-header-wrapper {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.5rem;
  }
  body.appShell.job-detail-page .page-actions .btn {
    font-size: 0.8rem;
  }
}

/* Field workers: no job tray / dock affordances on schedule */
body.field-worker.schedule-page #job-dock,
body.field-worker.schedule-page #dockRestoreInlineBtn,
body.field-worker.schedule-page #dockPlaceHud {
  display: none !important;
}
.appShell.is-compact {
  grid-template-columns: var(--sidebar-w-compact) 1fr !important;
}
/* Support alternate class used by some scripts */
body.sidebar-compact .appShell { grid-template-columns: var(--sidebar-w-compact) 1fr !important; }

/* Ensure sidebar width changes are visible */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--page-pad-y) var(--s-4);
  background: var(--crm-muted);
  border-right: var(--border);
  width: var(--sidebar-w) !important;
  transition: width 0.3s ease;
  overflow: hidden;
  min-width: var(--sidebar-w) !important;
  max-width: var(--sidebar-w) !important;
}
.appShell.is-compact .sidebar {
  width: var(--sidebar-w-compact) !important;
  min-width: var(--sidebar-w-compact) !important;
  max-width: var(--sidebar-w-compact) !important;
}
body.sidebar-compact .sidebar {
  width: var(--sidebar-w-compact) !important;
  min-width: var(--sidebar-w-compact) !important;
  max-width: var(--sidebar-w-compact) !important;
}

.sidebar .item,.sidebar .nav-item{display:flex;align-items:center;gap:var(--s-3);padding:10px 12px;border-radius:var(--radius-sm)}
.sidebar .item__label{white-space:nowrap; transition: opacity 0.3s ease;}
.appShell.is-compact .sidebar .item__label{display:none; opacity: 0;}
.appShell.is-compact .sidebar .item{justify-content:center}

.sidebar .cta{
  display:flex;align-items:center;gap:var(--s-2);padding:10px 12px;border-radius:var(--radius);
  background:var(--crm-brand);color:#07111a;font-weight:600;
  transition: padding 0.3s ease;
}
.appShell.is-compact .sidebar .cta{padding:10px;justify-content:center}
.appShell.is-compact .sidebar .cta .cta__text{display:none; opacity: 0;}

/* === DEBUGGING: Sidebar Toggle === */
.sidebar__toggle {
  align-self: flex-end;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.06);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255,255,255,.2);
  z-index: 1000;
}
.sidebar__toggle:hover {
  background: rgba(255,255,255,.1);
  transform: scale(1.05);
  border-color: rgba(255,255,255,.4);
}
.appShell.is-compact .sidebar__toggle {
  align-self: center;
}

.main{min-width:0;padding:var(--page-pad-y) var(--page-pad-x); transition: padding-left 0.3s ease;}

/* Dashboard grid (12-col) */
.dash{display:grid;gap:var(--s-4);grid-template-columns:repeat(12,1fr)}
.dash__primary{grid-column:span 8}
.dash__secondary{grid-column:span 4}

/* Cards + headers */
.card{
  display:grid;grid-template-rows:auto auto 1fr;gap:var(--s-2);padding:var(--s-4);
  border:var(--border);border-radius:var(--radius);background:var(--crm-surface);
}
.card__title{
  font-weight:600;overflow:hidden;text-overflow:ellipsis;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  word-break:normal;overflow-wrap:anywhere;hyphens:auto;
}
.hdr{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--s-3)}
.hdr__count{background:rgba(255,255,255,.08);border:var(--border);padding:2px 8px;border-radius:9999px;font-size:12px}

/* Chat toggle badge */
.chatToggle{position:relative;display:inline-flex;align-items:center;justify-content:center}
.badge{
  position:absolute;top:-6px;right:-6px;display:inline-flex;align-items:center;justify-content:center;
  min-width:18px;height:18px;padding:0 4px;border-radius:9999px;background:var(--crm-danger);color:#fff;font-size:12px;font-weight:600;line-height:1;box-shadow:var(--ring)
}

/* Zero-scroll region at 1080p (adjust constant if header differs) */
.dashboardScrollRegion{max-height:calc(100vh - 120px);overflow:auto}

/* Reset global badge so Bootstrap badges remain unaffected; scope absolute to chat toggle */
.badge{position:static;top:auto;right:auto;min-width:auto;height:auto;padding:0.5em 0.75em;border-radius:0.375rem;background:inherit;color:inherit;font-size:inherit;box-shadow:none}
.chatToggle .badge{position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;padding:0 4px;border-radius:9999px;background:var(--crm-danger);color:#fff;font-size:12px;font-weight:600;line-height:1;box-shadow:var(--ring)}

/* Quebec CRM Custom Styles */

/* Custom color variables */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* General styling */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navigation enhancements */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  font-weight: 500;
  transition: color 0.2s ease;
  display: inline-block;
}

.navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Card enhancements */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Button enhancements */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
}

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

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Table enhancements */
.table {
    margin-bottom: 0;
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Badge enhancements */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Tag color system - consistent across all views */
.tag-materiaux {
    background-color: #17a2b8 !important;
    color: white !important;
}

/* Bootstrap purple color for Travaux */
.bg-purple {
    background-color: #6f42c1 !important;
    color: white !important;
}

.tag-urgent {
    background-color: #dc3545 !important;
    color: white !important;
}

.tag-special {
    background-color: #ffc107 !important;
    color: black !important;
}

.tag-livraison {
    background-color: #28a745 !important;
    color: white !important;
}

.tag-travaux {
    background-color: #6f42c1 !important;
    color: white !important;
}

/* Tag display consistency */
.tag-display {
    padding: 5px 10px;
    margin: 4px 2px;
    border-radius: 15px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
}

/* Avatar styles */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

/* Form enhancements */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Alert enhancements */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Pagination enhancements */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination .page-link:hover {
    color: #0056b3;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* Modal enhancements */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Timeline styles */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 3px #e9ecef;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

/* Stats cards */
.border-left-primary {
    border-left: 0.25rem solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 0.25rem solid var(--success-color) !important;
}

.border-left-warning {
    border-left: 0.25rem solid var(--warning-color) !important;
}

.border-left-danger {
    border-left: 0.25rem solid var(--danger-color) !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-uppercase {
    text-transform: uppercase !important;
}

/* Responsive enhancements */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* File upload styles */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.15s ease-in-out;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

/* Search and filter enhancements */
.search-highlight {
    background-color: #fff3cd;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* Status indicators */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-active {
    background-color: var(--success-color);
}

.status-pending {
    background-color: var(--warning-color);
}

.status-inactive {
    background-color: var(--secondary-color);
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .page-actions,
    .modal {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .table {
        border-collapse: collapse !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
}

/* Chat Interface Styles */
.chat-tab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-tab:hover {
    transform: scale(1.05);
}

.chat-tab-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.chat-notification-badge {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.chat-tab.flash {
    animation: flash 0.5s ease-in-out;
}

@keyframes flash {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.chat-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 600px; /* Increased from 400px to 600px (1.5x wider) */
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1040;
    display: none; /* Initially hidden, will be changed by JavaScript */
    flex-direction: column;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header .btn-close {
    color: white;
    filter: brightness(0) invert(1);
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-user-bubbles-sticky {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 8px 0;
    margin-bottom: 10px;
    z-index: 10;
}

.chat-user-bubble {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    font-size: 0.8rem;
}

.chat-user-bubble:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-user-bubble.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
    box-shadow: 0 2px 12px rgba(0,123,255,0.3);
}

.chat-user-bubble .user-avatar {
    width: 32px;
    height: 32px;
    background: #6c757d;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-user-bubble.active .user-avatar {
    background: #ffffff;
    color: #007bff;
}

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

.chat-user-bubble .user-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-user-bubble .user-status {
    font-size: 0.7rem;
    color: #28a745;
    line-height: 1;
}

.chat-user-bubble.active .user-status {
    color: #ffffff;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Reduced from 10px to 4px */
    padding: 10px 0;
}

.chat-message {
    max-width: 85%;
    padding: 5px 7px; /* 50% smaller: was 10px 14px */
    border-radius: 9px;
    word-wrap: break-word;
    position: relative;
    margin: 1px 0;
    font-size: 0.875rem;
}

.chat-message.sent {
    background: #007bff;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    margin-right: 30px;
}

.chat-message.received {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 3px;
    margin-left: 30px;
}

.chat-message .message-time {
    font-size: 8px;
    color: #6c757d;
    opacity: 0.8;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
}

.chat-message.sent .message-time {
    left: -38px;
}

.chat-message.received .message-time {
    right: -38px;
}

.chat-message .message-user {
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 2px;
    display: block;
}

.chat-message .message-content {
    margin-bottom: 0;
    display: inline;
}

.message-actions {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    vertical-align: middle;
}

.chat-message:hover .message-actions {
    opacity: 1;
}

.message-actions .btn {
    padding: 2px 4px;
    font-size: 0.65rem;
    border-radius: 8px;
    min-width: auto;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Improve button visibility for sent messages (blue background) */
.chat-message.sent .message-actions .btn {
    background: rgba(255, 255, 255, 0.9) !important; /* White background for visibility */
    color: #007bff !important; /* Blue text for contrast */
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.chat-message.sent .message-actions .btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
}

/* Improve button visibility for received messages (white background) */
.chat-message.received .message-actions .btn {
    background: #f8f9fa !important; /* Light background for visibility */
    color: #495057 !important; /* Dark text for contrast */
    border-color: #dee2e6 !important;
}

.chat-message.received .message-actions .btn:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background: white;
    border-radius: 0 0 15px 15px;
}

.chat-input .input-group {
    gap: 10px;
}

.chat-input input {
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

.chat-input button {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        height: 60vh;
    }
    
    .chat-tab {
        bottom: 10px;
        right: 10px;
    }
}

/* Message forwarding styles */
.forward-options {
    position: absolute;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 10px;
    z-index: 1000;
    min-width: 200px;
}

.forward-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.forward-option:hover {
    background-color: #f8f9fa;
}

.forward-option .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forward-option .user-avatar {
    width: 24px;
    height: 24px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Global Chat Styles */
.global-chat-messages {
    background: #f8f9fa;
}

/* Dark theme overrides for Team Chat */
body.dark-theme .global-chat-messages {
    background: var(--bg-header);
}

body.dark-theme .global-chat-message {
    background: var(--bg-header);
    border-bottom-color: var(--border-light);
}

body.dark-theme .global-user-name {
    color: var(--text-primary);
}

body.dark-theme .global-message-content {
    color: var(--text-primary);
}

body.dark-theme .global-chat-input {
    background: var(--bg-header);
}

body.dark-theme .global-chat-input input {
    background: var(--bg-header);
    border-color: var(--border-light);
    color: var(--text-primary);
}

body.dark-theme .global-chat-input input::placeholder {
    color: var(--text-muted);
}

/* Dark theme overrides for Individual Chat Windows */
body.dark-theme .individual-chat-window {
    background: var(--bg-card);
    border-color: var(--border-light);
}

body.dark-theme .chat-tabs-header {
    background: var(--bg-header);
    border-bottom-color: var(--border-light);
}

body.dark-theme .conversation-tab {
    background: var(--bg-header);
    border-right-color: var(--border-light);
    color: var(--text-primary);
}

body.dark-theme .conversation-tab:hover {
    background: var(--neutral-bg-light);
}

body.dark-theme .conversation-tab.active {
    background: var(--primary);
    color: white;
}

body.dark-theme .chat-header {
    background: var(--primary);
    color: white;
}

body.dark-theme .chat-body {
    background: var(--bg-header);
}

body.dark-theme .chat-messages {
    background: var(--bg-header);
}

body.dark-theme .chat-message.received {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-light);
}

body.dark-theme .chat-input {
    background: var(--bg-header);
    border-top-color: var(--border-light);
}

body.dark-theme .chat-input input {
    background: var(--bg-header);
    border-color: var(--border-light);
    color: var(--text-primary);
}

body.dark-theme .chat-input input::placeholder {
    color: var(--text-muted);
}

body.dark-theme .reply-content {
    background: var(--neutral-bg-light);
    color: var(--text-primary);
    border-left-color: var(--border-light);
}

body.dark-theme .chat-message.sent .reply-content {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: rgba(255, 255, 255, 0.5);
}

/* Dark theme for Global Messenger */
body.dark-theme .messenger-panel {
    background: var(--bg-card);
    border-color: var(--border-light);
}

body.dark-theme .conversation-item {
    background: var(--bg-header);
    border-bottom-color: var(--border-light);
    color: var(--text-primary);
}

body.dark-theme .conversation-item:hover {
    background: var(--neutral-bg-light);
}

body.dark-theme .user-name {
    color: var(--text-primary);
}

body.dark-theme .user-username {
    color: var(--text-muted);
}

/* Team Chat full height optimization */
.card.h-100 .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.global-chat-messages.flex-grow-1 {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.global-chat-input.mt-auto {
    margin-top: auto;
    flex-shrink: 0;
}

.global-chat-message {
    padding: 2px 0; /* much tighter spacing */
    border-bottom: none;
    margin-bottom: 2px;
}

.global-chat-message:last-child {
    border-bottom: none;
}

.global-user-avatar { display: none !important; }

.global-user-name { font-size: 0.75rem; color: #495057; }

.global-message-content { font-size: 0.8rem; line-height: 1.25; color: #212529; word-wrap: break-word; }

.global-chat-input {
    background: white;
}

.global-chat-input input {
    border-radius: 20px;
    border: 1px solid #e9ecef;
}

.global-chat-input button {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-message-actions {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px; /* Space between content and actions */
    opacity: 0;
    transition: opacity 0.2s ease;
    vertical-align: middle; /* Align with text */
}

.global-chat-message:hover .global-message-actions {
    opacity: 1;
}

.global-message-actions .btn {
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 12px;
    min-width: auto;
    background: #f8f9fa !important; /* Light background for visibility */
    color: #495057 !important; /* Dark text for contrast */
    border-color: #dee2e6 !important;
}

.global-message-actions .btn:hover {
    background: #e9ecef !important;
    border-color: #adb5bd !important;
}

/* New Chat System Styles */

/* Global Messenger Bar (Bottom Right) */
.global-messenger-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.messenger-toggle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.messenger-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.messenger-toggle { position: relative; }
.total-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #dc3545;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 9999px;
    line-height: 1;
    font-weight: 600;
    font-size: 13px;
    border: 2px solid #ffffff;
}

.messenger-panel {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    display: none;
    overflow: hidden;
}

.global-messenger-bar.open .messenger-panel {
    display: block;
    animation: slideInUp 0.3s ease-out;
}

.messenger-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.messenger-header h6 {
    margin: 0;
    font-weight: 600;
}

.messenger-header .btn-close {
    filter: invert(1);
    opacity: 0.8;
}

.messenger-header .btn-close:hover {
    opacity: 1;
}

.conversation-list {
    max-height: 400px;
    overflow-y: auto;
}

.conversation-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversation-item:hover {
    background-color: #f8f9fa;
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    position: relative;
}

.unread-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    line-height: 1;
}

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

.user-name {
    font-weight: 600;
    color: #212529;
    margin-bottom: 2px;
}

.user-username {
    font-size: 12px;
    color: #6c757d;
}

/* Individual Chat Windows */
.individual-chat-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 500px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

/* Chat Tabs Header */
.chat-tabs-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    height: 40px;
}

.conversation-tab {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #e9ecef;
    border-right: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    position: relative;
    white-space: nowrap;
}

.conversation-tab:hover {
    background: #dee2e6;
}

.conversation-tab.active {
    background: #007bff;
    color: white;
}

.conversation-tab .tab-name {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-tab .tab-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.conversation-tab .tab-close:hover {
    opacity: 1;
}

.conversation-tab.active .tab-close {
    color: white;
}

/* Chat Conversations Container */
.chat-conversations {
    flex: 1;
    position: relative;
    height: calc(100% - 40px); /* Subtract tab header height */
    overflow: hidden;
}

.conversation-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h6 {
    margin: 0;
    font-weight: 600;
}

.chat-header .btn-close {
    filter: invert(1);
    opacity: 0.8;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
}

.chat-header .chat-header-close {
    margin-left: auto;
    opacity: 0.95;
    filter: invert(1);
    background: none !important;
    border: none;
    padding: 4px 8px;
    font-size: 1.25rem;
    line-height: 1;
}
.chat-header .chat-header-close::before {
    display: none;
}
.chat-header .chat-header-close .fas {
    display: block;
}
.chat-header .chat-header-close:hover {
    opacity: 1;
}
.chat-header .btn-close:hover {
    opacity: 1;
}

.individual-chat-window .chat-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: auto;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    max-height: 100%;
}

.chat-message {
    max-width: 80%;
    padding: 5px 7px;
    border-radius: 9px;
    position: relative;
    word-wrap: break-word;
    font-size: 0.875rem;
}

.chat-message.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-bottom-right-radius: 3px;
}

.chat-message.received {
    align-self: flex-start;
    background: #f1f3f4;
    color: #212529;
    border-bottom-left-radius: 3px;
}

.message-content {
    margin-bottom: 3px;
    line-height: 1.4;
}

.message-actions {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-message:hover .message-actions {
    opacity: 1;
}

.message-actions .btn {
    padding: 2px 4px;
    font-size: 0.65rem;
    border-radius: 8px;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    text-align: right;
}

.individual-chat-window .chat-input {
    padding: 10px 12px 12px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
    height: auto;
    min-height: 0;
    max-height: none;
    flex-shrink: 0;
}

.individual-chat-window .chat-compose-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.individual-chat-window .chat-compose-input {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 20px;
    border: 1px solid #dee2e6;
}

.individual-chat-window .btn-chat-attach {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.individual-chat-window .btn-send-chat {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
}

.individual-chat-window .btn-send-chat:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: white;
}

.individual-chat-window .chat-pending-images {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    max-height: 100px;
    overflow-y: auto;
    width: 100%;
}

.individual-chat-window .chat-input.chat-drop-active {
    outline: 2px dashed #007bff;
    outline-offset: -4px;
    background: #eef5ff;
}

/* Reply and Forward Styling */
.reply-content {
    background: rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-style: italic;
    border-left: 3px solid rgba(0, 0, 0, 0.3);
}

.chat-message.sent .reply-content {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: rgba(255, 255, 255, 0.5);
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Notification Styling */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .global-messenger-bar {
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .messenger-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    /* Full-width conversation picker — easy to open chats on phone */
    .global-messenger-bar.open .messenger-panel {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        bottom: 72px !important;
        border-radius: 12px 12px 0 0 !important;
        max-height: min(72vh, 520px) !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .global-messenger-bar.open .messenger-panel .conversation-list {
        max-height: min(58vh, 440px) !important;
        -webkit-overflow-scrolling: touch;
    }

    .conversation-item {
        padding: 14px 16px !important;
        min-height: 56px;
    }

    /* Active DM: nearly full screen, thumb-friendly */
    .individual-chat-window {
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-width: none !important;
        height: min(88dvh, 720px) !important;
        max-height: calc(100dvh - env(safe-area-inset-bottom, 0px) - 24px) !important;
        bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        border-radius: 14px !important;
    }

    .chat-tabs-header {
        height: 44px !important;
    }

    .conversation-tab {
        min-width: 120px !important;
        min-height: 44px !important;
        padding: 8px 12px !important;
    }

    .chat-input-area textarea,
    .chat-input-area .form-control {
        font-size: 16px !important; /* reduce iOS zoom on focus */
        min-height: 44px !important;
    }

    .chat-send-btn,
    .chat-input-area .btn {
        min-height: 44px !important;
        min-width: 44px !important;
    }

    .individual-chat-window .chat-messages {
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
}

/* Scrollbar Styling */
.conversation-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.conversation-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.conversation-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Global Chat Messages Styling */
.global-chat-messages {
    background: #f8f9fa;
    border-radius: 8px;
}

.global-chat-message {
    margin-bottom: 8px;
    padding: 6px 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.global-chat-message:last-child {
    margin-bottom: 0;
}

.global-user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    margin-right: 8px;
}

.global-user-name {
    font-weight: 600;
    color: #007bff;
    margin-bottom: 3px;
    font-size: 0.9rem;
}

.global-message-content {
    color: #212529;
    line-height: 1.3;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.global-message-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.global-chat-message:hover .global-message-actions {
    opacity: 1;
}

.global-message-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

.global-chat-input {
    background: white;
}

.global-chat-input input {
    border-radius: 20px 0 0 20px;
    border: 1px solid #dee2e6;
}

.global-chat-input button {
    border-radius: 0 20px 20px 0;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
    padding: 8px 15px;
}

.global-chat-input button:hover {
    background: #0056b3;
    border-color: #0056b3;
}

/* Reply and Forward Styling for Global Chat */
.global-reply-content {
    background: rgba(0, 123, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-style: italic;
    border-left: 3px solid #007bff;
    color: #0056b3;
}

.global-reply-input-wrapper {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    padding: 0.375rem 0.75rem;
    margin-bottom: 10px;
}

.global-reply-prefix {
    color: #6c757d;
    font-size: 0.875rem;
    font-style: italic;
    margin-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
    background-color: #f8f9fa;
}

/* Mention highlighting */
.global-message-content .mention {
    background: rgba(255, 193, 7, 0.2);
    color: #856404;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Message timestamp */
.global-message-time { font-size: 10px; color: #6c757d; text-align: right; margin-top: 2px; }

/* Mention suggestions dropdown */
.mention-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}

.mention-suggestions-header {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.mention-suggestions-list {
    max-height: 150px;
    overflow-y: auto;
}

.mention-suggestion {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.mention-suggestion:hover,
.mention-suggestion.selected {
    background-color: #e3f2fd;
}

.mention-suggestion:last-child {
    border-bottom: none;
}

.mention-suggestion .user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.mention-suggestion .user-info {
    flex-grow: 1;
}

.mention-suggestion .user-name {
    font-weight: 600;
    color: #212529;
    font-size: 14px;
    margin-bottom: 2px;
}

.mention-suggestion .user-username {
    color: #6c757d;
    font-size: 12px;
}

/* Scrollbar styling for mention suggestions */
.mention-suggestions-list::-webkit-scrollbar {
    width: 6px;
}

.mention-suggestions-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mention-suggestions-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mention-suggestions-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Global Chat Reply Preview Styling */
.global-reply-preview {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.global-reply-preview .reply-content {
    position: relative;
}

.global-reply-preview .reply-content small {
    font-size: 0.8rem;
    color: #6c757d;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.global-reply-preview .reply-original-message {
    color: #495057;
    font-style: italic;
    background-color: #e9ecef;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 4px solid #6c757d;
    margin-right: 2.5rem;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
    max-width: 100%;
    overflow-wrap: break-word;
}

.global-reply-preview .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.global-reply-preview .btn-close:hover {
    opacity: 1;
}

/* Dark theme overrides for global reply preview */
body.dark-theme .global-reply-preview {
    background-color: #2d3748;
    border-color: #4a5568;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-theme .global-reply-preview .reply-content small {
    color: #a0aec0;
}

body.dark-theme .global-reply-preview .reply-original-message {
    color: #e2e8f0;
    background-color: #4a5568;
    border-left-color: #718096;
}

/* Individual Chat Reply Preview Styling */
.reply-preview {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.reply-preview .reply-content {
    position: relative;
}

.reply-preview .reply-content small {
    font-size: 0.8rem;
    color: #6c757d;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.reply-preview .reply-original-message {
    color: #495057;
    font-style: italic;
    background-color: #e9ecef;
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 4px solid #6c757d;
    margin-right: 2.5rem;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 0.9rem;
    max-width: 100%;
    overflow-wrap: break-word;
}

.reply-preview .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.reply-preview .btn-close:hover {
    opacity: 1;
}

/* Dark theme overrides for individual chat reply preview */
body.dark-theme .reply-preview {
    background-color: #2d3748;
    border-color: #4a5568;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-theme .reply-preview .reply-content small {
    color: #a0aec0;
}

body.dark-theme .reply-preview .reply-original-message {
    color: #e2e8f0;
    background-color: #4a5568;
    border-left-color: #718096;
}

/* Sidebar and main content spacing */
/* Use grid to push content; remove legacy margin hack */
body.with-sidebar .main-content {
    margin-left: 0 !important;
    width: auto !important;
}

body.with-sidebar {
    padding-left: 0;
}

/* Individual chat notification badge centering */
.individual-chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    line-height: 1;
}

/* Dashboard notification badge centering */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    line-height: 1;
    border: 2px solid white;
    text-align: center;
}

/* Schedule event text visibility - bigger, bolder text with proper boundaries (exclude schedule page; schedule uses its own layout) */
body:not(.schedule-page) .fc-event {
    font-weight: 700 !important;
    color: #ffffff !important;
    font-size: 0.85rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body:not(.schedule-page) .fc-event .fc-event-title {
    font-weight: 700 !important;
    color: #ffffff !important;
    font-size: 0.85rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
}

body:not(.schedule-page) .fc-event .fc-event-time {
    font-weight: 600 !important;
    color: #ffffff !important;
    font-size: 0.8rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Job details edit buttons - smaller boxes */
.btn-xs {
    padding: 0.15rem 0.3rem;
    font-size: 0.65rem;
    border-radius: 0.15rem;
    line-height: 1;
    min-width: 20px;
    min-height: 20px;
}

.btn-xs .fa-edit {
    font-size: 0.6rem;
}

/* Custom purple badge for Travaux tags */
.bg-purple {
    background-color: #6f42c1 !important;
    color: white !important;
}

/* Tag option hover and active states */
.tag-option {
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-option:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tag-option.active {
    opacity: 1;
    transform: scale(1.1);
    border: 2px solid #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-weight: 700;
}

.tag-option.active::after {
    content: ' ✓';
    font-weight: bold;
    color: inherit;
}

/* Ensure all tag colors are preserved when active */
.tag-option.bg-purple.active {
    background-color: #6f42c1 !important;
    color: white !important;
}

.tag-option.bg-danger.active {
    background-color: #dc3545 !important;
    color: white !important;
}

.tag-option.bg-info.active {
    background-color: #17a2b8 !important;
    color: white !important;
}

.tag-option.bg-warning.active {
    background-color: #ffc107 !important;
    color: black !important;
}

.tag-option.bg-success.active {
    background-color: #28a745 !important;
    color: white !important;
}

/* Enhanced Schedule Cards */
.job-schedule {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.job-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
    font-style: italic;
}

/* Calendar left panel compact cards */
.left-panel .job-card-content{padding:6px 8px !important}
.left-panel .job-title{font-size:.85rem !important; line-height:1.2; margin:0}
.left-panel .job-address{font-size:.75rem !important; color:var(--text-muted)}

/* Make calendar compact with 30-minute slots */
.fc-timegrid-slot {
    height: var(--slot-h, 6px) !important;
    border-bottom: 1px solid var(--border-light) !important;
}

.fc-timegrid-slot-label {
    font-size: 0.8rem !important;
    padding: 0.1rem 0.3rem !important;
}

.fc-col-header-cell {
    padding: 0.3rem !important;
    font-size: 0.9rem !important;
}

.fc-timegrid-axis {
    width: 4rem !important;
}

body:not(.schedule-page) .fc-event {
    font-size: 0.75rem !important;
    padding: 2px 4px !important;
}

/* Job Details Edit Buttons */
.btn-xs {
    padding: 0.125rem 0.25rem;
    font-size: 0.75rem;
    border-radius: 0.2rem;
}

.btn-xs .fa-xs {
    font-size: 0.75rem;
}

/* === PAGES: Dashboard === */
.main-content.container-fluid { margin-top: 0.5rem !important; }

/* Standardize page header across all pages - FORCE OVERRIDE */
#mainContent .page-title,
#mainContent h1.page-title,
#mainContent h1.h3,
#mainContent h1.h4,
#mainContent > div.page-header-wrapper > h1,
#mainContent > div.d-flex.justify-content-between > h1,
#mainContent > div.d-flex.justify-content-between.align-items-center > h1 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    line-height: 1.5 !important;
}

/* Remove extra spacing around page header - FORCE OVERRIDE */
#mainContent > div.page-header-wrapper,
#mainContent > div.d-flex.justify-content-between.align-items-center {
    margin-top: 0 !important;
    margin-bottom: 0.75rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Ensure container-fluid has minimal padding - FORCE OVERRIDE */
#mainContent.container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Slightly denser cards on dashboard */
.card-header { padding: 12px 16px !important; }
.card-body { padding: 12px 16px !important; }
.tag-display { margin: 2px 4px; }

/* Status badge styles */
.status-waiting-parts { background:#6366f1 !important; color:#ffffff !important; }

/* Compact badges and headings for job cards */
.dashboard-job-card .badge { font-size: 0.55rem; padding: 0.12rem 0.28rem; }
.compact-meta { font-size: 0.7rem; }
.card .card-body h6, .card-header h6 { font-size: 0.9rem !important; }

/* Grids for dashboard lists */
.six-col-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 8px; }
@media (min-width: 1400px) { .six-col-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }

.five-col-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 8px; }
@media (min-width: 1400px) { .five-col-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }

.three-col-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 8px; }

/* Ensure grid children can shrink without overflow */
.six-col-grid > *, .five-col-grid > *, .three-col-grid > * { min-width: 0; }

/* Compact dashboard job card */
.dashboard-job-card { padding: 6px 8px !important; min-height: 64px; }
.dashboard-job-card h6 { font-size: 0.8rem !important; line-height: 1.2; margin: 0; }
.dashboard-job-card .compact-meta small { font-size: 0.6rem; opacity: 0.85; }
/* Tags subdued within cards */
.dashboard-job-card .tag-xs { font-size: 0.6rem; opacity: 0.9; }
/* Assigned avatar */
.avatar-xs { width: 20px; height: 20px; border-radius: 50%; background: var(--secondary, #10b981); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; }

