
html:has(body:not(.home) .view[data-view="factory"].on) { --z: 1; }
body:has(.view[data-view="factory"].on):not(.home) {
  --bg: #101113;
  --side: #141517;
  --panel: #1b1d20;
  --panel2: #17191c;
  --line: #292c30;
  --line2: #363a40;
  --text: #eceef1;
  --muted: #a1a7af;
  --faint: #858d96;
  font-size: var(--ds-size-16);
  line-height: var(--ds-leading-body);
}
body:has(.view[data-view="factory"].on) .content {
  scrollbar-color: #51555e var(--bg);
  scrollbar-width: thin;
}
#mc[hidden] { display: none; }
#factory-live {
  --faint: #858d96;
  font-size: var(--ds-size-16);
  line-height: var(--ds-leading-body);
  color: var(--text);
}
#factory-live [hidden] { display: none !important; }

#factory-live button:where(:not(.ds-tabs__tab, .ds-button, .ds-icon-button)), #factory-live input {
  font: inherit;
  color: inherit;
}
#factory-live button:where(:not(.ds-button)) {
  border: 0;
  cursor: pointer;
  background: transparent;
}
#factory-live button:disabled { cursor: default; }
#factory-live a:where(:not(.ds-tabs__tab, .ds-button)) {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
}
#factory-live a.ds-button {
  text-decoration: none;
}
#factory-live a.ds-panel__row:focus-visible {   
  outline: none;
  background: var(--ds-hover);
}
#factory-live :is(a, button, input, summary):where(:not(.ds-tabs__tab, .ds-button, .ds-icon-button,
  .ds-panel__row)):focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
}
#factory-live ::selection {
  background: #565f9766;
  color: #fff;
}
#factory-live input { caret-color: var(--acc); }
.fx-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.fx-wrap {
  container: fx-page / inline-size;   
  max-width: 1450px;
  margin: auto;
  padding: 28px 28px 24px;
}
.fx-heading, .fx-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.fx-heading { margin-bottom: 16px; }
.fx-heading h2 {
  font-size: var(--ds-size-24);
  font-weight: var(--ds-weight-semibold);
  line-height: var(--ds-leading-title);
  letter-spacing: var(--ds-tracking-tight);
}
.fx-heading p {
  color: var(--muted);
  margin-top: 4px;
}

#fx-scope-note {
  color: var(--ds-text);
}
.fx-project {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  margin-top: var(--ds-space-2);
  color: var(--ds-text);
  font-size: var(--ds-size-14);
  line-height: var(--ds-leading-body);
}
.fx-project .home-avatar {
  width: var(--ds-avatar-sm-size);
  height: var(--ds-avatar-sm-size);
  border-radius: var(--ds-avatar-sm-radius);
  font-size: var(--ds-size-11);
  letter-spacing: var(--ds-tracking-normal);
}
.fx-overview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ds-space-2);
}
.fx-overview-actions .ds-alert {
  padding-inline: var(--ds-space-3);
  white-space: nowrap;
}

.fx-health {
  position: relative;
}
.fx-health summary {
  cursor: pointer;
  list-style: none;
}
.fx-health summary::-webkit-details-marker { display: none; }

#fx-health-detail {
  position: absolute;
  top: calc(100% + var(--ds-space-2));
  right: 0;
  z-index: 5;
  width: 340px;
  max-width: calc(100vw - 32px);
  padding: var(--ds-space-3);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  box-shadow: var(--ds-border) 0 0 0 1px, var(--ds-shadow-overlay);
  color: var(--ds-text-muted);
  font-size: var(--ds-size-14);
  line-height: var(--ds-leading-body);
  text-wrap: pretty;
  user-select: text;
}
#fx-health-detail p {   
  margin: 0;
  color: inherit;
}
#fx-health-detail p + p { margin-top: var(--ds-space-2); }
#fx-health-detail strong {
  color: var(--ds-text-strong);
  font-weight: var(--ds-weight-medium);
}


