/* ==========================================================================
   crews.css — unified dark theme (black + orange)
   Applies to BOTH Job Board and Job Detail pages.
   ========================================================================== */

:root{
  --bg: #0b0b0c;            /* page background (near-black) */
  --surface: #141518;       /* cards/panels */
  --surface-2: #1a1c20;     /* slightly lighter surface */
  --border: #23252b;        /* subtle borders */
  --muted: #9aa3ae;         /* secondary text */
  --text: #e9edf1;          /* primary text */
  --accent: #ff7a00;        /* orange */
  --accent-2: #ffa24a;      /* hover/soft orange */
  --shadow: rgba(0,0,0,.35);

  /* Role badge colors (kept as requested) */
  --role-super: #ff7a00;    /* orange */
  --role-gf: #ffd54a;       /* yellow */
  --role-foreman: #4aa3ff;  /* blue */
  --role-journeyman: #6c8cff; /* indigo-ish (consistent with blue family) */
  --role-lv: #8ecbff;       /* light blue */
  --role-apprentice: #4caf50;/* green */
}

/* Base ---------------------------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1,h2,h3,h4,h5,h6 { color: var(--text); }
.text-muted, .muted, small, .form-text { color: var(--muted) !important; }

/* Cards / containers -------------------------------------- */
.card,
.job-card,
.list-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 20px var(--shadow);
}

