/* ═══════════════════════════════════════════════════════════════
   HIGH 5 CONNECT CRM — V2 Job Detail Panel
   Desktop: 3-column (left section nav + center + right details)
   Tablet: 2-column (content + right details)
   Mobile: full-screen section-based page
   ═══════════════════════════════════════════════════════════════ */

/* ─── Panel Container ───────────────────────────────────────── */
.job-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-panel);
  display: flex;
  justify-content: flex-end;
}

.job-panel.hidden {
  display: none;
}

.job-panel-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-sm);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  cursor: pointer;
}

.job-panel-content {
  position: relative;
  width: 100%;
  background: var(--bg-page);
  overflow-y: auto;
  box-shadow: var(--shadow-panel);
  z-index: 1;
  animation: panel-slide-in var(--t-normal) forwards;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

@keyframes panel-slide-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Mobile: full-screen, no overlay */
@media (max-width: 640px) {
  .job-panel-content {
    max-width: 100%;
  }

  .job-panel-overlay {
    display: none;
  }
}

/* Tablet: narrower panel */
@media (min-width: 641px) and (max-width: 1024px) {
  .job-panel-content {
    max-width: 90%;
  }
}

/* Desktop: full-width 3-column page */
@media (min-width: 1025px) {
  .job-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: calc(var(--z-panel) + 1);
    justify-content: stretch;
    background: var(--bg-page);
  }

  .job-panel-overlay {
    display: none;
  }

  .job-panel-content {
    width: 100%;
    max-width: none;
    box-shadow: none;
    animation: view-fade-in var(--t-normal) forwards;
  }
}

/* ─── 3-Column Layout (Desktop) ────────────────────────────── */
.job-3col {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

@media (min-width: 1025px) {
  .job-3col {
    flex-direction: row;
    height: 100dvh;
  }
}

.job-3col-center {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* ─── Left Sidebar — Section Nav (Desktop only) ────────────── */
.job-left-nav {
  display: none;
}

@media (min-width: 1025px) {
  .job-left-nav {
    display: flex;
    flex-direction: column;
    width: 200px;
    min-width: 200px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: var(--s2) 0;
    transition: width 0.2s ease, min-width 0.2s ease;
  }

  .job-left-nav.collapsed {
    width: 48px;
    min-width: 48px;
    overflow: hidden;
  }

  .job-left-nav.collapsed .job-nav-label {
    display: none;
  }

  .job-left-nav.collapsed .job-nav-item {
    justify-content: center;
    padding: var(--s2);
  }
}

.job-nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--t-fast);
  white-space: nowrap;
  width: 100%;
  text-align: left;
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
}

.job-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.job-nav-item.active {
  color: var(--accent);
  background: var(--accent-bg);
}

.job-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--accent);
}

.job-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: currentColor;
}

.job-nav-badge {
  margin-left: auto;
  background: var(--bg-input);
  color: var(--text-label);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

.job-nav-item.active .job-nav-badge {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ─── Center Content Area ──────────────────────────────────── */
.job-center {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

@media (min-width: 1025px) {
  .job-center {
    border-right: 1px solid var(--border);
  }
}

/* ─── Center Header (breadcrumbs + title + toolbar) ────────── */
.job-center-header {
  padding: var(--s4) var(--s5);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.job-breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--text-xs);
  color: var(--text-label);
  margin-bottom: var(--s2);
}

.job-breadcrumb-link {
  color: var(--text-link);
  cursor: pointer;
  font-weight: 500;
}

.job-breadcrumb-link:hover {
  text-decoration: underline;
}

.job-breadcrumb-sep {
  color: var(--text-label);
}

.job-center-title-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s1);
}

.job-center-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.job-number-badge {
  background: var(--navy-whisper);
  color: var(--navy-base);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px var(--s2);
  border-radius: var(--r-sm);
}

.job-center-section-title {
  font-size: var(--text-sm);
  color: var(--text-label);
}

