/* Job Control — sidebar shell + stage board */

:root {
  --sidebar-width: 15.5rem;
  --sidebar-bg: #eaf2f9;
  --sidebar-border: #c9dceb;
  /* Main nav areas: slightly deeper pastel than sidebar */
  --sidebar-section-bg: #d9e8f5;
}

html[data-theme="dark"] {
  --bg: #111318;
  --surface: #1b1e25;
  --border: #343842;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #6366f1;
  --link: #93c5fd;
  --focus: #c7d2fe;
  --danger: #fca5a5;
  --sidebar-bg: #17191f;
  --sidebar-border: #343842;
  /* Main nav areas: lighter than sidebar in dark mode */
  --sidebar-section-bg: #22252d;
  color-scheme: dark;
}

body.app-shell {
  display: flex;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

body.app-shell .top {
  display: none !important;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 40;
}

.sidebar-brand {
  padding: 1.15rem 1.1rem 0.85rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand .brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.65rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-section {
  background: var(--sidebar-section-bg);
  border-radius: 8px;
  padding: 0.3rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-group-label {
  margin: 0.15rem 0.55rem 0.2rem;
  font-size: 0.975rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

.sidebar-link {
  display: block;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  color: #3a5570;
  text-decoration: none;
  font-size: 0.9rem;
}

.sidebar-link-main {
  font-size: 0.975rem;
  font-weight: 650;
  color: var(--text);
}

.theme-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(61, 111, 168, 0.1);
  color: var(--text);
}

.sidebar-link.active {
  background: #cfe0f0;
  color: var(--text);
  font-weight: 650;
}

html[data-theme="dark"] .sidebar-link { color: #d4d4d8; }
html[data-theme="dark"] .sidebar-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
html[data-theme="dark"] .sidebar-link.active { background: #30333c; color: #fff; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #14171c;
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .table th { background: #16191f; }
html[data-theme="dark"] .btn { background: #22262e; color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .btn:hover { background: #2b3039; }
html[data-theme="dark"] .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .btn.danger { background: #2a1b1d; border-color: #7f1d1d; color: #fecaca; }
html[data-theme="dark"] .dash-bulk-select,
html[data-theme="dark"] .dash-search-input { background: #14171c; color: var(--text); }
html[data-theme="dark"] .job-task-step.complete { background: #13251b; }
html[data-theme="dark"] .flash { background: #123127; border-color: #166534; color: #bbf7d0; }
html[data-theme="dark"] .flash.error { background: #32191c; border-color: #7f1d1d; color: #fecaca; }

.sidebar-link-sub {
  padding-left: 1.15rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.page-welcome {
  font-size: 0.95rem;
  font-weight: 500;
}

.jobs-page-sticky {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg);
  padding: 0.35rem 0 0;
  margin: -0.35rem 0 0;
  border-bottom: 1px solid var(--sidebar-border);
}

.jobs-page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.jobs-page-sticky .dash-toolbar {
  margin-bottom: 0;
}

.jobs-page-sticky .page-title {
  margin-top: 0;
}

.jobs-sticky-cols {
  margin-top: 0.55rem;
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
  padding-bottom: 0;
  scrollbar-width: none;
}
.jobs-sticky-cols::-webkit-scrollbar {
  display: none;
}
.jobs-sticky-cols .table {
  margin: 0;
}
.jobs-sticky-cols .table th {
  border-bottom: 1px solid var(--border);
}
.jobs-table-body {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
  margin-top: 0;
}

.customer-field-hint a {
  font-weight: 600;
}

.sidebar-footer {
  padding: 0.75rem 0.65rem 1rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  padding: 0 0.65rem 0.45rem;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 0 1.25rem 2.5rem;
  max-width: 76rem;
}

.app-main-wide {
  max-width: min(96vw, 120rem);
}

.main-panel {
  padding-top: 0.5rem;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 50;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 860px) {
  body.app-shell {
    display: block;
  }

  .sidebar-toggle {
    display: inline-block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.35);
    z-index: 35;
  }

  .sidebar-backdrop[hidden] {
    display: none !important;
  }

  .app-main {
    max-width: none;
    padding: 3.25rem 1rem 2rem;
  }
}

/* Stage board */

.stage-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  white-space: nowrap;
}

.stage-chip.stage-designing { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.stage-chip.stage-cuttings { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.stage-chip.stage-edging { background: #fefce8; border-color: #fde68a; color: #854d0e; }
.stage-chip.stage-building { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.stage-chip.stage-installing { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }
.stage-chip.stage-completed { background: #e8f0f7; border-color: #b7cce0; color: #3a5570; }

.stage-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.stage-board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.stage-board-card .count {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stage-board-card .label {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.jobs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 0 0 1rem;
}

.jobs-toolbar .grow { flex: 1; min-width: 12rem; }

.section-anchor { scroll-margin-top: 1rem; }

.drawing-list { list-style: none; margin: 0; padding: 0; }
.drawing-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.drawing-list li:last-child { border-bottom: 0; }
.drawing-drive-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}
.drawing-drive-badge--pending {
  background: #fef3c7;
  color: #92400e;
}
.drawing-drive-badge--synced {
  background: #dcfce7;
  color: #166534;
}
.drawing-drive-badge--error {
  background: #fee2e2;
  color: #991b1b;
}
html[data-theme="dark"] .drawing-drive-badge--pending {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
html[data-theme="dark"] .drawing-drive-badge--synced {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}
html[data-theme="dark"] .drawing-drive-badge--error {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.stock-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.stock-hub-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}
.stock-hub-card:hover { border-color: #a1a1aa; }
.stock-hub-card strong { display: block; margin-bottom: 0.25rem; }
.stock-hub-card span { font-size: 0.8125rem; color: var(--muted); }

select.stage-select {
  font-size: 0.875rem;
  max-width: 12rem;
}

.th-stock-progress,
.cell-stock-progress {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stock-progress-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}
.stock-progress-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.stock-progress-link.is-complete {
  color: #166534;
}

.cell-dispatch-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cell-dispatch-date a {
  color: var(--text);
  text-decoration: none;
  font-weight: 550;
}
.cell-dispatch-date a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.table-jobs thead th.th-job-meter,
.table-jobs tbody td.cell-job-meter,
.table-jobs tbody td.cell-job-task-progress {
  width: 19.5rem;
  min-width: 19.5rem;
  max-width: 19.5rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}
.table-jobs thead th.th-job-meter + th.th-job-meter,
.table-jobs tbody td.cell-job-meter + td.cell-job-meter {
  padding-left: 0.15rem;
}
.job-list-task-progress,
.job-list-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 100%;
  box-sizing: border-box;
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
}
.job-list-meter:hover { text-decoration: none; }
.job-list-meter:hover .job-list-meter-count,
.job-list-meter:hover .job-list-meter-pct {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.job-list-meter-count {
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--muted);
}
.job-list-task-track,
.job-list-meter-track {
  display: block;
  flex: 0 0 11.5rem;
  width: 11.5rem;
  height: 0.45rem;
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}
.job-list-task-track i,
.job-list-meter-track i {
  display: block;
  height: 100%;
  background: #16a34a;
  border-radius: inherit;
}
.job-list-meter-pct {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.job-list-meter.is-complete .job-list-meter-pct { color: #166534; }
.cell-job-task-progress small,
.cell-job-meter small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  white-space: nowrap;
}

.table-jobs thead .th-sort-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.table-jobs thead .th-sort-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.table-jobs thead .th-sort-caret {
  margin-left: 0.2rem;
  font-weight: 700;
  color: var(--muted);
}

/* Add line — matches Stock Control job.php */
.job-add-line-card {
  min-width: 0;
  padding-top: 0.5rem;
}

.job-add-line-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.job-add-line-card-head h2.job-add-line-card-title {
  margin: 0;
}

.job-add-line-card-head .btn {
  flex-shrink: 0;
}

.job-add-line-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(9.25rem, 11.25rem) minmax(9.25rem, 11.25rem);
  gap: 0.65rem 0.75rem;
  align-items: stretch;
  border: none;
  margin: 0;
  padding: 0;
}

.job-add-line-grid.job-add-line-grid--has-fav {
  grid-template-columns:
    minmax(12.5rem, 18rem)
    minmax(9rem, min(21rem, 40%))
    minmax(9.25rem, 11.25rem)
    minmax(9.25rem, 1fr);
}

.job-add-line-span-full {
  grid-column: 1 / -1;
}

.job-add-line-col-fav {
  gap: 0.45rem;
}

.job-add-line-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.job-add-line-col-desc {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.job-add-line-col-desc textarea {
  flex: 1 1 auto;
  min-height: 3.4rem;
  resize: vertical;
}

.job-add-line-grid--has-fav .job-add-line-col-desc textarea {
  min-height: 3rem;
}

.job-add-line-col-tail {
  min-height: 0;
}

.job-add-favourite-select {
  width: 100%;
  max-width: none;
}

@media (max-width: 720px) {
  .job-add-line-grid {
    grid-template-columns: 1fr;
  }

  .job-add-line-col-desc textarea {
    min-height: 3.1rem;
  }
}

.job-materials-wrap {
  min-width: 0;
}

.import-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}
.import-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}
.import-stat .n {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.import-stat .l {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Job type and company path administration */
.job-path-page-head .page-title { margin-bottom: 0.2rem; }
.job-path-page-head p { margin: 0 0 1rem; }

.job-path-admin {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.job-type-panel,
.job-path-editor { margin: 0; }

.job-path-editor-head,
.job-type-actions,
.job-task-row,
.job-task-row-actions {
  display: flex;
  align-items: center;
}

.job-path-editor-head {
  justify-content: space-between;
  gap: 1rem;
}

.job-path-editor h2 {
  margin: 0;
  font-size: 1rem;
}

.job-type-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.job-type-item {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 7.5rem;
  padding: 0.45rem 0.7rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.job-type-item:hover { background: var(--bg); }
.job-type-item.active {
  background: var(--bg);
  border-color: var(--accent, #2563eb);
  box-shadow: inset 0 0 0 1px var(--accent, #2563eb);
}
.job-type-item strong {
  display: block;
  font-size: 0.88rem;
  line-height: 1.2;
}
.job-type-item small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.job-type-add {
  margin: 0;
  padding: 0;
  border: 0;
  flex: 1 1 12rem;
  min-width: 11rem;
  max-width: 18rem;
}

.job-type-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.job-type-add-row input { min-width: 0; flex: 1; }

.job-type-name-form { flex: 1 1 18rem; min-width: 0; max-width: none; }
.job-type-actions,
.job-task-row-actions { gap: 0.4rem; flex-wrap: wrap; }
.job-type-actions form,
.job-task-row-actions form { margin: 0; }

.job-path-preview {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.job-path-preview > p { margin: 0; }
.job-path-node {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
}
.job-path-node small {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
}
.job-path-arrow { color: var(--muted); flex: 0 0 auto; }

.job-task-list {
  display: grid;
  gap: 0.5rem;
}
.job-task-row {
  gap: 0.65rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.job-task-number {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.job-task-name-form {
  display: flex;
  gap: 0.45rem;
  flex: 1;
  min-width: 12rem;
}
.job-task-name-form input { min-width: 0; flex: 1; }
.job-task-row-actions { margin-left: auto; }
.job-task-row-actions .btn[disabled] { opacity: 0.35; cursor: default; }

.job-task-add-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 620px) {
  .job-path-editor-head,
  .job-task-row { align-items: stretch; flex-direction: column; }
  .job-type-actions { margin-top: 0.65rem; }
  .job-task-name-form { min-width: 0; }
  .job-task-row-actions { margin-left: 2.25rem; }
  .job-type-add {
    flex: 1 1 100%;
    max-width: none;
  }
}

/* Per-job company path */
.job-progress-section { margin: 0 0 1rem; }
.job-progress-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.8rem;
}
.job-progress-label {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}
.job-progress-pct {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.job-progress-empty { margin-top: 0.65rem; }
.job-progress-empty p { margin: 0; color: var(--muted); }
.job-progress-bar {
  flex: 1 1 auto;
  min-width: 4rem;
  height: 0.5rem;
  margin: 0;
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}
.job-progress-bar span {
  display: block;
  height: 100%;
  background: #16a34a;
  border-radius: inherit;
  transition: width 0.2s ease;
}
.job-task-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(14rem, 1fr);
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.1rem 0 0.55rem;
}
.job-task-step {
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid #a1a1aa;
  border-radius: 8px;
}
.job-task-step.complete {
  border-top-color: #16a34a;
  background: #f0fdf4;
}
.job-task-step-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.job-task-step-title > span {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.job-task-step.complete .job-task-step-title > span {
  background: #16a34a;
  color: #fff;
}
.job-task-plan-form {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.job-task-plan-form label { min-width: 0; }
.job-task-plan-form small {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
}
.job-task-plan-form input,
.job-task-plan-form select { width: 100%; min-width: 0; }
.job-task-plan-form .job-task-assign-field { grid-column: 1 / -1; }
.job-task-plan-form .job-task-assign-hint { grid-column: 1 / -1; margin: 0; }
.job-task-plan-form .btn { grid-column: 1 / -1; }
.task-autosave-enabled .job-task-save-fallback { display: none; }
.job-task-save-status {
  grid-column: 1 / -1;
  min-height: 1.1rem;
  color: var(--muted);
}
.job-task-save-status[data-state="saving"] { color: #2563eb; }
.job-task-save-status[data-state="saved"] { color: #15803d; }
.job-task-save-status[data-state="error"] { color: var(--danger); }

.job-task-area-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(13.5rem, 1fr);
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.1rem 0 0.6rem;
}
.job-task-area {
  align-self: start;
  padding: 0.45rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.job-task-area > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0.2rem 0.5rem;
}
.job-task-area > header strong {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.job-task-area > header span {
  color: var(--muted);
  font-size: 0.65rem;
}
.job-task-area-list { display: grid; gap: 0.35rem; }
.job-task-compact-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.job-task-compact-wrap.complete { border-left: 3px solid #16a34a; }
.job-task-compact-wrap.na { border-left: 3px solid #a1a1aa; }
.job-task-compact-wrap.na summary strong { color: var(--muted); }
.job-task-compact-wrap.overdue {
  background: #fde8e8;
  border-color: #f0c4c4;
  border-left: 3px solid #e57373;
}
html[data-theme="dark"] .job-task-compact-wrap.overdue {
  background: rgba(229, 115, 115, 0.18);
  border-color: rgba(229, 115, 115, 0.35);
}
.job-task-actions {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.12rem;
  line-height: 0;
}
.job-task-complete-form,
.job-task-na-form {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 0;
}
.job-task-actions .btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-width: 3.6rem;
  margin: 0;
  padding: 0.18rem 0.28rem;
  font-size: 0.62rem;
  line-height: 1.15;
  border-radius: 4px;
}
.job-task-na-form .btn.job-task-na-active {
  background: #d9e8f5;
  border-color: #9bb8d4;
  color: #3a5570;
  font-weight: 650;
}
html[data-theme="dark"] .job-task-na-form .btn.job-task-na-active {
  background: #3f3f46;
  border-color: #71717a;
  color: #f4f4f5;
}
.job-task-compact { border: 0; background: transparent; }
.job-task-compact summary {
  display: block;
  min-height: 2.85rem;
  padding: 0.45rem 4.2rem 0.45rem 0.5rem;
  box-sizing: border-box;
  cursor: pointer;
  list-style: none;
}
.job-task-compact summary::-webkit-details-marker { display: none; }
.job-task-compact-main { display: block; min-width: 0; }
.job-task-compact summary strong,
.job-task-compact summary small { display: block; }
.job-task-compact summary strong {
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-task-compact summary small {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.62rem;
}
.job-task-compact-controls {
  padding: 0.5rem;
  border-top: 1px solid var(--border);
}

.job-area-editor-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15rem, 1fr);
  gap: 0.65rem;
  overflow-x: auto;
  margin: 1.1rem 0;
  padding-bottom: 0.5rem;
}
.job-area-editor-column {
  align-self: start;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.job-area-editor-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.job-area-editor-head > form:first-child {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 0.25rem;
}
.job-area-editor-head input { min-width: 0; width: 100%; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.job-area-move { display: flex; gap: 0.2rem; }
.job-area-editor-tasks { display: grid; gap: 0.4rem; }
.job-area-editor-task {
  padding: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.job-path-hours-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.job-path-hours-status {
  margin: 0;
  flex: 1 1 16rem;
  font-size: 0.9rem;
}
.job-path-hours-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.job-area-task-save input,
.job-area-task-save select { width: 100%; font-size: 0.75rem; }
.job-area-task-hours,
.job-area-task-worker {
  display: grid;
  grid-template-columns: auto minmax(3.5rem, 1fr);
  align-items: center;
  gap: 0.35rem;
}
.job-area-task-hours input,
.job-area-task-worker select { margin: 0; width: 100%; font-size: 0.75rem; }
.job-area-editor-task .job-task-row-actions {
  justify-content: space-between;
  margin-top: 0.35rem;
}
.job-task-add-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1.5fr) minmax(10rem, 1fr) minmax(10rem, 1fr) auto;
  gap: 0.5rem;
}
.job-task-add-grid.has-hours:not(.has-worker),
.job-task-add-grid.has-worker:not(.has-hours) {
  grid-template-columns: minmax(10rem, 1.4fr) minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(5.5rem, 0.7fr) auto;
}
.job-task-add-grid.has-hours.has-worker {
  grid-template-columns: minmax(9rem, 1.2fr) minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(5rem, 0.65fr) minmax(8rem, 1fr) auto;
}
@media (max-width: 760px) {
  .job-task-add-grid,
  .job-task-add-grid.has-hours,
  .job-task-add-grid.has-worker { grid-template-columns: 1fr; }
}

/* Two-column job workspace */
/* Toast flash: avoid pushing page content (scroll jump on save) */
.flash.js-auto-hide-flash {
  position: fixed;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  margin: 0;
  max-width: min(32rem, calc(100vw - 2rem));
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.job-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1rem 0 0.75rem;
}
.job-title-row .page-title { margin: 0; flex: 0 1 auto; }
.job-title-row > .btn,
.job-title-actions { flex: 0 0 auto; }
.job-title-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Nested Areas on Jobs list */
.table-jobs tr.job-row-area td {
  background: color-mix(in srgb, var(--bg) 55%, var(--surface) 45%);
}
html[data-theme="dark"] .table-jobs tr.job-row-area td {
  background: color-mix(in srgb, var(--surface) 94%, #fff 6%);
}
html[data-theme="dark"] .table-jobs tbody tr:hover td {
  background: #1f232b;
}
html[data-theme="dark"] .table-jobs tbody tr.job-row-area:hover td {
  background: #242830;
}
.table-jobs .cell-job-ref.is-area {
  padding-left: 1.65rem;
  position: relative;
}
.table-jobs .cell-job-ref.is-area::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 0.45rem;
  border-left: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-radius: 0 0 0 3px;
}

/* Add Area dialog on job detail */
.job-area-dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  max-width: min(28rem, calc(100vw - 1.5rem));
  width: 100%;
  background: var(--surface, #fff);
  color: inherit;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}
.job-area-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}
.job-area-dialog-form { padding: 1rem 1.1rem 1.05rem; }
.job-area-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.job-area-dialog-head h2 {
  margin: 0;
  font-size: 1.15rem;
}
.job-area-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.job-detail-columns {
  display: grid;
  grid-template-columns: minmax(17rem, 0.72fr) minmax(0, 1.65fr);
  gap: 0.75rem;
  align-items: start;
}
.job-detail-columns > div { min-width: 0; }
.job-detail-column-title,
.job-detail-resources > h2:first-child {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.job-detail-info .card { margin-bottom: 0; }
.job-detail-resources > h2.section { margin-top: 0; }

/* Compact Job information + Materials columns */
.job-detail-columns .card {
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
}
.job-detail-columns h2.section {
  margin: 0.75rem 0 0.35rem;
}
.job-detail-columns > .job-detail-resources > h2.job-detail-column-title {
  margin: 0 0 0.3rem;
}
.job-detail-columns .label {
  margin-bottom: 0.12rem;
}
.job-detail-columns fieldset.form-grid {
  gap: 0.4rem;
}
.job-detail-columns .drawing-list li {
  padding: 0.35rem 0;
  gap: 0.35rem 0.75rem;
}
.job-detail-columns .job-add-line-card {
  padding-top: 0.35rem;
}
.job-detail-columns .job-add-line-card-head {
  margin-bottom: 0.35rem;
  gap: 0.45rem;
}
.job-detail-columns .job-add-line-grid {
  gap: 0.4rem 0.55rem;
}
.job-detail-columns .job-add-line-col {
  gap: 0.4rem;
}
.job-detail-columns .job-add-line-col-fav {
  gap: 0.3rem;
}
.job-detail-columns .job-add-line-col-desc textarea {
  min-height: 2.5rem;
}
.job-detail-columns .job-add-line-grid--has-fav .job-add-line-col-desc textarea {
  min-height: 2.35rem;
}
.job-detail-columns .queue-toolbar {
  margin-bottom: 0.4rem;
  gap: 0.45rem;
}
.job-detail-columns .table th,
.job-detail-columns .table td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.job-detail-columns .job-materials-wrap form > .bulk-actions-bar {
  margin-bottom: 0.45rem;
  padding: 0.4rem 0.55rem;
}

@media (max-width: 1100px) {
  .job-detail-columns { grid-template-columns: 1fr; }
  .job-detail-info .card { margin-bottom: 0.55rem; }
}

/* Reports */
.reports-head,
.report-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.reports-head .page-title { margin-bottom: 0.2rem; }
.reports-head p { margin: 0 0 1rem; }
.report-filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.report-filters > div { min-width: 12rem; }
.report-area-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}
.report-area-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
}
.report-area-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  background: var(--cal-bg);
  border: 2px solid var(--cal-border);
  box-sizing: border-box;
}
.report-area-swatch-overbook,
.report-area-legend-overbook .report-area-swatch {
  background: #fef2f2;
  border-color: #dc2626;
  box-shadow: inset 0 0 0 1px #dc2626;
}
.report-overbook-alert {
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.85rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 6px;
  color: #7f1d1d;
}
.report-overbook-alert strong { font-weight: 700; }
.report-overbook-alert ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}
.report-overbook-alert li { margin: 0.2rem 0; }
.report-overbook-alert .muted { color: #9f1239; }
.report-calendar-day.has-overbook {
  background: color-mix(in srgb, #fef2f2 70%, transparent);
}
.report-calendar-day.is-drop-target {
  outline: 2px dashed var(--accent, #2563eb);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent);
}
.report-cal-event.is-draggable {
  cursor: grab;
}
.report-cal-event.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.report-cal-event.is-span-continuation {
  opacity: 0.88;
  cursor: default;
}
.report-calendar.is-dragging-task .report-cal-event:not(.is-dragging) {
  pointer-events: none;
}
.report-calendar.is-saving-move {
  opacity: 0.65;
  pointer-events: none;
}
.report-cal-drag-hint { margin-top: 0.55rem; }
.report-calendar-day.has-overbook .report-calendar-date {
  color: #b91c1c;
}
.report-day-overbook-flag,
.report-overbook-mark {
  display: inline-block;
  font-style: normal;
  font-weight: 800;
  color: #dc2626;
}
.report-calendar-events a.report-cal-event.is-overbooked {
  outline: 2px solid #dc2626;
  outline-offset: 0;
  box-shadow: 0 0 0 1px #fecaca;
}
html[data-theme="dark"] .report-overbook-alert {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fecaca;
}
html[data-theme="dark"] .report-overbook-alert .muted { color: #fda4af; }
html[data-theme="dark"] .report-calendar-day.has-overbook {
  background: color-mix(in srgb, #450a0a 55%, transparent);
}
.report-schedule-table tr.report-schedule-overbooked td {
  background: color-mix(in srgb, #fef2f2 80%, transparent);
}
html[data-theme="dark"] .report-schedule-table tr.report-schedule-overbooked td {
  background: color-mix(in srgb, #450a0a 45%, transparent);
}
.report-section { margin-top: 1.5rem; }
.report-section-head { margin-bottom: 0.65rem; }
.report-section h2 {
  margin: 0;
  font-size: 1rem;
}
.report-section-head p { margin: 0.15rem 0 0; }
.report-assignment-list ul {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.45rem;
}
.report-assignment-list li { line-height: 1.35; }
.report-assignment-list a {
  color: var(--text);
  text-decoration: none;
}
.report-assignment-list a:hover { text-decoration: underline; }
.report-schedule-table td:first-child { white-space: nowrap; }
.report-schedule-table td:nth-child(2) small {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
}
.report-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(12rem, 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}
.report-link-grid .card {
  display: block;
  margin: 0;
  color: var(--text);
  text-decoration: none;
}
.report-link-grid .card:hover { border-color: #a1a1aa; }
.report-link-grid strong,
.report-link-grid span { display: block; }
.report-link-grid span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.report-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(7rem, 1fr));
  padding: 0;
  overflow-x: auto;
}
.report-calendar-weekday {
  min-width: 7rem;
  padding: 0.45rem 0.55rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.report-calendar-day {
  min-width: 7rem;
  min-height: 8.5rem;
  padding: 0.4rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.report-calendar-day:nth-child(7n) { border-right: 0; }
.report-calendar-day.outside { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.report-calendar-day.outside .report-calendar-date { opacity: 0.45; }
.report-calendar-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.report-calendar-date {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.report-calendar-events { display: grid; gap: 0.25rem; }
.report-calendar-events a,
.report-calendar-events a.report-cal-event {
  display: block;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  overflow: hidden;
  background: var(--cal-bg, #eff6ff);
  border-left: 3px solid var(--cal-border, #3b82f6);
  border-radius: 3px;
  color: var(--cal-fg, #1e3a8a);
  font-size: 0.68rem;
  line-height: 1.25;
  text-decoration: none;
}
.report-calendar-events a.is-multi-day,
.report-calendar-events a.report-cal-event.is-multi-day {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cal-border, #3b82f6) 45%, transparent);
}
.report-calendar-events .report-cal-title,
.report-calendar-events .report-cal-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-calendar-events .report-cal-title {
  font-weight: 650;
  text-transform: none;
}
.report-calendar-events .report-cal-meta {
  margin-top: 0.05rem;
  opacity: 0.92;
}
.report-calendar-events .report-cal-meta strong {
  font-weight: 700;
}
.report-calendar-events small { color: var(--muted); font-size: 0.68rem; }
html[data-theme="dark"] .report-calendar-events a,
html[data-theme="dark"] .report-calendar-events a.report-cal-event {
  background: var(--cal-bg-dark, #172554);
  border-left-color: var(--cal-border-dark, #60a5fa);
  color: var(--cal-fg-dark, #dbeafe);
}
html[data-theme="dark"] .report-area-swatch {
  background: var(--cal-bg-dark);
  border-color: var(--cal-border-dark);
}

@media (max-width: 700px) {
  .report-link-grid { grid-template-columns: 1fr; }
}

@media print {
  body.app-shell { display: block; background: #fff; }
  .sidebar,
  .sidebar-toggle,
  .sidebar-backdrop,
  .no-print { display: none !important; }
  .app-main,
  .app-main-wide {
    max-width: none;
    padding: 0;
  }
  .main-panel { padding: 0; }
  .card { break-inside: avoid; }
  .report-section { break-inside: avoid; }
  .report-calendar { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .report-calendar-weekday,
  .report-calendar-day { min-width: 0; }
  .report-calendar-day { min-height: 6rem; padding: 0.2rem; }
  .report-calendar-events a { padding: 0.15rem; font-size: 0.58rem; }
}

.settings-backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 0.85rem;
}
.settings-backup-grid > div {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.settings-backup-grid h3,
.settings-backup-grid p { margin-top: 0; }
.settings-backup-grid form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
@media (max-width: 700px) {
  .settings-backup-grid { grid-template-columns: 1fr; }
}

.user-accounts-page {
  max-width: 72rem;
}
.user-account-list {
  display: grid;
  gap: 0.75rem;
}
.user-account-card { margin: 0; }
.user-account-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.user-account-card-head strong,
.user-account-card-head span { display: block; }
.user-account-form {
  display: grid;
  grid-template-columns: minmax(4.5rem, 0.5fr) minmax(6.5rem, 0.85fr) minmax(6.5rem, 0.85fr) minmax(6.5rem, 0.85fr) auto auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
}
.user-account-form > div { min-width: 0; }
.user-account-form input[type="text"],
.user-account-form input[type="email"],
.user-account-form input[type="password"] {
  width: 100%;
}
.user-account-form > div:first-of-type {
  max-width: 10rem;
}
.user-account-form > div:nth-of-type(2),
.user-account-form > div:nth-of-type(3),
.user-account-form > div:nth-of-type(4) {
  max-width: 14rem;
}
.user-active-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: center;
  white-space: nowrap;
  margin: 0;
}
.user-active-check input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}
.user-account-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.user-account-actions form {
  margin: 0;
  display: inline;
}

@media (max-width: 1150px) {
  .user-account-form { grid-template-columns: repeat(2, minmax(10rem, 1fr)); }
}
@media (max-width: 650px) {
  .user-account-form { grid-template-columns: 1fr; }
  .user-account-actions { justify-content: flex-start; flex-wrap: wrap; }
}

/* Job Card template editor */
.template-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.template-page-head .page-title { margin-bottom: 0.2rem; }
.template-page-head p { margin: 0 0 1rem; }
.template-settings-form { max-width: 72rem; }
.template-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(12rem, 1fr));
  gap: 0.75rem;
}
.template-section-grid { display: grid; gap: 0.65rem; }
.template-section-row {
  display: grid;
  grid-template-columns: minmax(10rem, 0.7fr) minmax(14rem, 2fr) 7rem;
  gap: 0.75rem;
  align-items: end;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.template-section-row > strong { align-self: center; }
.template-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(12rem, 1fr));
  gap: 0.65rem;
}
.template-settings-form textarea { width: 100%; }
.template-save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
@media (max-width: 780px) {
  .template-field-grid,
  .template-checkbox-grid { grid-template-columns: 1fr 1fr; }
  .template-section-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .template-page-head { align-items: start; flex-direction: column; }
  .template-field-grid,
  .template-checkbox-grid { grid-template-columns: 1fr; }
}

.settings-status-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.settings-status-row {
  display: grid;
  grid-template-columns: 0.75rem minmax(12rem, 1fr) 8rem minmax(12rem, auto);
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.82rem;
}
.settings-status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
}
.settings-status-dot.ready { background: #16a34a; }
.settings-status-dot.missing { background: #dc2626; }
.settings-status-row > span:nth-child(3) { color: var(--muted); }
@media (max-width: 720px) {
  .settings-status-row { grid-template-columns: 0.75rem 1fr; }
  .settings-status-row > span:nth-child(3),
  .settings-status-row > code { grid-column: 2; }
}

.profile-card { max-width: 34rem; }
.profile-name {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.profile-name span,
.profile-name strong { display: block; }
.profile-name strong { margin-top: 0.1rem; font-size: 1.05rem; }

/* Capacity admin */
.capacity-page {
  max-width: 72rem;
}
.capacity-add-stage { margin-bottom: 1rem; }
.capacity-add-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}
.capacity-add-stage-row select,
.capacity-add-stage-row input[type="text"] {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 28rem;
}
.capacity-stage-rename select {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 28rem;
  font-weight: 650;
  font-size: 1.05rem;
}
.capacity-stage-rename .capacity-custom-task-name {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 22rem;
}
.capacity-stage { margin-bottom: 1rem; }
.capacity-stage-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.capacity-stage-rename {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  flex: 1 1 16rem;
}
.capacity-stage-rename input[type="text"] {
  flex: 1 1 12rem;
  min-width: 10rem;
  max-width: 22rem;
  font-weight: 650;
  font-size: 1.05rem;
}
.capacity-stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
}
.capacity-stage-total {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 0.9rem;
}
.capacity-grid {
  display: grid;
  width: 100%;
  grid-template-columns:
    minmax(8rem, 1.6fr)
    repeat(7, minmax(3.2rem, 1fr))
    minmax(3rem, 0.7fr)
    2.6rem
    minmax(3.6rem, auto)
    minmax(4.2rem, auto);
  gap: 0.35rem 0.4rem;
  align-items: end;
}
.capacity-grid-head {
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.capacity-grid-head .capacity-col-day,
.capacity-grid-head .capacity-col-week,
.capacity-grid-head .capacity-col-active {
  text-align: center;
}
.capacity-worker-row {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.capacity-worker-row.is-inactive { opacity: 0.55; }
.capacity-hours-input {
  width: 100%;
  min-width: 0;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.capacity-week-total {
  text-align: center;
  font-size: 0.85rem;
  padding-bottom: 0.45rem;
  color: var(--muted);
}
.capacity-active-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 0.35rem;
}
.capacity-worker-actions,
.capacity-worker-delete {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
  padding-bottom: 0.05rem;
}
.capacity-add-worker {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}
.capacity-add-worker-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 0.05rem;
}
@media (max-width: 1100px) {
  .capacity-grid {
    grid-template-columns: minmax(7rem, 1.2fr) repeat(7, minmax(2.8rem, 1fr)) minmax(2.8rem, 0.65fr) 2.4rem auto auto;
  }
}
@media (max-width: 820px) {
  .capacity-grid-head { display: none; }
  .capacity-worker-row {
    padding: 0.65rem 0;
  }
  .capacity-grid,
  .capacity-add-worker-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
  .capacity-worker-row > .capacity-col-worker,
  .capacity-add-worker-grid > .capacity-col-worker {
    grid-column: 1 / -1;
  }
  .capacity-week-total,
  .capacity-active-cell,
  .capacity-worker-actions,
  .capacity-worker-delete,
  .capacity-add-worker-actions {
    grid-column: span 2;
    justify-content: flex-start;
    text-align: left;
    padding-bottom: 0;
  }
  .capacity-add-spacer { display: none; }
}