#fx-overview {
  container: fx-overview / inline-size;
}
.fx-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}
@container fx-overview (max-width: 1199px) {
  .fx-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fx-summary > .fx-kpi:nth-child(3) {
    box-shadow: inset 0 1px 0 var(--ds-border);
  }
  .fx-summary > .fx-kpi:nth-child(4) {
    box-shadow: inset 1px 0 0 var(--ds-border), inset 0 1px 0 var(--ds-border);
  }
}
#factory-live .fx-kpi {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label chart" "value chart" "note chart";   
  align-items: end;
  gap: var(--ds-space-1) var(--ds-space-4);
  padding: var(--ds-space-4-5);   
  border: 0;
  background: transparent;
  color: var(--ds-text);
  text-align: left;
  text-decoration: none;   
  transition: background-color var(--ds-duration-hover) ease;
}
#factory-live :is(a, button).fx-kpi {   
  cursor: pointer;
}
.fx-kpi + .fx-kpi {
  box-shadow: inset 1px 0 0 var(--ds-border);
}
.fx-kpi[data-tone="all"] { --fx-tone: var(--ds-text-strong); }
.fx-kpi[data-tone="running"] { --fx-tone: var(--ds-info); }
.fx-kpi[data-tone="needs"] { --fx-tone: var(--ds-warning); }
.fx-kpi[data-tone="done"] { --fx-tone: var(--ds-success); }
#factory-live .fx-kpi:focus-visible {
  outline: none;
  background: var(--ds-hover);
}
@media (hover: hover) and (pointer: fine) {
  #factory-live :is(a, button).fx-kpi:hover {
    background: var(--ds-hover);
  }
}
.fx-kpi-label {
  grid-area: label;
  display: flex;
  align-items: center;
  gap: var(--ds-space-1-5);
  margin-bottom: calc(var(--ds-space-3) - var(--ds-space-1));   
  font-size: var(--ds-size-13);
  line-height: var(--ds-leading-body);
  color: var(--ds-text-muted);
}
.fx-kpi-label::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fx-tone);
}
.fx-kpi > b {
  grid-area: value;
  font-size: var(--ds-size-28);
  line-height: var(--ds-leading-display);
  font-weight: var(--ds-weight-semibold);
  letter-spacing: var(--ds-tracking-tight);
  color: var(--ds-text-strong);
}
.fx-kpi-note {
  grid-area: note;
  min-height: calc(var(--ds-size-13) * var(--ds-leading-body));
  font-size: var(--ds-size-13);
  line-height: var(--ds-leading-body);
  color: var(--ds-text-faint);
}

#fx-summary .fx-kpi-note {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.fx-kpi-chart {
  grid-area: chart;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;   
  width: 148px;
  min-height: 44px;
}
.fx-trend {
  display: flex;
  flex: 1;
  align-items: flex-end;
  gap: 3px;
}
.fx-trend > i {
  flex: 1;
  height: var(--h);
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--ds-border-strong);
}
.fx-trend > i.is-now {
  background: var(--fx-tone);
}
.fx-meter {
  display: flex;
  gap: 2px;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--ds-radius-xs);
}
.fx-meter > i {
  flex: var(--n) 1 0;
  min-width: 4px;
  background: color-mix(in srgb, var(--ds-warning) var(--step), transparent);
}
.fx-meter-key {
  display: flex;
  justify-content: space-between;
  gap: var(--ds-space-2);
  margin-top: var(--ds-space-2);
  font-size: var(--ds-size-11);
  line-height: var(--ds-leading-compact);
  color: var(--ds-text-faint);
  white-space: nowrap;
}
.fx-meter-key > span {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-1);
}
.fx-meter-key > span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ds-warning) var(--step), transparent);
}

.fx-shares > i, .fx-shares + .fx-meter-key > span::before {
  background: var(--fx-group-tone);
}
.fx-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  margin: 24px 0;
  align-items: start;
}
.fx-work {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.fx-side { min-width: 0; }
.fx-insights {
  display: grid;
  gap: 24px;
  min-width: 0;
  align-items: start;
}
.fx-card {
  --fx-card-pad: var(--ds-space-4-5);   
  background: var(--panel);
  border: 1px solid #2d3137;
  border-radius: 16px;
  padding: var(--fx-card-pad);
  min-width: 0;
}
.fx-card-heading {
  min-height: 34px;
  gap: 12px;
  margin-bottom: 16px;
}
.fx-card-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--ds-size-18);
  font-weight: var(--ds-weight-medium);
  line-height: var(--ds-leading-heading);
  letter-spacing: var(--ds-tracking-normal);
}
.fx-card-heading > span {
  color: var(--faint);
  font-size: var(--ds-size-14);
  line-height: var(--ds-leading-body);
}