.card .card-header{
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

/* Buttons ------------------------------------------------- */
.btn,
button{
  color: var(--text);
}

.btn-primary{
  background: var(--accent);
  border-color: var(--accent);
  color: #101214;
}
.btn-primary:hover,
.btn-primary:focus{
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #0b0b0c;
}

.btn-outline-secondary{
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}
.btn-outline-secondary:hover{
  color: #0b0b0c;
  background: var(--accent);
  border-color: var(--accent);
}

.btn-outline-danger{
  color: #ff6b6b;
  border-color: #ff6b6b;
  background: transparent;
}
.btn-outline-danger:hover{
  color: #0b0b0c;
  background: #ff6b6b;
  border-color: #ff6b6b;
}

/* Forms --------------------------------------------------- */
.form-control,
.form-select{
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.form-control::placeholder{ color: #8b939c; }
.form-control:focus,
.form-select:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem rgba(255,122,0,.15);
}

/* Badges / counters -------------------------------------- */
.badge{
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.badge.bg-secondary{
  background: var(--surface-2) !important;
  border-color: var(--border);
  color: var(--text) !important;
}
.count b,
.badge b{
  color: var(--accent);
  font-weight: 700;
}

/* Navbar (minimal tweaks only) ---------------------------- */
.navbar,
.navbar-dark{
  background: #111214 !important;
  border-bottom: 1px solid var(--accent); /* CHANGED: make divider orange */
}
.navbar .nav-link{ color: var(--text) !important; }
.navbar .nav-link:hover{ color: var(--accent) !important; }

/* brand to orange */
.navbar .navbar-brand,
.navbar-dark .navbar-brand{
  color: var(--accent) !important;   /* NEW */
}
.navbar .navbar-brand:hover,
.navbar-dark .navbar-brand:hover{
  color: var(--accent-2) !important; /* NEW */
}

/* make specifically the Logout link orange (keeps other links as-is) */
.navbar a.nav-link[href$="logout/"],
.navbar a.nav-link[href*="/logout"]{
  color: var(--accent) !important;   /* NEW */
}
.navbar a.nav-link[href$="logout/"]:hover,
.navbar a.nav-link[href*="/logout"]:hover{
  color: var(--accent-2) !important; /* NEW */
}

/* =========================================================
   JOB BOARD
   ========================================================= */
.job-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.job-card{
  display: block;
  padding: 14px 14px 12px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.job-card:hover{
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px var(--shadow);
}
.job-card-title{
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: var(--text);
}
.job-card-address{
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 8px;
}
.job-card-stats{
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: .88rem;
  color: #cfd6dd;
}
.job-card-stats span b{ color: var(--accent); }

/* “Create Job” button on board sits nicely */
.create-job-wrap{
  display:flex; align-items:center; justify-content:flex-end; gap:8px;
}

/* =========================================================
   JOB DETAIL (Crews page)
   ========================================================= */
.list-title{ color: var(--text); }
.people-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 36px;
}

.empty-hint{
  color: var(--muted);
  font-style: italic;
}

.person{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: grab;
  transition: border-color .12s ease, transform .08s ease;
}
.person:active{ cursor: grabbing; }
.person:hover{ border-color: var(--accent); }

.person .person-top{
  display:flex; align-items:center; justify-content:space-between;
  gap: 8px;
}
.person .name{ color: var(--text); font-weight: 600; }
.person .person-bottom{
  margin-top: 4px; display:flex; gap:10px; flex-wrap:wrap; align-items:center;
  color: #cfd6dd;
}
.person .phone{ color: #dfe6ee; opacity: .9; }
.person .truck{ color: var(--accent); }

/* Role badges — keep the specified colors */
.role-badge{
  padding: 2px 8px;
  font-size: .75rem;
  font-weight: 700;
  border-radius: 999px;
  color: #0b0b0c;
}
.role-superintendent{ background: var(--role-super); }
.role-gf{ background: var(--role-gf); color: #121212; }
.role-foreman{ background: var(--role-foreman); }
.role-journeyman{ background: var(--role-journeyman); }
.role-lv_tech{ background: var(--role-lv); color: #102030; }
.role-apprentice{ background: var(--role-apprentice); }

/* Counts row inside crew/unassigned cards */
.list-card .counts{
  display:flex; gap: 10px; flex-wrap: wrap; color: #cfd6dd;
}
.list-card .counts .count b{ color: var(--accent); }

/* Drag & drop affordances */
.list-card.drag-over{
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}
.person.dragging{
  opacity: .75;
  transform: scale(.98);
}

/* Tables (if any) ---------------------------------------- */
.table{
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  color: var(--text);
  border-color: var(--border);
}
.table thead th{
  color: var(--text);
  border-bottom-color: var(--border);
}
.table tbody td{
  border-top-color: var(--border);
}

/* Toasts / alerts (Bootstrap) ---------------------------- */
.alert{
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.alert-primary{
  background: rgba(255,122,0,.1);
  border-color: rgba(255,122,0,.4);
  color: var(--text);
}

/* Footer / minor UI -------------------------------------- */
hr{ border-color: var(--border); opacity: 1; }
code, pre{ color: #ffe0c2; }

/* Small helpers ------------------------------------------ */
.bg-accent{ background: var(--accent) !important; color: #0b0b0c !important; }
.text-accent{ color: var(--accent) !important; }
.border-accent{ border-color: var(--accent) !important; }

/* Make cards breathe a bit on small screens */
@media (max-width: 480px){
  .job-grid{ grid-template-columns: 1fr; }
  .job-card{ padding: 12px; }
}

/* === Layout for job page: left sidebar + right board === */
.job-layout{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:16px;
}
@media (max-width: 991.98px){
  .job-layout{ grid-template-columns: 1fr; }
  #leftSidebar{ order: 2; }
}

/* Make entire crew card feel like a drop zone */
.drop-host { position: relative; }
.drop-host.drag-over,
.people-list.dropzone.drag-over{
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}
.people-list.dropzone{
  min-height: 56px;           /* bigger target */
  padding-bottom: 4px;
}

/* Slight spacing for the counts row */
.list-card .counts { margin-top: 2px; }

/* ======================================================================
   APPENDED: Tools & Rentals item cards + Tabs (kept dark theme)
   ====================================================================== */
.item-card{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: grab;
  transition: border-color .12s ease, transform .08s ease, box-shadow .08s ease;
}
.item-card:hover{ border-color: var(--accent); }
.item-card.dragging{
  opacity: .8;
  transform: scale(.98);
  box-shadow: 0 8px 18px var(--shadow);
}
.item-card .top{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.item-card .top .fw-semibold{ color: var(--text); }
.item-card .top .text-muted{ color: var(--muted) !important; }

/* Tabs */
.nav-tabs{
  border-bottom: 1px solid var(--border);
}
.nav-tabs .nav-link{
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}
.nav-tabs .nav-link:hover{
  color: var(--accent);
  border-color: transparent;
}
.nav-tabs .nav-link.active{
  color: var(--text);
  background: var(--surface);
  border-color: var(--border) var(--border) var(--surface);
}



/* ======================================================================
   APPENDED: Responsive full-width grid for Crews pane (TV-friendly)
   ====================================================================== */
:root{
  /* Adjust this to control min tile width (more columns if smaller) */
  --crew-col-min: 320px;
}

/* Make the crews page span nearly the full viewport width */
#pane-crews .container,
#pane-crews .container-fluid{
  max-width: 98vw !important;
  width: 100% !important;
  padding-left: 8px;
  padding-right: 8px;
}

/* Turn the crews row into a CSS Grid that auto-fills horizontally */
#pane-crews .row.g-3{
  display: grid !important; /* override Bootstrap's flex row */
  grid-template-columns: repeat(auto-fill, minmax(var(--crew-col-min), 1fr)) !important;
  gap: 12px !important;     /* mirrors Bootstrap g-3 spacing */
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
}

/* Let grid handle sizing instead of Bootstrap's col classes */
#pane-crews .row.g-3 > [class*="col-"]{
  width: 100% !important;
  max-width: none !important;
  flex: 0 0 auto !important;
}

/* Ensure each crew card stretches within its grid cell */
#pane-crews .list-card{
  height: 100%;
  display: flex;
  flex-direction: column;
}
#pane-crews .list-card .card-body{ padding: .75rem; }
#pane-crews .people-list{ min-height: 2.25rem; }

/* Optional: scale tile minimum width on very large displays */
@media (min-width: 1600px){
  :root{ --crew-col-min: 360px; }
}



/* ======================================================================
   OVERRIDES — Responsive, clean expansion for Crew cards (TV-friendly)
   ----------------------------------------------------------------------
   Goals:
   - Cards **expand** as the window grows; never squished.
   - Auto-fit columns with a comfortable minimum width.
   - Use available horizontal space cleanly, with even breathing room.
   - No JS changes; DnD unaffected.
   - Scoped to the Crews pane only.
   ====================================================================== */

/* Use nearly the full viewport width on the crews pane */
#pane-crews .container,
#pane-crews .container-fluid{
  max-width: 100vw !important;
  width: 100% !important;
  padding-left: 8px;
  padding-right: 8px;
}

/* Turn the Bootstrap row into a CSS Grid that expands gracefully.
   - auto-fit chooses how many columns fit without squishing.
   - min 360px keeps each tile comfortable.
   - 1fr lets tiles *grow* to fill negative space (no awkward gaps). */
#pane-crews .row.g-3{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
  gap: 16px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
}

/* Let the grid handle sizing instead of Bootstrap column widths */
#pane-crews .row.g-3 > [class*="col-"]{
  width: 100% !important;
  max-width: none !important;
  flex: 0 0 auto !important;
}

/* Make each crew card stretch and breathe */
#pane-crews .list-card{
  min-height: 120px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
#pane-crews .list-card .card-body{ padding: .9rem; }
#pane-crews .people-list{ min-height: 2.4rem; }

/* On ultra-wide displays, gently increase spacing */
@media (min-width: 1920px){
  #pane-crews .row.g-3{ gap: 20px !important; }
}



/* ======================================================================
   FULL-BLEED CREWS BOARD (use entire viewport width cleanly)
   - #crew-page wrapper breaks out of any parent .container max-width
   - Uses CSS Grid on the crews row to expand cards naturally
   - Keeps DnD intact (layout-only)
   ====================================================================== */

/* Make the page wrapper go full-bleed across the viewport */
#crew-page{
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 12px;
  padding-right: 12px;
}

/* If any ancestor .container tries to clamp width, squash it under our scope */
#crew-page .container,
#crew-page .container-sm,
#crew-page .container-md,
#crew-page .container-lg,
#crew-page .container-xl,
#crew-page .container-xxl{
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 0;
  padding-right: 0;
}

/* Tabs/content should also stretch */
#crew-page .tab-content,
#crew-page .nav-tabs{
  max-width: 100% !important;
  width: 100% !important;
}

