/* Modular Workbench host. Palette and status colors come only from shared semantic tokens. */
.modular-workbench{--review-control:var(--control-min-h,1.9rem);margin:0;min-height:100vh;display:flex;flex-direction:column;color:var(--ink);background:var(--of-paper);font:.875rem/1.4 var(--ui-font-family)}
.modular-workbench[data-density="touch"]{--review-control:2.75rem}
.modular-workbench *,.modular-workbench *::before,.modular-workbench *::after{box-sizing:border-box}
.modular-workbench [hidden]{display:none!important}
.modular-workbench :is(button,input,select,textarea,a){font:inherit}
.modular-workbench :is(button,input,select,textarea){color:var(--ink)}
.modular-workbench button,.modular-workbench select{cursor:pointer}
.modular-workbench button{min-height:var(--review-control)}
.modular-workbench a{color:var(--link);text-underline-offset:3px}
.modular-workbench :focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.modular-workbench h1,.modular-workbench h2,.modular-workbench h3,.modular-workbench p{margin:0}
.modular-workbench h2{font-size:.8rem}
.eyebrow{color:var(--muted);font-size:.75rem;font-weight:600;letter-spacing:.045em;text-transform:uppercase}
.skip-link{position:fixed;z-index:100;top:-6rem;left:.75rem;padding:.5rem;background:var(--field-surface)}
.skip-link:focus{top:.75rem}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

.bar-context{min-width:0;overflow:hidden;padding:0 .75rem;align-self:center;text-overflow:ellipsis;white-space:nowrap;font-size:.75rem;letter-spacing:.04em;text-transform:uppercase}
.bar-end{display:flex;margin-left:auto}
.bar-link + .bar-link{border-left:var(--bar-control-divider)}

.modular-workbench>main{display:flex;flex:1 1 auto;min-height:0;flex-direction:column}
.host-note{padding:.55rem 1rem;border-bottom:1px solid var(--line);background:var(--surface-subtle);color:var(--muted);font-size:.75rem}
.workbench{position:relative;display:flex;flex:1 1 auto;min-height:18rem;flex-direction:column;gap:.5rem;padding:.5rem;background:var(--surface-subtle);container-type:inline-size}
.wb-toolbar{display:flex;flex:0 0 auto;align-items:center;flex-wrap:wrap;gap:.35rem .6rem;min-width:0}
.wb-toolbar label,.wb-floating-controls label{display:flex;align-items:center;gap:.3rem;min-width:0;color:var(--muted);font-size:.75rem}
.wb-toolbar select,.wb-floating-controls select,.wb-toolbar>button{min-height:var(--review-control);min-width:0;max-width:100%;padding:.2rem .4rem;border:1px solid var(--line);border-radius:.2rem;background:var(--field-surface);font:inherit;color:var(--ink)}
#arrangement-readout{margin-left:auto;color:var(--muted);font-size:.75rem}

