/* The simulator's shared controls: one header, one set of buttons, one field, one menu, one way a sheet or dialog opens.
   Every simulator page (the store list, the workbench and the hosted sign-in) loads this last, so a
   control looks and behaves the same wherever it appears. Page stylesheets keep only their own layout. */

:root {
  /* The simulator's field and row heights; a touch screen gets the 44 px target. Buttons, motion, focus and the pressed
     state come from the shared tokens. */
  --control-h: var(--control-h-field);
  --control-h-row: 28px;
  /* The page's side margin, shared by the header and the page under it so their edges line up. */
  --gutter: 24px;
}
@media (pointer: coarse) {
  :root {
    --control-h: var(--touch-target);
    --control-h-row: 36px;
  }
}
@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }
}

/* ---- Weight (UI refresh, step 6): nothing on a simulator page is heavier than 500; hierarchy is size and grey. The browser's own
   bold (headings, strong, table heads) comes down to 500 here; the shared parts already set it (the brand mark keeps its own). ---- */
:where(h1, h2, h3, h4, h5, h6, strong, b, th, legend, summary, dt) {
  font-weight: 500;
}
:is(.px-btn, .px-btn-outline, .overview-card, .connection-tile, summary) {
  transition:
    background-color var(--motion) var(--ease),
    border-color var(--motion) var(--ease),
    color var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}
:is(.px-btn, .px-btn-outline):active:not(:disabled) {
  transform: translateY(0.5px);
}

/* The current choice of a switch stays readable even though choosing it again does nothing. */
:is(.px-btn, .px-btn-outline)[aria-pressed="true"]:disabled {
  opacity: 1;
  cursor: default;
}

/* ---- Fields: one border, one hover, one focus (the border turns brand with a soft ring, no second outline). ---- */
:is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea) {
  transition:
    border-color var(--motion) var(--ease),
    box-shadow var(--motion) var(--ease);
}
:is(
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]),
    select,
    textarea
  ):hover:not(:disabled, :focus) {
  border-color: var(--fg-deco);
}
:is(
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]),
  select,
  textarea
):focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
:is(input:not([type="checkbox"], [type="radio"]), select, textarea):disabled,
:is(input, textarea)[readonly] {
  background-color: var(--surface-2);
  color: var(--fg-muted);
}
::placeholder {
  color: var(--fg-faint);
  opacity: 1;
}
input[type="number"] {
  font-variant-numeric: tabular-nums;
}

/* ---- One keyboard focus ring for everything else that can be focused. ---- */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

/* ---- Numbers: tabular figures wherever a value updates or lines up in a column, so live numbers never jiggle. ---- */
:is(td, th).numeric,
.store-metrics strong,
#clock,
.connection-progress dd,
.equipment-air,
.request-story-time {
  font-variant-numeric: tabular-nums;
}

/* ---- Sortable headers: a faint mark on every sortable column, an arrow on the sorted one. ---- */
.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-weight: 500;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
th.numeric .sort-header {
  flex-direction: row-reverse;
}
.sort-header::after {
  content: var(--sort-glyph-idle);
  display: inline-block;
  width: 0.9em;
  line-height: 1;
  text-align: center;
  color: var(--fg-deco);
}
.sort-header:hover {
  color: var(--fg);
}
th[aria-sort="ascending"] .sort-header,
th[aria-sort="descending"] .sort-header {
  color: var(--fg);
}
th[aria-sort="ascending"] .sort-header::after {
  content: var(--sort-glyph-asc);
  color: var(--fg-muted);
  opacity: 1;
}
th[aria-sort="descending"] .sort-header::after {
  content: var(--sort-glyph-desc);
  color: var(--fg-muted);
  opacity: 1;
}

/* ---- Disclosures: every <details> that shows or hides a section looks like the shared Disclosure: the ▸/▾ glyph, a
   full-ink label at 500 and a hover wash. Menus (data-menu, the row ⋮) and the "add" form panels are not disclosures. ---- */
details:not([data-menu], .row-menu, .form-panel) > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  margin-inline: calc(-1 * var(--space-2));
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
}
details:not([data-menu], .row-menu, .form-panel) > summary::-webkit-details-marker {
  display: none;
}
details:not([data-menu], .row-menu, .form-panel) > summary::before {
  content: "▸";
  flex: none;
  width: 16px;
  color: var(--fg);
  font-size: var(--disclosure-glyph-size);
  text-align: center;
}
details[open]:not([data-menu], .row-menu, .form-panel) > summary::before {
  content: "▾";
}
details:not([data-menu], .row-menu, .form-panel) > summary:hover {
  background: var(--surface-2);
}
@media (pointer: coarse) {
  details:not([data-menu], .row-menu, .form-panel) > summary {
    min-height: var(--touch-target);
  }
}

