/* Browser slicer: an app layout on the site's tokens */
:root {
  --panel: #0e1322;
  --panel-2: #141a2c;
  --line: rgb(255 255 255 / 0.08);
  --muted: rgb(245 245 242 / 0.55);
}

body.app {
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto auto 1fr; /* bar, notice (when shown), body */
  overflow: hidden;
  background: #090d18;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* Top bar */
.app__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.app__bar .wordmark { margin-right: 8px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.05);
}

.tab {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tab[aria-selected="true"] { background: rgb(255 255 255 / 0.12); color: var(--ink); }

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  font-size: 12px;
  color: var(--muted);
}

.app__actions { display: flex; gap: 8px; margin-left: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: rgb(255 255 255 / 0.06);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.btn:hover { background: rgb(255 255 255 / 0.12); }
.btn--primary { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn--primary:hover { background: #fff; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.tab:focus-visible, .btn:focus-visible, .model:focus-visible, .mode:focus-within,
.drop:focus-within, select:focus-visible, textarea:focus-visible, .composer__send:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Body: settings | plate | agent */
.app__body {
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  min-height: 0;
}

.side {
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
}

.side--settings { border-right: 1px solid var(--line); padding: 8px 0 24px; }
.side--agent { border-left: 1px solid var(--line); display: flex; flex-direction: column; }

.group { padding: 14px 16px; border-bottom: 1px solid var(--line); }

.group__title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.models { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }

.model {
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.model[aria-pressed="true"] { border-color: var(--accent); background: rgb(77 125 255 / 0.15); }

.drop {
  display: grid;
  gap: 2px;
  padding: 14px;
  border: 1.5px dashed rgb(255 255 255 / 0.18);
  border-radius: 12px;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.drop span { color: var(--muted); font-size: 12px; }
.drop:hover, .drop.is-over { border-color: var(--accent); background: rgb(77 125 255 / 0.08); }

.field { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 13px; }
.field span { color: var(--muted); }
.field strong { font-weight: 500; text-align: right; }

.modes { display: grid; gap: 6px; }

.mode {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
}

.mode:has(input:checked) { border-color: var(--accent); background: rgb(77 125 255 / 0.12); }
.mode input { margin: 3px 0 0; accent-color: var(--accent); }
.mode span { display: grid; gap: 2px; }
.mode strong { font-size: 13px; font-weight: 600; }
.mode em { font-style: normal; font-size: 12px; color: var(--muted); }

.mode i {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(77 125 255 / 0.25);
  color: #c7d5ff;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 0;
  font-size: 13px;
}

.row select, .row input[type="range"] { grid-column: 1 / -1; width: 100%; }
.row--toggle { grid-template-columns: 1fr auto; }
.row--toggle input { grid-column: auto; }

select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
output { color: var(--muted); }

.credits { margin: 0; padding: 14px 16px; font-size: 11px; line-height: 1.5; color: rgb(245 245 242 / 0.4); }

/* Plate */
.stage { position: relative; min-width: 0; min-height: 0; }
.stage__view { position: absolute; inset: 0; cursor: grab; }
.stage__view:active { cursor: grabbing; }
.stage__view canvas { display: block; width: 100%; height: 100%; }

.stage__name {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}

.preview {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 8px 20px;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
}

.preview[hidden] { display: none; }

.estimates { display: flex; gap: 20px; margin: 0; }
.estimates dt { font-size: 12px; color: var(--muted); }
.estimates dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; white-space: nowrap; }

.layers { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.layers input { grid-column: 1 / -1; width: 100%; }
.layers output { text-align: right; }

.preview__note { grid-column: 1 / -1; margin: 0; font-size: 11px; color: rgb(245 245 242 / 0.4); }

/* Agent sidebar */
.agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.plate-strip { font-size: 12px; color: var(--muted); }

.agent-thread > * { flex-shrink: 0; }

.agent-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bubble p { margin: 0; font-size: 14px; line-height: 1.5; }

.bubble--user {
  align-self: flex-end;
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 16px 16px 4px 16px;
  background: rgb(255 255 255 / 0.1);
}

.bubble__who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.bubble__who::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.tools { margin-top: 8px; font-size: 12px; color: var(--muted); }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 12px;
  padding: 8px 8px 8px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
}

.composer__send {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
}

/* Print sheet */
.sheet {
  width: min(440px, calc(100% - 32px));
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--glass-edge);
  background: var(--panel-2);
  color: var(--ink);
}

.sheet::backdrop { background: rgb(0 0 0 / 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet h2 { margin: 0 0 8px; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.sheet p { margin: 0 0 20px; font-size: 15px; line-height: 1.5; color: rgb(245 245 242 / 0.75); }
.sheet__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sign-in popup: asking the Agent while it isn't connected */
.sheet--signin { width: min(460px, calc(100% - 32px)); padding: 28px; }
.sheet--signin[open] { animation: sheet-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet__icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px;
  border-radius: 14px; background: rgb(77 125 255 / 0.18); color: #9db4ff;
}
.sheet--signin .export__note { margin-top: -8px; }
.signin__draft {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgb(0 0 0 / 0.22); font-size: 14px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.signin__draft::before { content: "Your message: "; color: rgb(245 245 242 / 0.5); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* Get Unlayered Slicer (agent/?get=slicer, where /software lands): two big choices */
.sheet--get { width: min(480px, calc(100% - 32px)); }
.sheet__x {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / 0.06); color: rgb(245 245 242 / 0.7); font: inherit; font-size: 20px; line-height: 1; cursor: pointer;
}
.sheet__x:hover { background: rgb(255 255 255 / 0.14); color: var(--ink); }
.get__options { display: grid; gap: 10px; margin-bottom: 18px; }
.get__option {
  display: grid; gap: 3px; padding: 16px 18px; border-radius: 16px; text-align: left; cursor: pointer;
  border: 1px solid var(--glass-edge); background: rgb(255 255 255 / 0.05); color: var(--ink); font: inherit;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}
.get__option strong { font-size: 16px; font-weight: 600; }
.get__option span { font-size: 13px; color: rgb(245 245 242 / 0.6); }
.get__option:hover { background: rgb(255 255 255 / 0.1); transform: translateY(-1px); }
.get__option--primary { background: var(--ink); border-color: var(--ink); color: #0b0f1a; }
.get__option--primary span { color: rgb(11 15 26 / 0.65); }
.get__option--primary:hover { background: #fff; }
.get__option:focus-visible, .sheet__x:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.get__pro { margin: 0 !important; font-size: 13px !important; color: rgb(245 245 242 / 0.55) !important; }
.get__pro a { color: #9db4ff; }
@media (prefers-reduced-motion: reduce) { .get__option { transition: none; } .get__option:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet--signin[open] { animation: none; } }

/* Narrow screens: stack plate, settings and agent in one scrolling column */
@media (max-width: 960px) {
  body.app { height: auto; overflow: visible; }
  .app__bar { flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
  .badge { display: none; }
  .app__body { grid-template-columns: 1fr; }
  .stage { order: -1; height: 60svh; }
  .side { overflow: visible; border: 0; }
  .side--agent { min-height: 420px; border-top: 1px solid var(--line); }
  .preview { grid-template-columns: 1fr; left: 10px; right: 10px; bottom: 10px; padding: 10px 14px; }
  .preview__note { display: none; }
  .estimates { flex-wrap: wrap; gap: 10px 18px; }
}

@media (max-width: 480px) {
  .app__bar { gap: 10px; }
  .app__actions { width: 100%; }
  .app__actions .btn { flex: 1; }
}

/* Live mode: sign-in notice, slicing progress */
.notice {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 16px; font-size: 14px; color: rgb(245 245 242 / 0.85);
  background: rgb(77 125 255 / 0.12); border-bottom: 1px solid rgb(77 125 255 / 0.25);
}
.notice[hidden] { display: none; }
.btn--small { padding: 6px 12px; font-size: 13px; }
.bubble--error p { color: #ff9b9b; }
.confirm { display: flex; gap: 8px; margin-top: 8px; }
.tools--running::after { content: " …"; }
/* `hidden` must win over the display rules above (.btn, .field, .row) */
[hidden] { display: none !important; }

/* Loading screen over the plate while a part downloads or is read */
.loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgb(11 11 11 / 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: 14px; color: rgb(245 245 242 / 0.85);
}
.loading__spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgb(255 255 255 / 0.14); border-top-color: #4d7dff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading__spinner { animation-duration: 2.4s; } }

/* A setting the Agent just changed */
.row.is-changed { animation: changed 1.6s ease-out; border-radius: 10px; }
@keyframes changed { from { background: rgb(77 125 255 / 0.28); } to { background: transparent; } }
/* Fixed rows, so the body keeps the stretchy row whether or not the notice shows */
.app__bar { grid-row: 1; }
.notice { grid-row: 2; }
.app__body { grid-row: 3; }

/* Bug report form */
.sheet--bug { width: min(480px, calc(100vw - 32px)); }
.bug { display: grid; gap: 12px; }
.bug h2 { margin: 0; }
.bug__lead { margin: 0; color: rgb(245 245 242 / 0.7); font-size: 14px; }
.bug__field { display: grid; gap: 6px; font-size: 13px; color: rgb(245 245 242 / 0.8); }
.bug__field input, .bug__field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; resize: vertical;
  background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.16); color: inherit;
}
.bug__field input:focus-visible, .bug__field textarea:focus-visible { outline: 2px solid #4d7dff; outline-offset: 1px; }
.bug__shot { font-size: 13px; }
.bug__status { margin: 0; min-height: 1.2em; font-size: 13px; color: rgb(245 245 242 / 0.75); }

/* --- Prepare: the plate ---------------------------------------------------- */

.models .model { font-size: 12px; }

/* Parts on the plate */
.objects { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 2px; max-height: 240px; overflow-y: auto; }
.obj {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; padding: 7px 10px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; font-size: 13px; text-align: left; cursor: pointer;
}
.obj:hover { background: rgb(255 255 255 / 0.05); }
.obj[aria-current="true"] { background: rgb(77 125 255 / 0.15); border-color: rgb(77 125 255 / 0.45); }
.obj:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.obj__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj__size { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.obj.is-warn .obj__name::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 7px 1px 0; border-radius: 50%; background: #f0a050; }
.obj__rename { width: 100%; padding: 6px 9px; border-radius: 9px; border: 1px solid var(--accent); background: var(--panel-2); font-size: 13px; outline: none; }
.objects__empty { margin: 0 0 10px; font-size: 12px; color: var(--muted); }

/* Floating tool pill over the plate */
.ptools {
  position: absolute; left: 12px; top: 44px; z-index: 1;
  display: flex; flex-direction: column; gap: 2px; padding: 5px;
  border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 8px 32px rgb(0 0 0 / 0.25);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
}
.ptool {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: rgb(245 245 242 / 0.82); cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.ptool svg, .chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ptool:hover:not(:disabled) { background: rgb(255 255 255 / 0.1); color: var(--ink); }
.ptool[aria-expanded="true"] { background: rgb(77 125 255 / 0.3); color: var(--ink); }
.ptool:disabled { opacity: 0.3; cursor: default; }
.ptool:focus-visible, .chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.ptools__rule { height: 1px; margin: 3px 7px; background: var(--glass-edge); }

.flyout {
  position: absolute; z-index: 3; width: 232px; padding: 12px;
  display: grid; gap: 10px;
  border-radius: 18px; border: 1px solid var(--glass-edge);
  background: rgb(20 26 44 / 0.82);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.1), 0 12px 40px rgb(0 0 0 / 0.35);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  font-size: 13px;
}
.flyout__title { font-size: 12px; font-weight: 600; color: var(--muted); }
.flyout__field { display: flex; align-items: center; gap: 8px; }
.flyout__field input { width: 72px; }
.flyout input[type="number"] {
  padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: rgb(0 0 0 / 0.25);
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.flyout input[type="number"]::-webkit-inner-spin-button { opacity: 0.4; }
.flyout input:focus { outline: none; border-color: var(--accent); }
.flyout input.is-bad { border-color: #f0a050; background: rgb(240 160 80 / 0.12); }
.flyout__grid { display: grid; grid-template-columns: 18px 1fr 1fr; gap: 6px; align-items: center; }
.flyout__grid > span, .flyout__scale > span { color: var(--muted); font-size: 12px; }
.flyout__scale { display: grid; grid-template-columns: 14px 1fr 1fr; gap: 6px; align-items: center; }
.flyout__scale label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.flyout__scale input { width: 100%; min-width: 0; color: var(--ink); }
.flyout__head { font-size: 11px; }
.flyout__row { display: flex; gap: 6px; flex-wrap: wrap; }
.flyout__row--stepper { align-items: center; justify-content: space-between; }
.flyout__note { margin: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 30px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--glass-edge); background: rgb(255 255 255 / 0.06);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color 0.2s;
}
.chip:hover:not(:disabled) { background: rgb(255 255 255 / 0.12); }
.chip:disabled { opacity: 0.35; cursor: default; }
.chip--wide { width: 100%; }
.chip[aria-pressed="true"] { background: rgb(77 125 255 / 0.25); border-color: rgb(77 125 255 / 0.55); }
.chip svg { width: 14px; height: 14px; }

/* Cut planes tool (js/slicer.js renderCut): the plane list, the plane editor and the options */
.flyout--cut { width: 260px; max-height: calc(100% - 16px); overflow-y: auto; }
.cut__summary { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.cut__list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cut__list[hidden] { display: none; }
.cut__row {
  display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 4px;
  padding: 3px 4px 3px 8px; border-radius: 10px; border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s;
}
.cut__row:hover { background: rgb(255 255 255 / 0.05); }
.cut__row.is-active { background: rgb(255 179 26 / 0.1); border-color: rgb(255 179 26 / 0.45); }
.cut__name {
  display: flex; align-items: center; gap: 7px; min-width: 0; padding: 4px 2px;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.cut__name em { font-style: normal; font-size: 11px; color: var(--muted); }
.cut__swatch { flex: none; width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25); }
.cut__icon {
  width: 24px; height: 24px; border: 0; border-radius: 7px; background: none; color: var(--muted);
  font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
}
.cut__icon:hover:not(:disabled) { background: rgb(255 255 255 / 0.1); color: var(--ink); }
.cut__icon:disabled { opacity: 0.25; cursor: default; }
.cut__name:focus-visible, .cut__icon:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cut__edit {
  display: grid; gap: 9px; padding: 10px; border-radius: 12px;
  background: rgb(0 0 0 / 0.22); border: 1px solid rgb(255 179 26 / 0.3);
}
.cut__edit[hidden] { display: none; }
.cut__edit-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: #ffc65a; }
.cut__edit-head .chip { padding-block: 3px; }
.cut__range { display: grid; grid-template-columns: 52px 1fr 38px; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cut__range input { width: 100%; min-width: 0; }
.cut__range output { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.cut__opts { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.cut__opts[hidden] { display: none; }
.cut__check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }

/* Size of the selected part, under it in the view */
.plate-dim {
  position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none;
  padding: 3px 9px; border-radius: 999px;
  background: rgb(11 16 32 / 0.72); border: 1px solid rgb(77 125 255 / 0.45);
  font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink);
}

/* Parts off the plate or too tall */
.plate-warn {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1;
  max-width: calc(100% - 32px); padding: 6px 12px 6px 10px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px;
  background: rgb(240 160 80 / 0.14); border: 1px solid rgb(240 160 80 / 0.45);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  font-size: 12px; font-weight: 500; color: #ffd2a6;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plate-warn::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #f0a050; }
.stage__name { max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 960px) {
  .ptools { top: 40px; left: 8px; padding: 3px; }
  .ptool { width: 32px; height: 32px; }
  .plate-warn { top: auto; bottom: 10px; }
}

/* Settings column: Printer, Filament, Process (js/settings.js) */
.group--settings { padding: 0; }

.st__bar {
  position: sticky; top: -8px; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.st__search {
  flex: 1; min-width: 0; padding: 8px 12px 8px 32px;
  border-radius: 999px; border: 1px solid var(--line); outline: none;
  background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f2' stroke-opacity='.5' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center;
  font-size: 13px;
}
.st__search:focus-visible { border-color: var(--accent); }
.st__adv { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }

.st__sec { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.st__sec .group__title { margin-bottom: 6px; }

.st__meta { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-size: 12px; color: var(--muted); }
.st__axes { padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; font-weight: 600; }
.st__axes--five { border-color: transparent; background: rgb(77 125 255 / 0.25); color: #c7d5ff; }

/* One setting: label left, control right; wide rows (printer, filament, preset) stack */
.set-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
  margin: 0 -8px; padding: 5px 8px; border-radius: 10px; font-size: 13px;
}
.set-row--wide { grid-template-columns: minmax(0, 1fr); }
.set-row--wide .set-row__ctl, .set-row--wide select { width: 100%; }
.set-row__label { display: flex; align-items: center; gap: 6px; min-width: 0; cursor: default; }
.set-row__name { overflow-wrap: anywhere; }
.set-row__adv { display: none; font-size: 10px; font-weight: 600; color: rgb(245 245 242 / 0.4); }
.is-searching .set-row__adv { display: inline; }
.set-row__ctl { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.set-row__unit { min-width: 30px; font-size: 12px; color: var(--muted); }
.set-row select { min-width: 0; max-width: 100%; padding: 6px 8px; font-size: 13px; }
.set-row:not(.set-row--wide) select { width: 116px; }
.set-row input[type="number"] {
  width: 74px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums;
}
.set-row input[type="number"]:focus-visible, .set-row select:focus-visible { outline: none; border-color: var(--accent); }
.set-row.is-off { opacity: 0.45; }

/* Changed from the preset or the filament's default: an accent dot, like the desktop "*" */
.set-row.is-modified .set-row__name::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.set-row.is-changed, .st__tab.is-changed { animation: changed 1.6s ease-out; }
.is-preset-modified select { border-color: rgb(77 125 255 / 0.55); }

.st__reset {
  margin-left: auto; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
}
.st__reset:hover { color: var(--ink); background: rgb(255 255 255 / 0.08); }

/* Switches */
.st__switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 32px; height: 18px; margin: 0; border-radius: 999px; background: rgb(255 255 255 / 0.16);
  cursor: pointer; transition: background-color 0.2s;
}
.st__switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); transition: transform 0.2s;
}
.st__switch:checked { background: var(--accent); }
.st__switch:checked::after { transform: translateX(14px); }
.st__switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Process tabs: two rows of three in the 300 px column */
.st__tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 10px 0 8px; padding: 4px; border-radius: 12px; background: rgb(255 255 255 / 0.05); }
.st__tab { padding: 6px 4px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.st__tab[aria-selected="true"] { background: rgb(255 255 255 / 0.12); color: var(--ink); }
.st__tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.st__panel-title { display: none; margin: 10px 0 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.is-searching .st__panel-title { display: block; }
.st__empty { margin: 0; padding: 18px 16px; font-size: 13px; color: var(--muted); }

@media (max-width: 960px) {
  .st__bar { position: static; }
  .st__tabs { grid-template-columns: repeat(6, auto); }
}
@media (max-width: 520px) {
  .st__tabs { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .st__switch, .st__switch::after { transition: none; } }

/* The Agent is working: three pulsing dots */
.typing__dots { display: inline-flex; gap: 5px; padding: 6px 0 2px; }
.typing__dots i {
  width: 7px; height: 7px; border-radius: 50%; background: rgb(245 245 242 / 0.75);
  animation: typing 1.2s ease-in-out infinite;
}
.typing__dots i:nth-child(2) { animation-delay: 0.15s; }
.typing__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing__dots i { animation-duration: 2.4s; transform: none; } }

/* Export 3MF sheet */
.export__note { margin: 0; font-size: 13px; color: rgb(245 245 242 / 0.6); }
.export__status { margin: 0; min-height: 1.2em; font-size: 13px; color: rgb(245 245 242 / 0.8); }

/* The empty chat: what the Agent does here, and starter cards (js/starters.js) */
.starters { display: flex; flex-direction: column; justify-content: center; gap: 20px; min-height: 100%; padding: 8px 0; }
.starters__head { display: flex; flex-direction: column; gap: 10px; }
.starters__badge {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 50%; background: rgb(77 125 255 / 0.18); color: #4d7dff;
}
.starters__badge-icon { width: 20px; height: 20px; }
.starters__title { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.starters__lead { margin: 0; font-size: 14px; line-height: 1.4; color: rgb(245 245 242 / 0.6); }
.starters__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.starters__grid.is-in { animation: starters-in 0.5s ease-out; }
@keyframes starters-in { from { opacity: 0; } to { opacity: 1; } }
.starter {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 88px; padding: 12px;
  border-radius: 12px; border: 1px solid rgb(255 255 255 / 0.1); background: rgb(255 255 255 / 0.04);
  color: inherit; text-align: left; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.starter:hover { background: rgb(77 125 255 / 0.12); border-color: rgb(77 125 255 / 0.4); }
.starter:focus-visible { outline: 2px solid #4d7dff; outline-offset: 2px; }
.starter__icon {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: rgb(77 125 255 / 0.18); color: #4d7dff; transition: background 0.15s, color 0.15s;
}
.starter:hover .starter__icon { background: #4d7dff; color: #f5f5f2; }
.starter__label { font-size: 13px; font-weight: 500; line-height: 1.3; }
.starters__more {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 6px; border: 0;
  border-radius: 6px; background: none; color: rgb(245 245 242 / 0.6); font-size: 12px; cursor: pointer;
}
.starters__more:hover { background: rgb(255 255 255 / 0.06); color: #f5f5f2; }
.starters__more-icon { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .starters__grid.is-in { animation: none; } }

/* --- The slicer sidebar: agent/?host=unlayered-slicer (js/sidebar.js) -------------------------
   Only the chat column, full height, in the theme the slicer passes. The light variant swaps the
   same tokens; the browser slicer never sets data-theme, so it keeps the dark values above. */
html[data-layout="sidebar"] .app__bar,
html[data-layout="sidebar"] .side--settings,
html[data-layout="sidebar"] .stage { display: none !important; }
html[data-layout="sidebar"] body.app { height: 100vh; height: 100svh; overflow: hidden; background: var(--panel); }
html[data-layout="sidebar"] .app__body { grid-template-columns: minmax(0, 1fr); }
html[data-layout="sidebar"] .side--agent { overflow: hidden; border: 0; min-height: 0; }
html[data-layout="sidebar"] .agent-head { padding: 12px 12px 10px 14px; border-bottom: 0; }
html[data-layout="sidebar"] .plate-strip { display: none; }
html[data-layout="sidebar"] .agent-thread { padding: 14px 12px; }
html[data-layout="sidebar"] .composer { margin: 10px; }
html[data-layout="sidebar"] .notice { flex-wrap: wrap; justify-content: flex-start; font-size: 13px; padding: 8px 12px; }
html[data-layout="sidebar"] .starters__title { font-size: 20px; }

/* The chat's controls in the Agent header (js/chat.js): Usage, a labelled New chat, the ... menu */
.plate-strip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-head__tools { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.agent-head__tools .usage-btn { margin-left: 0; margin-right: 2px; }
.agent-head__new {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 12px; white-space: nowrap; cursor: pointer;
}
.agent-head__icon {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.agent-head__new:hover, .agent-head__icon:hover, .agent-head__icon[aria-expanded="true"] { background: rgb(255 255 255 / 0.08); color: var(--ink); }
.agent-head__new:disabled, .agent-head__icon:disabled { opacity: 0.5; cursor: default; background: transparent; }
.agent-head__new:focus-visible, .agent-head__icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.amenu {
  position: absolute; right: 12px; top: calc(100% + 4px); z-index: 30; min-width: 200px; max-width: min(300px, calc(100vw - 24px));
  display: grid; padding: 5px; border-radius: 12px; border: 1px solid rgb(255 255 255 / 0.14);
  background: rgb(14 19 34 / 0.98); box-shadow: 0 18px 40px rgb(0 0 0 / 0.45);
}
.amenu__item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer;
}
.amenu__item:hover:not(:disabled), .amenu__item:focus-visible { background: rgb(255 255 255 / 0.08); outline: none; }
.amenu__item:disabled { opacity: 0.45; cursor: default; }
.amenu__item[aria-checked]::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--muted); }
.amenu__item[aria-checked="true"]::before { content: "✓"; display: grid; place-items: center; font-size: 11px; line-height: 1; background: var(--accent); border-color: var(--accent); color: #fff; }
.amenu__rule { margin: 4px 2px; border: 0; border-top: 1px solid var(--line); }
/* Past chats (js/chat-history.js), in the same panel as the ... menu */
.pchats { width: min(320px, calc(100vw - 24px)); max-height: min(460px, 70vh); overflow-y: auto; }
.pchats__head { padding: 6px 9px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pchats__list { display: grid; gap: 1px; margin-top: 2px; }
.pchats__row { display: flex; align-items: center; gap: 2px; }
.pchats__open {
  flex: 1; min-width: 0; display: grid; gap: 1px; padding: 6px 9px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.pchats__open:hover, .pchats__open:focus-visible { background: rgb(255 255 255 / 0.08); outline: none; }
.pchats__open.is-current { background: rgb(77 125 255 / 0.14); }
.pchats__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.pchats__meta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pchats__trash {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.pchats__trash:hover:not(:disabled) { color: #ff8a8a; background: rgb(255 107 107 / 0.1); }
.pchats__trash:disabled { opacity: 0.35; cursor: default; }
.pchats__confirm { display: grid; gap: 4px; padding: 8px 9px; border-radius: 8px; background: rgb(255 107 107 / 0.08); }
.pchats__acts { display: flex; gap: 6px; margin-top: 2px; }
.btn.pchats__delete { background: #c0392b; color: #fff; border-color: transparent; }
.btn.pchats__delete:hover { background: #a93226; }
.pchats__empty, .pchats__status { margin: 0; padding: 6px 9px; font-size: 12px; color: var(--muted); }
.pchats__status { color: #ffb547; }
html[data-theme="light"] .pchats__open:hover, html[data-theme="light"] .pchats__open:focus-visible { background: rgb(18 24 40 / 0.06); }
html[data-layout="sidebar"] .pchats__open { border-radius: calc(var(--sl-radius) - 2px); color: var(--sl-fg); }
html[data-layout="sidebar"] .pchats__open:hover, html[data-layout="sidebar"] .pchats__open:focus-visible { background: var(--sl-tint10); }
html[data-layout="sidebar"] .pchats__open.is-current { background: var(--sl-tint25); }
html[data-layout="sidebar"] .btn.pchats__delete { background: var(--sl-error); color: #fff; }
/* A message that could not be drawn, and the panel's way out (js/chat.js) */
.msg-unshown { padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; font-size: 12px; color: var(--muted); }
.panel-fail { display: grid; gap: 8px; justify-items: center; padding: 18px 12px; text-align: center; }
.panel-fail p { margin: 0; }
.panel-fail__title { font-size: 14px; font-weight: 500; }
.panel-fail__detail { max-width: 300px; overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); }
.panel-fail__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
/* A message held while a new chat opens (js/chat.js hold) */
.bubble.is-held { opacity: 0.6; }

/* What is on the slicer's plate (the Agent app's PlateStrip) */
.pstrip { display: flex; align-items: flex-start; gap: 10px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.pstrip__icon { flex: none; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.pstrip__text { min-width: 0; flex: 1; line-height: 1.3; }
.pstrip__line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pstrip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.pstrip.is-empty .pstrip__name { font-weight: 400; color: var(--muted); }
.pstrip__facts { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.pstrip__sync { flex: none; min-width: 8px; height: 8px; border-radius: 999px; background: var(--muted); opacity: 0.6; font-size: 11px; line-height: 8px; color: var(--muted); }
.pstrip__sync[data-sync="synced"] { background: var(--accent); opacity: 1; }
.pstrip__sync[data-sync="stale"] { background: #f0a050; opacity: 1; }
.pstrip__sync[data-sync="failed"] { background: #ff6b6b; opacity: 1; }
.pstrip__sync[data-sync="syncing"] { height: auto; background: none; opacity: 1; animation: pstrip-pulse 1.2s ease-in-out infinite; }
.pstrip__sync[data-sync="syncing"]:empty { width: 8px; height: 8px; background: var(--accent); }
@keyframes pstrip-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .pstrip__sync { animation: none !important; } }

/* A tool line's muted detail (the demo's), and a note from the page */
.tools__detail { display: block; margin-top: 2px; font-size: 12px; opacity: 0.8; }
.tools--note { font-style: italic; }

/* Light theme (the slicer's light mode) */
html[data-theme="light"] {
  --ink: #15181f;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f4f8;
  --line: rgb(18 24 40 / 0.1);
  --muted: rgb(21 24 31 / 0.58);
  --glass: rgb(18 24 40 / 0.04);
  --glass-edge: rgb(18 24 40 / 0.16);
  color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] body.app { background: var(--panel); color: var(--ink); }
html[data-theme="light"] .bubble--user { background: rgb(18 24 40 / 0.07); }
html[data-theme="light"] .btn { background: rgb(18 24 40 / 0.04); }
html[data-theme="light"] .btn:hover { background: rgb(18 24 40 / 0.09); }
html[data-theme="light"] .btn--primary { background: var(--ink); color: #fff; }
html[data-theme="light"] .btn--primary:hover { background: #000; }
html[data-theme="light"] .typing__dots i { background: rgb(21 24 31 / 0.6); }
html[data-theme="light"] .bubble--error p { color: #c0392b; }
html[data-theme="light"] .notice { color: var(--ink); background: rgb(77 125 255 / 0.1); }
html[data-theme="light"] .starters__badge,
html[data-theme="light"] .starter__icon { background: rgb(77 125 255 / 0.12); color: #2f5fe0; }
html[data-theme="light"] .starters__lead,
html[data-theme="light"] .starters__more { color: var(--muted); }
html[data-theme="light"] .starters__more:hover { background: rgb(18 24 40 / 0.06); color: var(--ink); }
html[data-theme="light"] .starter { border-color: rgb(18 24 40 / 0.1); background: rgb(18 24 40 / 0.03); }
html[data-theme="light"] .starter:hover { background: rgb(77 125 255 / 0.08); border-color: rgb(77 125 255 / 0.45); }
html[data-theme="light"] .starter:hover .starter__icon { background: #4d7dff; color: #fff; }
html[data-theme="light"] .agent-head__new:hover,
html[data-theme="light"] .agent-head__icon:hover { background: rgb(18 24 40 / 0.06); }
html[data-theme="light"] .amenu { background: #fff; border-color: var(--line); box-shadow: 0 12px 32px rgb(0 0 0 / 0.15); }
html[data-theme="light"] .amenu__item:hover:not(:disabled), html[data-theme="light"] .amenu__item:focus-visible { background: rgb(18 24 40 / 0.06); }
html[data-theme="light"] .composer textarea::placeholder { color: rgb(21 24 31 / 0.45); }
html[data-theme="light"] :focus-visible { outline-color: var(--accent); }

/* --- The Agent demo (agent/?demo=…, js/demo.js) ----------------------------------------------- */
.demo-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.demo-stats div { padding: 8px 10px; border-radius: 12px; background: rgb(255 255 255 / 0.06); min-width: 0; }
.demo-stats dt { font-size: 11px; color: var(--muted); }
.demo-stats dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.demo-card { display: grid; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid rgb(77 125 255 / 0.35); background: rgb(77 125 255 / 0.08); }
.demo-card__note { margin: 0; font-size: 12px; color: var(--muted); }
.demo-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* Its way to Unlayered Pro: an accent-edged button and one line with the price */
.btn--pro { border-color: rgb(77 125 255 / 0.7); background: rgb(77 125 255 / 0.16); }
.btn--pro:hover { background: rgb(77 125 255 / 0.28); }
.demo-card__pro { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.demo-card__pro a { color: var(--ink); border-bottom: 1px solid rgb(245 245 242 / 0.35); }

/* Phones: the four header buttons wrap instead of pushing the page sideways */
@media (max-width: 480px) {
  .app__actions { flex-wrap: wrap; }
  .app__actions .btn { min-width: calc(50% - 4px); }
}
/* Agent usage (js/usage.js): plan, a bar per limit, % used, when it resets */
.agent-head { position: relative; }
.usage-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 4px 10px;
  border-radius: 999px; border: 1px solid rgb(255 255 255 / 0.14); background: rgb(255 255 255 / 0.04);
  color: rgb(245 245 242 / 0.75); font-size: 12px; cursor: pointer;
}
.usage-btn:hover { color: #f5f5f2; border-color: rgb(77 125 255 / 0.5); }
.usage-btn__meter { width: 36px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 0.12); overflow: hidden; }
.usage-btn__meter i, .usage__track i { display: block; height: 100%; background: #4d7dff; border-radius: inherit; }
.usage-btn__meter i.is-high, .usage__track i.is-high { background: #ffb547; }
.usage {
  position: absolute; right: 12px; top: calc(100% + 6px); z-index: 20; width: min(320px, calc(100vw - 32px));
  display: grid; gap: 14px; padding: 16px; border-radius: 14px;
  background: rgb(14 19 34 / 0.96); border: 1px solid rgb(255 255 255 / 0.14);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.usage__head { display: flex; justify-content: space-between; align-items: baseline; }
.usage__plan { font-size: 12px; color: #8fb0ff; }
.usage__row { display: grid; gap: 6px; }
.usage__label { display: flex; justify-content: space-between; font-size: 13px; }
.usage__pct { color: rgb(245 245 242 / 0.7); font-variant-numeric: tabular-nums; }
.usage__track { height: 6px; border-radius: 3px; background: rgb(255 255 255 / 0.1); overflow: hidden; }
.usage__note { margin: 0; font-size: 12px; line-height: 1.4; color: rgb(245 245 242 / 0.55); }
.usage__link { color: #8fb0ff; }

/* --- Signed out: the Unlayered Agent launch copy in the chat column (js/launch.js) ------------- */
.app__body.is-launch { grid-template-columns: 300px 1fr 400px; }
.launch { display: flex; flex-direction: column; gap: 14px; font-size: 14px; line-height: 1.5; }
.launch p { margin: 0; }
.launch a:not(.btn) { color: #8fb0ff; }
.launch__hero { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.launch__badge {
  align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: rgb(77 125 255 / 0.18); color: #c7d5ff;
}
.launch__badge--free { background: rgb(255 255 255 / 0.1); color: var(--ink); }
.launch__title { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -0.025em; line-height: 1.1; }
.launch__lead { color: rgb(245 245 242 / 0.75); }
.launch__chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.launch__chips li { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; }
.launch__promises, .launch__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.launch__promises li::before, .launch__list li::before { content: "✓ "; color: var(--accent); font-weight: 600; }
.launch__ctas { display: flex; flex-wrap: wrap; gap: 8px; }
.launch__small, .launch__fine, .launch__muted { font-size: 12px; color: var(--muted); }
.launch__card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel-2); }
.launch__card .btn { align-self: flex-start; }
.launch__card--pro { border-color: rgb(77 125 255 / 0.45); background: linear-gradient(160deg, rgb(77 125 255 / 0.14), var(--panel-2) 70%); }
.launch__price { font-size: 14px; color: var(--muted); }
.launch__price strong { font-size: 30px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.launch__strong { font-weight: 500; }
.launch__h3 { margin: 0; font-size: 16px; font-weight: 600; }
.launch__section { display: flex; flex-direction: column; gap: 8px; }
.launch__steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; }
.launch__examples { margin: 0; display: grid; gap: 8px; }
.launch__examples dt { font-weight: 600; font-size: 13px; }
.launch__examples dd { margin: 0; font-size: 13px; color: rgb(245 245 242 / 0.7); }
.launch__faq { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.launch__faq summary { cursor: pointer; font-weight: 500; }
.launch__faq p { margin-top: 6px; color: rgb(245 245 242 / 0.75); }
.launch__band { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; background: rgb(77 125 255 / 0.1); text-align: left; }
.launch__signin { display: flex; flex-direction: column; justify-content: center; gap: 12px; min-height: 100%; }
.launch__signin-btn { align-self: flex-start; }
html[data-theme="light"] .launch__lead, html[data-theme="light"] .launch__examples dd, html[data-theme="light"] .launch__faq p { color: var(--muted); }
html[data-theme="light"] .launch__badge { color: #2f5fe0; background: rgb(77 125 255 / 0.12); }
html[data-theme="light"] .launch a:not(.btn) { color: #2f5fe0; }
@media (max-width: 960px) { .app__body.is-launch { grid-template-columns: 1fr; } }

/* The Agent usage button and panel in the sidebar's header (js/usage.js), light theme */
html[data-theme="light"] .usage { background: #fff; color: var(--ink); border-color: var(--line); }

/* Unlayered-only features: the export notice and the Cut planes note (warn, never block) */
.unl-only {
  display: grid; gap: 8px; margin: 4px 0; padding: 12px 14px; border-radius: 12px;
  background: rgb(77 125 255 / 0.12); border: 1px solid rgb(77 125 255 / 0.35); font-size: 13px; line-height: 1.45;
}
.unl-only p { margin: 0; }
.unl-only .btn { justify-self: start; }
.unl-note { margin: 6px 0 0; font-size: 12px; color: #8fb0ff; }
.unl-note a { color: inherit; }

/* --- The slicer sidebar in Unlayered Slicer's own colours ------------------------------------
   The slicer's theme tokens (release/0.1.8 ThemeManager built-ins, StateColor gDarkColors,
   AccentColor.hpp; the same values as the Agent app's lib/slicerTheme.ts): Dark is the slicer's
   default, Light when it says so. Sidebar layout only -- the site and the browser slicer keep
   their own palette. A slicer theme other than the built-ins (High contrast, Neon, a user theme)
   arrives over the bridge and js/slicer-host.js writes its --sl-* values inline on <html>, which
   win over these. The accent is the slicer's neutral grey #767676, not the site's blue (Alex
   10/25: "match the slicer for agent when it is inside the slicer"; this reverts the blue
   accent 45850a4 put back). */
html[data-layout="sidebar"] {
  --sl-bg: #232327; --sl-card: #2b2b30; --sl-fg: #e2e2e5; --sl-muted-fg: #a4a4a8;
  --sl-border: #4c4c55; --sl-input: #78787f; --sl-input-bg: #232328; --sl-secondary: #3e3e45;
  --sl-secondary-fg: #efeff0; --sl-primary: #767676; --sl-primary-fg: #ffffff;
  --sl-primary-hover: #a8a8a8; --sl-primary-pressed: #5c5c5c; --sl-tint10: #3a3a3e;
  --sl-tint25: #4f4f53; --sl-ring: #3b8bf5; --sl-error: #bb2a3a; --sl-heat: #d15b00;
  --sl-modified: #f1754e; --sl-success: #4cc27a;
  /* the site's tokens, re-pointed */
  --ink: var(--sl-fg); --bg: var(--sl-bg); --panel: var(--sl-bg); --panel-2: var(--sl-card);
  --line: var(--sl-border); --muted: var(--sl-muted-fg); --glass: var(--sl-tint10);
  --glass-edge: var(--sl-border); --accent: var(--sl-primary);
  --sl-link: color-mix(in srgb, var(--sl-ring) 80%, var(--sl-fg));
  --sl-radius: 8px;
  color-scheme: dark;
}
html[data-layout="sidebar"][data-theme="light"] {
  --sl-bg: #ffffff; --sl-card: #f8f8f8; --sl-fg: #363636; --sl-muted-fg: #6b6b6b;
  --sl-border: #eeeeee; --sl-input: #dbdbdb; --sl-input-bg: #fffeff; --sl-secondary: #dfdfdf;
  --sl-secondary-fg: #262e30; --sl-primary: #767676; --sl-primary-fg: #ffffff;
  --sl-primary-hover: #888888; --sl-primary-pressed: #5c5c5c; --sl-tint10: #ececec;
  --sl-tint25: #d8d8d8; --sl-ring: #3b8bf5; --sl-error: #d01b1b; --sl-heat: #ff6f00;
  --sl-modified: #c9500e; --sl-success: #1e8a4c;
  --sl-link: color-mix(in srgb, var(--sl-ring) 70%, #000);
  color-scheme: light;
}
/* Inside the slicer: its UI font and its small corners */
html[data-layout="sidebar"] body.app {
  background: var(--sl-bg); color: var(--sl-fg);
  font-family: "HarmonyOS Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html[data-layout="sidebar"] :focus-visible { outline-color: var(--sl-ring); }
html[data-layout="sidebar"] .btn {
  border-radius: var(--sl-radius); border-color: transparent; background: var(--sl-secondary); color: var(--sl-secondary-fg);
}
html[data-layout="sidebar"] .btn:hover { background: var(--sl-tint25); }
html[data-layout="sidebar"] .btn--primary,
html[data-layout="sidebar"] .composer__send { background: var(--sl-primary); color: var(--sl-primary-fg); }
html[data-layout="sidebar"] .btn--primary:hover,
html[data-layout="sidebar"] .composer__send:hover { background: var(--sl-primary-hover); }
html[data-layout="sidebar"] .btn--primary:active,
html[data-layout="sidebar"] .composer__send:active { background: var(--sl-primary-pressed); }
html[data-layout="sidebar"] .composer__send { border-radius: var(--sl-radius); }
html[data-layout="sidebar"] .composer__send:disabled { background: var(--sl-secondary); color: var(--sl-muted-fg); }
html[data-layout="sidebar"] .composer {
  border-radius: var(--sl-radius); border-color: var(--sl-input); background: var(--sl-input-bg);
}
html[data-layout="sidebar"] .composer:focus-within { border-color: var(--sl-ring); }
html[data-layout="sidebar"] .composer textarea { color: var(--sl-secondary-fg); }
html[data-layout="sidebar"] .composer textarea::placeholder { color: var(--sl-muted-fg); }
html[data-layout="sidebar"] .bubble--user { border-radius: var(--sl-radius); background: var(--sl-tint10); }
html[data-layout="sidebar"] .bubble--error p { color: color-mix(in srgb, var(--sl-error) 65%, var(--sl-fg)); }
html[data-layout="sidebar"] .typing__dots i { background: var(--sl-muted-fg); }
html[data-layout="sidebar"] .notice { color: var(--sl-fg); background: var(--sl-card); border-bottom-color: var(--sl-border); }
html[data-layout="sidebar"] .agent-head__new { border-radius: var(--sl-radius); border-color: var(--sl-border); }
html[data-layout="sidebar"] .agent-head__new:hover,
html[data-layout="sidebar"] .agent-head__icon:hover,
html[data-layout="sidebar"] .agent-head__icon[aria-expanded="true"] { background: var(--sl-tint10); color: var(--sl-fg); }
html[data-layout="sidebar"] .amenu { border-radius: var(--sl-radius); background: var(--sl-card); border-color: var(--sl-border); }
html[data-layout="sidebar"] .amenu__item { border-radius: calc(var(--sl-radius) - 2px); color: var(--sl-fg); }
html[data-layout="sidebar"] .amenu__item:hover:not(:disabled),
html[data-layout="sidebar"] .amenu__item:focus-visible { background: var(--sl-tint10); }
html[data-layout="sidebar"] .amenu__item[aria-checked="true"]::before { background: var(--sl-primary); border-color: var(--sl-primary); }
html[data-layout="sidebar"] .pstrip__sync[data-sync="synced"] { background: var(--sl-success); }
html[data-layout="sidebar"] .pstrip__sync[data-sync="syncing"]:empty { background: var(--sl-muted-fg); }
html[data-layout="sidebar"] .pstrip__sync[data-sync="stale"] { background: var(--sl-heat); }
html[data-layout="sidebar"] .pstrip__sync[data-sync="failed"] { background: var(--sl-error); }
/* The empty chat */
html[data-layout="sidebar"] .starters__badge,
html[data-layout="sidebar"] .starter__icon { background: var(--sl-tint25); color: var(--sl-fg); }
html[data-layout="sidebar"] .starters__lead,
html[data-layout="sidebar"] .starters__more { color: var(--sl-muted-fg); }
html[data-layout="sidebar"] .starters__more:hover { background: var(--sl-tint10); color: var(--sl-fg); }
html[data-layout="sidebar"] .starter { border-radius: var(--sl-radius); border-color: var(--sl-border); background: var(--sl-card); }
html[data-layout="sidebar"] .starter:hover { background: var(--sl-tint10); border-color: var(--sl-input); }
html[data-layout="sidebar"] .starter:hover .starter__icon { background: var(--sl-primary); color: var(--sl-primary-fg); }
html[data-layout="sidebar"] .starter:focus-visible { outline-color: var(--sl-ring); }
/* Usage button and panel */
html[data-layout="sidebar"] .usage-btn { border-radius: var(--sl-radius); border-color: var(--sl-border); background: var(--sl-card); color: var(--sl-muted-fg); }
html[data-layout="sidebar"] .usage-btn:hover { color: var(--sl-fg); border-color: var(--sl-input); }
html[data-layout="sidebar"] .usage-btn__meter,
html[data-layout="sidebar"] .usage__track { background: var(--sl-tint25); }
html[data-layout="sidebar"] .usage-btn__meter i,
html[data-layout="sidebar"] .usage__track i { background: var(--sl-primary-hover); }
html[data-layout="sidebar"] .usage-btn__meter i.is-high,
html[data-layout="sidebar"] .usage__track i.is-high { background: var(--sl-heat); }
html[data-layout="sidebar"] .usage {
  border-radius: var(--sl-radius); background: var(--sl-card); color: var(--sl-fg); border-color: var(--sl-border);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-layout="sidebar"] .usage__plan,
html[data-layout="sidebar"] .usage__link,
html[data-layout="sidebar"] .launch a:not(.btn) { color: var(--sl-link); }
html[data-layout="sidebar"] .usage__pct,
html[data-layout="sidebar"] .usage__note { color: var(--sl-muted-fg); }
/* Signed out: the launch copy */
html[data-layout="sidebar"] .launch__badge { background: var(--sl-tint25); color: var(--sl-fg); }
html[data-layout="sidebar"] .launch__lead,
html[data-layout="sidebar"] .launch__examples dd,
html[data-layout="sidebar"] .launch__faq p { color: var(--sl-muted-fg); }
html[data-layout="sidebar"] .launch__card,
html[data-layout="sidebar"] .launch__chips li { border-radius: var(--sl-radius); background: var(--sl-card); }
html[data-layout="sidebar"] .launch__card--pro { border-color: var(--sl-input); background: var(--sl-card); }
html[data-layout="sidebar"] .launch__band { border-radius: var(--sl-radius); background: var(--sl-tint10); }
html[data-layout="sidebar"] .launch__promises li::before,
html[data-layout="sidebar"] .launch__list li::before { color: var(--sl-success); }
/* Unlayered-only notice and note, in the slicer's colours */
html[data-layout="sidebar"] .unl-only { border-radius: var(--sl-radius); background: var(--sl-card); border-color: var(--sl-border); color: var(--sl-fg); }
html[data-layout="sidebar"] .unl-note { color: var(--sl-link); }


/* The free plan's beta pop-up (js/agent-beta.js): over the whole page in both layouts, OK only */
.beta-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(8 9 12 / 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.beta-gate__card {
  width: min(400px, 100%);
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgb(255 255 255 / 0.1);
  background: #14161d;
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);
  color: #f5f5f2;
}
.beta-gate__title { margin: 0 0 10px; font-size: 1.1rem; font-weight: 600; }
.beta-gate__text { margin: 0 0 8px; font-size: 0.9rem; line-height: 1.5; color: rgb(245 245 242 / 0.75); }
.beta-gate__field { display: grid; gap: 6px; margin-top: 14px; font-size: 0.8rem; font-weight: 600; }
.beta-gate__field input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgb(255 255 255 / 0.14);
  background: rgb(255 255 255 / 0.05);
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.beta-gate__field input:focus { outline: 2px solid #7c95ff; outline-offset: 1px; }
.beta-gate__field input[aria-invalid="true"] { border-color: #ff6b6b; }
.beta-gate__error { margin: 8px 0 0; font-size: 0.8rem; color: #ff8a8a; }
.beta-gate__ok {
  width: 100%;
  height: 42px;
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0b0d12;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.beta-gate__ok:disabled { opacity: 0.6; cursor: default; }

/* The Agent data consent (js/agent-consent.js): the beta pop-up's card, the server's words */
.consent-gate__text { max-height: min(50vh, 360px); overflow-y: auto; }
.consent-gate__text .beta-gate__text { white-space: pre-line; }
.consent-gate__link { color: #8fb0ff; }

/* Staff (js/agent-staff.js): the preview banner, Settings > Preview as / Reset my usage */
.preview-banner {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 12px;
  background: rgb(77 125 255 / 0.12); border-bottom: 1px solid rgb(77 125 255 / 0.3);
}
.preview-banner__text { flex: 1; min-width: 0; }
.preview-banner__stop { flex: none; padding: 0; border: 0; background: none; color: #8fb0ff; font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.asettings { width: min(320px, calc(100vw - 24px)); padding: 8px; gap: 8px; }
.asettings__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.asettings__opt { padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.asettings__opt:hover { color: var(--ink); }
.asettings__opt[aria-pressed="true"] { border-color: rgb(77 125 255 / 0.5); background: rgb(77 125 255 / 0.14); color: var(--ink); }
.asettings__note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.asettings__note:empty { display: none; }
.asettings__row { display: flex; gap: 8px; }
.staff-actions { flex-wrap: wrap; }
html[data-layout="sidebar"] .preview-banner { background: var(--sl-card); border-bottom-color: var(--sl-border); }
html[data-layout="sidebar"] .preview-banner__stop { color: var(--sl-link); }
html[data-layout="sidebar"] .asettings__opt { border-radius: var(--sl-radius); border-color: var(--sl-border); }
html[data-layout="sidebar"] .asettings__opt[aria-pressed="true"] { border-color: var(--sl-input); background: var(--sl-tint25); color: var(--sl-fg); }

/* A refusal for a limit (js/agent-limits.js limitCard) and why a reply stopped (STOP_NOTE) */
.limit-card { padding: 10px 12px; border-radius: 12px; border: 1px solid rgb(77 125 255 / 0.35); background: rgb(77 125 255 / 0.08); font-size: 13px; }
.limit-card__title { font-weight: 600; }
.limit-card__body { margin: 3px 0 0; line-height: 1.45; overflow-wrap: anywhere; }
.limit-card__actions { flex-wrap: wrap; }
.tools--stop { font-style: normal; }
html[data-layout="sidebar"] .limit-card { border-radius: var(--sl-radius); border-color: var(--sl-border); background: var(--sl-card); }

/* The composer's Stop while a reply runs (queued messages stay) */
.composer__stop {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.composer__stop:hover { background: rgb(255 255 255 / 0.08); color: var(--ink); }
html[data-layout="sidebar"] .composer__stop { border-radius: var(--sl-radius); }
html[data-layout="sidebar"] .composer__stop:hover { background: var(--sl-tint10); }

/* Queued follow-ups (js/chat.js queue): dimmed bubbles with Edit and Remove; the hold line */
.queued { display: grid; gap: 8px; justify-items: end; }
.queued__item { display: grid; justify-items: end; gap: 2px; max-width: 85%; }
.queued__bar { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.queued__btn { padding: 1px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.queued__btn:hover { background: rgb(255 255 255 / 0.08); color: var(--ink); }
.queued__text { padding: 8px 12px; border: 1px dashed var(--line); border-radius: 16px 16px 4px 16px; font-size: 14px; line-height: 1.45; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.queued__hold { justify-self: stretch; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgb(255 255 255 / 0.05); font-size: 12px; color: var(--muted); }
.queued__hold span { flex: 1; }
html[data-layout="sidebar"] .queued__text { border-radius: var(--sl-radius); border-color: var(--sl-border); }
html[data-layout="sidebar"] .queued__hold { border-radius: var(--sl-radius); background: var(--sl-card); }

/* Training and feedback mode (js/agent-modes.js): the docks above the composer, Rate under replies */
.agent-dock { display: grid; gap: 6px; margin: 0 12px; }
.agent-dock:empty { display: none; }
.tdock { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 7px 10px; border-radius: 10px; font-size: 12px; }
.tdock--line { padding: 2px 2px; color: var(--muted); }
.tdock--feedback, .tdock--card { border: 1px solid rgb(77 125 255 / 0.4); background: rgb(77 125 255 / 0.07); }
.tdock--card { display: grid; }
.tdock__text { flex: 1; min-width: 0; }
.tdock__sub { display: block; margin: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.tdock__head { display: flex; align-items: center; gap: 8px; }
.tdock__title { flex: 1; min-width: 0; font-weight: 600; }
.tdock__changes { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tdock__change { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.tdock__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tdock__values, .tdock__ref { flex: none; font-family: ui-monospace, monospace; font-size: 11px; }
.tdock__ref { color: var(--muted); }
.rate { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: -6px; font-size: 11px; color: var(--muted); }
.rate__label { margin-right: 4px; }
.rate__btn { padding: 2px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.rate__btn:hover { background: rgb(255 255 255 / 0.08); color: var(--ink); }
.rate__note.is-bad { color: #ff8a8a; }
.rate__form { display: grid; gap: 6px; width: 100%; }
.rate__text { width: 100%; min-height: 52px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: 12px; resize: vertical; }
html[data-layout="sidebar"] .agent-dock { margin: 0 10px; }
html[data-layout="sidebar"] .tdock--feedback, html[data-layout="sidebar"] .tdock--card { border-radius: var(--sl-radius); border-color: var(--sl-border); background: var(--sl-card); }
html[data-layout="sidebar"] .rate__text { border-radius: var(--sl-radius); border-color: var(--sl-input); background: var(--sl-input-bg); }
html[data-layout="sidebar"] .rate__btn:hover, html[data-layout="sidebar"] .queued__btn:hover { background: var(--sl-tint10); color: var(--sl-fg); }

/* Web slicer: the printer select asks for the visitor's own printer (js/slicer.js printerChosen) */
.printer-ask { margin: 4px 0 0; font-size: 12px; color: #8fb0ff; }
.printer-ask[hidden] { display: none; }
.set-row.is-unchosen select { border-color: rgb(77 125 255 / 0.55); }
.set-row.is-needed select { border-color: #ffb547; box-shadow: 0 0 0 3px rgb(255 181 71 / 0.25); }
.set-row.is-needed + .printer-ask { color: #ffb547; font-weight: 500; }

/* Staff: what each reply cost and the chat's total (js/agent-cost.js) */
.cost-line { display: none; align-self: flex-end; margin-top: -8px; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); opacity: 0.8; }
.agent-thread.show-cost .cost-line { display: block; }
.chat-cost { padding: 0 4px; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* The model badge (js/agent-model.js), shown only where the provider isn't locked */
.agent-head__badge {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; max-width: 170px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer;
}
.agent-head__badge[hidden] { display: none; }
.agent-head__badge:disabled { opacity: 0.5; cursor: default; }
.agent-head__badge:hover:not(:disabled) { background: rgb(255 255 255 / 0.08); }
.agent-head__spark { color: var(--accent); font-size: 11px; }
.agent-head__badge-name { white-space: nowrap; }
.agent-head__badge-model { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); }
.model-menu { width: 260px; }
.model-menu__words { display: grid; gap: 1px; min-width: 0; }
.model-menu__model { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
html[data-layout="sidebar"] .agent-head__badge { border-radius: var(--sl-radius); border-color: var(--sl-border); }
html[data-layout="sidebar"] .agent-head__badge:hover:not(:disabled) { background: var(--sl-tint10); }

/* A narrow Agent column (the slicer clamps its sidebar to 280 DIP): labels fold into icons so the
   header never wraps or overflows */
.agent-head { container-type: inline-size; container-name: agenthead; }
.agent-head > strong { flex: none; }
.agent-head__tools { min-width: 0; }
@container agenthead (max-width: 520px) {
  .agent-head__badge-model { display: none; }
}
@container agenthead (max-width: 400px) {
  /* with the model badge there: New chat folds to its icon, the badge to its mark */
  .agent-head:has(.agent-head__badge:not([hidden])) .agent-head__new span { display: none; }
  .agent-head:has(.agent-head__badge:not([hidden])) .agent-head__new { width: 28px; padding: 0; justify-content: center; }
  .agent-head__badge-name { display: none; }
}
@container agenthead (max-width: 290px) {
  .agent-head__new span { display: none; }
  .agent-head__new { width: 28px; padding: 0; justify-content: center; }
}
@container agenthead (max-width: 320px) {
  /* the meter alone says it; with no meter (no limits) the word stays */
  .usage-btn:has(.usage-btn__meter:not([hidden])) .usage-btn__label { display: none; }
  .usage-btn { padding: 4px 7px; }
  .agent-head__tools { gap: 2px; }
  /* staff: the chat's total gives way (each reply still shows its own cost) */
  .chat-cost { display: none; }
}

/* The first-run note above the composer (js/agent-firstrun.js) */
.firstrun { display: flex; align-items: flex-start; gap: 8px; margin: 0 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgb(255 255 255 / 0.03); }
.firstrun__text { flex: 1; margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.firstrun__x { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.firstrun__x:hover { background: rgb(255 255 255 / 0.08); color: var(--ink); }
html[data-layout="sidebar"] .firstrun { margin: 0 10px; border-radius: var(--sl-radius); border-color: var(--sl-border); background: var(--sl-card); }

/* Group chat (js/agent-participants.js): the To row, an assistant's message, a direct message */
.to-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 12px; font-size: 12px; color: var(--muted); }
.to-row[hidden] { display: none; }
.to-row__label { margin-right: 2px; }
.to-row__opt { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.to-row__opt:hover { color: var(--ink); }
.to-row__opt[aria-checked="true"] { border-color: var(--line); background: rgb(255 255 255 / 0.08); color: var(--ink); }
.to-row__dot { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / 0.3); }
.to-row__dot.is-on { background: #4cc27a; }
.composer.is-direct { border-style: dashed; }
.bubble--author { align-self: flex-start; max-width: 85%; }
.bubble--author p { padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; background: rgb(255 255 255 / 0.05); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble__author { margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.bubble--user.is-direct { border: 1px dashed rgb(255 255 255 / 0.25); }
.bubble__to { margin-bottom: 2px; font-size: 11px; color: var(--muted); }
html[data-layout="sidebar"] .to-row { margin: 0 10px; }
html[data-layout="sidebar"] .to-row__opt { border-radius: var(--sl-radius); }
html[data-layout="sidebar"] .to-row__opt[aria-checked="true"] { border-color: var(--sl-border); background: var(--sl-tint10); }
html[data-layout="sidebar"] .to-row__dot.is-on { background: var(--sl-success); }
html[data-layout="sidebar"] .bubble--author p { border-radius: var(--sl-radius); border-color: var(--sl-border); background: var(--sl-card); }

/* An Agent reply's markdown (js/markdown.js) */
.bubble__md { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.bubble__md p, .bubble__md ul, .bubble__md ol, .bubble__md pre { margin: 0; }
.bubble__md ul, .bubble__md ol { padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; }
.bubble__md strong { font-weight: 650; }
.bubble__md code { padding: 1px 5px; border-radius: 5px; background: rgb(255 255 255 / 0.09); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.92em; }
.bubble__md pre { padding: 10px 12px; border-radius: 8px; background: rgb(0 0 0 / 0.35); overflow-x: auto; }
.bubble__md pre code { padding: 0; background: none; white-space: pre; }
.bubble__md a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Product suggestions under an Agent reply (js/agent-products.js) */
.products { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.product { padding: 10px 12px; border: 1px solid rgb(255 255 255 / 0.12); border-radius: 10px; background: rgb(255 255 255 / 0.04); font-size: 12.5px; line-height: 1.45; }
.product p { margin: 0; }
.product__title { font-size: 14px; font-weight: 600; }
.product__note { margin-top: 2px !important; opacity: 0.72; }
.product__code { margin-top: 4px !important; }
.product__code code { padding: 1px 5px; border-radius: 5px; background: rgb(255 255 255 / 0.09); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 600; }
.product__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.product__go { text-decoration: none; }
.product__host { font-size: 11px; opacity: 0.6; }
.product__disclosure { margin-top: 4px !important; font-size: 11px; opacity: 0.65; }
