:root {
  --ink: #101820;
  --graphite: #25313d;
  --muted: #667789;
  --line: #d9e1e8;
  --line-strong: #bfccd8;
  --wash: #eef3f6;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --cornflower: #6495ed;
  --teal: #078c84;
  --red: #b42318;
  --red-dark: #8f1d15;
  --red-soft: #fff1f0;
  --green: #047857;
  --green-dark: #065f46;
  --green-soft: #ecfdf3;
  --amber: #b7791f;
  --amber-soft: #fff6df;
  --section-accent: var(--teal);
  --focus: rgba(37, 99, 235, 0.28);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  background: var(--wash);
}

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

body.theme-documents {
  --section-accent: #0e7490;
  --focus: rgba(14, 116, 144, 0.24);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 750;
  line-height: 32px;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  font-weight: 750;
  line-height: 24px;
  letter-spacing: 0;
}

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

.kicker {
  color: var(--section-accent);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
  text-transform: uppercase;
}

.button {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 var(--s-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 700;
  line-height: 20px;
  cursor: pointer;
}

.button:focus-visible,
.field:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button-primary {
  background: var(--blue);
  color: #fff;
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--graphite);
}

.button-danger {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
  background: color-mix(in srgb, var(--red) 8%, var(--surface));
  color: var(--red);
}

.button-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--red) 14%, var(--surface));
}

.button-compact {
  min-height: 32px;
  padding: 0 var(--s-3);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.profile-button {
  display: inline-grid;
  grid-template-columns: 32px minmax(0, auto);
  align-items: center;
  min-height: 40px;
  max-width: 280px;
  padding: 3px var(--s-3) 3px 3px;
  gap: var(--s-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--graphite);
  text-decoration: none;
}

.profile-button:hover {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line-strong));
}

.profile-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.profile-button-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  background: var(--profile-color, var(--graphite));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.profile-button-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-appearance {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: var(--s-4);
  margin-top: var(--s-3);
}

.profile-avatar-preview {
  display: grid;
  width: 96px;
  height: 96px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--profile-color, var(--graphite));
  color: #fff;
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-preview-upload {
  margin-top: 23px;
}

.profile-appearance-fields {
  display: grid;
  min-width: 0;
  gap: var(--s-3);
}

.profile-color-field {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
}

.profile-color-swatch {
  position: relative;
  display: block;
  width: 52px;
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--profile-color, var(--graphite));
  cursor: pointer;
}

.profile-color-swatch:has(.color-field-picker:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.profile-color-field .color-field-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-color-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
}

.profile-remove-photo-button {
  justify-self: start;
  margin-top: var(--s-2);
}

.profile-button-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.profile-button-label,
.profile-button-subtext {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-button-label {
  font-size: 13px;
  font-weight: 800;
}

.profile-button-subtext {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-small {
  min-height: 32px;
  padding: 0 var(--s-3);
  font-size: 13px;
}

.button-block {
  width: 100%;
}

.field {
  width: 100%;
  height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
}

.field-textarea {
  min-height: 96px;
  padding-top: var(--s-3);
  resize: vertical;
}

.field-group {
  display: grid;
  gap: var(--s-2);
}

.field-group span {
  color: var(--graphite);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
}

.form-stack {
  display: grid;
  gap: var(--s-4);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: var(--s-6);
}

.auth-shell {
  width: min(100%, 420px);
}

.auth-panel {
  display: grid;
  gap: var(--s-6);
  padding: var(--s-8);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.auth-logo {
  width: 180px;
  height: auto;
}

.auth-heading {
  display: grid;
  gap: var(--s-2);
}

.auth-footer {
  display: grid;
  grid-auto-flow: column;
  justify-content: center;
  gap: var(--s-2);
  font-weight: 650;
}

.auth-footer a {
  color: var(--blue);
  font-weight: 750;
}

.alert {
  padding: var(--s-3);
  border: 1px solid #f2d999;
  border-radius: var(--r-md);
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 650;
}

.notice {
  padding: var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--graphite);
  font-weight: 650;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--topbar-height);
  padding: var(--s-3) var(--s-6);
  border-top: 4px solid var(--section-accent);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.theme-workspace {
  --section-accent: var(--blue);
}

.theme-admin {
  --section-accent: var(--amber);
}

.theme-composer {
  --section-accent: var(--cornflower);
}

.theme-super {
  --section-accent: var(--red);
}

.theme-documentation {
  --section-accent: #078c84;
  --focus: rgba(7, 140, 132, 0.24);
}

.brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 148px;
  height: auto;
}

.brand-name {
  color: var(--graphite);
  font-size: 13px;
  font-weight: 750;
  line-height: 18px;
}

.brand-context {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.top-actions {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--s-2);
}

.tenant-switcher {
  margin: 0;
}

.tenant-switcher label {
  display: grid;
  grid-template-columns: auto 220px;
  align-items: center;
  gap: var(--s-2);
}

.tenant-switcher span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 12px;
  text-transform: uppercase;
}

.tenant-switcher select {
  width: 220px;
  height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--graphite);
  font-weight: 700;
}

.main-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  align-items: stretch;
  min-height: calc(100vh - 65px);
}

.side-nav {
  position: sticky;
  top: var(--topbar-height);
  z-index: 30;
  display: grid;
  align-content: start;
  align-self: start;
  max-height: calc(100vh - var(--topbar-height));
  min-height: calc(100vh - var(--topbar-height));
  gap: var(--s-2);
  overflow-y: auto;
  padding: var(--s-6) var(--s-4);
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.side-nav-section {
  margin: var(--s-3) 0 var(--s-1, 4px);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 16px;
  text-transform: uppercase;
}

.side-nav-link {
  display: grid;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--graphite);
  font-weight: 750;
}

.side-nav-link:hover {
  border-color: var(--line);
  background: var(--surface);
}

.side-nav-link.is-active {
  border-color: color-mix(in srgb, var(--section-accent) 34%, var(--line-strong));
  background: var(--surface);
  color: var(--ink);
}

.badge {
  display: inline-grid;
  place-items: center;
  height: 22px;
  min-width: 0;
  max-width: 180px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--section-accent) 18%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--section-accent) 7%, var(--surface));
  color: var(--graphite);
  font-size: 11px;
  font-weight: 750;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  align-content: start;
  gap: var(--s-6);
  padding: var(--s-8);
}

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--s-4);
}

.page-actions {
  display: grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  align-items: center;
}

.subnav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: start;
  gap: var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.subnav-link {
  display: grid;
  place-items: center;
  min-height: 32px;
  padding: 0 var(--s-3);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 18px;
  white-space: nowrap;
}

.subnav-link:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--graphite);
}

.subnav-link.is-active {
  border-color: color-mix(in srgb, var(--section-accent) 30%, var(--line-strong));
  background: color-mix(in srgb, var(--section-accent) 7%, var(--surface));
  color: var(--ink);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4);
}

.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}

.metric,
.panel,
.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.metric,
.admin-card {
  display: grid;
  align-content: start;
  gap: var(--s-2);
  padding: var(--s-4);
}

.metric span,
.admin-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
  text-transform: uppercase;
}

.metric strong,
.admin-card strong {
  font-size: 22px;
  line-height: 30px;
}

.admin-card:hover {
  border-color: var(--line-strong);
}

.document-purge-card {
  margin: 0;
}

.document-purge-card .field-group {
  margin-top: var(--s-3);
}

.document-purge-card .button {
  justify-self: start;
  margin-top: var(--s-2);
}

.document-purge-card-danger {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
}

.document-purge-card-danger strong {
  color: var(--red-dark);
}

.panel {
  overflow: hidden;
}

.panel {
  padding: var(--s-4);
}

.panel-head {
  padding: 0;
}

.panel-title {
  display: grid;
  gap: var(--s-2);
}

.documentation-page {
  max-width: 1320px;
}

.documentation-head {
  align-items: center;
}

.documentation-band,
.documentation-section {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.documentation-band {
  padding: var(--s-4);
}

.documentation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
}

.documentation-summary div {
  display: grid;
  align-content: start;
  gap: var(--s-2);
  min-height: 112px;
  padding: var(--s-4);
  border: 1px solid color-mix(in srgb, var(--section-accent) 18%, var(--line));
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--section-accent) 5%, var(--surface));
}

.documentation-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
  text-transform: uppercase;
}

.documentation-summary strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 26px;
}

.documentation-section {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-5);
}

.documentation-section-head {
  display: grid;
  gap: var(--s-1);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}

.documentation-prose {
  display: grid;
  gap: var(--s-3);
  max-width: 940px;
  color: var(--graphite);
}

.documentation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4);
}

.documentation-grid article {
  display: grid;
  align-content: start;
  gap: var(--s-2);
  min-height: 172px;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.documentation-grid h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
  line-height: 20px;
}

.documentation-grid p,
.documentation-list,
.documentation-timeline p {
  color: var(--graphite);
}

.documentation-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.documentation-grid-compact article {
  min-height: 132px;
}

.documentation-two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: var(--s-5);
  align-items: start;
}

.documentation-list {
  display: grid;
  gap: var(--s-3);
  margin: 0;
  padding-left: var(--s-5);
}

