/* Device-first cards and dark/teal palette adapted from feat/admin Robot Console. */
:root {
  color-scheme: dark;
  --bg: #0c1014;
  --panel: #141a21;
  --input: #0e141a;
  --line: #35424f;
  --text: #e7eef5;
  --muted: #a4b3c3;
  --accent: #65e0d1;
  --danger: #ff98a4;
  --warning: #f5c076;
  font: 15px/1.5 Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1, h2, h3, p, dl, dd, pre { margin: 0; }
h1 { font-size: 1.65rem; }
h2, summary { font-size: 1rem; font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select, textarea {
  min-height: 2.45rem;
  padding: .38rem .65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: #102a27; font-weight: 700; }
.danger { color: var(--danger); }
.shell { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 40px; }
.topbar, .panel-head, .toolbar { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.topbar, .panel-head { justify-content: space-between; }
.topbar { margin-bottom: 1.25rem; }
.showcase-link { color: var(--accent); text-underline-offset: .22em; }
.panel { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.login { max-width: 31rem; display: grid; gap: .55rem; }
.login input { flex: 1; min-width: 8rem; }
.layout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; }
.tools, .result { margin-top: 12px; }
.devices { margin-bottom: 12px; }
.devices select { min-width: 10rem; max-width: 100%; }
.badge { padding: .22rem .55rem; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.badge[data-state="online"] { color: var(--accent); }
.badge[data-state="stale"], .notice[data-error="true"] { color: var(--warning); }
.badge[data-state="offline"], .badge[data-state="revoked"] { color: var(--danger); }
.notice { padding: .6rem 0; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem .75rem; margin: .9rem 0; }
.metrics dt, time, th { color: var(--muted); font-size: .82rem; }
.metrics dd { margin-top: .17rem; overflow-wrap: anywhere; }
.audio-level dd { display: flex; align-items: center; gap: .5rem; }
.audio-level meter { width: 5rem; accent-color: var(--accent); }
.task-search { margin-top: .6rem; }
.scroll { overflow-x: auto; }
.services { margin: .8rem 0; }
.services > div {
  display: grid; grid-template-columns: minmax(3.5rem, .75fr) minmax(0, 2.25fr) auto;
  gap: .55rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line);
}
.services dt { font-weight: 600; }
.services dd { min-width: 0; overflow-wrap: anywhere; }
.services small { display: block; color: var(--muted); }
.services .badge { font-size: .78rem; }
.vision-actions { margin-top: .9rem; }
.depth-legend { margin-top: .8rem; font-size: .82rem; color: var(--muted); }
.depth-gradient {
  flex: 1; min-width: 4rem; height: .6rem; border-radius: 4px;
  background: linear-gradient(90deg, #f9e16d, #5bcd9e, #237e97, #3f2773);
}
.depth-empty { display: inline-block; width: .65em; height: .65em; border: 1px solid var(--line); background: #0f151f; }
.timings { margin: .85rem 0; padding-top: .75rem; border-top: 1px solid var(--line); }
.timings h3 { font-size: .9rem; }
.timings .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: .25rem; }
.muted { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
#camera-image { display: block; width: 100%; max-height: 28rem; object-fit: contain; background: var(--input); margin-top: .75rem; }
table { width: 100%; border-collapse: collapse; margin-top: .4rem; text-align: left; }
th, td { padding: .55rem .45rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.task-link { max-width: 100%; text-align: left; overflow-wrap: anywhere; color: var(--accent); }
summary { cursor: pointer; }
details[open] > summary { margin-bottom: .85rem; }
.fields { display: grid; gap: .45rem; margin: .75rem 0; }
textarea { width: 100%; resize: vertical; }
pre { margin-top: .7rem; padding: .75rem; background: var(--input); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 35rem; overflow: auto; }

@media (max-width: 680px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .shell { width: calc(100% - 20px); padding-top: 14px; }
  .panel { padding: .75rem; }
}

.bazaar { margin: 0 0 1rem; padding: clamp(1rem, 2.6vw, 2rem); border-top: 3px solid var(--accent); }
.bazaar h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
.bazaar .panel-head { gap: 1rem; margin-bottom: 1rem; }
.bazaar-tabs { border: 1px solid var(--line); border-radius: 8px; padding: .2rem; gap: .2rem; }
.bazaar-tabs button, .bazaar-topics button { background: transparent; border-color: transparent; }
.bazaar button[aria-pressed="true"] { background: #203b3d; color: var(--accent); }
.bazaar-columns { display: grid; grid-template-columns: minmax(12rem, 1fr) 2fr; gap: 1.5rem; }
.bazaar-index label, .bazaar-card h4 { display: block; margin: 0 0 .4rem; color: var(--muted); font-size: .82rem; }
.bazaar-index input { width: 100%; }
.bazaar-topics { display: grid; margin-top: .5rem; max-height: 15rem; overflow-y: auto; gap: 2px; }
.bazaar-topics button { text-align: left; }
.bazaar-card { padding: 1.1rem 1.35rem; background: var(--input); border-radius: 6px; }
.bazaar-card h3 { font-size: 1.25rem; margin-bottom: 1rem; }
.bazaar-card p { margin-bottom: 1rem; max-width: 52em; line-height: 1.7; }
.bazaar-card small { color: var(--accent); }
.bazaar-chapters { padding-inline-start: 2rem; }
.bazaar-chapters li { border-bottom: 1px solid var(--line); padding: .45rem 0; }
.bazaar-chapters li::marker { color: var(--accent); font-variant-numeric: tabular-nums; }
.bazaar-chapters li > div { display: flex; align-items: center; gap: .45rem; }
.bazaar-chapters strong { flex: 1; }
#bazaar-status:not(:empty) { padding-bottom: .8rem; }
@media(max-width: 640px) {
  .bazaar-columns { grid-template-columns: 1fr; gap: .75rem; }
  .bazaar-topics { max-height: 6.5rem; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bazaar-card { padding: 1rem; }
  .bazaar-plan-head { align-items: start; }
}

.bazaar-card details { margin-top: .8rem; }
.bazaar-card details h4 { margin-top: .75rem; }

.bazaar-card > button { display: block; margin-top: .8rem; }
.bazaar-card form h3 { margin-bottom: .3rem; }
#bazaar-gap-table { margin-top: .8rem; }
#field-editor .fields label, #bazaar-card .fields label { display: grid; gap: .25rem; }
#field-editor input:not([type=checkbox]), #field-editor select, #bazaar-card .fields input { width: 100%; }
#field-editor label:has(input[type=checkbox]) { display: flex; align-items: center; }
#bazaar-desk > .toolbar { margin-bottom: 1rem; }
#bazaar-desk a { color: var(--accent); }

.trial-panel { margin-bottom: .85rem; }
#agent-switch button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--panel); }
#trial-topics { margin-top: .8rem; }
#trial-topics summary { cursor: pointer; }
#topic-filter { width: min(22rem, 100%); margin: .6rem 0; }
#topic-options { max-height: 14rem; overflow-y: auto; }
#topic-options button { text-align: left; }
.trial-input { margin: .7rem 0; }
.trial-input input { flex: 1 1 17rem; min-width: 0; }
#trial-examples button, #trial-related button { min-height: 1.9rem; font-size: .88rem; }
#trial-status, #trial-output { margin-top: .8rem; }
#trial-output { border-top: 1px solid var(--line); padding-top: .8rem; }
#trial-answer { margin-top: .45rem; white-space: pre-line; overflow-wrap: anywhere; }
#trial-method, #trial-sources, #trial-status { color: var(--muted); }
#trial-sources { margin: .4rem 0; padding-left: 1.3rem; overflow-wrap: anywhere; }
.trial-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
#trial-history { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
#trial-history summary { cursor: pointer; }
#trial-list { margin: .6rem 0; padding: 0; list-style: none; max-height: 16rem; overflow-y: auto; }
#trial-list button { text-align: left; margin: .18rem 0; overflow-wrap: anywhere; }
#trial-slide {
  inset: 0; margin: 0; border: 0; width: 100%; max-width: none; height: 100%;
  max-height: none; padding: clamp(1rem, 4vw, 4rem); color: var(--text); background: var(--bg);
}
#trial-slide::backdrop { background: var(--bg); }
.slide-content { max-width: 68rem; margin: 0 auto; overflow-wrap: anywhere; }
#slide-device, #slide-meta, #slide-page { color: var(--muted); }
#slide-question { margin: 1.3rem 0 .7rem; font-size: clamp(1.7rem, 3.5vw, 3rem); line-height: 1.25; }
#slide-answer { white-space: pre-line; font-size: clamp(1.35rem, 2.5vw, 2.25rem); line-height: 1.6; }
.slide-content h3 { margin: 1.4rem 0 .3rem; font-size: 1.1rem; }
#slide-sources { margin: 0; padding-left: 1.35rem; font-size: 1.15rem; }
#slide-meta { border-top: 1px solid var(--line); padding: 1rem 0; margin-top: 1rem; }

/* Console shell and authenticated workspace navigation. */
.control-room { background: radial-gradient(ellipse at 80% 0%, #17313266, transparent 48rem), #0b1116; min-height: 100vh; }
.control-room > .shell { width: min(1340px, calc(100% - clamp(32px, 7vw, 112px))); padding-top: clamp(18px, 3vw, 38px); }
.control-room .topbar { padding: 0 0 1.05rem; border-bottom: 1px solid #2a393e; }
.console-brand { display: flex; align-items: center; gap: .85rem; }
.console-brand h1 { font-size: clamp(1.35rem, 2.3vw, 1.85rem); letter-spacing: -.035em; }
.orbit-mark { width: 32px; height: 32px; position: relative; flex: none; border: 1px solid #62cdbb; border-radius: 50%; }
.orbit-mark::before, .orbit-mark::after { content: ''; position: absolute; inset: 3px 9px; border: 1.5px solid #96f2dd; border-radius: 50%; transform: rotate(38deg); }
.orbit-mark::after { transform: rotate(-42deg); }
.control-room .showcase-link { font-size: .86rem; color: var(--muted); }
.control-room .login { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(240px, .86fr) 1.14fr; gap: 0;
  width: min(880px, 100%); max-width: none; padding: 0; margin: clamp(45px, 12vh, 150px) auto 0;
  background: linear-gradient(112deg,#18242a,#101d23 65%,#11292b); border-color: #35494e; border-radius: 18px; box-shadow: 0 24px 75px #01080944; }
.login-fields { min-width: 0; align-self: center; display: grid; gap: .65rem; padding: clamp(28px, 4vw, 54px); }
.login-fields h2 { font-size: clamp(1.45rem,2.6vw,2rem); letter-spacing: -.035em; margin: 0 0 .9rem; }
.login-fields label { font-size: .85rem; color: #b3c5c8; }
.control-room .login-fields input { min-width: 0; width: 100%; height: 42px; }
.login-fields button { margin-top: .45rem; height: 42px; }
#login-relief { width:100%;height:100%;min-height:270px;object-fit:cover;align-self:stretch;mask-image:linear-gradient(to right,transparent,#000 24%); }
#workspace-nav { display:flex; flex-wrap:wrap; gap:.45rem; margin:1.2rem 0; }
#workspace-nav button { display:flex; align-items:center; justify-content:center; gap:.65rem; padding:.65rem 1.15rem;
  color:#a8b8c1; background:transparent; border:1px solid transparent; border-radius:9px; font-weight:600; }
#workspace-nav button:hover { background:#17252b; color:#e2f1ee; }
#workspace-nav button[aria-current="page"] { color:#b1f9e8; background:#18302f; border-color:#365751; }
.nav-glyph { display:inline-block; width:15px;height:15px; flex:none;position:relative;box-sizing:border-box; }
.overview-glyph { border:1.5px solid currentColor; border-radius:3px; background:linear-gradient(90deg,transparent 34%,currentColor 34% 43%,transparent 43%); }
.scene-glyph { width:13px;height:13px;border:1.5px solid currentColor;border-radius:2px;transform:rotate(-30deg) skew(6deg); }
.depth-glyph { height:12px;border-block:1.5px solid currentColor;transform:skewY(-16deg); }
.depth-glyph::after {content:'';position:absolute;left:0;right:0;top:4px;border-top:1.5px solid currentColor;}
.control-room .devices { padding:.8rem 1rem; background:#142024; border:1px solid #2e4046; border-radius:10px; margin-bottom:1rem; }
.spatial-workspace { min-width:0; }
@media(max-width:680px) {
  .control-room > .shell { width:calc(100% - 24px); }
  .control-room .login { grid-template-columns:1fr; max-width:420px; margin-top:2rem; }
  #login-relief { grid-row:1; height:80px; min-height:0; mask-image:linear-gradient(to bottom,#000,transparent); }
  .login-fields { padding: 0 1.5rem 1.6rem; }
  #workspace-nav { flex-wrap:nowrap; gap:.25rem; }
  #workspace-nav button { flex:1; padding:.6rem .3rem; gap:.35rem; font-size:.88rem; }
}
