/* ── Weygand Scorecards — Styles ───────────────────────────────────────────── */

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

:root {
  --navy:         #19223F;
  --navy-light:   #1d2847;
  --navy-lighter: #243261;
  --navy-dark:    #0d1117;
  --gold:         #C99E50;
  --tan:          #EBCA9C;
  --slate:        #7FA8C9;
  --off-white:    #B0B8C4;
  --muted:        #8893A0;
  --white:        #ffffff;

  --on-track:     #4A9B6F;
  --on-track-bg:  rgba(74,155,111,0.18);
  --ahead:        #7FA8C9;
  --ahead-bg:     rgba(127,168,201,0.18);
  --behind:       #CC4444;
  --behind-bg:    rgba(204,68,68,0.18);
  --no-date:      #5a6375;
  --no-date-bg:   rgba(90,99,117,0.15);

  --header-h:     64px;
  --info-w:       280px;
  --row-h:        52px;
  --group-h:      36px;
}

body {
  font-family: 'Lato', 'Noto Sans Display', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--navy);
  color: var(--white);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */

header {
  background: var(--navy-dark);
  border-bottom: 2px solid var(--gold);
  padding: 0 1.25rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Actual Weygand SVG logo */
.header-logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: rgba(201,158,80,0.35);
  flex-shrink: 0;
}

.brand-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.header-tabs {
  display: flex;
  gap: 0.125rem;
  flex: 1;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: 0.82rem/1 'Lato', sans-serif;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.02em;
}

.tab-btn:hover  { color: var(--off-white); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.7rem;
  color: var(--muted);
  gap: 0.2rem;
  flex-shrink: 0;
}

.last-updated { color: var(--muted); }
.job-count    { color: var(--off-white); font-weight: 600; }

/* ── Summary Bar ─────────────────────────────────────────────────────────────── */

.summary-bar {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--navy-dark);
  border-bottom: 1px solid rgba(201,158,80,0.2);
  flex-wrap: wrap;
  align-items: center;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: 1px solid;
  background: rgba(0,0,0,0.25);
  min-width: 115px;
  position: relative;
  overflow: hidden;
}

/* Left accent bar on summary cards */
.summary-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 8px 0 0 8px;
}

.summary-card.on-track { border-color: rgba(74,155,111,0.4); }
.summary-card.on-track::before { background: var(--on-track); }
.summary-card.ahead    { border-color: rgba(127,168,201,0.4); }
.summary-card.ahead::before    { background: var(--ahead); }
.summary-card.behind   { border-color: rgba(204,68,68,0.4); }
.summary-card.behind::before   { background: var(--behind); }

.s-count {
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}
.summary-card.on-track .s-count { color: var(--on-track); }
.summary-card.ahead    .s-count { color: var(--slate); }
.summary-card.behind   .s-count { color: var(--behind); }

.s-label {
  font-size: 0.68rem;
  color: var(--off-white);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.4;
}

.summary-total {
  display: flex;
  align-items: center;
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
  gap: 0.4rem;
}
.summary-total strong {
  color: var(--off-white);
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Gantt Controls ──────────────────────────────────────────────────────────── */

.gantt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  background: var(--navy-light);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  gap: 1rem;
  flex-wrap: wrap;
}

.legend {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.73rem;
  color: var(--off-white);
}

.legend-item--milestones {
  gap: 0.35rem;
  margin-left: 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.ms-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border-radius: 1px;
  flex-shrink: 0;
  margin-right: 1px;
}
.ms-dot.approval { background: var(--tan); }
.ms-dot.field    { background: var(--slate); }
.ms-dot.drafting { background: var(--gold); }
.ms-dot.due      { background: var(--white); border: 1.5px solid rgba(0,0,0,0.4); }

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-dot.on-track { background: var(--on-track); }
.legend-dot.ahead    { background: var(--ahead); }
.legend-dot.behind   { background: var(--behind); }

.controls-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mock-badge {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: var(--gold);
  background: rgba(201,158,80,0.12);
  border: 1px solid rgba(201,158,80,0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}
.mock-badge.visible { display: flex; }

.range-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--off-white);
}

.range-select select {
  background: var(--navy-dark);
  border: 1px solid rgba(127,168,201,0.35);
  color: var(--white);
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}
.range-select select:focus {
  outline: none;
  border-color: var(--slate);
}