.documentation-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
}

.documentation-timeline div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
  min-height: 108px;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.documentation-timeline span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--section-accent);
  color: #fff;
  font-weight: 800;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
}

.split-grid > .panel:first-child {
  position: sticky;
  top: calc(var(--topbar-height) + var(--s-4));
  max-height: calc(100vh - var(--topbar-height) - (var(--s-4) * 2));
  overflow-y: auto;
}

.admin-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(140px, 190px) minmax(140px, 190px) auto auto;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.admin-filter-bar .field {
  min-height: 38px;
}

.admin-filter-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.tenant-edit-workspace {
  display: grid;
  gap: var(--s-4);
}

.tenant-edit-form {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.tenant-edit-form > .panel-title {
  display: none;
}

.tenant-edit-form > .tenant-profile-section {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
}

.tenant-edit-form > .tenant-edit-options {
  grid-column: 2;
  min-width: 0;
}

.option-stack {
  display: grid;
  gap: var(--s-4);
  align-content: start;
}

.profile-side-stack {
  position: sticky;
  top: var(--s-4);
}

.accordion-panel {
  padding: 0;
}

.accordion-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-4);
  cursor: pointer;
  list-style: none;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.accordion-indicator {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}

.accordion-indicator::before {
  content: "+";
  color: var(--graphite);
  font-size: 18px;
  font-weight: 750;
  line-height: 1;
}

.accordion-panel[open] .accordion-indicator::before {
  content: "-";
}

.accordion-body {
  display: grid;
  gap: var(--s-5);
  padding: 0 var(--s-4) var(--s-5);
}

.accordion-body .table-wrap {
  margin-top: 0;
}

.tenant-form-section {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.tenant-form-section .accordion-summary {
  padding: var(--s-4);
}

.tenant-form-section .accordion-body {
  padding: 0 var(--s-4) var(--s-4);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}

.section-divider {
  height: 1px;
  background: var(--line);
}

.form-actions,
.row-actions {
  display: grid;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: var(--s-2);
}

.row-actions {
  grid-auto-flow: column;
  justify-content: end;
  grid-template-columns: repeat(auto-fit, minmax(32px, max-content));
}

.action-cell {
  text-align: right;
}

.action-cell .inline-form {
  display: grid;
  justify-content: end;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.icon-button svg {
  display: block;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-button:hover {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line-strong));
  background: color-mix(in srgb, var(--red) 6%, var(--surface));
  color: var(--red);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.inline-form {
  display: inline;
  margin: 0;
}

.table-edit-form {
  margin: 0;
}

.table-edit-secondary {
  margin-top: var(--s-2);
}

.alias-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1.2fr) auto;
  gap: var(--s-2);
  align-items: center;
}

.rule-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(140px, 0.7fr) minmax(140px, 0.7fr);
  gap: var(--s-4);
}

.rule-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(96px, 0.55fr) minmax(112px, max-content) minmax(96px, max-content) auto;
  gap: var(--s-2);
  align-items: center;
}

.form-builder-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.7fr) minmax(140px, 0.7fr) minmax(96px, max-content);
  gap: var(--s-4);
  align-items: end;
}

.form-builder-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(300px, 360px);
  gap: var(--s-4);
  align-items: start;
}

.builder-fullscreen-body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.builder-fullscreen-body .app-shell {
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.builder-fullscreen-body .topbar,
.builder-fullscreen-body .side-nav,
.builder-fullscreen-body .page-head,
.builder-fullscreen-body .subnav {
  display: none;
}

.builder-fullscreen-body .main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.builder-fullscreen-body .workspace {
  grid-column: 1;
  align-content: stretch;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  padding: var(--s-3);
  gap: var(--s-3);
  overflow: hidden;
}

.builder-fullscreen-shell {
  display: grid;
  min-height: 100vh;
}

.builder-fullscreen-workspace {
  align-content: stretch;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  padding: var(--s-3);
  gap: var(--s-3);
  overflow: hidden;
}

.builder-message-stack {
  display: grid;
  gap: var(--s-3);
}

.builder-message-stack:empty {
  display: none;
}

.builder-status-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  min-height: 48px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.builder-status-copy {
  min-width: 0;
}

.status-message {
  display: grid;
  width: 100%;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 20px;
}

.status-message-notice {
  border-color: color-mix(in srgb, var(--green) 38%, var(--line-strong));
  background: var(--green-soft);
  color: var(--green-dark);
}

.status-message-alert {
  border-color: color-mix(in srgb, var(--red) 38%, var(--line-strong));
  background: var(--red-soft);
  color: var(--red-dark);
}

[data-part-history-sync-status][hidden] {
  display: none;
}

.builder-status-actions {
  display: grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  align-items: center;
  justify-content: end;
}

.builder-status-actions .button-small {
  height: 40px;
  min-height: 40px;
}

.builder-history-form {
  margin: 0;
}

.builder-history-form label {
  display: grid;
  grid-template-columns: auto 128px;
  align-items: center;
  gap: var(--s-2);
}

.builder-history-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 14px;
  text-transform: uppercase;
}

.field-small {
  min-height: 32px;
  padding: 5px 28px 5px 10px;
  font-size: 12px;
  line-height: 18px;
}

.builder-fullscreen-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-4);
  min-height: 56px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.builder-fullscreen-actions {
  display: grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  align-items: center;
}

.json-dialog {
  width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--graphite);
  box-shadow: 0 24px 72px rgba(16, 24, 32, 0.24);
}

.json-dialog::backdrop {
  background: rgba(16, 24, 32, 0.48);
}

.json-dialog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.json-viewer {
  max-height: calc(100vh - 176px);
  margin: 0;
  padding: var(--s-4);
  overflow: auto;
  background: var(--ink);
  color: #f5f7fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 18px;
  white-space: pre;
}

.builder-fullscreen-bar {
  display: none;
}

.builder-fullscreen-body .builder-fullscreen-bar {
  display: grid;
}

.form-builder-shell.is-fullscreen,
.builder-fullscreen-body .form-builder-shell {
  align-self: stretch;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(300px, 340px);
  align-items: stretch;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  gap: var(--s-3);
  overflow: hidden;
}

.form-builder-shell.is-fullscreen .form-builder-rail,
.form-builder-shell.is-fullscreen .form-builder-stage,
.form-builder-shell.is-fullscreen .form-builder-detail,
.builder-fullscreen-body .form-builder-rail,
.builder-fullscreen-body .form-builder-stage,
.builder-fullscreen-body .form-builder-detail {
  height: calc(100vh - 152px);
  max-height: calc(100vh - 152px);
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.form-builder-shell.is-fullscreen .form-builder-stage,
.form-builder-shell.is-fullscreen .form-builder-detail,
.builder-fullscreen-body .form-builder-stage,
.builder-fullscreen-body .form-builder-detail {
  overflow: hidden;
}

.form-builder-shell.is-fullscreen .form-builder-rail,
.builder-fullscreen-body .form-builder-rail {
  display: block;
  overflow-y: auto;
}

.form-builder-shell.is-fullscreen .form-builder-detail > .panel,
.builder-fullscreen-body .form-builder-detail > .panel {
  min-height: 0;
  height: 100%;
}

.form-builder-shell.is-fullscreen .field-outline-panel,
.builder-fullscreen-body .field-outline-panel {
  display: grid;
  grid-template-rows: none;
  min-height: 0;
  margin-top: var(--s-4);
  overflow: visible;
}

.form-builder-shell.is-fullscreen .field-outline-list,
.builder-fullscreen-body .field-outline-list {
  align-content: start;
  grid-auto-rows: max-content;
  min-height: 0;
  overflow: visible;
  overscroll-behavior: contain;
  padding-right: 0;
}

.form-builder-shell.is-fullscreen .accordion-summary,
.builder-fullscreen-body .accordion-summary {
  padding: var(--s-3);
}

.form-builder-shell.is-fullscreen .accordion-body,
.builder-fullscreen-body .accordion-body {
  gap: var(--s-3);
  padding: 0 var(--s-3) var(--s-3);
}

.form-builder-shell.is-fullscreen .form-builder-stage,
.builder-fullscreen-body .form-builder-stage {
  height: 100%;
  min-height: 0;
}

.form-builder-shell.is-fullscreen .form-preview-surface,
.builder-fullscreen-body .form-preview-surface {
  min-height: 0;
  height: 100%;
  overflow: auto;
  align-items: start;
  padding: var(--s-5);
}

.form-builder-shell.is-fullscreen .form-preview-page {
  width: min(100%, 820px);
  min-height: 560px;
}

.form-builder-rail {
  display: grid;
  gap: var(--s-4);
  align-content: start;
}

.definition-compact-panel:not([open]) {
  padding-bottom: 0;
}

.field-outline-panel {
  display: grid;
  gap: var(--s-3);
  align-content: start;
}

.field-outline-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-3);
}

.builder-mini-actions {
  display: grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  align-items: center;
}

.field-outline-list {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: var(--s-2);
}

.field-outline-empty {
  padding: var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.field-outline-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.field-outline-row:hover {
  border-color: var(--line-strong);
}

.field-outline-row.is-selected {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line-strong));
  background: color-mix(in srgb, var(--section-accent) 6%, var(--surface));
}

