/* NEXUS: neutral surfaces with one blue accent. */
:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-hover: #edf3fe;
  --text: #172033;
  --muted: #596579;
  --line: #dce3ec;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff5ff;
  --accent-line: #abc7fb;
  --on-accent: #ffffff;
  --surface-strong: var(--accent);
  --shadow: 0 4px 22px rgba(15, 23, 42, 0.045);
  background: var(--page-bg);
  color: var(--text);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #10141c;
  --surface: #191f2a;
  --surface-subtle: #202837;
  --surface-hover: #26334a;
  --text: #edf1f8;
  --muted: #a3afc2;
  --line: #354052;
  --accent: #6496ff;
  --accent-hover: #85adff;
  --accent-soft: #202f4b;
  --accent-line: #3b5990;
  --on-accent: #0d1a33;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
}

.topbar {
  min-height: 74px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface-strong);
  border-radius: 8px;
  border-bottom: 4px solid var(--accent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 900;
  font-size: clamp(1.1rem, 3vw, 1.65rem);
}

.brand img {
  height: 48px;
  width: auto;
  background: var(--surface);
  border-radius: 4px;
  padding: 4px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

nav a {
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 6px;
}

nav a:hover {
  background: var(--surface-hover);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.panel,
.summary,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.analyze-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}

input,
select,
button,
textarea {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font: inherit;
}

button,
.downloads a,
.button-link,
.print-button {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

button {
  padding-inline: 22px;
}

button:hover,
.downloads a:hover,
.button-link:hover,
.print-button:hover {
  background: var(--accent-hover);
}

.alerts {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.alerts.success {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.alerts p {
  margin: 0;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border-left: 4px solid var(--accent);
  color: var(--text);
  font-weight: 700;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
  padding: 18px;
}

.summary div {
  display: grid;
  gap: 4px;
}

.label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
}

.summary strong {
  font-size: 1.1rem;
}

.downloads {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.downloads a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 6px;
  padding: 8px 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th:nth-child(7),
td:nth-child(7) {
  text-align: center;
}

th {
  background: var(--surface-strong);
  color: var(--on-accent);
  font-size: 0.84rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--surface-hover);
}

input[type="checkbox"][disabled] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  display: block;
  margin: 0 auto;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel img {
  width: 118px;
  height: auto;
  display: block;
  margin-bottom: 18px;
}

.login-help {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.stack-form {
  display: grid;
  gap: 16px;
}

textarea {
  min-height: 520px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.45;
  resize: vertical;
}

.section-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.button-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border-radius: 6px;
  padding: 8px 14px;
}

.list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:hover {
  background: var(--surface-hover);
}

.list-row span {
  color: var(--muted);
}

.narrow {
  max-width: 560px;
}

.danger {
  background: var(--surface-strong);
}

.danger:hover {
  background: var(--accent-hover);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.chart-panel {
  padding: 18px;
}

.chart-panel h2,
.panel h2 {
  margin-bottom: 14px;
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  gap: 10px;
  align-items: center;
}

.bar-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.bar-track {
  height: 18px;
  background: var(--surface-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  min-width: 2px;
  height: 100%;
  background: var(--accent);
}

.muted {
  color: var(--muted);
}

.simple-table table {
  min-width: 620px;
}

@media (max-width: 820px) {
  .analyze-form,
  .summary,
  .topbar,
  .list-row,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    margin-block: 18px;
  }

  nav {
    justify-content: flex-start;
  }
}

@media print {
  body {
    background: var(--surface);
  }

  .topbar nav,
  .downloads,
  .button-link {
    display: none !important;
  }

  .shell {
    width: 100%;
    margin: 0;
  }

  .topbar,
  .panel,
  .summary,
  .table-wrap,
  .chart-panel {
    box-shadow: none;
    break-inside: avoid;
  }

  .chart-grid {
    grid-template-columns: 1fr 1fr;
  }
}


.single-upload-form {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.home-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.home-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.home-heading p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.home-action {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-subtle);
}

.home-action:hover {
  background: var(--surface-hover);
  border-color: var(--accent-line);
}

.home-action strong {
  font-size: 1.2rem;
}

.home-action span {
  color: var(--muted);
  line-height: 1.4;
  font-weight: 700;
}

.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.admin-links span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.admin-links a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 7px 12px;
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--on-accent);
  font-weight: 800;
  text-decoration: none;
}

.program-data-table table {
  min-width: 1040px;
  table-layout: fixed;
}

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

.program-data-table th:first-child,
.program-data-table td:first-child,
.program-data-table th:nth-child(2),
.program-data-table td:nth-child(2),
.program-data-table th:nth-child(3),
.program-data-table td:nth-child(3) {
  text-align: left;
}

.program-data-table th:nth-child(6),
.program-data-table td:nth-child(6) {
  text-align: center;
}

.program-data-table th:nth-child(1) { width: 70px; }
.program-data-table th:nth-child(2) { width: 80px; }
.program-data-table th:nth-child(3) { width: 330px; }
.program-data-table th:nth-child(4) { width: 130px; }
.program-data-table th:nth-child(5) { width: 240px; }
.program-data-table th:nth-child(6) { width: 150px; }
.program-data-table th:nth-child(7) { width: 160px; }

.tool-data-cell,
.feed-cell {
  white-space: normal;
  line-height: 1.35;
}

.operation-row td {
  padding: 10px 16px 16px;
  background: var(--surface-subtle);
  border-bottom: 2px solid var(--line);
  text-align: left;
  white-space: normal;
}

.program-tool-row td {
  border-bottom: 0;
}

.operation-row summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.operation-row details[open] summary {
  margin-bottom: 8px;
}

.operation-text {
  max-width: none;
  line-height: 1.45;
  white-space: normal;
}

.text-cell {
  max-width: 420px;
  white-space: normal;
  line-height: 1.35;
}

.tool-validation-table table {
  min-width: 900px;
}

.tool-validation-table th,
.tool-validation-table td {
  text-align: left;
}

.tool-validation-table th:nth-child(2),
.tool-validation-table td:nth-child(2) {
  text-align: right;
}

.validation-pass {
  color: var(--accent);
  font-weight: 900;
}

.validation-fail {
  color: var(--accent);
  font-weight: 900;
}

.validation-row-fail {
  background: var(--accent-soft);
}

.validation-row-pass {
  background: var(--accent-soft);
}

.validation-issues {
  white-space: normal;
  min-width: 290px;
  line-height: 1.35;
}

.validation-found-values {
  min-width: 250px;
  white-space: normal;
}

.validation-found-values summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.validation-found-values dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  margin: 12px 0 0;
  line-height: 1.35;
}

.validation-found-values dt {
  color: var(--muted);
  font-weight: 800;
}

.validation-found-values dd {
  margin: 0;
}


.estimator-table table {
  min-width: 980px;
}

.wide-shell {
  width: min(1500px, calc(100% - 32px));
}

.machine-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.machine-toolbar-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.machine-toolbar-title strong {
  font-size: 1.2rem;
}

.machine-toolbar-title span {
  color: var(--muted);
  font-weight: 800;
}

.machine-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.machine-tabs a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 800;
  background: var(--surface-subtle);
}