/* ── Gantt Header (sticky column labels) ─────────────────────────────────────── */
/* NOTE: gantt-header is a sibling BEFORE gantt-wrapper in the DOM.             */
/* This ensures position:sticky works against the window scroll container,      */
/* not against the overflow-x:auto gantt-wrapper (which would break sticky).    */

.gantt-header {
  display: flex;
  align-items: stretch;
  border-bottom: 2px solid rgba(201,158,80,0.3);
  position: sticky;
  top: var(--header-h);
  background: var(--navy-dark);
  z-index: 40;
}

.gantt-info-col {
  flex-shrink: 0;
  width: var(--info-w);
  padding: 0.4rem 0.75rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
}

/* Clips the timeline header to the viewport width; synced via JS scrollLeft */
.gantt-header-clip {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.gantt-timeline-col {
  position: relative;
  height: 40px;
  min-width: 600px;
}

/* ── Gantt Wrapper ───────────────────────────────────────────────────────────── */

.gantt-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.month-label {
  position: absolute;
  top: 4px;
  font-size: 0.62rem;
  color: var(--muted);
  transform: translateX(-1px);
  white-space: nowrap;
  border-left: 1px solid rgba(255,255,255,0.08);
  padding-left: 4px;
}

.today-header-label {
  position: absolute;
  bottom: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--gold);
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

/* ── 30-Day Benchmark Line ───────────────────────────────────────────────────── */

.benchmark-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  /* Dashed via gradient — CSS doesn't support dashed on box borders for position:absolute */
  background: repeating-linear-gradient(
    to bottom,
    rgba(201,158,80,0.5) 0px,
    rgba(201,158,80,0.5) 5px,
    transparent 5px,
    transparent 10px
  );
  pointer-events: none;
  z-index: 4;
}

.benchmark-label {
  position: absolute;
  top: 3px;
  left: 3px;
  font-size: 0.58rem;
  color: rgba(201,158,80,0.8);
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* ── Group ───────────────────────────────────────────────────────────────────── */

.gantt-group {
  border-bottom: 1px solid rgba(201,158,80,0.12);
}

.group-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  background: var(--navy-lighter);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
}

.group-toggle {
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.group-header.collapsed .group-toggle {
  transform: rotate(-90deg);
}

.group-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--tan);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.group-pill {
  font-size: 0.65rem;
  background: rgba(201,158,80,0.18);
  color: var(--gold);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
}

.group-status-summary {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  font-size: 0.65rem;
}

.gss-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
}
.gss-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.gss-dot.on-track { background: var(--on-track); }
.gss-dot.ahead    { background: var(--ahead); }
.gss-dot.behind   { background: var(--behind); }

/* ── Job Rows ────────────────────────────────────────────────────────────────── */

.group-jobs {
  transition: max-height 0.25s ease;
}
.group-jobs.collapsed { display: none; }