.field-outline-row.is-dragging,
.builder-outline-section.is-dragging {
  opacity: 0.56;
}

.field-outline-row.is-drop-before::before,
.field-outline-row.is-drop-after::after,
.builder-outline-section.is-drop-before::before,
.builder-outline-section.is-drop-after::after {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent);
  content: "";
  pointer-events: none;
}

.field-outline-row.is-drop-before::before,
.builder-outline-section.is-drop-before::before {
  top: -7px;
}

.field-outline-row.is-drop-after::after,
.builder-outline-section.is-drop-after::after {
  bottom: -7px;
}

.field-outline-select {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-1);
  min-width: 0;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--graphite);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.field-outline-grip {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.field-outline-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
}

.field-outline-delete {
  width: 24px;
  height: 24px;
  min-height: 24px;
  border-radius: var(--r-sm);
}

.field-outline-delete svg {
  width: 14px;
  height: 14px;
}

.builder-outline-section {
  position: relative;
  display: grid;
  gap: var(--s-2);
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--wash) 52%, var(--surface));
}

.builder-outline-section.is-selected {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line-strong));
}

.builder-outline-section.is-drop-inside {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 5%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 28%, transparent);
}

.builder-outline-section-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px 24px;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
}

.builder-outline-section-fields {
  display: grid;
  gap: var(--s-2);
  padding-left: var(--s-3);
}

.form-builder-detail {
  display: grid;
  align-content: start;
}

.form-builder-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 640px;
  padding: 0;
}

.builder-detail-panel {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: var(--s-4);
}

.builder-detail-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.builder-stage-head {
  position: relative;
  padding: var(--s-3);
  border-bottom: 1px solid var(--line);
}

.builder-stage-head .badge {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
}

.builder-stage-head .panel-title {
  display: block;
}

.form-preview-surface {
  display: grid;
  justify-items: center;
  padding: var(--s-6);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--wash);
  background-size: 16px 16px;
}

.form-preview-page {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: var(--s-5);
  width: min(100%, 760px);
  min-height: 520px;
  padding: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 16px 48px rgba(16, 24, 32, 0.08);
}

.form-preview-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-4);
  align-items: start;
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.form-preview-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-4);
  align-content: start;
}

.form-empty-state {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  min-height: 240px;
  gap: var(--s-2);
  padding: var(--s-6);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  text-align: center;
}

.form-empty-state strong {
  color: var(--graphite);
}

.builder-field-card {
  display: grid;
  grid-column: span var(--field-width, 12);
  gap: var(--s-3);
  min-width: 0;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
}

.builder-field-card:hover {
  border-color: var(--line-strong);
}

.builder-field-card.is-selected {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--section-accent) 10%, transparent);
}

.builder-field-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.builder-section-card {
  display: grid;
  grid-column: span var(--field-width, 12);
  gap: var(--s-4);
  min-width: 0;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 92%, var(--wash));
  cursor: pointer;
}

.builder-section-card.is-selected {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--section-accent) 10%, transparent);
}

.builder-section-title {
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
  color: var(--graphite);
  font-size: 14px;
  font-weight: 850;
  line-height: 20px;
}

.builder-section-fields {
  align-items: start;
  align-content: start;
  gap: var(--s-3);
}

.builder-section-empty {
  min-height: 120px;
}

.builder-field-preview {
  display: grid;
  gap: var(--s-3);
}

.builder-field-preview .field:disabled,
.builder-field-preview input:disabled,
.builder-field-preview select:disabled,
.builder-field-preview textarea:disabled {
  pointer-events: none;
}

.builder-canvas-label {
  color: var(--graphite);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
}

.builder-canvas-label.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.builder-section-preview {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3) 0;
  border-top: 2px solid color-mix(in srgb, var(--section-accent) 32%, var(--line));
}

.builder-checkbox-preview {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
  color: var(--graphite);
}

.builder-checkbox-preview input {
  width: 18px;
  height: 18px;
  accent-color: var(--section-accent);
}

.builder-file-preview {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  font-weight: 750;
}

.builder-static-text-preview,
.builder-static-table-preview,
.record-static-text,
.record-static-table {
  display: grid;
  gap: 4px;
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 72%, var(--wash));
  color: var(--graphite);
}

.builder-static-text-preview p,
.record-static-text p {
  margin: 0;
  line-height: 1.45;
}

.builder-static-table-preview div,
.record-static-table div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 180px);
  column-gap: var(--s-5);
  row-gap: 2px;
  align-items: baseline;
}

.builder-static-table-preview span,
.builder-static-table-preview strong,
.record-static-table span,
.record-static-table strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.builder-static-table-preview strong,
.record-static-table strong {
  font-weight: 650;
}

.builder-static-empty,
.record-static-empty {
  padding: var(--s-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
}

.record-component-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-4);
  align-content: start;
  align-items: start;
  min-height: 360px;
}

.record-group-tabs {
  display: grid;
  gap: var(--s-3);
  min-width: 0;
}

.record-group-tab-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(96px, max-content);
  justify-content: start;
  gap: var(--s-1);
  min-width: 0;
  overflow-x: auto;
  padding-bottom: var(--s-1);
}

.record-group-tab {
  min-height: 32px;
  padding: var(--s-1) var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  text-align: left;
  white-space: nowrap;
}

.record-group-tab:hover {
  color: var(--graphite);
  background: color-mix(in srgb, var(--wash) 72%, var(--surface));
}

.record-group-tab.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--graphite);
}

.record-group-tab-panel {
  display: grid;
  min-width: 0;
}

.record-group-tab-panel .record-component-card {
  grid-column: 1 / -1;
}

.record-preview-surface {
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
  padding: var(--s-5);
}

.form-definition-preview-surface {
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
  padding: var(--s-5);
}

.record-preview-page {
  justify-self: stretch;
  width: auto;
  max-width: none;
  min-height: 100%;
}

.form-definition-preview-page {
  justify-self: stretch;
  width: auto;
  max-width: none;
  min-height: 100%;
}

.form-builder-shell.is-fullscreen .record-preview-surface {
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
}

.form-builder-shell.is-fullscreen .form-definition-preview-surface {
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
}

.form-builder-shell.is-fullscreen .record-preview-page {
  justify-self: stretch;
  width: auto;
  max-width: none;
  min-height: 100%;
}

.form-builder-shell.is-fullscreen .form-definition-preview-page {
  justify-self: stretch;
  width: auto;
  max-width: none;
  min-height: 100%;
}

.record-component-card {
  display: grid;
  grid-column: span var(--field-width, 12);
  gap: var(--s-4);
  min-width: 0;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
}

.record-component-card:hover {
  border-color: var(--line-strong);
}

.record-component-card.is-selected {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--section-accent) 10%, transparent);
}

.record-component-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.record-component-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}

.record-form-field-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  align-content: start;
  gap: var(--s-3);
}

.record-form-field {
  display: grid;
  grid-column: span var(--field-width, 12);
  gap: var(--s-2);
  min-width: 0;
}

.record-form-field span {
  overflow: hidden;
  color: var(--graphite);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-form-field div {
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}

.record-form-section-spacer {
  grid-column: 1 / -1;
  min-height: 96px;
  border: 0;
  background: transparent;
}

.part-field-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  overflow: visible;
}

.field-candidate-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.field-candidate-trigger {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.field-candidate-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  left: -4px;
  display: none;
  min-width: 280px;
  max-width: min(360px, 80vw);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.06);
}

.field-candidate-menu[hidden] {
  display: none !important;
}

.field-candidate-menu.is-open {
  display: grid;
  gap: 4px;
}

.field-candidate-option {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.field-candidate-option:hover,
.field-candidate-option:focus-visible {
  background: var(--wash);
}

.field-candidate-option.is-priority {
  border: 1px solid color-mix(in srgb, #2563eb 34%, var(--line));
  background: color-mix(in srgb, #2563eb 11%, var(--surface));
  box-shadow: inset 4px 0 0 #2563eb;
}

.field-candidate-option.is-priority:hover,
.field-candidate-option.is-priority:focus-visible {
  background: color-mix(in srgb, #2563eb 16%, var(--surface));
}

.field-candidate-option.is-priority strong::after {
  content: "Priority";
  display: inline-block;
  margin-left: 8px;
  padding: 1px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, #2563eb 12%, var(--surface));
  color: #2563eb;
  font-size: 10px;
  font-weight: 850;
  vertical-align: 1px;
}

.field-candidate-option:disabled {
  cursor: default;
  opacity: 1;
}

.field-candidate-option strong,
.field-candidate-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-candidate-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.record-form-empty {
  padding: var(--s-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.builder-field-edit-form {
  display: grid;
  align-content: start;
  gap: var(--s-4);
  margin-top: var(--s-4);
}

.builder-static-table-editor {
  display: grid;
  gap: var(--s-2);
}

.builder-static-table-editor.is-hidden {
  display: none;
}

.builder-static-table-rows {
  display: grid;
  gap: var(--s-2);
}

.builder-static-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px) 32px;
  gap: var(--s-2);
  align-items: center;
}

.builder-static-table-row .field {
  min-width: 0;
}

.builder-static-table-add {
  justify-self: start;
}

.field-textarea-small {
  min-height: 72px;
}

.field-check {
  min-height: 64px;
  align-content: end;
}

.field-check input {
  width: 20px;
  height: 20px;
  margin: 10px 0;
  accent-color: var(--section-accent);
}

.detail-check {
  min-height: 0;
  align-content: start;
}

.form-field-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(140px, 0.8fr) minmax(110px, max-content) minmax(90px, max-content) auto;
  gap: var(--s-2);
  align-items: center;
}

.matrix-upload-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.2fr);
  gap: var(--s-4);
  align-items: stretch;
}

.po-validation-shell {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  gap: var(--s-4);
  align-items: start;
}

.po-validation-page {
  max-width: 100vw;
  overflow-x: hidden;
}

.po-validation-page .app-shell,
.po-validation-page .main-layout,
.po-validation-page .workspace,
.po-validation-page .po-validation-shell,
.po-validation-page .po-queue-workspace,
.po-validation-page .po-tab-panel {
  min-width: 0;
  max-width: 100%;
}

.po-validation-page .main-layout {
  width: 100%;
}

.po-validation-page .workspace {
  width: 100%;
  overflow-x: hidden;
}

.po-upload-rail {
  position: static;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: none;
  overflow: visible;
  display: grid;
  gap: var(--s-4);
  padding: 0;
  border: 0;
  box-shadow: none;
}

.po-pending-files {
  display: grid;
  gap: var(--s-1);
  max-height: 360px;
  overflow-y: auto;
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.po-pending-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--white);
}