.job-center-contact {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--s3);
}

.job-center-contact-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

.job-center-contact-link:hover {
  text-decoration: underline;
}

/* ─── Desktop Toolbar (icon row) ───────────────────────────── */
.job-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.job-toolbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--t-fast);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.job-toolbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--text-label);
}

/* ─── Center Content Body ──────────────────────────────────── */
.job-center-body {
  padding: var(--s5);
}

/* Financial Summary Card */
.job-stage-overview {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.job-overview-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.job-profit-analysis {
  padding: var(--s4);
  margin-bottom: var(--s5);
}

.job-profit-analysis .profit-analysis-grid {
  margin-top: var(--s2);
}

.profit-analysis-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profit-analysis-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--s3);
  padding: var(--s2) 0;
  font-size: var(--text-sm);
  align-items: center;
}

.profit-analysis-label {
  color: var(--text-secondary);
}

.profit-analysis-value {
  font-weight: 600;
  text-align: right;
  min-width: 80px;
}

.profit-analysis-pct {
  font-size: var(--text-xs);
  color: var(--text-label);
  text-align: right;
  min-width: 48px;
}

.profit-analysis-subtotal {
  border-top: 2px solid var(--navy-base);
  padding-top: var(--s2);
  margin-top: var(--s1);
}

.profit-analysis-subtotal .profit-analysis-label,
.profit-analysis-subtotal .profit-analysis-value {
  font-weight: 700;
}

.profit-analysis-total {
  border-top: 3px solid var(--navy-base);
  padding-top: var(--s3);
  margin-top: var(--s2);
}

.profit-analysis-total .profit-analysis-label,
.profit-analysis-total .profit-analysis-value {
  font-weight: 800;
  font-size: var(--text-base);
}

.job-fin-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s5);
  margin-bottom: var(--s5);
  box-shadow: var(--shadow-sm);
}

.job-fin-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.job-fin-title a {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 600;
}

.job-fin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}

.job-fin-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--s1);
}

.job-fin-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-normal);
}

.job-fin-value-sm {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

/* Amount Collected Card */
.job-collected {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s5);
  margin-bottom: var(--s5);
  box-shadow: var(--shadow-sm);
}

.job-collected-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--green);
  margin-bottom: var(--s3);
}

.job-collected-amount {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--s3);
}

.job-collected-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--s3);
}

/* ─── Financial Bars ───────────────────────────────────────── */
.job-fin-bar-row {
  margin-top: var(--s3);
}

.job-fin-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--r-full);
  overflow: hidden;
}

.job-fin-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width var(--t-slow);
}

.job-fin-bar-fill.bar-green {
  background: var(--green);
}

/* ─── Dashboard Content Layout ─────────────────────────────── */
.job-dashboard-content {
  padding: var(--s5);
  max-width: 700px;
}

.job-activity-preview {
  margin-top: var(--s4);
}

.job-activity-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--s3);
}

.job-activity-title .text-link {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.job-activity-title .text-link:hover {
  text-decoration: underline;
}

/* ─── Right Sidebar — Details Panel (Desktop/Tablet) ───────── */
.job-right-sidebar {
  display: none;
}

@media (min-width: 641px) {
  .job-right-sidebar {
    display: flex;
    flex-direction: column;
    width: 320px;
    min-width: 320px;
    background: var(--bg-card);
    overflow-y: auto;
    border-left: 1px solid var(--border);
    transition: width 0.2s ease, min-width 0.2s ease;
  }
}

@media (min-width: 1025px) {
  .job-right-sidebar {
    width: 340px;
    min-width: 340px;
    border-left: none;
    max-height: 100dvh;
    overflow-y: auto;
  }

  .job-right-sidebar.collapsed {
    width: 36px;
    min-width: 36px;
    overflow: hidden;
    border-left: 1px solid var(--border);
  }

  .job-right-sidebar.collapsed > *:not(.job-right-collapse-row) {
    display: none;
  }
}

/* Collapse buttons — always visible with good contrast */
.job-panel-collapse-btn {
  color: var(--text-secondary);
  transition: all var(--t-fast);
}

.job-right-sidebar.collapsed .job-panel-collapse-btn,
.job-left-nav.collapsed .job-panel-collapse-btn {
  color: var(--text-primary);
  background: var(--bg-input);
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-sm);
}