/* Turn the crews row into an expanding grid */
#crew-page #pane-crews .row.g-3{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
  gap: 16px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
}

/* Let the grid own sizing of columns */
#crew-page #pane-crews .row.g-3 > [class*="col-"]{
  width: 100% !important;
  max-width: none !important;
  flex: 0 0 auto !important;
}

/* Make crew cards fill their grid cells and breathe */
#crew-page #pane-crews .list-card{
  height: 100%;
  display: flex;
  flex-direction: column;
}
#crew-page #pane-crews .list-card .card-body{ padding: .9rem; }
#crew-page #pane-crews .people-list{ min-height: 2.25rem; }

/* Slightly larger gap on very wide displays for a clean look */
@media (min-width: 1920px){
  #crew-page #pane-crews .row.g-3{ gap: 20px !important; }
}


/* === Apply same responsive grid to Bus Plugs & Materials panes === */
#pane-busplugs .row.g-3,
#pane-materials .row.g-3,
#pane-tools .row.g-3,
#pane-rentals .row.g-3{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
  gap: 16px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
}
#pane-busplugs .row.g-3 > [class*="col-"],
#pane-materials .row.g-3 > [class*="col-"],
#pane-tools .row.g-3 > [class*="col-"],
#pane-rentals .row.g-3 > [class*="col-"]{
  width: 100% !important;
  max-width: none !important;
  flex: 0 0 auto !important;
}