.po-pending-file strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-upload-rail form {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.po-rail-fields {
  display: grid;
  gap: var(--s-3);
}

.po-rail-fields {
  grid-template-columns: repeat(2, minmax(160px, 240px));
}

.po-upload-rail .po-upload-dropzone {
  min-height: 128px;
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}

.po-upload-rail .po-upload-dropzone .upload-dropzone-icon {
  width: 44px;
  height: 44px;
}

.po-upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  align-items: center;
}

.po-upload-list-dropzone {
  display: grid;
  gap: var(--s-2);
}

.po-upload-list-heading {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  align-items: baseline;
}

.po-upload-list-heading small {
  color: var(--muted);
}

.matrix-validation-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}

.po-upload-file-table-wrap.is-dragging {
  border-color: var(--section-accent);
  background: var(--blue-soft);
}

.po-upload-file-table {
  width: 100%;
}

.po-upload-file-table th:last-child,
.po-upload-file-table td:last-child:not([colspan]) {
  width: 96px;
  text-align: right;
}

.po-upload-status {
  min-height: 20px;
  font-size: 12px;
}

.po-queue-workspace {
  min-width: 0;
  padding: 0;
}

.po-alert-stack {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4) 0;
}

.po-alert-stack:empty {
  display: none;
}

.po-alert {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
}

.po-alert-success {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: var(--green-soft);
  color: var(--green-dark);
}

.po-alert-error {
  border-color: color-mix(in srgb, var(--red) 34%, var(--line));
  background: var(--red-soft);
  color: var(--red-dark);
}

.po-alert-working {
  border-color: color-mix(in srgb, var(--section-accent) 40%, var(--line));
  background: color-mix(in srgb, var(--section-accent) 8%, var(--surface));
  color: var(--graphite);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}

.po-alert-working::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--section-accent), transparent);
  animation: po-alert-progress 1.2s linear infinite;
  content: "";
}

.po-alert-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 3px solid color-mix(in srgb, var(--section-accent) 18%, var(--surface));
  border-top-color: var(--section-accent);
  border-radius: 999px;
  animation: po-alert-spin .75s linear infinite;
}

.po-alert-copy {
  min-width: 0;
}

.po-alert a {
  color: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.po-alert-close {
  display: inline-grid;
  width: 24px;
  height: 24px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

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

@keyframes po-alert-progress {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}

.po-tab-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(128px, max-content);
  justify-content: start;
  gap: var(--s-1);
  overflow-x: auto;
  padding: var(--s-3) var(--s-4) 0;
  border-bottom: 1px solid var(--line);
}

.po-tab {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  white-space: nowrap;
}

.po-tab:hover {
  color: var(--graphite);
  background: color-mix(in srgb, var(--wash) 62%, var(--surface));
}

.po-tab.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--graphite);
  transform: translateY(1px);
}

.po-tab span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 var(--s-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--section-accent) 12%, var(--surface));
  color: var(--section-accent);
  font-size: 11px;
  line-height: 16px;
}

.po-tab-panel {
  display: none;
  padding: var(--s-5);
}

.po-tab-panel.is-active {
  display: block;
}

.po-queue-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-4);
  align-items: start;
}

.po-action-bar {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
}

.po-history-filter-controls {
  display: grid;
  grid-template-columns: minmax(260px, 460px) minmax(170px, 210px) auto auto;
  align-items: center;
  gap: var(--s-2);
  margin-right: auto;
  min-width: 0;
}

.po-history-filter-controls .field {
  height: 32px;
  min-height: 32px;
}

@media (max-width: 900px) {
  .po-history-filter-controls {
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 190px) auto auto;
    width: 100%;
  }
}

.po-status-line {
  display: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
}

.po-status-line:not(:empty) {
  display: block;
  margin-top: var(--s-2);
}

.po-status-line[data-status-type="success"] {
  color: var(--green-dark);
}

.po-status-line[data-status-type="error"] {
  color: var(--red-dark);
}

.button-small {
  min-height: 32px;
  padding: 0 var(--s-3);
  font-size: 12px;
  line-height: 16px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.po-tab-panel .po-queue-table-wrap {
  margin: var(--s-4) 0 0;
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 390px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.po-queue-workspace,
.po-tab-panel {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.po-queue-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface-soft);
}

.po-queue-table thead .po-sticky-select,
.po-queue-table thead .po-sticky-po,
.po-queue-table thead .po-sticky-customer {
  z-index: 6;
}

.po-queue-table {
  min-width: 1780px;
}

.po-queue-table th,
.po-queue-table td {
  white-space: nowrap;
}

.po-select-column {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.po-select-column input {
  width: 16px;
  height: 16px;
  accent-color: var(--section-accent);
}

.po-order-link {
  color: var(--section-accent);
  text-decoration: none;
}

.po-part-history-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--section-accent);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  cursor: pointer;
}

.po-part-history-link:hover,
.po-part-history-link:focus-visible {
  text-decoration-color: currentColor;
}

.po-history-icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--section-accent);
  cursor: pointer;
}

.po-history-icon-button:hover,
.po-history-icon-button:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.po-history-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.po-history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 79;
  background: rgba(15, 23, 42, 0.28);
}

.po-staged-document-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.po-staged-document-link:hover,
.po-staged-document-link:focus-visible {
  text-decoration: underline;
}

.po-upload-file-table tbody tr.is-document-active > td {
  background: #e8f0ff;
  box-shadow: inset 0 1px 0 var(--blue), inset 0 -1px 0 var(--blue);
}

.po-document-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 28px;
  background: rgba(15, 23, 42, 0.62);
}

.po-document-modal[hidden] {
  display: none;
}

.po-document-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--s-4);
  width: min(1400px, 96vw);
  margin: 0 auto;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: #fff;
}

.po-document-modal-head h2,
.po-document-modal-head p {
  margin: 0;
}

.po-document-modal iframe {
  width: min(1400px, 96vw);
  height: 100%;
  margin: 0 auto;
  border: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: #fff;
}

.po-part-notes {
  height: 100%;
  padding: 1.25rem;
  background: var(--surface-soft);
  overflow: auto;
}

.po-part-note-form {
  display: grid;
  grid-template-columns: 7rem minmax(12rem, 1fr) auto;
  gap: .6rem;
  align-items: start;
  margin: .75rem 0;
}

.po-part-note-form textarea {
  min-height: 6.5rem;
  padding: .75rem .875rem;
  line-height: 1.45;
  resize: vertical;
}
.po-part-note-list { display: grid; gap: .65rem; }
.po-part-note { padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); }
.po-part-note.is-alert { border-left: 4px solid var(--red); }
.po-part-note-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .78rem; }
.po-part-note-head span { color: var(--muted); }
.po-part-note p { margin: .35rem 0 0; white-space: pre-wrap; }
.po-part-note-actions { display: flex; gap: .45rem; justify-content: flex-end; margin-top: .6rem; }
.po-part-note-editor { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .6rem; margin-top: .6rem; }
.po-part-note-editor .po-part-note-actions { grid-column: 1 / -1; margin-top: 0; }
.po-part-note-count { display: inline-grid; min-width: 1.15rem; height: 1.15rem; place-items: center; padding: 0 .25rem; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; line-height: 1; }

@media (max-width: 760px) {
  .po-part-note-form { grid-template-columns: 1fr; }
  .po-part-note-editor { grid-template-columns: 1fr; }
}