.job-right-sidebar.collapsed .job-panel-collapse-btn:hover,
.job-left-nav.collapsed .job-panel-collapse-btn:hover {
  background: var(--bg-hover);
}

/* Clickable stage badge in right sidebar */
.badge-clickable {
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity var(--t-fast);
}

.badge-clickable:hover {
  opacity: 0.8;
}

/* Hero Image — Full-Width, Edge-to-Edge */
.job-right-hero {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy-base));
  overflow: hidden;
  position: relative;
}

.job-right-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-right-hero-actions {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  display: flex;
  gap: var(--s1);
}

.job-right-hero-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: rgba(10, 22, 40, 0.5);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast);
}

.job-right-hero-btn:hover {
  background: rgba(10, 22, 40, 0.7);
}

/* Address Section */
.job-right-address {
  padding: var(--s4);
  border-bottom: 1px solid var(--border);
}

.job-right-address-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--s1);
}

.job-right-address-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Sub-Tabs: Overview | Custom Fields */
.job-right-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.job-right-tab {
  flex: 1;
  padding: var(--s3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
}

.job-right-tab:hover {
  color: var(--text-primary);
}

.job-right-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Details Section */
.job-right-section {
  padding: var(--s4);
  border-bottom: 1px solid var(--border);
}

.job-right-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s3);
  cursor: pointer;
}

.job-right-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.job-right-section-chevron {
  color: var(--text-label);
  transition: transform var(--t-fast);
}

.job-right-section-header.collapsed .job-right-section-chevron {
  transform: rotate(-90deg);
}

/* Detail Row — Icon + Label + Value */
.job-detail-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
  min-height: 36px;
}

.job-detail-icon {
  width: 18px;
  height: 18px;
  color: var(--text-label);
  flex-shrink: 0;
}

.job-detail-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  min-width: 80px;
}

.job-detail-value {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-left: auto;
}

.job-detail-value select {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: right;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}

.job-detail-value select:hover {
  background: var(--bg-hover);
}

/* Tags Section */
.job-tags-section {
  padding: var(--s4);
}

.job-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.job-tag-add {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-label);
  border: 1px dashed var(--border);
  cursor: pointer;
  transition: all var(--t-fast);
}

.job-tag-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

/* Subcontractors Section */
.job-subs-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
}

.job-subs-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.job-subs-trade {
  font-size: var(--text-xs);
  color: var(--text-label);
}

/* ─── Mobile Job Page Overrides ────────────────────────────── */
@media (max-width: 640px) {
  .job-center-header {
    padding: var(--s3) var(--s4);
  }

  .job-center-body {
    padding: var(--s4);
  }

  .job-toolbar {
    display: none;
  }

  /* Mobile shows hero at top, not in right sidebar */
  .job-mobile-hero {
    display: block;
  }
}

@media (min-width: 641px) {
  .job-mobile-hero {
    display: none;
  }
}

/* ─── Job Hero Image (Mobile Full-Width) ───────────────────── */
.job-hero {
  position: relative;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy-base));
  overflow: hidden;
}

.job-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, var(--overlay-md));
}

.job-hero-actions {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  right: var(--s3);
  display: flex;
  justify-content: space-between;
}