/* Make board cards stretch and keep internals tidy */
.list-card.card {
  display: flex;
  flex-direction: column;
}
.list-card .card-body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* Reduce extra padding on dense boards (optional) */
.list-card .card-body {
  padding: .75rem .9rem;
}

/* Keep titles from wrapping too wildly */
.list-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tighten “counts” line on small screens */
@media (max-width: 576px) {
  .counts {
    flex-wrap: wrap;
    gap: .5rem !important;
  }
}
/* Viewport that fills the screen (no scroll). Adjust offset if your header is taller/shorter. */
.fit-wrapper {
  --header-offset: 148px;              /* tweak to match your header area */
  width: 100%;
  height: calc(100vh - var(--header-offset));
  overflow: hidden;                    /* we will scale the strip to avoid scroll */
  position: relative;
}

/* One long horizontal row of fixed-width columns */
.crews-strip {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  flex-wrap: nowrap;                   /* <-- critical: single row, no wrap */
  transform-origin: 0 0;               /* scale from top-left in JS */
  will-change: transform;
}

/* Each column gets a fixed base width; change if you want larger/smaller tiles */
.crew-col {
  flex: 0 0 280px;                     /* width per column; change 280 to taste */
}

/* Make cards fill their column */
.list-card.card { height: 100%; display: flex; flex-direction: column; }
.list-card .card-body { display: flex; flex-direction: column; gap: .5rem; }

/* Keep titles neat */
.list-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.board-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  width: 100%;
}

/* Make Bootstrap .col-* work as grid items even without a .row */
.board-grid > [class*="col-"]{
  width: 100% !important;
  max-width: none !important;
  flex: 0 0 auto; /* stop Bootstrap's flex rules */
}

/* Make sure tab panes themselves don’t constrain width */
.tab-content, 
#pane-tools, #pane-rentals, #pane-busplugs, #pane-materials {
  width: 100%;
}

.tab-pane .list-card{
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Put counts under the crew title without changing HTML structure */
#pane-crews .card-body > .d-flex.align-items-center.justify-content-between.mb-2 {
  flex-wrap: wrap;
  gap: 4px 8px;
}
#pane-crews .card-body > .d-flex.align-items-center.justify-content-between.mb-2 .list-title {
  flex: 1 1 auto;
}
#pane-crews .card-body > .d-flex.align-items-center.justify-content-between.mb-2 .counts {
  width: 100%;
  order: 2;
  margin-top: 2px;
}

/* Let crew names wrap fully (fixes truncated titles only on Crews tab) */
#pane-crews .list-title {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}

/* Transfers: subtle timeline + green completion badge (UI-only) */
.tr-timeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 12px;
  color: var(--muted);
}
@media (max-width: 480px) {
  .tr-timeline { grid-template-columns: 1fr; }
}

/* Card outline + checkmark when fully received (status=received) */
.tr-complete {
  box-shadow: 0 0 0 1px #2ecc71 inset;
  border-color: #2ecc71 !important;
}
.tr-complete-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2ecc71;
  color: #0b0b0c;
  display: grid;
  place-items: center;
  font-weight: 900;
  line-height: 1;
}

/* Transfers cards with status styling */
.tr-card{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem .9rem;
  box-shadow: 0 6px 20px var(--shadow);
}
.tr-title { font-weight: 600; color: var(--text); }
.tr-meta  { font-size: .875rem; color: var(--muted); }

/* Pending: yellow outline + hourglass */
.tr-card.pending{
  border-color: #f7c948;
  box-shadow: 0 0 0 .15rem rgba(247,201,72,.25);
}
.tr-card.pending::after{
  content: "⌛";
  position: absolute; top: .4rem; right: .5rem;
  font-size: 1rem; opacity: .9;
}