.po-history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(1180px, 72vw);
  height: 100vh;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.2);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.po-part-drawer-tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--s-4);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.po-part-drawer-tab {
  appearance: none;
  padding: .85rem 1rem .7rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.po-part-drawer-tab:hover,
.po-part-drawer-tab:focus-visible { color: var(--ink); }
.po-part-drawer-tab.is-active { border-bottom-color: var(--blue); color: var(--blue-dark); }
.po-part-drawer-panel { min-height: 0; }
.po-part-drawer-panel.is-active { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.po-part-drawer-panel[hidden] { display: none; }

.po-history-drawer.is-open {
  transform: translateX(0);
}

.po-history-drawer-head,
.po-history-drawer-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  align-items: start;
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.po-history-pending {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  background: #f7faff;
}

.po-history-pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.po-history-pending-head p {
  margin: 0;
}

.po-history-pending-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: var(--s-2) var(--s-4);
}

.po-history-pending-grid > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.po-history-pending-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.po-history-pending-grid strong {
  overflow: hidden;
  color: var(--graphite);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-history-drawer-head h2,
.po-history-drawer-head p {
  margin: 0;
}

.po-history-drawer-actions {
  display: flex;
  flex: 0 0 auto;
  gap: var(--s-2);
  align-items: center;
}

.po-history-drawer-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.po-history-drawer-body {
  min-width: 0;
  overflow: auto;
  padding: var(--s-4);
  background: #fff;
}

.po-history-table-wrap {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: auto;
}

.po-history-table {
  min-width: 1120px;
  table-layout: auto;
  background: #fff;
}

.po-history-table th,
.po-history-table td {
  vertical-align: top;
  white-space: nowrap;
}

.po-history-table td:nth-child(7),
.po-history-table td:nth-child(9) {
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.po-history-table tbody tr {
  background: #fff;
}

.po-history-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-soft);
}

@media (max-width: 800px) {
  .po-history-drawer {
    width: 100vw;
  }
}

.po-order-link:hover,
.po-order-link:focus-visible {
  text-decoration: underline;
}

.po-history-price-mismatch .po-history-price-cell {
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  color: var(--red);
  font-weight: 700;
}

.po-history-price-missing .po-history-price-cell {
  background: color-mix(in srgb, #d97706 13%, var(--surface));
  color: #9a4d05;
  font-weight: 700;
}

.po-history-price-flag {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.po-alert-column {
  min-width: 220px;
  max-width: 260px;
}

.po-alert-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  white-space: normal;
}

.po-rule-column {
  min-width: 250px;
  max-width: 330px;
}

.po-rule-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  white-space: normal;
}

.po-alert-reason {
  display: block;
  flex-basis: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 15px;
}

.po-state-pill {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 14px;
  text-transform: uppercase;
  white-space: nowrap;
}

.po-state-pill.is-ok {
  border-color: color-mix(in srgb, var(--green) 36%, var(--line));
  background: var(--green-soft);
  color: var(--green-dark);
}

.po-state-pill.is-issue {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
  background: var(--red-soft);
  color: var(--red-dark);
}

.po-state-pill.is-neutral {
  border-color: color-mix(in srgb, var(--section-accent) 30%, var(--line));
  background: color-mix(in srgb, var(--section-accent) 10%, var(--surface));
  color: var(--section-accent);
}

.po-sticky-select,
.po-sticky-po,
.po-sticky-customer {
  position: sticky;
  background: var(--surface);
}

th.po-sticky-select,
th.po-sticky-po,
th.po-sticky-customer {
  background: var(--surface-soft);
  z-index: 5;
}

td.po-sticky-select,
td.po-sticky-po,
td.po-sticky-customer {
  z-index: 4;
}

.po-sticky-select {
  left: 0;
}

.po-sticky-po {
  left: 44px;
  width: 160px;
  min-width: 160px;
}

.po-sticky-customer {
  left: 204px;
  width: 200px;
  min-width: 200px;
  box-shadow: 1px 0 0 var(--line);
}

.po-export-history {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-1);
}

.po-production-review {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-1);
}

.po-production-review[hidden] {
  display: none;
}

.po-production-review-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-2);
}

.po-production-review-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
}

.po-production-review .po-production-review-wrap {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.po-production-review-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.po-production-review-table th,
.po-production-review-table td {
  white-space: nowrap;
}

.po-production-review-table td {
  padding: var(--s-2);
}

.po-production-review-table tr.is-existing-production td {
  background: var(--amber-soft);
}

.po-production-review-table tr.is-dynamics-verified td {
  background: var(--green-soft);
}

.po-production-review-table tr.is-existing-production .po-review-input {
  border-color: var(--amber);
  background: var(--white);
}

.po-review-text {
  display: block;
  min-width: 128px;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--graphite);
  line-height: 18px;
}

.po-review-input {
  min-width: 128px;
  height: 34px;
  font-size: 12px;
}

.po-dynamics-read {
  display: grid;
  gap: 2px;
  min-width: 160px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.po-dynamics-read strong {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.po-dynamics-read.is-verified {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.po-dynamics-read.is-verified strong {
  color: var(--green-dark);
}

.po-production-review-table th:first-child,
.po-production-review-table td:first-child {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
}

.po-production-review-table .po-review-sticky-select,
.po-production-review-table .po-review-sticky-history,
.po-production-review-table .po-review-sticky-item,
.po-production-review-table .po-review-sticky-customer {
  position: sticky;
  z-index: 3;
  background: var(--surface);
}

.po-production-review-table thead .po-review-sticky-select,
.po-production-review-table thead .po-review-sticky-history,
.po-production-review-table thead .po-review-sticky-item,
.po-production-review-table thead .po-review-sticky-customer {
  z-index: 6;
  background: var(--surface-soft);
}

.po-production-review-table tr.is-existing-production .po-review-sticky-select,
.po-production-review-table tr.is-existing-production .po-review-sticky-history,
.po-production-review-table tr.is-existing-production .po-review-sticky-item,
.po-production-review-table tr.is-existing-production .po-review-sticky-customer {
  background: var(--amber-soft);
}

.po-production-review-table tr.is-dynamics-verified .po-review-sticky-select,
.po-production-review-table tr.is-dynamics-verified .po-review-sticky-history,
.po-production-review-table tr.is-dynamics-verified .po-review-sticky-item,
.po-production-review-table tr.is-dynamics-verified .po-review-sticky-customer {
  background: var(--green-soft);
}

.po-queue-table tbody tr.is-history-active > td,
.po-production-review-table tbody tr.is-history-active > td,
.po-production-review-table tbody tr.is-history-active > .po-review-sticky-select,
.po-production-review-table tbody tr.is-history-active > .po-review-sticky-history,
.po-production-review-table tbody tr.is-history-active > .po-review-sticky-item,
.po-production-review-table tbody tr.is-history-active > .po-review-sticky-customer {
  background: #e8f0ff;
  box-shadow: inset 0 1px 0 var(--blue), inset 0 -1px 0 var(--blue);
}

.po-queue-table tbody tr.is-history-active > td:first-child,
.po-production-review-table tbody tr.is-history-active > td:first-child {
  box-shadow: inset 4px 0 0 var(--blue), inset 0 1px 0 var(--blue), inset 0 -1px 0 var(--blue);
}

.po-review-sticky-select { left: 0; }

.po-review-sticky-history {
  left: 44px;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  padding-left: 6px !important;
  padding-right: 6px !important;
  text-align: center;
}

.po-review-sticky-item {
  left: 108px;
  width: 180px;
  min-width: 180px;
}

.po-review-sticky-customer {
  left: 288px;
  width: 180px;
  min-width: 180px;
  box-shadow: 1px 0 0 var(--line);
}

.po-production-review-table td:first-child input,
.po-production-review-table th:first-child input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--section-accent);
}

/* Size by field, so adding an Alerts column cannot squeeze another input. */
.po-production-review-table [data-review-field="ItemNo"],
.po-production-review-table [data-review-field="SellToCustomerNo"] {
  width: 164px;
  min-width: 164px;
}
.po-production-review-table .po-review-po-field [data-review-field="ExternalPONo"] {
  width: 180px;
  min-width: 180px;
  flex: 0 0 180px;
}
.po-production-review-table [data-review-field="ShipTo"] {
  width: 340px;
  min-width: 340px;
  min-height: 66px;
  height: auto;
  padding: 8px 10px;
  line-height: 20px;
  white-space: normal;
  overflow-wrap: anywhere;
  resize: vertical;
}
.po-production-review-table [data-review-field="JobNo"] {
  width: 220px;
  min-width: 220px;
}
.po-production-review-table [data-review-field="DueDate"] {
  width: 150px;
  min-width: 150px;
}
.po-production-review-table .po-review-input {
  font-size: 14px;
}
.po-production-review-table .po-alert-column {
  min-width: 190px;
  max-width: 240px;
}
.po-production-review .po-production-review-wrap {
  overflow-x: auto;
}

.po-export-history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-1);
}

.po-export-history-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
}