.job-hero-back {
  color: var(--text-inverse);
  background: rgba(10, 22, 40, 0.4);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-radius: var(--r-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Desktop back/close button in info header */
.job-desktop-back {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.job-desktop-back:hover {
  color: var(--text-primary);
}

/* Panel collapse toggle buttons */
.job-nav-collapse-row,
.job-right-collapse-row {
  display: flex;
  justify-content: flex-end;
  padding: 0 var(--s2) var(--s1);
}

.job-panel-collapse-btn {
  opacity: 0.5;
  transition: opacity var(--t-fast);
}

.job-panel-collapse-btn:hover {
  opacity: 1;
}

.job-right-sidebar.collapsed .job-panel-collapse-btn svg {
  transform: rotate(180deg);
}

.job-left-nav.collapsed .job-panel-collapse-btn svg {
  transform: rotate(180deg);
}

.job-hero-edit {
  color: var(--text-inverse);
  background: rgba(10, 22, 40, 0.4);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-radius: var(--r-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.job-hero-camera {
  position: absolute;
  bottom: var(--s3);
  right: var(--s3);
  color: var(--text-inverse);
  background: rgba(10, 22, 40, 0.5);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-radius: var(--r-full);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Stage Selector (on hero) ─────────────────────────────── */
.job-stage-selector {
  position: absolute;
  bottom: var(--s3);
  left: var(--s3);
}

.job-stage-btn {
  padding: var(--s1) var(--s3);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  gap: var(--s1);
}

/* ─── Job Info Header ──────────────────────────────────────── */
.job-info-header {
  padding: var(--s4) var(--s5);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 1025px) {
  .job-info-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
  }
}

.job-info-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--s1);
}

.job-info-contact {
  font-size: var(--text-sm);
  color: var(--accent);
  cursor: pointer;
}

.job-info-contact:hover {
  text-decoration: underline;
}

.job-info-address {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--s1);
}

/* ─── Job Quick Actions (Mobile) ───────────────────────────── */
.job-quick-actions {
  padding: var(--s2) var(--s5);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

/* ─── Job Overview Card (Mobile) ───────────────────────────── */
.job-overview {
  margin: var(--s4) var(--s5);
  padding: var(--s4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.job-overview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s2) 0;
}

.job-overview-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.job-overview-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.job-overview-alert {
  color: var(--red);
  font-weight: 600;
}

/* ─── Job Section List (Mobile) ────────────────────────────── */
.job-sections {
  padding: var(--s2) 0;
}

/* ─── Job Tabs (Desktop — now in center area) ──────────────── */
.job-tabs {
  display: none;
}

.job-tab-content {
  padding: var(--s5);
}

/* Async tab container */
.tab-async-container {
  min-height: 200px;
}

/* Desktop: use left nav instead of tabs */
@media (min-width: 1025px) {
  .job-sections {
    display: none;
  }
}

/* Mobile: show sections, hide tab content by default */
@media (max-width: 1024px) {
  .job-tab-content {
    display: none;
  }
}

/* ─── Job Fields Grid ──────────────────────────────────────── */
.job-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}

.job-field-full {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .job-fields {
    grid-template-columns: 1fr;
  }
}

/* ─── Job Form Inline Edit ─────────────────────────────────── */
.job-field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--s1);
}

.job-field-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
  padding: var(--s2) 0;
}

.job-field-value:empty::after {
  content: '\2014';
  color: var(--text-label);
}

/* ─── Contact Panel ────────────────────────────────────────── */
.contact-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-panel);
  display: flex;
  justify-content: flex-end;
}

.contact-panel.hidden {
  display: none;
}

.contact-panel-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-sm);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  cursor: pointer;
}

.contact-panel-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  background: var(--bg-page);
  overflow-y: auto;
  box-shadow: var(--shadow-panel);
  z-index: 1;
  animation: panel-slide-in var(--t-normal) forwards;
}

@media (max-width: 640px) {
  .contact-panel-content {
    max-width: 100%;
  }

  .contact-panel-overlay {
    display: none;
  }
}