.fx-widget-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: none;
  background: color-mix(in srgb, currentColor 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 5%, transparent);
}
.fx-orange-icon {
  color: #efac81;
}
.fx-neutral-icon {
  color: #c4cbd3;
}
.fx-green-icon {
  color: #70c99c;
}
.fx-tickets {
  background: #17191b;
  border-color: #2b2e33;
  padding: var(--ds-space-4-5);
  container-type: inline-size;
  scroll-margin-top: var(--ds-space-5);   
}
.fx-tickets .fx-card-heading {
  min-height: 40px;
  margin: 0;
}
.fx-tickets h2, .fx-delivery h2 { gap: 12px; }
.fx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #33373e;
  border-radius: 6px;
  padding: 8px 12px;
  background: #1c1f23;
  color: var(--faint);
  width: 200px;
  min-height: 40px;
}
.fx-search .fx-icon {
  width: 16px;
  height: 16px;
}
#factory-live #fx-search {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  font-size: var(--ds-size-14);
  line-height: var(--ds-leading-body);
}
#fx-search::placeholder {
  color: var(--faint);
  opacity: 1;
}
.fx-search kbd { font-family: var(--ds-font); font-size: var(--ds-size-14); font-weight: var(--ds-weight-regular); line-height: var(--ds-leading-body); font-variant-numeric: var(--ds-numeric); }
.fx-search:focus-within { border-color: var(--acc); }

.fx-toolbar.ds-tabs-row {
  justify-content: space-between;
  margin: var(--ds-space-3) calc(-1 * var(--fx-card-pad)) 0;
  padding-inline: var(--fx-card-pad);
}
.fx-toolbar > .fx-filters {
  flex: 0 1 auto;
  min-width: 0;
  mask-image: linear-gradient(to right, #000 calc(100% - var(--fx-filters-fade)), transparent);
  animation: fx-filters-fade linear both;
  animation-timeline: scroll(self inline);   
}
@property --fx-filters-fade {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@keyframes fx-filters-fade {
  from { --fx-filters-fade: var(--ds-space-6); }
  to { --fx-filters-fade: 0px; }
}
.fx-toolbar > .fx-search {
  flex: none;
  width: 200px;
}
@container (max-width: 560px) {
  .fx-toolbar.ds-tabs-row {
    flex-wrap: wrap;
  }
  .fx-toolbar > .fx-filters.ds-tabs--line {
    flex: 1 1 100%;
    max-width: none;
    margin-inline: calc(-1 * var(--fx-card-pad));
    padding-inline: var(--fx-card-pad);
  }
  .fx-toolbar > .fx-search {
    flex: 1 1 100%;
  }
}
.fx-filters span {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.fx-filters button[aria-pressed="true"] span { color: var(--acc); }

#fx-ticket-list {
  margin-top: var(--fx-card-pad);
}
.fx-group {
  overflow: hidden;   
  border-radius: var(--ds-radius-lg);
  background: var(--ds-tab-track);
  box-shadow: inset 0 0 0 1px var(--ds-border);   
}
.fx-group + .fx-group {
  margin-top: var(--fx-card-pad);
}
.fx-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-4);
  min-height: 56px;
  padding: var(--ds-space-3) var(--fx-card-pad);
  border-bottom: 1px solid var(--ds-border);
}
.fx-group[data-folded] .fx-group-head {
  border-bottom: 0;
}

.fx-needs { --fx-group-tone: var(--ds-warning); }   
.fx-running { --fx-group-tone: #4ea7fc; }
.fx-waiting { --fx-group-tone: var(--ds-violet); }
.fx-queued { --fx-group-tone: var(--muted); }
.fx-done { --fx-group-tone: #4cb782; }
.fx-group .fx-group-head h3 {   
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  min-width: 0;
  font-size: var(--ds-size-16);
  font-weight: var(--ds-weight-medium);
  line-height: var(--ds-leading-body);
  color: var(--ds-text-strong);
}
.fx-group-head h3 > .ds-count {
  font-weight: var(--ds-weight-regular);
}
.fx-group-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fx-group-tone);
}