.po-export-history .po-export-table-wrap {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.po-export-table {
  min-width: 720px;
}

.po-export-table th,
.po-export-table td {
  white-space: nowrap;
}

.po-export-table tbody tr[data-po-export-row] {
  cursor: pointer;
}

.po-export-table tbody tr[data-po-export-row].is-selected {
  background: color-mix(in srgb, var(--section-accent) 7%, var(--surface));
}

.po-export-links {
  display: flex;
  gap: var(--s-3);
  align-items: center;
}

.po-export-links a {
  color: var(--section-accent);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.po-empty-state {
  display: grid;
  gap: var(--s-1);
  min-height: 220px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.po-empty-state strong {
  color: var(--graphite);
}

.upload-dropzone {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  min-height: 88px;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px dashed color-mix(in srgb, var(--section-accent) 44%, var(--line-strong));
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--section-accent) 5%, var(--surface));
  cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragging {
  border-style: solid;
  background: color-mix(in srgb, var(--section-accent) 9%, var(--surface));
}

.upload-dropzone:has(.upload-dropzone-input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.upload-dropzone:has(.upload-dropzone-input:disabled) {
  cursor: not-allowed;
  opacity: 0.5;
}

.upload-dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-dropzone-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--section-accent) 24%, var(--line));
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--section-accent);
}

.upload-dropzone-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.upload-dropzone-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.upload-dropzone-copy strong {
  color: var(--graphite);
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-dropzone-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.profile-upload-dropzone {
  min-height: 104px;
  grid-template-columns: 48px minmax(0, 1fr);
  border-style: solid;
  background: color-mix(in srgb, var(--blue) 4%, var(--surface));
}

.profile-upload-dropzone:hover,
.profile-upload-dropzone.is-dragging {
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
}

.profile-upload-icon {
  width: 48px;
  height: 48px;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: var(--blue);
}

.matrix-list-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(96px, max-content) minmax(72px, max-content) minmax(160px, 1fr) auto;
  gap: var(--s-2);
  align-items: center;
}

.matrix-row-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(96px, 0.5fr) minmax(120px, 0.7fr) minmax(96px, 0.5fr) minmax(96px, 0.5fr) auto;
  gap: var(--s-2);
  align-items: end;
}

.matrix-row-submit {
  display: grid;
  align-items: end;
}

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

.matrix-rows-table-wrap {
  max-height: calc(100vh - var(--topbar-height) - var(--s-6));
  overflow: auto;
  overscroll-behavior: contain;
}

.matrix-rows-table-wrap .matrix-edit-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding-top: var(--s-3);
  padding-bottom: var(--s-3);
  vertical-align: middle;
  background: var(--surface-soft);
  box-shadow: 0 1px 0 var(--line);
}

.matrix-edit-table {
  min-width: max(960px, 100%);
}

.matrix-edit-table th,
.matrix-edit-table td {
  white-space: nowrap;
}

.matrix-edit-table .field {
  min-width: 160px;
}

.matrix-row-save-status {
  min-width: 54px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.matrix-edit-table tr.is-saved .matrix-row-save-status {
  color: var(--green);
}

.matrix-edit-table tr.has-save-error .matrix-row-save-status {
  color: var(--red-dark);
}

.matrix-edit-table .matrix-row-delete {
  flex: 0 0 32px;
}

.matrix-embedded .main-layout {
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.matrix-embedded .workspace {
  min-width: 0;
  padding: var(--s-5);
}

.matrix-embedded .page-head {
  align-items: start;
}

.matrix-embedded .matrix-rows-table-wrap {
  max-height: calc(100vh - 130px);
}

.matrix-line-editor {
  padding: var(--s-4);
}

.matrix-line-form {
  display: grid;
  gap: var(--s-5);
}

.matrix-line-form + .matrix-line-form {
  padding-top: var(--s-5);
  margin-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.matrix-line-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s-4);
}

.matrix-line-fields .field {
  width: 100%;
  min-width: 0;
}

.matrix-line-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}

.matrix-embedded .matrix-line-editor {
  overflow: visible;
}

.po-job-choice {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 300px;
  margin-top: var(--s-2);
}

.po-lead-time-override {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.po-job-choice .field {
  min-width: 170px;
}

.po-price-override {
  display: flex;
  align-items: stretch;
  width: 164px;
  min-width: 164px;
  margin-top: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.po-price-override:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}

.po-price-override-prefix {
  display: grid;
  width: 30px;
  place-items: center;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.po-price-override input {
  width: 94px;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.po-price-override button {
  display: grid;
  width: 38px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line-strong);
  place-items: center;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}

.po-price-override button:hover:not(:disabled) {
  background: var(--blue-dark);
}

.po-price-override button:disabled {
  cursor: wait;
  opacity: .55;
}

.po-price-override button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.grid-list-wrap {
  display: grid;
  overflow-x: auto;
}

.grid-list-header,
.grid-list-row,
.grid-list-empty {
  min-width: 640px;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}

.grid-list-header {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
  background: var(--surface-soft);
}

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

.parts-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}

.parts-layout-full {
  grid-template-columns: minmax(0, 1fr);
}

.parts-workspace {
  gap: var(--s-5);
  padding-top: var(--s-6);
}

.parts-workspace-detail {
  padding-top: var(--s-5);
}

.parts-main,
.parts-side {
  display: grid;
  gap: var(--s-5);
  min-width: 0;
}

.parts-list-panel > .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-4);
}

.parts-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.parts-list {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.parts-empty {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding: var(--s-5);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
}

.parts-empty strong {
  color: var(--graphite);
}

.parts-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.parts-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: var(--s-3) var(--s-4);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--graphite);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.parts-group-head span {
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parts-group-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.parts-group-body {
  display: none;
}

.parts-group.is-open .parts-group-body {
  display: grid;
}

.parts-group:first-child .parts-group-body,
.parts-group:only-child .parts-group-body {
  display: grid;
}

.part-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.part-row:hover {
  background: color-mix(in srgb, var(--blue) 3%, var(--surface));
}

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

.part-select-column {
  display: grid;
  width: 46px;
  height: 100%;
  place-items: center;
}

.part-select-column input {
  width: 16px;
  height: 16px;
  accent-color: var(--section-accent);
}

.part-row-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-4);
  align-items: center;
  min-height: 64px;
  padding: var(--s-3) var(--s-4) var(--s-3) 0;
  color: inherit;
  text-decoration: none;
}

.part-row:not(:has(.part-select-column)) .part-row-link {
  padding-left: var(--s-4);
}

.part-row-main {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}

.part-row-main strong,
.part-row-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-row-main small {
  color: var(--muted);
}

.part-row-meta {
  display: grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.part-selection-bar {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--s-3);
  min-height: 40px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 82%, var(--panel));
}

.part-select-all {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: 0 var(--s-3);
  color: var(--graphite);
  font-size: 13px;
  font-weight: 750;
  line-height: 18px;
  white-space: nowrap;
}

.part-select-all input {
  width: 16px;
  height: 16px;
  accent-color: var(--section-accent);
}

.part-selection-count {
  min-width: 88px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
}

.pill {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--graphite);
  font-size: 12px;
  font-weight: 750;
  line-height: 14px;
}

.part-intake-dropzone {
  margin-top: var(--s-4);
}

.part-processing-list {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.part-processing-list:empty {
  display: none;
  margin-top: 0;
}

.document-library {
  gap: var(--s-5);
  padding-top: var(--s-6);
}

.document-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-4);
}

.document-metric {
  border-top: 3px solid color-mix(in srgb, var(--section-accent) 78%, var(--surface));
}

.document-library-panel {
  padding-bottom: 0;
}

.document-folder-panel {
  display: grid;
  gap: var(--s-4);
}

.document-folder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-4);
  padding: 0;
}

.document-folder-create-button {
  display: inline-grid;
  grid-template-columns: 20px auto;
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid color-mix(in srgb, var(--section-accent) 36%, var(--line-strong));
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--section-accent) 7%, var(--surface));
  color: var(--section-accent);
  cursor: pointer;
  font-weight: 750;
}

.document-folder-create-button:hover {
  background: color-mix(in srgb, var(--section-accent) 11%, var(--surface));
}

.document-folder-create-button svg,
.document-folder-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-folder-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) minmax(220px, 320px) auto;
  gap: var(--s-3);
  align-items: end;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
}

.document-folder-share-field.is-hidden {
  display: none;
}

.document-folder-share-list {
  display: grid;
  gap: 6px;
  max-height: 150px;
  padding: var(--s-2);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.document-folder-share-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
  min-height: 28px;
  color: var(--graphite);
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
}

.document-folder-share-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.document-folder-share-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-folder-share-empty {
  color: var(--muted);
  font-size: 13px;
}

.document-folder-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.document-folder-card-shell {
  position: relative;
  display: grid;
  gap: var(--s-2);
}

.document-folder-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-3);
  min-height: 72px;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--graphite);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.document-folder-card-shell .document-folder-card {
  width: 100%;
}

.document-folder-card:hover {
  border-color: color-mix(in srgb, var(--section-accent) 34%, var(--line-strong));
  background: color-mix(in srgb, var(--section-accent) 5%, var(--surface));
}

.document-folder-card.is-active {
  border-color: color-mix(in srgb, var(--section-accent) 62%, var(--line-strong));
  background: color-mix(in srgb, var(--section-accent) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--section-accent) 38%, transparent);
}

.document-folder-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--section-accent) 30%, var(--line));
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--section-accent) 8%, var(--surface));
  color: var(--section-accent);
}

.document-folder-card-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.document-folder-card-copy strong,
.document-folder-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-folder-card-copy small {
  color: var(--muted);
}

