.jobs-page,
.job-page,
.job-detail-page {
  overflow-x: hidden;
}

.jobs-page,
.job-page,
.job-detail-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

main[data-active-nav="jobs"] .topbar {
  display: none;
}

.jobs-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.jobs-toolbar > :nth-child(1) {
  min-width: 220px;
}

.jobs-toolbar > :nth-child(n + 2) {
  min-width: 0;
}

.jobs-toolbar > * {
  min-width: 0;
}

.jobs-toolbar input[type="search"],
.jobs-toolbar select {
  width: 100%;
}

.job-links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.job-link-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.job-link-group .button {
  width: 100%;
}

.lead-section__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.lead-section__header h2,
.lead-section__header h3 {
  margin: 0;
}

.lead-subtitle {
  margin: 4px 0 0;
  color: var(--fg-muted);
}

.lead-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.lead-stat-card {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.lead-stat-card__label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}

.lead-stat-card__value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  color: #0f172a;
}

.job-table-wrapper {
  overflow-x: auto;
}

.job-table {
  width: 100%;
  table-layout: auto;
}

.jobs-table tr[data-job-id] {
  cursor: pointer;
  transition: background 0.15s ease;
}

.jobs-table tr[data-job-id]:hover {
  background: rgba(37, 99, 235, 0.08);
}

.jobs-table tr.job-row--expanded {
  background: rgba(37, 99, 235, 0.12);
}

.jobs-table thead th {
  white-space: nowrap;
}

.jobs-table th:nth-child(1),
.jobs-table td:nth-child(1) {
  min-width: 150px;
}

.jobs-table th:nth-child(2),
.jobs-table td:nth-child(2) {
  min-width: 120px;
}

.jobs-table th:nth-child(3),
.jobs-table td:nth-child(3) {
  min-width: 240px;
}

.jobs-table th:nth-child(4),
.jobs-table td:nth-child(4) {
  min-width: 140px;
}

.jobs-table th:nth-child(5),
.jobs-table td:nth-child(5) {
  min-width: 140px;
}

.jobs-table th:nth-child(6),
.jobs-table td:nth-child(6) {
  min-width: 170px;
}

.jobs-table th:nth-child(7),
.jobs-table td:nth-child(7) {
  min-width: 130px;
}

.job-table td,
.job-table th {
  vertical-align: top;
}

.job-table__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.job-empty {
  margin: 0;
  color: var(--fg-muted);
}

.job-type-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.12);
  color: #075985;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.job-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 20px;
  align-items: start;
}

.job-detail-grid > *,
.job-main,
.job-sidebar,
.crm-shell__hero > * {
  min-width: 0;
}

.job-main,
.job-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.job-main .card,
.job-sidebar .card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.job-customer-card {
  grid-column: 1 / -1;
  width: 100%;
}

.job-field,
.lead-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.job-field label,
.lead-field span {
  font-weight: 600;
  color: #64748b;
}

.job-field input,
.job-field select,
.job-field textarea,
.lead-field input,
.lead-field select,
.lead-field textarea {
  width: 100%;
}

.job-field select,
.lead-field select {
  color: #2563eb;
  font-weight: 600;
}

.job-field--wide,
.lead-field--wide {
  grid-column: 1 / -1;
}

.job-summary {
  display: grid;
  gap: 12px;
}

.lead-meta__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.lead-meta__item span:last-child {
  font-weight: 700;
  color: #0f172a;
  text-align: right;
  word-break: break-word;
}

.lead-side-actions,
.job-actions-fixed {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.job-page__header.crm-entity-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.98) 0%, rgba(255, 255, 255, 0.98) 42%, rgba(248, 250, 252, 0.98) 100%);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

.job-page__header.crm-entity-hero .job-page__header-actions {
  display: flex;
  justify-content: flex-end;
  margin-left: 0;
}

@media (max-width: 900px) {
  .job-page__header.crm-entity-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .job-page__header.crm-entity-hero .job-page__header-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .job-page__header.crm-entity-hero {
    grid-template-columns: 1fr;
  }
}

.job-link {
  color: #0f172a;
  text-decoration: none;
  font-weight: 700;
}

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

.job-muted {
  color: #64748b;
}

@media (max-width: 1100px) {
  .jobs-toolbar {
    grid-template-columns: 1fr;
  }

  .job-links-grid {
    grid-template-columns: 1fr;
  }

  .job-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .jobs-toolbar {
    grid-template-columns: 1fr;
  }

  .job-form-grid {
    grid-template-columns: 1fr;
  }

  .lead-section__header {
    flex-direction: column;
  }
}