/* ─── Tag Pills ──────────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  background: color-mix(in srgb, var(--tag-color, #475569) 15%, transparent);
  color: var(--tag-color, #475569);
  white-space: nowrap;
}

.tag-pill-remove {
  display: inline-flex;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
}
.tag-pill-remove:hover { opacity: 1; }
.tag-pill-remove svg { width: 12px; height: 12px; }

.pipeline-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.job-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 var(--s4);
}

.job-tag-add {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  cursor: pointer;
}
.job-tag-add:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
}

/* Tag Picker Dropdown */
.tag-picker-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--s2);
  z-index: var(--z-dropdown);
  margin-top: 4px;
}

.tag-picker-input {
  width: 100%;
  margin-bottom: var(--s2);
}

.tag-picker-list {
  max-height: 180px;
  overflow-y: auto;
}

.tag-picker-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2) var(--s3);
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  text-align: left;
}
.tag-picker-item:hover {
  background: var(--bg-hover);
}

.tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-picker-create {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2) var(--s3);
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--accent);
  border-top: 1px solid var(--border);
  margin-top: var(--s2);
  padding-top: var(--s2);
}
.tag-picker-create:hover {
  background: var(--accent-bg);
}

.job-tags-section {
  position: relative;
  padding: var(--s3) 0;
}

/* ─── Subcontractors ─────────────────────────────────────────── */
.job-subs-list {
  padding: 0 var(--s4) var(--s3);
}

.sub-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border-light);
}

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

.sub-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.sub-trade {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.sub-phone {
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.sub-phone:hover { text-decoration: underline; }

.sub-remove {
  opacity: 0;
  transition: opacity 0.15s;
}
.sub-row:hover .sub-remove { opacity: 1; }

.job-detail-row-subs {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* ─── Custom Fields ──────────────────────────────────────────── */
.job-right-section-content {
  padding: var(--s3) var(--s4);
}

.cf-row {
  margin-bottom: var(--s3);
}

.cf-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.cf-input {
  width: 100%;
}

.cf-input[type="checkbox"] {
  width: auto;
}

/* ═══════════════════════════════════════════════════════════════
   SECTION TOOLBAR — Search + Show Related Toggle
   ═══════════════════════════════════════════════════════════════ */

.section-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s3);
  flex-wrap: wrap;
}

.section-search {
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 var(--s3);
  flex: 1;
  min-width: 160px;
  transition: border-color var(--t-fast);
}

.section-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(6, 139, 195, 0.1);
}

.section-search-icon {
  color: var(--text-label);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.section-search-icon svg {
  width: 16px;
  height: 16px;
}

.section-search-input {
  border: none;
  background: transparent;
  padding: var(--s2) 0;
  font-size: var(--text-sm);
  color: var(--text-primary);
  width: 100%;
  outline: none;
  font-family: inherit;
}

.section-search-input::placeholder {
  color: var(--text-label);
}

.section-toggle {
  display: flex;
  align-items: center;
  gap: var(--s2);
  cursor: pointer;
  white-space: nowrap;
}

.section-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.section-toggle-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.section-toggle-label svg {
  width: 14px;
  height: 14px;
}

/* ─── Compact Panel Mode (60% width, collapsed sidebars) ──── */
@media (min-width: 1025px) {
  .job-panel.compact {
    left: auto;
    width: 60%;
  }

  .job-panel.compact .job-panel-overlay {
    display: block;
  }

  .job-panel.compact .job-left-nav {
    width: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
  }

  .job-panel.compact .job-right-sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
  }
}

/* ─── Insurance Claim Section (Right Sidebar) ─── */
.job-insurance-section {
  padding: var(--s4);
  border-top: 1px solid var(--border);
}

.job-insurance-fields {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-top: var(--s2);
}

.job-insurance-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-insurance-field .input-label {
  font-size: 11px;
  color: var(--text-label);
  font-weight: 600;
}

.job-insurance-field .input-sm {
  font-size: 12px;
  padding: 4px 8px;
}