.document-folder-card-actions {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
}

.document-folder-action {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 92%, white);
  color: var(--muted);
  cursor: pointer;
}

.document-folder-action:hover {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line-strong));
  color: var(--section-accent);
}

.document-folder-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-folder-dialog {
  width: min(560px, calc(100vw - 48px));
}

.document-folder-dialog-body {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-4);
}

.document-folder-edit-form {
  display: grid;
  gap: var(--s-2);
}

.document-folder-edit-actions {
  display: inline-flex;
  gap: var(--s-2);
  align-items: center;
}

.document-folder-delete-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

.document-folder-delete-panel div {
  display: grid;
  gap: 2px;
}

.document-folder-delete-panel span {
  color: var(--muted);
  font-size: 13px;
}

.document-library-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-4);
  padding: 0;
}

.document-bulk-actions {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: var(--s-3);
}

.document-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 210px) minmax(170px, 240px) minmax(160px, 230px);
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.document-folder-assign-select {
  min-width: 160px;
}

.document-type-list {
  display: grid;
  gap: var(--s-4);
  margin-top: var(--s-4);
  padding-bottom: var(--s-4);
}

.document-type-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.document-type-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  padding: var(--s-4);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--section-accent) 5%, var(--surface-soft));
  color: var(--graphite);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.document-type-head:hover {
  background: color-mix(in srgb, var(--section-accent) 8%, var(--surface-soft));
}

.document-type-head:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.document-type-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
}

.document-type-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 22px;
}

.document-accordion-indicator {
  justify-self: center;
}

.document-type-group.is-open .document-accordion-indicator::before {
  content: "-";
}

.document-table-wrap {
  display: none;
  overflow: auto;
}

.document-type-group.is-open .document-table-wrap {
  display: block;
}

.document-table {
  min-width: 900px;
}

.document-select-column {
  width: 44px;
  text-align: center;
}

.document-select-column input {
  width: 16px;
  height: 16px;
  accent-color: var(--section-accent);
}

.document-name-cell {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}

.document-name-cell span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.document-name-cell strong,
.document-name-cell small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-name-cell small {
  color: var(--muted);
}

.document-file-icon {
  display: grid;
  width: 48px;
  height: 36px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--section-accent) 32%, var(--line));
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--section-accent) 9%, var(--surface));
  color: var(--section-accent);
  font-size: 10px;
  font-weight: 850;
  line-height: 12px;
}

.document-record-link {
  color: var(--section-accent);
  font-weight: 750;
}

.document-record-link:hover {
  text-decoration: underline;
}

.document-action-list {
  display: inline-grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  align-items: center;
}

.document-icon-action {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--section-accent);
}

.document-icon-action:hover {
  border-color: color-mix(in srgb, var(--section-accent) 45%, var(--line-strong));
  background: color-mix(in srgb, var(--section-accent) 7%, var(--surface));
}

.document-directory-view {
  margin-top: var(--s-4);
  padding-bottom: var(--s-4);
}

.document-directory-view .document-table-wrap {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.document-directory-table {
  min-width: 980px;
}

.document-icon-action:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.document-icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.part-detail-panel {
  margin-bottom: 0;
}

.part-detail-panel > .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-4);
  padding: 0;
  margin-bottom: var(--s-4);
}

.part-detail-actions {
  display: grid;
  grid-auto-flow: column;
  gap: var(--s-2);
  justify-content: end;
}

.part-operation-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: var(--s-6);
  align-items: start;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
}

.part-document-panel {
  display: grid;
  align-content: start;
  gap: var(--s-3);
}

.part-document-list {
  display: grid;
  gap: var(--s-2);
}

.part-document-list-label {
  display: grid;
  gap: var(--s-1);
  padding-top: var(--s-1);
}

.part-document-row {
  display: grid;
  gap: var(--s-2);
  align-items: start;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
}

.part-document-row:hover {
  border-color: var(--accent);
}

.part-document-row span:first-child {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}

.part-document-row .pill {
  justify-self: start;
}

.part-document-row small {
  color: var(--muted);
}

.part-record-dropzone {
  margin-top: 0;
  grid-template-columns: auto minmax(0, 1fr);
  padding: var(--s-3);
}

.part-detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--s-3);
}

.record-value-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-3);
}

.record-value-grid > div,
.record-form-field-grid > .record-static-field {
  grid-column: span var(--field-width, 12);
  min-width: 0;
}

.record-edit-grid > .field-group {
  grid-column: span var(--field-width, 12);
  min-width: 0;
}

.record-form-section-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  align-content: start;
  column-gap: var(--s-4);
  row-gap: var(--s-6);
  min-width: 0;
}

.record-form-section {
  display: grid;
  grid-column: span var(--field-width, 12);
  align-content: start;
  gap: var(--s-3);
  min-width: 0;
}

.record-form-section-title {
  margin: 0;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
  color: var(--graphite);
  font-size: 14px;
  font-weight: 850;
  line-height: 20px;
}

.record-display-grid > .record-display-field {
  grid-column: span var(--field-width, 12);
  min-width: 0;
}

.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
}

.meta-label {
  display: block;
  margin-bottom: var(--s-1);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.record-item-list {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.part-record-group-list {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-4);
}

.part-record-group {
  display: grid;
  grid-column: span var(--field-width, 12);
  gap: var(--s-3);
  min-width: 0;
}

.part-record-group-title {
  margin: 0;
  color: var(--graphite);
  font-size: 15px;
  line-height: 20px;
}

.part-record-inline-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-3);
}

.part-record-object {
  grid-column: span var(--field-width, 12);
  min-width: 0;
}

.part-record-tabs {
  display: grid;
  gap: var(--s-3);
}

.part-record-tab-panel {
  display: none;
}

.part-record-tab-panel.is-active {
  display: grid;
}

.record-item-card {
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.record-item-head {
  margin-bottom: var(--s-3);
}

.record-item-head h3 {
  margin: var(--s-1) 0 0;
}

.part-process-card {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
}

.part-process-card.is-error {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
  background: color-mix(in srgb, var(--red) 4%, var(--surface));
}

.part-process-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
}

.part-process-head strong {
  overflow: hidden;
  color: var(--graphite);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-process-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.part-process-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.part-process-card small {
  color: var(--muted);
}

.table-wrap {
  margin: var(--s-4) calc(var(--s-4) * -1) calc(var(--s-4) * -1);
  overflow: auto;
  border-top: 1px solid var(--line);
}

.part-history-search-form {
  display: grid;
  grid-template-columns: minmax(240px, 520px) auto;
  align-items: end;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.part-history-list-actions {
  display: flex;
  align-items: end;
  gap: var(--s-3);
}

.part-history-list-actions .field-group {
  min-width: 240px;
}

.part-history-list-actions .badge {
  margin-bottom: 10px;
}

.part-history-empty {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-4) calc(var(--s-4) * -1) calc(var(--s-4) * -1);
  padding: var(--s-8) var(--s-4);
  border-top: 1px solid var(--line);
  text-align: center;
}

.part-history-empty p {
  color: var(--muted);
}

[data-part-history-table] {
  min-width: 1780px;
}

[data-part-history-table] th,
[data-part-history-table] .table-sort {
  white-space: nowrap;
}

tr[data-row-href] {
  cursor: pointer;
  transition: background-color 120ms ease;
}

tr[data-row-href]:hover > td,
tr[data-row-href]:focus-visible > td {
  background: #f3f7ff;
}

tr[data-row-href]:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: -2px;
}

.part-history-ship-to {
  min-width: 300px;
  max-width: 420px;
  white-space: normal;
}

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

th,
td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 16px;
  background: var(--surface-soft);
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.table-sort:hover,
.table-sort:focus-visible {
  color: var(--blue);
}

.table-sort span {
  min-width: 10px;
  color: var(--muted);
  font-size: 11px;
}

.table-sort[data-sort-direction] span {
  color: var(--blue);
}

tr:last-child td {
  border-bottom: 0;
}

.is-active-row td {
  background: var(--surface-soft);
}