/* Completed: subtle check mark */
.tr-card.completed::after{
  content: "✓";
  position: absolute; top: .4rem; right: .5rem;
  font-weight: 700; opacity: .85;
}

/* Denied: red border + X */
.tr-card.denied{
  border-color: #dc3545;
  box-shadow: 0 0 0 .15rem rgba(220,53,69,.2);
  background: color-mix(in srgb, #dc3545 6%, var(--surface));
}
.tr-card.denied::after{
  content: "✕";
  position: absolute; top: .4rem; right: .5rem;
  font-weight: 700; color: #dc3545; opacity: .9;
}

/* Completed: green outline + ✓ */
.tr-card.completed,
.tr-card.tr-complete,           /* back-compat if old class still present */
.tr-card.border-success {       /* back-compat if Bootstrap class was used */
  border-color: #198754;        /* Bootstrap "success" green */
  box-shadow: 0 0 0 .15rem rgba(25,135,84,.25);
  /* Optional subtle tint; remove if you want pure background */
  background: color-mix(in srgb, #198754 6%, var(--bs-body-bg));
}
.tr-card.completed::after,
.tr-card.tr-complete::after,
.tr-card.border-success::after {
  content: "✓";
  position: absolute;
  top: .4rem;
  right: .5rem;
  font-weight: 700;
  opacity: .85;
}

/* NOTE: PreFab status card visuals now live in crews_job_detail.css (to avoid duplication) */
#jobTabsContent > .tab-pane { display: none !important; }
#jobTabsContent > .tab-pane.active.show { display: block !important; }

/* Search form cleanup */
.mv-search-form .form-label {
  font-weight: 500;
  color: var(--bs-secondary-color, #888);
}
.mv-search-form input, .mv-search-form select {
  height: 36px;
  font-size: 0.9rem;
}
.mv-search-form .btn {
  height: 36px;
  font-weight: 600;
}

.ring-focus { outline: 3px solid #ff7a00; outline-offset: 2px; border-radius: 8px; }

/* crewhierarchy/static/crewhierarchy/tree.css */

/* Container width and breathing room */
.ch-wrap { padding: 0.75rem; }

/* Rail above the tree for PM (parallel) */
.ch-rail {
  margin-bottom: 1rem;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: .6rem;
  background: rgba(255,255,255,.02);
}
.ch-rail-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .75;
  padding: .5rem .75rem .25rem;
}
.ch-rail-row {
  padding: .25rem .75rem .75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

/* Generic tree rows */
.ch-row { margin-bottom: 1.25rem; }
.ch-row-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .75;
  margin: 0 .5rem .25rem;
}
.ch-row-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;   /* center like the screenshot */
}

/* Gold-ish connectors between rows, subtle */
.ch-row-connector {
  height: 14px;
  position: relative;
  margin: .25rem auto 0;
  width: clamp(200px, 50%, 540px);
}
.ch-row-connector::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 6px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,193,7,.15), rgba(255,193,7,.45), rgba(255,193,7,.15));
  border-radius: 2px;
}

/* Crew grid (cards on bottom row) */
.ch-crew-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.ch-crew-card {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: .75rem;
  background: rgba(255,255,255,.02);
  padding: .5rem .6rem .65rem;
  position: relative;
}
.ch-crew-head {
  padding-bottom: .35rem;
  border-bottom: 1px dashed rgba(255,255,255,.12);
  margin-bottom: .35rem;
  display: flex;
  align-items: baseline;
  gap: .25rem;
}
.ch-crew-name { font-weight: 600; }
.ch-crew-loc { opacity: .75; }

.ch-crew-rail {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding-top: .25rem;
}
.ch-crew-rail--foremen {
  /* light underline separator to echo screenshot “pill rows” */
  padding-bottom: .25rem;
  border-bottom: 1px dashed rgba(255,255,255,.08);
  margin-bottom: .25rem;
}

/* Node wrapper so your employee badge can drop in */
.ch-node {
  display: inline-flex;
  align-items: stretch;
}

/* Optional: small polish if your badge does not span full height */
.ch-node > * {
  border-radius: .75rem; /* soften corners like the screenshot pills */
}

/* Responsive helpers */
@media (max-width: 720px) {
  .ch-row-connector { width: 70%; }
}

/* universal "Previous page" link */
.back-link {
  display: inline-block;
  margin: 4px 0 12px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  color: inherit;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .2s ease;
}
.back-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}