/* ---- Sheets and dialogs open with one short fade and lift; their backdrop fades in. ---- */
dialog[open] {
  animation: sim-rise var(--motion) var(--ease);
}
dialog[open]::backdrop {
  animation: sim-fade var(--motion) var(--ease);
}
details.form-panel[open] {
  animation: sim-fade var(--motion) var(--ease);
}
@keyframes sim-rise {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.995);
  }
}
@keyframes sim-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
@keyframes sim-fade {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  ::backdrop {
    /* 0s, not a moment: what fades in would wait unseen for a slow page to start it, and every element without a transition
       would have one on everything it changes. */
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ---- The header: one height, one brand mark in one place and one right edge on every page (the store page's bar, store-page.css),
   so nothing moves from page to page, and quiet items of one height. ---- */
:is(.topbar, body > header) {
  box-sizing: border-box;
  min-height: 48px;
  padding-block: 6px;
  padding-inline: 12px 16px;
  background: var(--bg);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--divider);
}
/* In dark the bar is the page's black with no rule under it, as on the workbench and the console. */
:root[data-theme="dark"] :is(.topbar, body > header) {
  box-shadow: none;
}
:is(.topbar, body > header) .px-brand {
  color: var(--fg);
  text-decoration: none;
}
:is(.topbar, body > header) .toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
}
:is(.topbar, body > header) .toolbar > .px-btn,
:is(.topbar, body > header) .toolbar > details > summary {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--fg-muted);
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: none;
}
:is(.topbar, body > header) .toolbar > .px-btn:hover,
:is(.topbar, body > header) .toolbar > details > summary:hover {
  background: var(--surface-2);
  color: var(--fg);
}

/* A form control in a tool window is as wide as what it holds, never the width of the screen. */
#tool-sheet
  .tool-sheet-content
  :is(select, input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"])):not(
    .sheet-table-filter
  ) {
  max-width: 100%;
}

/* A link that opens a new tab says so with a small mark after its name. */
.new-tab {
  color: var(--fg-faint);
  font-size: var(--text-sm);
}

/* ---- A status reads as a dot and a word, the same everywhere (a lane, an instrument, a saved store, the LumicIQ
   controller): grey when idle or off, green when on, amber when it needs attention. No pills or outlined badges. ---- */
:is(.model-badge, .run-card .status) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}
:is(.model-badge, .run-card .status)::before {
  content: "";
  flex: none;
  width: var(--status-dot);
  height: var(--status-dot);
  border-radius: 50%;
  background: var(--fg-faint);
}
:is(.model-badge[data-active="true"], .run-card .status.open) {
  border: 0;
  background: none;
  color: var(--brand-text);
}
:is(.model-badge[data-active="true"], .run-card .status.open)::before {
  background: var(--success);
}
.run-card .status.failed::before {
  background: var(--warning);
}

/* ---- A row that scrolls sideways (the 3D view's settings, a phone's screen list and floor tools) fades at the edge that has
   more, so it is clear there is more to scroll to. Where scroll-linked animation is not supported the row simply scrolls. ---- */
@property --strip-fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --strip-fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@supports (animation-timeline: scroll()) {
  .tool-sheet-index,
  .ask-choices,
  #thermal-horizon {
    mask-image: linear-gradient(
      to right,
      transparent 0,
      black var(--strip-fade-start),
      black calc(100% - var(--strip-fade-end)),
      transparent 100%
    );
    animation: sim-strip-fade linear both;
    animation-timeline: scroll(self inline);
  }
  /* The fade follows the scroll, not time, so reduced motion keeps it: at 0 s it jumped to its end and faded the first tab of a
     strip still at its start (reduced motion's rule above). */
  @media (prefers-reduced-motion: reduce) {
    .tool-sheet-index,
    .ask-choices,
    #thermal-horizon {
      animation-duration: auto !important;
    }
  }
}
@keyframes sim-strip-fade {
  from {
    --strip-fade-start: 0px;
    --strip-fade-end: 32px;
  }
  1% {
    --strip-fade-start: 16px;
  }
  99% {
    --strip-fade-end: 16px;
  }
  to {
    --strip-fade-start: 32px;
    --strip-fade-end: 0px;
  }
}