@media (max-width: 900px) {
  .topbar,
  .page-head {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .tenant-switcher select {
    width: 100%;
  }

  .tenant-switcher label {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .profile-button {
    grid-template-columns: 32px minmax(0, 1fr);
    max-width: none;
    width: 100%;
  }

  .profile-appearance {
    grid-template-columns: 1fr;
  }

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

  .tenant-edit-form > .tenant-profile-section,
  .tenant-edit-form > .tenant-edit-options {
    grid-column: 1;
    grid-row: auto;
  }

  .profile-avatar-preview-upload {
    margin-top: 0;
  }

  .profile-side-stack {
    position: static;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    grid-template-columns: none;
    gap: var(--s-2);
    max-height: none;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: var(--s-3) var(--s-4);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav-section {
    display: none;
  }

  .dashboard-grid,
  .admin-card-grid,
  .documentation-summary,
  .documentation-grid,
  .documentation-grid-compact,
  .documentation-two-column,
  .documentation-timeline,
  .document-summary-grid,
  .parts-layout,
  .document-filter-bar,
  .parts-filter-bar {
    grid-template-columns: 1fr;
  }

  .documentation-head,
  .document-library-head,
  .document-bulk-actions,
  .admin-filter-bar,
  .parts-list-panel > .panel-head,
  .part-selection-bar,
  .document-folder-head,
  .document-folder-create-form,
  .document-folder-list,
  .document-type-title {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .part-row,
  .part-row-meta {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    justify-items: start;
    white-space: normal;
  }

  .part-detail-grid,
  .record-value-grid {
    grid-template-columns: 1fr;
  }

  .split-grid,
  .po-validation-shell,
  .form-builder-shell,
  .form-row,
  .alias-edit-grid,
  .form-builder-grid,
  .form-field-grid,
  .rule-form-grid,
  .rule-edit-grid,
  .matrix-upload-grid,
  .matrix-list-grid,
  .matrix-row-grid {
    grid-template-columns: 1fr;
  }

  .split-grid > .panel:first-child {
    position: static;
    max-height: none;
    overflow: hidden;
  }

  .builder-stage-head,
  .form-preview-title {
    grid-template-columns: 1fr;
  }

  .form-preview-surface {
    padding: var(--s-4);
  }

  .builder-fullscreen-body {
    overflow: auto;
  }

  .builder-fullscreen-workspace,
  .form-builder-shell.is-fullscreen {
    height: auto;
    overflow: visible;
  }

  .workspace {
    padding: var(--s-4);
  }

  .po-upload-rail {
    position: static;
  }

  .po-rail-fields,
  .po-upload-actions,
  .po-queue-head,
  .po-export-history-head {
    grid-template-columns: 1fr;
  }

  .po-tab-list {
    grid-auto-columns: max-content;
  }
}
.po-review-po-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.po-queue-table tr.is-duplicate-row > td {
  background: var(--amber-soft);
}

.po-queue-table tr.is-dynamics-conflict-row > td {
  background: #fff0f0;
  border-top-color: #ef9a9a;
  border-bottom-color: #ef9a9a;
}

.po-queue-table tr.is-dynamics-conflict-row > td:first-child {
  box-shadow: inset 4px 0 0 #c62828;
}

.po-review-po-field .po-review-input,
.po-review-po-field .po-review-text {
  min-width: 0;
  flex: 1 1 auto;
}

.po-document-icon-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--blue);
  padding: 5px 7px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.po-document-icon-button:hover,
.po-document-icon-button:focus-visible {
  border-color: var(--blue);
  background: var(--surface-soft);
}

.dynamics-item-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.dynamics-item-steps span {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.dynamics-item-steps strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-soft);
}

.dynamics-item-steps .is-active {
  color: var(--blue);
  border-color: var(--blue);
}

.dynamics-item-steps .is-active strong {
  color: white;
  background: var(--blue);
}

.dynamics-item-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, .85fr);
  gap: var(--s-4);
  align-items: start;
}

.dynamics-item-form-section {
  display: grid;
  grid-template-columns: minmax(180px, .45fr) minmax(0, 1.55fr);
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
}

.dynamics-item-form-section h3,
.dynamics-item-checklist h3 {
  margin: 0 0 var(--s-1);
}

.dynamics-item-form-section p {
  margin: 0;
}

.dynamics-item-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}

.dynamics-item-field-grid em {
  color: var(--blue);
  font-size: 10px;
  font-style: normal;
  text-transform: uppercase;
}

.dynamics-item-source {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--s-3);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}

.dynamics-item-source .meta-label {
  grid-column: 1 / -1;
}

.dynamics-item-source small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.po-create-part-link {
  display: grid;
  width: max-content;
  min-height: 30px;
  margin-top: var(--s-2);
  padding: 4px 10px;
  border-color: color-mix(in srgb, var(--blue) 30%, var(--line));
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
  color: var(--blue-dark);
  text-decoration: none;
  white-space: nowrap;
}

.po-create-part-link:hover {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
}

.dynamics-customer-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--r-md);
  background: var(--green-soft);
}

.dynamics-customer-context.has-error {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.dynamics-customer-context > div {
  display: grid;
  align-content: start;
  gap: 2px;
}

.dynamics-customer-context small,
.dynamics-customer-context p {
  color: var(--muted);
}

.dynamics-tier-editor {
  min-width: 0;
}

.dynamics-tier-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.dynamics-tier-table th,
.dynamics-tier-table td {
  padding: var(--s-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.dynamics-tier-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.dynamics-tier-table .field {
  min-width: 110px;
}

.dynamics-tier-editor > .button {
  margin-top: var(--s-3);
}

.dynamics-customer-context p {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: var(--s-2);
  border-top: 1px solid var(--line);
}

.dynamics-payload-panel {
  position: sticky;
  top: var(--s-4);
}

.dynamics-payload-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}

.dynamics-payload-panel pre {
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: #101828;
  color: #d1e9ff;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.dynamics-item-checklist {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .dynamics-item-layout,
  .dynamics-item-form-section {
    grid-template-columns: 1fr;
  }

  .dynamics-payload-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .dynamics-item-steps,
  .dynamics-item-field-grid,
  .dynamics-customer-context {
    grid-template-columns: 1fr;
  }
}

/* Active part notes remain visible beside the part across order stages. */
.po-part-note-indicators { display: inline-flex; flex-wrap: wrap; gap: .3rem; margin-left: .4rem; vertical-align: middle; }
.po-part-note-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .2rem; box-sizing: border-box; border: 0; border-radius: 999px; background: #285bea; color: #fff; font-size: .65rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.po-part-note-badge.is-alert { background: #bd2920; color: #fff; }
.po-part-note-badge[hidden] { display: none; }

.cdx-part-notes-dialog { width: min(760px, calc(100vw - 2rem)); max-height: 85vh; padding: 1.25rem; border: 1px solid var(--line); border-radius: .75rem; color: var(--text); background: var(--surface); }
.cdx-part-notes-dialog::backdrop { background: rgb(15 23 42 / 45%); }
.cdx-part-notes-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.cdx-part-notes-dialog h2 { margin: 0; font-size: 1.1rem; }
.cdx-part-notes-dialog [data-global-part-notes-body] { display: grid; gap: .75rem; }
.cdx-part-notes-dialog small { display: block; margin-top: .5rem; color: var(--muted); }
button.po-part-note-badge { cursor: pointer; font-family: inherit; }
button.po-part-note-badge:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Keep part labels and note counts on one centered line. */
.po-part-history-link { display: inline-flex; align-items: center; gap: .45rem; vertical-align: middle; white-space: nowrap; }
.po-part-note-indicators { align-items: center; flex-wrap: nowrap; gap: .25rem; line-height: 1; }
.po-part-history-link > .po-part-note-indicators { margin-left: 0; }
.po-part-note-badge { flex: 0 0 auto; font-family: inherit; text-align: center; vertical-align: middle; }
td[data-part-note-host] > a, td[data-part-note-host] > strong { vertical-align: middle; }
.cdx-part-note-preview { position: fixed; z-index: 10000; width: max-content; max-width: min(360px, calc(100vw - 16px)); max-height: min(360px, calc(100vh - 16px)); overflow-y: auto; box-sizing: border-box; padding: .8rem 1rem; border: 1px solid #d4dce8; border-radius: .6rem; background: #fff; color: #172338; box-shadow: 0 8px 28px rgb(15 23 42 / 18%); font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; }
.cdx-part-note-preview[hidden] { display: none; }
.cdx-part-note-preview strong { display: block; font-size: .75rem; color: #51637c; }
.cdx-part-note-preview p { margin: .5rem 0 0; white-space: pre-wrap; }
.po-part-note-badge:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.po-review-comments-cell { min-width: 150px; max-width: 240px; }
.po-review-comments-cell small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .35rem; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.po-review-comments-cell small:empty { display: none; }
.po-order-review-dialog { width: min(780px, calc(100vw - 2rem)); max-height: 85vh; box-sizing: border-box; overflow-y: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); color: var(--text); }
.po-order-review-dialog::backdrop { background: rgb(15 23 42 / 45%); }
.po-order-review-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.po-order-review-dialog h2 { margin: .25rem 0; }
.po-order-review-dialog form { margin-bottom: 1rem; }
.po-order-review-dialog form[hidden] { display: none; }
.po-order-review-dialog textarea { width: 100%; box-sizing: border-box; }
.po-order-review-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .6rem; }
.po-order-review-comment { padding: .9rem; margin-top: .75rem; border: 1px solid var(--line); border-radius: .6rem; }
.po-order-review-comment small { color: var(--muted); }
.po-order-review-comment p { white-space: pre-wrap; overflow-wrap: anywhere; margin: .5rem 0; }

/* Operational dashboard */
.dashboard-range { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: end; }
.dashboard-range label { display: grid; gap: var(--s-2); }
.dashboard-summary { margin-top: var(--s-4); }
.dashboard-queues { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.dashboard-queue { color: var(--ink); text-decoration: none; }
.dashboard-queue:hover, .dashboard-queue:focus-visible { border-color: var(--line-strong); background: var(--surface-soft, var(--surface)); }
@media (max-width: 1000px) { .dashboard-queues { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .dashboard-queues { grid-template-columns: 1fr; } .dashboard-range label { width: 100%; } }