.machine-tabs a.active,
.machine-tabs a:hover {
  background: var(--surface-strong);
  color: var(--on-accent);
  border-color: var(--surface-strong);
}

.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.machine-card {
  display: grid;
  gap: 10px;
  min-height: 160px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
}

.machine-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent-line);
}

.machine-card strong {
  font-size: 1.5rem;
}

.machine-card span {
  color: var(--muted);
  font-weight: 800;
}

.machine-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin: 0;
}

.machine-card dt {
  color: var(--muted);
  font-weight: 800;
}

.machine-card dd {
  margin: 0;
  font-weight: 900;
}

.tool-form-panel {
  margin-top: 18px;
}

.tool-inline-form,
.tool-search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.tool-search-form {
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 16px;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.lower-tool-layout {
  grid-template-columns: minmax(0, 1fr) 430px;
}

.tool-summary {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 0;
}

.tool-job-table table {
  min-width: 760px;
}

.tool-job-table th,
.tool-job-table td {
  text-align: left;
}

.tool-job-table th:first-child,
.tool-job-table td:first-child {
  width: 76px;
  text-align: center;
}

.tool-job-table input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.setup-panel h3 {
  margin: 18px 0 10px;
}

.tool-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-chip-list span {
  display: inline-flex;
  min-width: 48px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-weight: 900;
}

.muted-chip-list span {
  background: var(--surface-subtle);
  border-color: var(--line);
  color: var(--muted);
}

.magazine-grid {
  display: block;
  column-width: 76px;
  column-gap: 8px;
}

.magazine-pot {
  display: grid;
  gap: 3px;
  min-width: 0;
  width: 76px;
  margin: 0 0 6px;
  padding: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  break-inside: avoid;
}

.magazine-pot.required {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.magazine-pot.not-required {
  background: var(--surface);
  border-color: var(--line);
}

.magazine-pot.restricted {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.magazine-pot span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.magazine-pot input {
  min-height: 30px;
  width: 100%;
  min-width: 0;
  text-align: center;
  font-weight: 900;
}

.magazine-pot em {
  color: var(--accent);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.form-footer {
  margin-top: 16px;
}

.tool-textarea {
  min-height: 420px;
}

.notes-textarea {
  min-height: 120px;
}

.selected-job-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.selected-job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.selected-job-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.selected-job-row small {
  color: var(--muted);
  font-weight: 800;
}

.add-job-row {
  background: var(--surface-subtle);
}

.search-results {
  display: grid;
  gap: 8px;
  margin: -6px 0 16px;
}

.icon-button {
  min-width: 42px;
  min-height: 38px;
  padding-inline: 12px;
}

.static-list .selected-job-row {
  grid-template-columns: 1fr;
}

.print-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.print-tool-grid span {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 1.2rem;
  font-weight: 900;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.role-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.permission-list {
  display: grid;
  gap: 8px;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 800;
}

.checkbox-row input {
  min-height: auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.role-actions {
  display: flex;
  gap: 10px;
}

.toolsheet-upload-form {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.upload-drop-zone {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.upload-drop-zone input {
  width: 100%;
  background: var(--surface);
}

.upload-drop-zone span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.readable-magazine-grid {
  column-width: 76px;
}

.machine-settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.restricted-form {
  display: grid;
  grid-template-columns: 80px 80px minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.restricted-panel table {
  min-width: 420px;
}

.delete-machine-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stock-seq-columns {
  column-width: 150px;
  column-gap: 18px;
  margin-top: 14px;
}

.stock-seq-columns span {
  display: block;
  break-inside: avoid;
  margin: 0 0 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
  background: var(--surface-subtle);
}

.unused-tool-row {
  background: var(--accent-soft);
}

@media (max-width: 1050px) {
  .tool-layout,
  .lower-tool-layout,
  .tool-summary,
  .tool-inline-form,
  .machine-settings-grid,
  .restricted-form {
    grid-template-columns: 1fr;
  }
}

.estimator-table th:nth-child(7),
.estimator-table td:nth-child(7) {
  text-align: center;
}

.estimator-table th:last-child,
.estimator-table td:last-child {
  font-weight: 900;
}


@media print {
  @page {
    size: 11in 17in portrait;
    margin: 0.35in;
  }

  body {
    background: var(--surface);
    color: var(--text);
  }

  .downloads,
  .notice,
  .topbar nav,
  .home-panel,
  .admin-links {
    display: none !important;
  }

  .shell {
    width: 100%;
    margin: 0;
  }

  .topbar {
    min-height: 0;
    margin-bottom: 10px;
    padding: 8px 0;
    background: var(--surface);
    border: 0;
    color: var(--text);
  }

  .brand {
    color: var(--text);
    font-size: 16pt;
  }

  .brand img {
    height: 34px;
    border: 1px solid var(--line);
  }

  .summary {
    box-shadow: none;
    border: 1px solid var(--line);
    padding: 8px;
    margin-top: 0;
    gap: 8px;
  }

  .summary strong {
    font-size: 9pt;
  }

  .label {
    font-size: 7pt;
  }

  .table-wrap {
    overflow: visible;
    box-shadow: none;
    border: 0;
  }

  table,
  .estimator-table table {
    min-width: 0 !important;
    table-layout: auto;
    font-size: 7.5pt;
  }

  th,
  td {
    padding: 3px 4px;
    white-space: nowrap;
  }

  input[type="checkbox"][disabled] {
    width: 11px;
    height: 11px;
  }
}

.form-actions,
.job-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.job-actions form {
  margin: 0;
}

.button-link.secondary {
  background: var(--surface-strong);
}

.button-link.secondary:hover {
  background: var(--accent-hover);
}

button.danger,
.button-link.danger {
  background: var(--surface-strong);
}

button.danger:hover,
.button-link.danger:hover {
  background: var(--accent-hover);
}

.job-manage-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0;
}

.job-manage-table th:last-child,
.job-manage-table td:last-child {
  min-width: 190px;
}

.delete-job-panel {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.delete-job-panel h2 {
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .job-manage-search {
    grid-template-columns: 1fr;
  }
}


.momentum-shell-wide {
  width: min(1500px, calc(100% - 24px));
}

.momentum-summary,
.momentum-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.momentum-stat,
.momentum-detail-grid > div {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: inherit;
  text-decoration: none;
}

.momentum-stat strong {
  font-size: 1.75rem;
}

.momentum-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.momentum-list-panel {
  padding: 18px;
}

.momentum-toolroom-panel {
  grid-column: 1 / -1;
}

.momentum-toolroom-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.momentum-toolroom-row:last-child {
  border-bottom: 0;
}

.momentum-toolroom-row .momentum-row {
  flex: 1 1 280px;
  min-width: 0;
  border-bottom: 0;
}

.momentum-toolroom-urgent {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}

.momentum-rank-form,
.momentum-rank-form label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.momentum-rank-form {
  margin: 8px 0 8px auto;
}

.momentum-rank-form input {
  width: 75px;
}

.momentum-row {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.momentum-row:last-child {
  border-bottom: 0;
}

.momentum-task-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.momentum-task-heading > strong,
.momentum-task-heading > a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.momentum-task-po {
  flex: 0 0 auto;
  max-width: 45%;
  text-align: right;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.momentum-row span,
.momentum-row small {
  color: var(--muted);
  font-weight: 700;
}

.momentum-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 18px;
  align-items: start;
}

.momentum-column {
  display: grid;
  gap: 12px;
  min-height: 420px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.momentum-column h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}

.momentum-column h2 span {
  min-width: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--on-accent);
  font-size: 0.85rem;
}

.momentum-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.momentum-card a {
  color: var(--text);
  text-decoration: none;
}

.momentum-card-meta,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.momentum-card-meta span {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.momentum-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 0.9rem;
}

.momentum-card dt {
  color: var(--muted);
  font-weight: 900;
}

.momentum-card dd {
  margin: 0;
  font-weight: 700;
}

.priority-urgent { border-left-color: var(--accent); }
.priority-high { border-left-color: var(--accent); }
.priority-normal { border-left-color: var(--accent); }
.priority-low { border-left-color: var(--muted); }

.momentum-status-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.momentum-status-form button {
  padding-inline: 12px;
}

.momentum-empty {
  padding: 10px 0;
}

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

.momentum-form [hidden] {
  display: none !important;
}

.momentum-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.momentum-checkbox input {
  width: auto;
}

.momentum-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.momentum-form .full-width,
.form-actions.full-width {
  grid-column: 1 / -1;
}

.momentum-form textarea {
  min-height: 170px;
}

.momentum-form select[multiple] {
  min-height: 150px;
}

.momentum-description {
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  white-space: pre-wrap;
  line-height: 1.45;
}

.momentum-detail-status {
  margin-top: 18px;
}

.momentum-comment,
.momentum-history {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.momentum-comment span,
.momentum-history span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.momentum-comment p,
.momentum-history p {
  margin: 0;
  white-space: pre-wrap;
}

.momentum-comment-form {
  margin-top: 16px;
}

.momentum-comment-form textarea {
  min-height: 120px;
}

.secondary {
  background: var(--surface-strong);
}

.secondary:hover {
  background: var(--surface-hover);
}

@media (max-width: 1100px) {
  .momentum-board,
  .momentum-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .momentum-form,
  .momentum-status-form {
    grid-template-columns: 1fr;
  }
}

.pulse-job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.pulse-job-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pulse-job-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.pulse-job-card a {
  color: var(--text);
  text-decoration: none;
}

.pulse-job-card span {
  color: var(--muted);
  font-weight: 900;
}

.pulse-job-card dl,
.pulse-inspection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.pulse-job-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pulse-job-card dd {
  margin: 0;
  font-weight: 900;
}

.pulse-empty,
.pulse-section {
  margin-top: 18px;
  padding: 18px;
}

.pulse-frequency-section,
.pulse-check-panel,
.pulse-inspection-grid > div {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.pulse-frequency-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
}

.checkbox-label input[type="checkbox"] {
  min-height: auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.pulse-status-update,
.pulse-filter-form {
  margin-top: 18px;
}

.pulse-note-form textarea {
  min-height: 120px;
}

@media (max-width: 820px) {
  .pulse-job-card dl,
  .pulse-inspection-grid,
  .pulse-frequency-row {
    grid-template-columns: 1fr;
  }
}


.pulse-machine-shell {
  width: min(1400px, calc(100% - 24px));
}

.pulse-supervisor-alerts {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.pulse-supervisor-alert {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 2px solid var(--accent);
  border-left-width: 8px;
  border-radius: 8px;
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}

.pulse-supervisor-alert strong {
  color: var(--accent);
  text-transform: uppercase;
}

.pulse-supervisor-alert span {
  color: var(--muted);
  font-weight: 800;
}

.pulse-supervisor-alert p {
  margin: 0;
  font-weight: 800;
}

.pulse-compact-jobs {
  display: grid;
  grid-template-columns: repeat(auto-fill, 178px);
  justify-content: start;
  gap: 12px;
  margin-top: 18px;
}

.pulse-compact-job {
  display: grid;
  align-content: start;
  gap: 6px;
  width: 178px;
  min-height: 178px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.pulse-compact-job:hover {
  background: var(--surface-hover);
  border-color: var(--accent-line);
}

.pulse-compact-job strong {
  font-size: 1rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.pulse-compact-job > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.pulse-compact-job dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  margin: 0;
}

.pulse-compact-job dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.pulse-compact-job dt {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.pulse-compact-job dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 900;
  text-align: right;
  overflow-wrap: anywhere;
}

.pulse-compact-status {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* Shared NEXUS workspace appearance. */
@media screen {
  body { color: var(--text); font-size: 15px; line-height: 1.5; }
  a { color: var(--accent); }
  h1 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; }
  h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.02em; }
  h3 { font-weight: 650; }
  label { color: var(--text); font-weight: 600; }
  .shell { margin-block: 28px; }
  .topbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 24px;
    min-height: 76px;
    box-shadow: var(--shadow);
  }
  .brand { color: var(--text); font-size: 1.05rem; font-weight: 800; letter-spacing: 0.12em; gap: 11px; }
  nav { align-items: center; gap: 4px; }
  nav a { color: var(--muted); font-weight: 600; font-size: 0.88rem; padding: 8px 10px; }
  nav a:hover { background: var(--surface-hover); color: var(--accent); }
  .panel, .summary, .table-wrap, .home-panel, .momentum-column { border-radius: 14px; box-shadow: var(--shadow); }
  .panel { padding: 24px; }
  input, select, textarea { background: var(--surface-subtle); color: var(--text); border-color: var(--line); border-radius: 9px; }
  input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
  input[type="checkbox"] { accent-color: var(--accent); }
  input:disabled, select:disabled, textarea:disabled { opacity: 0.7; }
  button, .button-link, .downloads a, .print-button { border-radius: 9px; font-weight: 600; }
  .secondary, .button-link.secondary, button.danger, .button-link.danger, .danger {
    background: var(--surface-subtle); color: var(--text); border: 1px solid var(--line);
  }
  .secondary:hover, .button-link.secondary:hover, button.danger:hover, .button-link.danger:hover, .danger:hover {
    background: var(--surface-hover); color: var(--accent); border-color: var(--accent-line);
  }
  .alerts { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); border-radius: 10px; }
  .alerts.success { color: var(--text); }
  .alerts.success::before { content: "✓ "; color: var(--accent); font-weight: 800; float: left; margin-right: 8px; }
  th { font-weight: 650; letter-spacing: 0.025em; }
  .home-panel { padding: 32px; }
  .home-heading { gap: 10px; margin-bottom: 30px; }
  .home-heading h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); letter-spacing: -0.055em; }
  .home-heading p { font-weight: 400; font-size: 1rem; }
  .home-eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; font-weight: 750; }
  .home-actions { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
  .home-action {
    display: flex; flex-direction: column; gap: 18px; min-height: 180px;
    padding: 22px; border: 1px solid var(--line); border-radius: 14px;
    background: var(--surface); transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  }
  .home-action:hover { border-color: var(--accent-line); background: var(--surface-subtle); box-shadow: var(--shadow); transform: translateY(-2px); }
  .home-action-heading { display: flex; align-items: center; gap: 10px; }
  .home-action strong { font-size: 1.05rem; font-weight: 650; }
  .home-action .module-mark { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); font-weight: 750; }
  .home-action .home-action-arrow { margin-left: auto; color: var(--accent); font-size: 1.2rem; font-weight: 400; }
  .home-action > span { font-weight: 400; font-size: 0.9rem; line-height: 1.6; }
  .home-empty { grid-column: 1 / -1; padding: 24px; border: 1px dashed var(--line); border-radius: 12px; }
  .admin-links a { background: var(--surface-subtle); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
  .admin-links a:hover { color: var(--accent); border-color: var(--accent-line); }
  .momentum-stat, .momentum-detail-grid > div { border-left: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); }
  .momentum-stat strong { font-weight: 700; color: var(--accent); }
  .momentum-stat span, .momentum-row span, .momentum-row small { font-weight: 500; }
  .momentum-row { border-radius: 8px; }
  .momentum-row:hover { background: var(--surface-subtle); }
  .momentum-row strong { font-weight: 650; }
  .momentum-column { box-shadow: none; background: var(--surface-subtle); }
  .momentum-card { padding: 16px; border-radius: 12px; background: var(--surface); }
  .momentum-card-meta span { font-weight: 600; background: var(--accent-soft); color: var(--accent); }
  .momentum-column h2 span { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
  .priority-urgent { border-left: 5px double var(--accent); }
  .momentum-toolroom-panel .section-actions { flex-wrap: wrap; }
  .momentum-toolroom-row { padding: 4px 0; }
  .momentum-toolroom-urgent { padding-left: 12px; }
  .momentum-rank-form label { color: var(--muted); font-size: 0.85rem; }
  .momentum-form small { font-weight: 400; line-height: 1.5; }
  .momentum-description { font-size: 0.95rem; }
  .login-panel { width: min(450px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
  .login-shell { padding-top: 90px; }
  .login-brand { display: flex; align-items: center; gap: 12px; }
  .login-brand h1 { font-size: 2rem; font-weight: 750; letter-spacing: 0.06em; }
  .login-brand + .login-help { margin: 12px 0 28px; }
  .login-panel .stack-form { gap: 20px; }
  .login-panel .stack-form button { margin-top: 4px; }
  .login-help { font-weight: 400; line-height: 1.6; font-size: 0.85rem; }
}

.brand-symbol {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px;
  background: var(--accent); color: var(--on-accent); border-radius: 10px;
  font-size: 1.15rem; font-weight: 800; letter-spacing: -0.08em; padding-right: 2px;
}

.theme-switch { display: inline-flex; align-items: center; gap: 3px; padding: 3px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 10px; }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 9px; background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 7px; font-size: 0.78rem; font-weight: 600; line-height: 1.3; }
.theme-switch button:hover { background: var(--surface-hover); color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--accent); border-color: var(--line); }
.theme-switch svg { width: 15px; height: 15px; flex: 0 0 15px; }
.login-appearance { position: absolute; top: 24px; right: 24px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media screen and (max-width: 820px) {
  .topbar { padding: 16px 18px; gap: 16px; }
  .home-panel { padding: 24px; }
  .panel { padding: 20px; }
  .section-actions { flex-wrap: wrap; }
  .theme-switch { margin-left: auto; }
  .login-panel { padding: 28px; }
  .login-appearance { top: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-action { transition: none; }
  .home-action:hover { transform: none; }
}

@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --page-bg: #ffffff; --surface: #ffffff; --surface-subtle: #f5f5f5; --surface-hover: #ffffff;
    --text: #000000; --muted: #444444; --line: #bbbbbb; --accent: #2563eb;
    --accent-hover: #1d4ed8; --accent-soft: #f5f5f5; --accent-line: #bbbbbb; --on-accent: #ffffff; --shadow: none;
    background: #ffffff; color: #000000;
  }
  .theme-switch, .login-appearance { display: none !important; }
  th { background: #f0f0f0; color: #000000; }
}

@media (max-width: 760px) {
  .pulse-compact-jobs {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  }

  .pulse-compact-job {
    width: auto;
    min-height: 0;
  }
}