.gantt-row {
  display: flex;
  align-items: stretch;
  min-height: var(--row-h);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

/* Subtle left-border accent by status — makes status scannable on the info column */
.gantt-row.behind   { border-left-color: rgba(204,68,68,0.55); }
.gantt-row.ahead    { border-left-color: rgba(127,168,201,0.45); }
.gantt-row.on-track { border-left-color: rgba(74,155,111,0.45); }
.gantt-row.no-date  { border-left-color: rgba(90,99,117,0.35); }

.gantt-row:hover { background: rgba(255,255,255,0.025); }

.gantt-info {
  flex-shrink: 0;
  width: var(--info-w);
  padding: 0.4rem 0.75rem;
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

.job-name-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.job-number {
  font-size: 0.62rem;
  color: var(--gold);
  font-weight: 700;
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
  white-space: nowrap;
}

.job-name {
  font-size: 0.78rem;
  color: var(--white);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.job-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.job-customer {
  font-size: 0.67rem;
  color: var(--off-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

.priority-badge {
  font-size: 0.58rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.priority-badge.rush   { background: rgba(220,80,60,0.25);  color: #ff8060; }
.priority-badge.high   { background: rgba(204,68,68,0.25);  color: #ff7070; }
.priority-badge.medium { background: rgba(201,158,80,0.25); color: var(--gold); }
.priority-badge.low    { background: rgba(127,168,201,0.2); color: var(--slate); }

/* ── Timeline Area ───────────────────────────────────────────────────────────── */

.gantt-timeline {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--row-h);
  min-width: 600px;
  overflow: hidden;
}

/* Today vertical line — appears in every row and in header */
.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(201,158,80,0.55);
  pointer-events: none;
  z-index: 5;
}

/* Job bar */
.job-bar {
  position: absolute;
  height: 14px;
  border-radius: 7px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 3px;
  opacity: 0.85;
  transition: opacity 0.15s, height 0.15s;
}
.gantt-row:hover .job-bar { opacity: 1; height: 18px; }

.job-bar.on-track { background: var(--on-track); }
.job-bar.ahead    { background: var(--ahead); }
.job-bar.behind   { background: var(--behind); }
.job-bar.no-date  { background: var(--no-date); }

/* Overflow clamp indicators */
.job-bar.overflow-left  { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.job-bar.overflow-right { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* No-end-date tick */
.job-bar.no-end-bar {
  border-radius: 3px;
  width: 6px !important;
  opacity: 0.5;
}

/* Overflow badge — shows actual duration when bar extends beyond window */
.overflow-badge {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  background: rgba(201,158,80,0.22);
  color: var(--gold);
  border: 1px solid rgba(201,158,80,0.55);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 7;
  pointer-events: none;
  letter-spacing: 0.03em;
}

/* Milestone markers (diamonds) */
.milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  cursor: default;
}

.milestone-diamond {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: var(--white);
  border: 1.5px solid rgba(0,0,0,0.25);
  display: block;
  border-radius: 1px;
}

.milestone.approval  .milestone-diamond { background: var(--tan); }
.milestone.field     .milestone-diamond { background: var(--slate); }
.milestone.drafting  .milestone-diamond { background: var(--gold); }
.milestone.due       .milestone-diamond { background: var(--white); border-width: 2px; }

.milestone-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-dark);
  border: 1px solid rgba(201,158,80,0.4);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  color: var(--tan);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
}

.milestone:hover .milestone-tooltip { opacity: 1; }

/* Overdue badge */
.overdue-tag {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.58rem;
  background: rgba(204,68,68,0.25);
  color: #ff8888;
  border: 1px solid rgba(204,68,68,0.5);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  pointer-events: none;
  z-index: 6;
}

/* Out-of-view indicator */
.no-date-indicator {
  position: absolute;
  left: 6px;
  font-size: 0.64rem;
  color: var(--muted);
  font-style: italic;
}
.no-date-indicator.out-of-view {
  font-style: normal;
  color: var(--no-date);
  font-size: 0.62rem;
}

/* ── Empty / Error States ────────────────────────────────────────────────────── */

.gantt-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.error-msg {
  padding: 2rem;
  margin: 1rem;
  background: rgba(204,68,68,0.1);
  border: 1px solid rgba(204,68,68,0.3);
  border-radius: 8px;
  color: #ff8888;
  font-size: 0.85rem;
}

/* ── Tab Panes ───────────────────────────────────────────────────────────────── */

.tab-pane { display: block; }
.tab-pane[hidden] { display: none !important; }

/* ── Section Controls Bar ────────────────────────────────────────────────────── */

.section-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: var(--navy-light);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  gap: 1rem;
  flex-wrap: wrap;
}

.section-info {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-title-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--tan);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.section-desc {
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── AR Summary Card Variants ────────────────────────────────────────────────── */

.summary-card.ar-fresh    { border-color: rgba(74,155,111,0.4); }
.summary-card.ar-fresh::before    { background: #4A9B6F; }
.summary-card.ar-fresh    .s-count { color: #4A9B6F; }

.summary-card.ar-aging    { border-color: rgba(201,158,80,0.4); }
.summary-card.ar-aging::before    { background: var(--gold); }
.summary-card.ar-aging    .s-count { color: var(--gold); }

.summary-card.ar-late     { border-color: rgba(232,135,58,0.45); }
.summary-card.ar-late::before     { background: #E8873A; }
.summary-card.ar-late     .s-count { color: #E8873A; }

.summary-card.ar-critical { border-color: rgba(204,68,68,0.45); }
.summary-card.ar-critical::before { background: var(--behind); }
.summary-card.ar-critical .s-count { color: var(--behind); }

/* ── AR Stats block in summary bar ──────────────────────────────────────────── */

.summary-total.ar-stats {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}

.ar-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.ar-stat-label {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ar-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--off-white);
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.ar-stat-value.ar-critical-text { color: var(--behind); }

/* ── AR Overview Bar ─────────────────────────────────────────────────────────── */

.ar-overview-container {
  padding: 1.25rem 1.25rem 0.5rem;
  background: var(--navy);
}

.ar-overview-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ar-overview-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--tan);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.ar-overview-subtitle {
  font-size: 0.72rem;
  color: var(--muted);
}

.ar-stacked-bar {
  display: flex;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  gap: 2px;
}

.ar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  cursor: default;
  min-width: 2px;
}
.ar-segment:hover { opacity: 0.85; }

.ar-seg-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Segment colors */
.ar-seg-fresh    { background: #4A9B6F; }
.ar-seg-aging    { background: #C99E50; }
.ar-seg-late     { background: #E8873A; }
.ar-seg-critical { background: #CC4444; }

.ar-bar-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}

.ar-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--off-white);
}

.ar-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ar-legend-label { color: var(--off-white); }
.ar-legend-count { font-weight: 700; color: var(--white); }
.ar-legend-pct   { font-weight: 400; color: var(--muted); }

/* ── AR Bucket Sections ──────────────────────────────────────────────────────── */

.ar-buckets-container {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ar-bucket-section {
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.15);
  overflow: hidden;
}

.ar-bucket-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  user-select: none;
  background: var(--navy-light);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.12s;
}
.ar-bucket-header:hover { background: var(--navy-lighter); }

.ar-bucket-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ar-bucket-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--off-white);
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.ar-bucket-count {
  font-size: 0.72rem;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
}

.ar-bucket-toggle {
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 0.2s;
}

/* ── AR Job Table ─────────────────────────────────────────────────────────────── */

.ar-jobs-table {
  display: flex;
  flex-direction: column;
}

.ar-table-header {
  display: grid;
  grid-template-columns: 1fr 130px 60px 100px 120px 80px;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ar-job-row {
  display: grid;
  grid-template-columns: 1fr 130px 60px 100px 120px 80px;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: center;
  transition: background 0.1s;
  font-size: 0.77rem;
}
.ar-job-row:hover { background: rgba(255,255,255,0.025); }
.ar-job-row:last-child { border-bottom: none; }

.ar-col-job {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ar-job-num {
  font-size: 0.62rem;
  color: var(--gold);
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

.ar-job-name {
  font-size: 0.78rem;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ar-job-customer {
  font-size: 0.67rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ar-priority-badge {
  display: inline-block;
  font-size: 0.58rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
  width: fit-content;
}
.ar-priority-badge.ar-prio-high   { background: rgba(204,68,68,0.25);   color: #ff7070; }
.ar-priority-badge.ar-prio-medium { background: rgba(201,158,80,0.25);  color: var(--gold); }

.ar-stage-badge {
  font-size: 0.68rem;
  background: rgba(127,168,201,0.12);
  color: var(--slate);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(127,168,201,0.2);
  white-space: nowrap;
}

/* Age badges */
.ar-age-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
.ar-age-fresh    { background: rgba(74,155,111,0.2);  color: #4A9B6F; }
.ar-age-aging    { background: rgba(201,158,80,0.2);  color: var(--gold); }
.ar-age-late     { background: rgba(232,135,58,0.2);  color: #E8873A; }
.ar-age-critical { background: rgba(204,68,68,0.2);   color: var(--behind); }

.ar-col-invoice,
.ar-col-price {
  font-size: 0.75rem;
  color: var(--off-white);
  white-space: nowrap;
}

/* Payment status badges */
.ar-pay-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.ar-pay-badge.pay-paid    { background: rgba(74,155,111,0.2);  color: #4A9B6F; border: 1px solid rgba(74,155,111,0.3); }
.ar-pay-badge.pay-deposit { background: rgba(127,168,201,0.12); color: var(--slate); border: 1px solid rgba(127,168,201,0.2); }
.ar-pay-badge.pay-none    { background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,0.08); }
.ar-pay-badge.pay-other   { background: rgba(201,158,80,0.12); color: var(--gold); border: 1px solid rgba(201,158,80,0.2); }

/* ── Crew Summary Card Variants ──────────────────────────────────────────────── */

.summary-card.crew-field  { border-color: rgba(127,168,201,0.4); }
.summary-card.crew-field::before  { background: var(--slate); }
.summary-card.crew-field  .s-count { color: var(--slate); }

.summary-card.crew-office { border-color: rgba(201,158,80,0.4); }
.summary-card.crew-office::before { background: var(--gold); }
.summary-card.crew-office .s-count { color: var(--gold); }

.summary-card.crew-total  { border-color: rgba(74,155,111,0.4); }
.summary-card.crew-total::before  { background: var(--on-track); }
.summary-card.crew-total  .s-count { color: var(--on-track); }

.s-sub {
  font-size: 0.6rem;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Crew Stats in summary bar ───────────────────────────────────────────────── */

.summary-total.crew-stats {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}

.crew-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.crew-stat-label {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.crew-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--off-white);
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.crew-stat-sub {
  font-size: 0.62rem;
  color: var(--muted);
}

/* ── Crew Grid ────────────────────────────────────────────────────────────────── */

.crew-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.crew-panel {
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
}

.crew-panel.full-width {
  grid-column: 1 / -1;
}

.crew-panel-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--navy-light);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.crew-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tan);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.crew-panel-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ── Stage Load Chart ─────────────────────────────────────────────────────────── */

.stage-load-chart {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stage-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 28px;
}

.stage-bar-label {
  width: 130px;
  flex-shrink: 0;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--off-white);
  text-align: right;
}

.stage-bar-label.stage-field  { color: var(--slate); }
.stage-bar-label.stage-office { color: var(--gold); }

.stage-bar-track {
  flex: 1;
  height: 20px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}

.stage-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.stage-bar-fill.fill-field  { background: linear-gradient(90deg, #7FA8C9, #9abfd8); }
.stage-bar-fill.fill-office { background: linear-gradient(90deg, #C99E50, #dab86a); }

.stage-bar-meta {
  width: 110px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stage-bar-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  min-width: 24px;
}

.stage-bar-age {
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
}

/* Age classes used in both AR and Crew */
.age-fresh    { background: rgba(74,155,111,0.2);  color: #4A9B6F; }
.age-aging    { background: rgba(201,158,80,0.2);  color: var(--gold); }
.age-late     { background: rgba(232,135,58,0.2);  color: #E8873A; }
.age-critical { background: rgba(204,68,68,0.2);   color: var(--behind); }

/* ── Crew Member Cards ────────────────────────────────────────────────────────── */

.crew-member-card {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.1s;
}
.crew-member-card:hover { background: rgba(255,255,255,0.02); }
.crew-member-card:last-child { border-bottom: none; }

.crew-member-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem 0.4rem;
}

.crew-member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-lighter);
  border: 1.5px solid rgba(127,168,201,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate);
  flex-shrink: 0;
  font-family: 'Lato', sans-serif;
}

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

.crew-member-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
  display: block;
}

.crew-member-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.crew-stage-tag {
  font-size: 0.62rem;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.crew-member-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.crew-member-count {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.crew-member-count-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.crew-expand-toggle {
  font-size: 0.55rem;
  color: var(--muted);
  transition: transform 0.2s;
  margin-top: 0.2rem;
}

.crew-member-bar {
  height: 5px;
  background: rgba(255,255,255,0.06);
  margin: 0 1rem 0.65rem;
  border-radius: 3px;
  overflow: hidden;
}

.crew-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.crew-bar-fill.fill-field    { background: var(--slate); }
.crew-bar-fill.fill-drafting { background: var(--gold); }

/* ── Crew Job Rows ────────────────────────────────────────────────────────────── */

.crew-member-jobs {
  background: rgba(0,0,0,0.12);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.crew-job-row {
  display: grid;
  grid-template-columns: 10px 1fr 120px 55px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.73rem;
}
.crew-job-row:last-child { border-bottom: none; }

.crew-job-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.crew-job-status-dot.behind   { background: var(--behind); }
.crew-job-status-dot.ahead    { background: var(--ahead); }
.crew-job-status-dot.on-track { background: var(--on-track); }
.crew-job-status-dot.no-date  { background: var(--no-date); }

.crew-job-info {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.crew-job-num {
  font-size: 0.6rem;
  color: var(--gold);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  flex-shrink: 0;
}

.crew-job-name {
  color: var(--off-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.73rem;
}

.crew-job-stage {
  font-size: 0.67rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crew-job-age {
  font-size: 0.68rem;
  font-weight: 700;
  text-align: right;
}

/* ── Crew Empty State ─────────────────────────────────────────────────────────── */

.crew-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.crew-empty-sub {
  font-size: 0.7rem;
  color: var(--no-date);
}

/* ── My Jobs Tab ─────────────────────────────────────────────────────────────── */

/* Person Selector */
.mj-selector-container {
  padding: 0.75rem 1rem 0;
}

.mj-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mj-selector-label {
  font-size: 0.78rem;
  color: var(--off-white);
  white-space: nowrap;
}

.mj-person-select {
  background: var(--navy-dark);
  border: 1.5px solid rgba(127,168,201,0.35);
  color: var(--white);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 240px;
}

.mj-person-select:focus {
  outline: none;
  border-color: var(--gold);
}

.mj-person-select option { background: var(--navy-dark); }

/* View container */
.mj-view-container {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Action Needed Panel ─────────────────────────────────────────────────────── */

.mj-action-panel {
  background: rgba(201,158,80,0.05);
  border: 1px solid rgba(201,158,80,0.3);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  overflow: hidden;
}

.mj-panel-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  background: rgba(201,158,80,0.08);
  border-bottom: 1px solid rgba(201,158,80,0.15);
}

.mj-panel-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  color: var(--gold);
}

.mj-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tan);
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.mj-panel-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(201,158,80,0.2);
  color: var(--gold);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
}

.mj-count-week {
  background: rgba(127,168,201,0.2);
  color: var(--slate);
}

.mj-panel-subtitle {
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: auto;
}

/* Action/Week job rows */
.mj-action-jobs,
.mj-week-jobs {
  padding: 0.35rem 0;
}

.mj-action-row,
.mj-week-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto 50px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.73rem;
}

.mj-action-row:last-child,
.mj-week-row:last-child { border-bottom: none; }

.mj-action-info {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.mj-action-name {
  color: var(--off-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.73rem;
}

.mj-action-badges {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

/* Status badges */
.mj-status-badge {
  font-size: 0.58rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mj-rework {
  background: rgba(232,135,58,0.2);
  color: #E8873A;
  border: 1px solid rgba(232,135,58,0.3);
}

.mj-precomp {
  background: rgba(127,168,201,0.15);
  color: var(--slate);
  border: 1px solid rgba(127,168,201,0.2);
}

.mj-rework-inline {
  font-size: 0.55rem;
}

.mj-stage-chip {
  font-size: 0.6rem;
  background: rgba(255,255,255,0.07);
  color: var(--muted);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Due date badges (This Week panel) */
.mj-due-badge {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.mj-due-today { background: rgba(204,68,68,0.2);    color: var(--behind); }
.mj-due-soon  { background: rgba(232,135,58,0.2);   color: #E8873A; }
.mj-due-week  { background: rgba(74,155,111,0.2);   color: var(--on-track); }

/* ── This Week Panel ─────────────────────────────────────────────────────────── */

.mj-this-week-panel {
  background: rgba(127,168,201,0.04);
  border: 1px solid rgba(127,168,201,0.2);
  border-left: 4px solid var(--slate);
  border-radius: 8px;
  overflow: hidden;
}

.mj-this-week-panel .mj-panel-header {
  background: rgba(127,168,201,0.07);
  border-bottom: 1px solid rgba(127,168,201,0.12);
}

.mj-this-week-panel .mj-panel-title { color: var(--slate); }
.mj-this-week-panel .mj-panel-icon { color: var(--slate); }

/* ── Stage Sections ──────────────────────────────────────────────────────────── */

.mj-stage-sections {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
}

.mj-sections-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.mj-sections-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tan);
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.mj-sections-sub {
  font-size: 0.68rem;
  color: var(--muted);
}

.mj-stage-section {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mj-stage-section:last-child { border-bottom: none; }

.mj-stage-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.12s;
  border-left: 3px solid transparent;
}

.mj-stage-header:hover { background: rgba(255,255,255,0.025); }

.mj-stage-header.mj-stage-field {
  border-left-color: var(--slate);
}

.mj-stage-header.mj-stage-office {
  border-left-color: var(--gold);
}

.mj-stage-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--off-white);
  flex: 1;
}

.mj-stage-header.mj-stage-field .mj-stage-name { color: var(--slate); }
.mj-stage-header.mj-stage-office .mj-stage-name { color: var(--tan); }

.mj-stage-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,0.07);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}

.mj-expand-toggle {
  font-size: 0.55rem;
  color: var(--muted);
  transition: transform 0.2s;
}

/* My Jobs job rows */
.mj-job-row {
  grid-template-columns: 10px 1fr auto auto 90px 50px;
}

.mj-job-row.mj-row-rework {
  background: rgba(232,135,58,0.04);
}

.mj-job-info {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.mj-role-tag {
  font-size: 0.58rem;
  background: rgba(127,168,201,0.12);
  color: var(--slate);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mj-customer {
  font-size: 0.65rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Summary bar stat ────────────────────────────────────────────────────────── */

.mj-action-stat .crew-stat-value { color: #E8873A; }
.mj-action-count { color: #E8873A !important; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */

.mj-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 0.5rem;
  text-align: center;
}

.mj-empty-icon { font-size: 2rem; opacity: 0.4; }
.mj-empty-title { font-size: 0.9rem; color: var(--off-white); font-weight: 600; }
.mj-empty-sub { font-size: 0.75rem; color: var(--muted); max-width: 320px; }

/* Extend .monday-link hover to mj rows */
.mj-action-row:hover .monday-link,
.mj-week-row:hover .monday-link,
.mj-job-row:hover .monday-link { opacity: 0.6; }

.mj-action-row:hover .monday-link:hover,
.mj-week-row:hover .monday-link:hover,
.mj-job-row:hover .monday-link:hover { opacity: 1; color: var(--gold); }

/* ── My Jobs Mobile ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .mj-selector-wrap { flex-direction: column; align-items: flex-start; }
  .mj-person-select { min-width: 100%; }
  .mj-selector-container { padding: 0.75rem; }
  .mj-view-container { padding: 0.75rem; }

  .mj-action-row,
  .mj-week-row {
    grid-template-columns: 10px 1fr auto 45px;
  }
  .mj-action-badges { display: none; }
  .mj-due-badge { font-size: 0.58rem; }

  .mj-job-row {
    grid-template-columns: 10px 1fr auto 45px;
  }
  .mj-role-tag { display: none; }
  .mj-rework-inline { display: none; }
  .mj-customer { display: none; }

  .mj-panel-subtitle { display: none; }
}

@media (max-width: 480px) {
  .mj-action-row,
  .mj-week-row,
  .mj-job-row {
    grid-template-columns: 10px 1fr 45px;
  }
  .mj-due-badge { display: none; }
  .mj-count-week { display: none; }
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */

footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */

.loading-state {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(201,158,80,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

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

/* ── Monday Link Icon ───────────────────────────────────────────────────────── */

.monday-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  margin-left: 2px;
  flex-shrink: 0;
  padding: 0.05rem 0.1rem;
  border-radius: 2px;
}

.gantt-row:hover .monday-link,
.ar-job-row:hover .monday-link,
.crew-job-row:hover .monday-link { opacity: 0.6; }

.gantt-row:hover .monday-link:hover,
.ar-job-row:hover .monday-link:hover,
.crew-job-row:hover .monday-link:hover { opacity: 1; color: var(--gold); }

/* ── Pipeline Value in Summary ───────────────────────────────────────────────── */

.summary-value {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.25rem;
}

.summary-value strong {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

/* ── Search + Filter Bar ─────────────────────────────────────────────────────── */

.search-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search-input {
  background: var(--navy-dark);
  border: 1px solid rgba(127,168,201,0.25);
  color: var(--white);
  padding: 0.25rem 0.65rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-family: inherit;
  width: 155px;
  transition: border-color 0.15s, width 0.25s ease;
}

.search-input::placeholder { color: var(--muted); }

.search-input:focus {
  outline: none;
  border-color: var(--slate);
  width: 195px;
}

.status-filters {
  display: flex;
  gap: 0.2rem;
}

.sf-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  padding: 0.22rem 0.55rem;
  border-radius: 5px;
  font-size: 0.68rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.sf-btn:hover { border-color: rgba(255,255,255,0.25); color: var(--off-white); }
.sf-btn.active { background: rgba(201,158,80,0.12); border-color: rgba(201,158,80,0.4); color: var(--gold); }
.sf-btn.active.sf-behind   { background: rgba(204,68,68,0.12);  border-color: rgba(204,68,68,0.4);  color: #ff8888; }
.sf-btn.active.sf-on-track { background: rgba(74,155,111,0.12); border-color: rgba(74,155,111,0.4); color: var(--on-track); }
.sf-btn.active.sf-ahead    { background: rgba(127,168,201,0.12); border-color: rgba(127,168,201,0.4); color: var(--slate); }

.filter-count {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
  margin-left: 0.15rem;
}

/* ── Job Detail Modal ────────────────────────────────────────────────────────── */

.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.detail-modal {
  background: var(--navy-dark);
  border: 1px solid rgba(201,158,80,0.4);
  border-radius: 10px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.detail-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.8rem;
  border-bottom: 1px solid rgba(201,158,80,0.2);
  gap: 0.75rem;
}

.detail-header-left { flex: 1; min-width: 0; }

.detail-job-number {
  font-size: 0.65rem;
  color: var(--gold);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.detail-job-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.detail-status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.detail-status-badge {
  display: inline-block;
  font-size: 0.62rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-status-badge.behind   { background: rgba(204,68,68,0.2);    color: var(--behind); }
.detail-status-badge.on-track { background: rgba(74,155,111,0.2);   color: var(--on-track); }
.detail-status-badge.ahead    { background: rgba(127,168,201,0.18); color: var(--slate); }
.detail-status-badge.no-date  { background: rgba(90,99,117,0.2);   color: var(--muted); }

.detail-stage-label {
  font-size: 0.7rem;
  background: rgba(127,168,201,0.1);
  color: var(--slate);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(127,168,201,0.2);
}

.detail-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.1rem 0.3rem;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
  border-radius: 4px;
}

.detail-close-btn:hover { color: var(--white); background: rgba(255,255,255,0.07); }

.detail-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-section-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--tan);
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.detail-field-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.detail-field-value {
  font-size: 0.82rem;
  color: var(--off-white);
  font-weight: 600;
}

.detail-field-value.value-empty {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

.detail-field-value.price-value {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Noto Sans Display', 'Lato', sans-serif;
}

.detail-monday-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(201,158,80,0.1);
  border: 1px solid rgba(201,158,80,0.4);
  border-radius: 6px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 0.25rem;
}

.detail-monday-btn:hover {
  background: rgba(201,158,80,0.2);
  border-color: rgba(201,158,80,0.65);
  color: var(--tan);
}

/* Gantt row is clickable */
.gantt-row { cursor: pointer; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy-dark); }
::-webkit-scrollbar-thumb { background: var(--navy-lighter); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,158,80,0.3); }

/* ── Mobile ──────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  :root {
    --info-w: 160px;
    --row-h: 56px;
    --header-h: 56px;
  }

  /* Search/filter mobile */
  .search-input { width: 120px; }
  .search-input:focus { width: 150px; }
  .sf-btn { padding: 0.2rem 0.45rem; font-size: 0.65rem; }
  .search-filter-bar { gap: 0.35rem; }

  /* Detail modal mobile */
  .detail-modal { max-width: 100%; max-height: 90vh; }
  .detail-fields { grid-template-columns: 1fr 1fr; }

  .header-logo { height: 28px; }
  .brand-divider,
  .brand-subtitle { display: none; }

  header { gap: 0.75rem; padding: 0 0.75rem; }

  .tab-btn { padding: 0.5rem 0.6rem; font-size: 0.75rem; }

  .summary-bar { padding: 0.5rem 0.75rem; gap: 0.5rem; }
  .summary-card { padding: 0.5rem 0.8rem; min-width: 90px; }
  .s-count { font-size: 1.5rem; }

  .gantt-controls { padding: 0.4rem 0.75rem; }
  .legend { gap: 0.75rem; }
  .legend-item--milestones { display: none; }

  .job-name { font-size: 0.72rem; }
  .job-customer { max-width: 110px; }

  .header-right { display: none; }

  footer { flex-direction: column; gap: 0.3rem; text-align: center; }

  /* AR Aging mobile */
  .ar-table-header { display: none; }
  .ar-job-row {
    grid-template-columns: 1fr 80px 55px;
    grid-template-rows: auto auto;
  }
  .ar-col-job    { grid-column: 1; grid-row: 1; }
  .ar-col-stage  { grid-column: 1; grid-row: 2; }
  .ar-col-age    { grid-column: 2; grid-row: 1; }
  .ar-col-payment { grid-column: 3; grid-row: 1; }
  .ar-col-invoice { display: none; }
  .ar-col-price   { display: none; }

  .ar-overview-container { padding: 0.75rem; }
  .ar-buckets-container  { padding: 0.75rem; }
  .ar-bar-legend { gap: 0.75rem; }

  /* Crew mobile */
  .crew-grid { grid-template-columns: 1fr; padding: 0.75rem; }
  .crew-panel.full-width { grid-column: 1; }

  .stage-bar-label { width: 90px; font-size: 0.68rem; }

  .crew-job-row { grid-template-columns: 10px 1fr 55px; }
  .crew-job-stage { display: none; }

  .summary-total.ar-stats,
  .summary-total.crew-stats { gap: 0.75rem; }
}

@media (max-width: 480px) {
  :root { --info-w: 130px; }
  .job-customer { display: none; }
  .summary-total { display: none; }
  .legend { gap: 0.5rem; }

  .ar-job-row { grid-template-columns: 1fr 55px; }
  .ar-col-payment { display: none; }
  .ar-col-age { grid-column: 2; }
}