/* A dialog's title takes the focus when it opens (so the first Tab reaches its first control) without drawing a ring. */
:is(h1, h2, h3)[tabindex="-1"]:focus {
  outline: none;
}

/* The playback row's plain buttons (Pause, +10 seconds) are outlined like every other button on the page. */
.transport .px-btn:not(.px-btn-primary) {
  border: 1px solid var(--line-hi);
  background: var(--surface);
  color: var(--fg);
}
.transport .px-btn:not(.px-btn-primary):hover:not(:disabled) {
  border-color: var(--fg-deco);
  background: var(--surface-2);
}

/* Why the main action of a common task cannot be used yet, said beside it in one quiet line. */
.why-note {
  color: var(--fg-muted);
  font-size: var(--text-md);
}

/* ═══════════════════ The rest of the simulator in the refreshed language (UI refresh, 2026-11-27) ═══════════════════
   The store view was refreshed first (store-view.css). These rules bring every other simulator screen to the same grammar,
   in one place because this sheet loads last on every page: one panel shape (the surface, a hairline, padding all round;
   never a tinted box), a figure large and light with its words small beside it, state only as a dot (red high, amber medium,
   grey low) and ink, never green, for what is on, chosen or done. */

/* ---- State as a dot: what is on, free or running is a solid ink dot; what is changing a ring; what is off a faint dot. Green
   is kept for the logo's dot and checked outcomes, and amber for what needs attention. ---- */
:is(.model-badge[data-active="true"], .run-card .status.open)::before,
.state-pill:is(.on, .free)::before {
  background: var(--fg);
}
.run-card .status.open {
  color: var(--fg);
}
.state-pill.changing::before {
  box-sizing: border-box;
  border: 1.5px solid var(--fg);
  background: none;
}
/* A fitting room in use is busy, not a problem: a muted dot, not the medium state's amber. */
.state-pill.busy::before {
  background: var(--fg-muted);
}

/* ---- Rows of like things in a tool window or dialog (lanes, the team, stock work, instruments, equipment, cameras, the day
   plan's two starts, a comparison's parts): the panel's hairline on the plain surface, the card radius, no tinted fill. ---- */
.tool-sheet .lane-card,
.tool-sheet .lane-card:last-child,
.tool-sheet-content #employees .staff-card,
.tool-sheet-content #employees .staff-card:last-child,
#tool-sheet #work .task,
#tool-sheet #work .task:last-child,
#tool-sheet .work-card,
#tool-sheet .work-card:last-child,
#tool-sheet .opening-window,
.plan-start > .sheet-block,
.sensor-group-grid .sensor-card,
.sensor-group-grid .sensor-card:first-child,
.ingest-card,
.equipment-card,
.experiment-card,
.camera-item,
.camera-sharing,
.connection-tile,
.air-strip-entry,
#panel-shoppers:has([data-screen-current][data-uses-shopper]) #shopper-picker {
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.connection-tile:hover {
  border-color: var(--line-hi);
  background: var(--surface-2);
}

/* ---- The panel beside the store ("In the store"): each card is the panel shape, its two figures large and light with their
   words under them. A figure that needs attention keeps its ink and carries the medium state's dot by its words. ---- */
.overview-group-title {
  font-size: var(--text-sm);
}
.overview-card,
.overview-card-action {
  background: var(--surface);
}
.overview-card:hover {
  background: var(--surface-2);
}
.overview-card-stack:has(> .overview-card:hover) > .overview-card-action {
  background: var(--surface-2);
}
.overview-card-title {
  font-weight: 500;
}
.overview-card[data-attention="true"] .overview-card-status::before,
.overview-line-value[data-state="warn"]::before {
  content: "";
  display: inline-block;
  width: var(--status-dot);
  height: var(--status-dot);
  margin-right: 6px;
  border-radius: 50%;
  background: var(--state-medium);
  vertical-align: 1px;
}
.overview-card[data-attention="true"] .overview-card-status,
.overview-line-value[data-state="warn"] {
  color: var(--fg);
}

/* ---- The Advanced tools' dialogs take the tool window's frame: the same width and corners, the title in a row of its own
   over a hairline, and the same outlined close. ---- */