.wb-stage{position:relative;flex:1 1 auto;min-width:0;min-height:15rem;overflow:hidden}
.wb-window{position:absolute;z-index:var(--wb-z,1);display:flex;left:var(--wb-x,0);top:var(--wb-y,0);width:var(--wb-width,100%);height:var(--wb-height,100%);flex-direction:column;min-width:0;min-height:0;overflow:hidden;border:1px solid var(--line);border-radius:.3rem;background:var(--surface-overlay);container-type:inline-size}
.wb-window[data-placement-mode="utility"],.wb-window[data-placement-kind="overlay"]{box-shadow:var(--bar-shadow)}
.wb-window[data-active="true"]{border-color:var(--accent);box-shadow:inset 0 2px var(--accent)}
.wb-titlebar{display:flex;align-items:center;justify-content:space-between;flex:0 0 auto;gap:.3rem;min-width:0;padding:.2rem .35rem;border-bottom:1px solid var(--line);background:var(--surface-subtle)}
.wb-titlebar h2{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wb-actions{display:flex;flex:0 0 auto;gap:.15rem}
.wb-actions button{min-width:var(--review-control);padding:.1rem .3rem;border:1px solid transparent;border-radius:.2rem;background:transparent;font-size:.8rem}
.wb-actions button:hover,.wb-actions button[aria-pressed="true"]{background:var(--accent-subtle);color:var(--accent)}
.wb-scope,.wb-status{flex:0 0 auto;padding:.25rem .6rem;color:var(--muted);font-size:.7rem;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.wb-status[data-load="loading"]{color:var(--status-info)}
.wb-status[data-load="stale"]{color:var(--status-warning);border-style:dashed}
.wb-status[data-load="error"]{color:var(--status-error)}
.wb-content{min-width:0;min-height:0;overflow:auto;flex:1 1 auto;padding:.65rem;font-size:.875rem}
.wb-content>p,.wb-content>h3{margin-bottom:.45rem}
.wb-lead,.wb-source{color:var(--muted);font-size:.75rem}
.wb-facts{margin:.5rem 0}
.wb-facts>div{display:grid;grid-template-columns:6.5rem minmax(0,1fr);gap:.45rem;padding:.4rem 0;border-top:1px solid var(--line)}
.wb-facts dt{color:var(--muted);font-size:.75rem}
.wb-facts dd{margin:0;overflow-wrap:anywhere}

.record-list{display:flex;flex-direction:column;margin:0;padding:0}
.record-row{display:grid;width:100%;min-height:3rem;gap:.2rem;padding:.4rem .55rem;border:0;border-bottom:1px solid var(--line);border-radius:0;background:transparent;text-align:left}
.record-row:hover,.record-row[data-selected="true"]{background:var(--accent-subtle)}
.record-row[data-selected="true"]{box-shadow:inset .2rem 0 var(--accent)}
.row-title{display:-webkit-box;overflow:hidden;font-size:.875rem;font-weight:600;line-height:1.25;-webkit-box-orient:vertical;-webkit-line-clamp:2}
.row-meta{display:flex;align-items:center;justify-content:space-between;gap:.5rem;color:var(--muted);font-size:.75rem}
.status-badge{display:inline-flex;align-items:center;gap:.25rem;padding:.12rem .35rem;border:1px solid currentColor;border-radius:1rem;font-size:.75rem;font-weight:600;line-height:1.2;white-space:nowrap}
.status-badge::before{content:"";width:.4rem;height:.4rem;border-radius:50%;background:currentColor}
.status-queued{color:var(--task-status-received,var(--status-success))}
.status-running{color:var(--task-status-working,var(--status-info))}
.status-waiting{color:var(--task-status-waiting,var(--status-warning))}
.status-blocked{color:var(--status-warning)}
.status-terminal{color:var(--muted)}
.status-unavailable{color:var(--status-error)}
.wb-badge{display:inline-block;width:fit-content;padding:.06rem .3rem;border:1px solid var(--line);border-radius:.2rem;font-size:.7rem;font-weight:400;line-height:1.3;color:var(--muted)}
.wb-badge.is-stale{border-style:dashed}
.wb-badge.is-error{border-color:var(--status-error);color:var(--status-error)}
.wb-timeline{margin:.35rem 0 .7rem;padding:0;list-style:none}
.wb-timeline li{display:flex;align-items:baseline;gap:.7rem;padding:.35rem 0;border-bottom:1px solid var(--line)}
.wb-timeline time{flex:0 0 9rem;color:var(--muted);font-size:.75rem}
.evidence-link{display:inline-block;overflow-wrap:anywhere}

#wb-empty:not([hidden]){display:block;padding:1rem;color:var(--muted)}
.modular-workbench[data-treatment="quiet-glass"] .wb-titlebar{background:color-mix(in srgb,var(--surface-overlay) 75%,transparent)}
.modular-workbench[data-treatment="current"] .wb-window{background:var(--field-surface)}

.preview-footer{display:flex;height:1.9rem;align-items:center;justify-content:space-between;gap:.5rem;overflow:hidden;padding:0 .6rem;border-top:1px solid var(--line);background:var(--surface-overlay);color:var(--muted);font-size:.75rem}

@container (max-width:50rem){
  .wb-toolbar label{flex:1 1 11rem}
  .wb-toolbar label select{flex:1}
  #arrangement-readout{flex:1 1 8rem;text-align:right}
  .workbench{gap:.35rem;padding:.35rem}
}
@media (max-width:50rem){
  .workbench{min-height:18rem}
}
@media (max-width:45rem){
  .host-note{padding:.45rem .75rem}
  .bar-link{padding:0 .55rem}
}
@media (pointer:coarse){.modular-workbench{--review-control:var(--ui-control-height)}}
@media (prefers-reduced-motion:reduce){
  .modular-workbench *,.modular-workbench *::before,.modular-workbench *::after{
    scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important
  }
}

.torch-terminal {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  min-height: 200px;
  max-width: 100vw;
  max-height: 100vh;
  border: 1px solid var(--line);
  border-radius: .3rem;
  background: var(--surface-overlay);
  box-shadow: var(--bar-shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.modular-workbench[data-treatment="quiet-glass"] .torch-terminal {
  background: color-mix(in srgb, var(--surface-overlay) 85%, transparent);
}
.torch-terminal[hidden] {
  display: none !important;
}
.torch-terminal[data-pinned="true"] {
  border-color: var(--accent);
}
.tt-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: .3rem;
  min-height: 2.2rem;
  padding: .2rem .35rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  cursor: grab;
  user-select: none;
}
.tt-titlebar:active {
  cursor: grabbing;
}
.tt-titlebar h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-actions {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.tt-actions button {
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: .1rem .2rem;
  border: 1px solid transparent;
  border-radius: .2rem;
  background: transparent;
  font-size: .8rem;
  line-height: 1;
}
.tt-actions button:hover, .tt-actions button[aria-pressed="true"] {
  background: var(--accent-subtle);
  color: var(--accent);
}
.tt-auto-open {
  display: flex;
  align-items: center;
  gap: .2rem;
  font-size: .7rem;
  color: var(--muted);
  margin-right: .25rem;
  cursor: pointer;
}
.tt-status, .tt-scope {
  flex: 0 0 auto;
  padding: .25rem .6rem;
  color: var(--muted);
  font-size: .7rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  overflow-wrap: anywhere;
}
.tt-status.is-stale {
  color: var(--status-warning);
  border-bottom-style: dashed;
}
.tt-status.is-error {
  color: var(--status-error);
}
.tt-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .5rem;
}
.tt-stream:empty::after {
  content: 'No terminal result is present in the current CIC payload.';
  color: var(--muted);
  font-style: italic;
}
.tt-entry {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .45rem .5rem;
  border: 1px solid var(--line);
  border-radius: .3rem;
  background: var(--surface-subtle);
}
.tt-entry-head, .tt-entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem;
}
.tt-entry-title {
  min-width: 0;
  font-size: .8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.tt-entry-ids, .tt-entry-meta, .tt-entry-models {
  color: var(--muted);
  font-size: .64rem;
  overflow-wrap: anywhere;
}
.tt-entry-body {
  margin: 0;
  font-size: .78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tt-entry-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.tt-entry-evidence a, .tt-entry-evidence span {
  padding: .1rem .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .64rem;
  overflow-wrap: anywhere;
}
.tt-expand {
  position: fixed;
  z-index: 101;
  inset-inline-end: .7rem;
  inset-block-end: .7rem;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .3rem;
  background: var(--surface-overlay);
  color: inherit;
  box-shadow: var(--bar-shadow);
  line-height: 1;
}
.tt-resizer {
  position: absolute;
  z-index: 10;
}
.tt-resizer-e {
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
}
.tt-resizer-s {
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
}
.tt-resizer-se {
  bottom: -5px;
  right: -5px;
  width: 15px;
  height: 15px;
  cursor: nwse-resize;
}
.torch-terminal[data-sheet="bottom"],
.torch-terminal[data-sheet="side"] {
  transform: none !important;
  cursor: default;
  box-shadow: var(--bar-shadow);
}
.torch-terminal[data-sheet="bottom"] {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  max-height: 60vh !important;
  border-radius: .5rem .5rem 0 0;
}
.torch-terminal[data-sheet="side"] {
  top: var(--bar-height, 3rem) !important;
  right: 0 !important;
  left: auto !important;
  bottom: 0 !important;
  width: min(28rem, 100%) !important;
  height: auto !important;
  max-height: none !important;
  border-radius: .5rem 0 0 0;
}
.torch-terminal[data-sheet] .tt-titlebar,
.torch-terminal[data-sheet] .tt-titlebar:active {
  cursor: default;
}
.torch-terminal[data-sheet] .tt-resizer {
  display: none;
}
@media (max-width: 50rem) {
  .torch-terminal {
    transform: none !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: 60vh !important;
    border-radius: .5rem .5rem 0 0;
    box-shadow: var(--bar-shadow);
  }
  .tt-titlebar,
  .tt-titlebar:active {
    cursor: default;
  }
  .tt-resizer {
    display: none;
  }
}