#factory-live .fx-fold {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: var(--ds-space-1);
  border: 0;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-control-fill);
  box-shadow: var(--ds-shadow-card);
  color: var(--ds-text-muted);
  cursor: pointer;
  transition: box-shadow var(--ds-duration-hover) ease, color var(--ds-duration-hover) ease;
}
#factory-live .fx-fold:focus-visible {
  outline: none;
  box-shadow: var(--ds-border-strong) 0 0 0 1px, var(--ds-shadow-button);
  color: var(--ds-text-strong);
}
@media (hover: hover) and (pointer: fine) {
  #factory-live .fx-fold:hover {
    box-shadow: var(--ds-border-strong) 0 0 0 1px, var(--ds-shadow-button);
    color: var(--ds-text-strong);
  }
}
#factory-live .fx-fold .fx-icon {
  width: var(--ds-icon-xs);
  height: var(--ds-icon-xs);
  transition: rotate var(--ds-duration-popover) var(--ds-ease-out);
}
.fx-group[data-folded] .fx-fold .fx-icon {
  rotate: -90deg;
}
.fx-group-actions {
  display: flex;
  align-items: center;
}

.fx-ticket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px 56px auto;
  column-gap: var(--ds-space-6);
  align-items: center;
  width: 100%;
  min-height: 88px;
  padding: var(--ds-space-5) var(--fx-card-pad);
  border-radius: 0;
  box-shadow: inset 1px 0 0 var(--fx-group-tone);
}

#factory-live .fx-ticket {
  border-bottom: 1px solid var(--ds-border);
}
#factory-live .fx-ticket:last-child {
  border-bottom: 0;
}
.fx-chevron { justify-self: end; }
.fx-ticket:hover { background: var(--ds-hover); }   
.fx-ticket-copy { min-width: 0; }
.fx-ticket-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--ds-text);
  font-size: var(--ds-size-16);
  line-height: var(--ds-leading-body);
  font-weight: var(--ds-weight-medium);
  overflow-wrap: anywhere;
}

.fx-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-1-5);
  margin-top: var(--ds-space-2);
}
.fx-ticket-meta > .ds-count {   
  flex: 0 1 auto;
  max-width: 100%;
}

.ds-count--lg .fx-provider {
  gap: var(--ds-space-1);
}
.fx-age b {   
  font-weight: inherit;
  color: var(--ds-text-muted);
}

.fx-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  margin-top: 8px;
  font-size: var(--ds-size-14);
  line-height: var(--ds-leading-body);
  color: var(--faint);
}
.fx-cost { font-variant-numeric: tabular-nums; }
.fx-provider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fx-provider svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.ds-count.ds-count--lg svg {   
  width: var(--ds-icon-xs);
  height: var(--ds-icon-xs);
}

.fx-ticket-state {
  display: grid;
  justify-items: start;
  gap: var(--ds-space-1-5);
  font-size: var(--ds-size-14);
  line-height: var(--ds-leading-body);
  overflow-wrap: anywhere;
}
.fx-ticket-state > :last-child:not(.fx-step) { color: var(--faint); }
.fx-ticket-state > .fx-step {   
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  justify-content: flex-start;
  text-align: left;
  overflow-wrap: normal;
}

:root {
  --fx-violet-soft: color-mix(in srgb, var(--ds-violet) 14%, transparent);
}
.ds-count.fx-tone-waiting {
  background: var(--fx-violet-soft);
  box-shadow: inset 0 0 0 0.5px var(--fx-violet-soft);
  color: var(--ds-violet);
}
.fx-cost {
  color: var(--ds-text-muted);
  text-align: right;
  font-family: var(--ds-font); font-size: var(--ds-size-16); font-weight: var(--ds-weight-regular); line-height: var(--ds-leading-body); font-variant-numeric: var(--ds-numeric);
}

.fx-motion {
  display: flex;
  align-self: center;
  padding: 0;
}
.fx-matrix {
  --fx-matrix-gap: 2px;
  --fx-matrix-tile: calc((var(--ds-badge-height) - 2 * var(--fx-matrix-gap)) / 3);
  display: grid;
  grid-template-columns: repeat(8, var(--fx-matrix-tile));
  grid-template-rows: repeat(3, var(--fx-matrix-tile));
  gap: var(--fx-matrix-gap);
  pointer-events: none;
}
.fx-matrix i {
  width: var(--fx-matrix-tile);
  height: var(--fx-matrix-tile);
  border-radius: 1px;
  background: var(--ds-info-soft);
  animation: fx-working 2.4s ease-in-out infinite;
  animation-delay: calc(var(--tile) * .12s - 2.4s);
}
@keyframes fx-working {
  0%, 50%, 100% { background-color: var(--ds-info-soft); }
  20% { background-color: var(--ds-info); }
}
@media (prefers-reduced-motion: reduce) {
  .fx-matrix i { animation: none; }
}