:is(#layout-dialog, #experiments-dialog, #control-experiments-dialog) {
  width: min(1240px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
}
:is(#layout-dialog, #experiments-dialog, #control-experiments-dialog, #branches-dialog) {
  border-radius: var(--radius-xl);
}
:is(#layout-dialog, #experiments-dialog, #control-experiments-dialog, #branches-dialog) > .panel-heading:first-child {
  align-items: center;
  margin: -24px -24px 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
#branches-dialog[open] > .panel-heading:first-child {
  margin-bottom: 4px;
}
:is(#layout-title, #experiments-title, #control-experiments-title, #branches-title) {
  font-size: var(--text-lg);
}
:is(#layout-hide, #experiments-hide, #control-hide, #branches-hide) {
  box-sizing: border-box;
  width: var(--control-h);
  height: var(--control-h);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
}
@media (max-width: 600px) {
  :is(#layout-dialog, #experiments-dialog, #control-experiments-dialog, #branches-dialog) > .panel-heading:first-child {
    margin: -16px -16px 12px;
    padding: 12px 16px;
  }
}

/* ---- The plan's detail switches read like the key under the view: small, plain words, not form labels. ---- */
.plan-layers {
  gap: 4px 20px;
  padding: 0 22px;
  margin: 10px 0;
}
.plan-layers label {
  min-height: 28px;
  font-size: var(--text-md);
  font-weight: 400;
  color: var(--fg-soft);
}
.plan-layers input {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* ---- The Layout studio's draft floor: the panel on the plain surface; the selected item and the staff-only marks in ink,
   since blue and amber there meant nothing about state. ---- */
.layout-preview-panel {
  border-radius: var(--radius-lg);
  background: var(--surface);
}
#layout-preview .selected {
  stroke: var(--fg);
}
.layout-point.staffOnly {
  fill: var(--surface);
  stroke: var(--fg);
}
.layout-access-boundary {
  stroke: var(--fg-muted);
}
/* A fixture is moved by hand (SIM-07): a drag on the shape, never a page scroll; the one in hand reaches at least 44 px across
   with a target that draws nothing. Its exact position is a read-out under its fields. */
#layout-preview .layout-movable {
  touch-action: none;
  cursor: grab;
}
#layout-preview .layout-movable:active {
  cursor: grabbing;
}
/* The page's focus ring is an outline in pixels, which this drawing (in metres) scales up into a band metres wide: a fixture with
   the keyboard on it is ringed by its own outline instead, the same width at any zoom. */
#layout-preview .layout-movable:focus-visible {
  outline: none;
  stroke: var(--fg);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}
#layout-preview .layout-fixture-target {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}
/* The fixture in hand's handles: squares at its corners and edges resize it, the round one beyond its top edge turns it. Drawn in
   the page's ink with a hairline on the surface's colour, so they read on the floor and on the fixture alike; the targets draw
   nothing. */
#layout-preview .layout-handle {
  fill: var(--surface);
  stroke: var(--fg);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
#layout-preview .layout-handle-stem {
  stroke: var(--fg);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
/* Pressed by their fill alone: `all` takes a stroke too, which in this drawing is a metre wide whether it is drawn or not. */
#layout-preview .layout-handle-target {
  fill: transparent;
  stroke: none;
  pointer-events: fill;
}
#layout-preview [data-handle="turn"] {
  cursor: grab;
}
/* The turning handle stands beyond the fixture's top edge: at the store's own top wall it is drawn past the plan's margin. */
#layout-preview {
  overflow: visible;
}
.layout-position {
  grid-column: 1/-1;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* The gap between a filter box (with its count and options) and the list or table under it, on every screen. */
:root {
  --filter-gap: var(--space-3);
}

/* ---- A switch: one control that holds on or off, seen at a glance (Dennis, 2026-11-30: not a button saying "Turn on" or "Turn
   off"). The shared Switch's track and knob (web/_design tokens.css .px-switch; LumicSimulatorDom.switchButton builds one), its
   size (--switch-width, --switch-height) and its one gap from the words beside it (--switch-gap) are tokens.css's. Here only a
   setting's row: its name and its switch. ---- */
.sim-switch-row {
  display: inline-flex;
  align-items: center;
  gap: var(--switch-gap);
  min-height: 44px;
  color: var(--fg);
  font-size: var(--text-read);
  cursor: pointer;
}
/* A setting's row: its name at the left, its switch at the right end of the line. */
.sim-switch-row.sim-setting {
  display: flex;
  justify-content: space-between;
}
