:root {
  /* Taken from the reference screenshot (Nail 28.11): ChatGPT-dark greys with the lime of "dot". */
  --bg: #181818;
  --side: #1e1e1e;
  --surface: #2a2a2a;
  --surface-2: #303030;
  --surface-3: #3d3d3d;
  --border: #2b2b2b;
  --menu: #2d2d2d;
  --text: #ffffff;
  --text-2: #d2d2d2;
  --muted: #9b9b9b;
  --faint: #6b6b6b;
  --accent: #bdd746;
  --accent-ink: #0d0d0d;
  --accent-soft: rgba(189, 215, 70, 0.14);
  --warn: #e8b04a;
  --danger: #f0645a;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: default; opacity: 0.4; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }

.boot { display: grid; place-items: center; height: 100%; }
.mark { letter-spacing: 0.5em; color: var(--faint); font-weight: 600; }

/* layout */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; height: 100dvh; }
.shell.collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.side {
  background: var(--side);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
}
.side-top { display: flex; align-items: center; gap: 8px; padding: 14px 14px 6px; }
.brand { font-weight: 650; letter-spacing: 0.32em; font-size: 13px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); }
.instance { color: var(--muted); font-size: 12px; margin-left: auto; }
.side-actions { padding: 6px 10px 4px; display: grid; gap: 2px; }
.side-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--text); text-align: left; width: 100%;
}
.side-btn:hover { background: var(--surface); }
.side-btn { min-width: 0; overflow: hidden; }
.side-btn svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search {
  width: 100%; background: transparent; border: 0; outline: 0; padding: 0; color: var(--text);
}
.search::placeholder { color: var(--muted); }
.section-label { color: var(--faint); font-size: 12px; padding: 14px 20px 4px; }
.chats { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.chat-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); position: relative;
}
.chat-item:hover { background: var(--surface); }
.chat-item.active { background: var(--surface-2); color: var(--text); }
.chat-item .pip {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px;
  background: var(--accent); vertical-align: 1px;
}
.chat-item .pip.wait { background: var(--warn); }
.chat-item .hit { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.side-bottom { border-top: 1px solid var(--border); padding: 8px 10px; display: grid; gap: 2px; }
.side-bottom .side-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.view { display: contents; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 48px;
  color: var(--muted); font-size: 14px;
}
.topbar .title { color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.feed { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.feed-inner { max-width: 780px; min-width: 0; margin: 0 auto; padding: 8px 22px 28px; }
.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 22px 12vh;
}
.empty h1 { font-weight: 500; font-size: 30px; letter-spacing: -0.01em; margin: 0 0 26px; text-align: center; }

/* messages */
.msg-user { display: flex; justify-content: flex-end; margin: 22px 0 6px; }
.bubble {
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 24px 24px 8px 24px;
  max-width: 82%; white-space: pre-wrap; overflow-wrap: anywhere;
}
.turn { margin: 6px 0 4px; }
.md { overflow-wrap: anywhere; }
.md p { margin: 0.55em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.1em 0 0.4em; line-height: 1.3; font-weight: 620; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.07em; }
.md ul, .md ol { margin: 0.5em 0; padding-left: 1.4em; }
.md li { margin: 0.2em 0; }
.md code {
  font: 0.88em/1.4 var(--mono); background: var(--surface-2); padding: 0.12em 0.38em; border-radius: 6px;
}
.md pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  overflow-x: auto; margin: 0.7em 0; position: relative;
}
.md pre code { background: none; padding: 0; font-size: 13px; }
.md pre .lang { position: absolute; top: 6px; right: 10px; color: var(--faint); font: 11px var(--mono); }
.md blockquote { margin: 0.6em 0; padding-left: 12px; border-left: 3px solid var(--surface-3); color: var(--muted); }
.md table { border-collapse: collapse; margin: 0.7em 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--surface); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md .link { color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(189,215,70,.35); }

/* action feed */
.steps { margin: 6px 0; border-left: 1px solid var(--border); padding-left: 12px; }
.steps.single > summary { display: none; }
.steps.single { border-left: 0; padding-left: 0; }
.steps > summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: 13.5px; padding: 3px 0; margin-left: -13px;
  padding-left: 12px; display: flex; align-items: center; gap: 6px;
}
.steps > summary::-webkit-details-marker { display: none; }
.steps > summary::before { content: "›"; display: inline-block; width: 10px; transition: transform .15s; }
.steps[open] > summary::before { transform: rotate(90deg); }
.step { font-size: 13.5px; color: var(--muted); }
.step > summary {
  list-style: none; cursor: pointer; padding: 3px 0; display: flex; gap: 8px; align-items: baseline; min-width: 0;
}
.step > summary::-webkit-details-marker { display: none; }
.step .verb { color: var(--text-2); flex: none; }
.step .arg { font-family: var(--mono); font-size: 12.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.step .state { margin-left: auto; flex: none; font-size: 12px; color: var(--faint); }
.step .state.err { color: var(--danger); }
.step .state.run { color: var(--accent); }
.step pre {
  margin: 4px 0 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; max-height: 340px; overflow: auto; font: 12px/1.45 var(--mono); color: var(--text-2); white-space: pre-wrap;
}
.diff .add { color: #a6d26a; } .diff .del { color: #f08a80; }
.step.sub { margin-left: 14px; }

.permission {
  border: 1px solid var(--surface-3); background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0;
}
.permission .q { font-weight: 560; margin-bottom: 6px; }
.permission pre {
  font: 12.5px/1.45 var(--mono); background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 6px 0 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto;
}
.permission .row { display: flex; gap: 8px; flex-wrap: wrap; }
.permission .answered { color: var(--muted); font-size: 13.5px; margin-top: 6px; overflow-wrap: anywhere; }
.permission .note { margin-top: 10px; font-size: 12.5px; color: var(--faint); }
.btn {
  padding: 8px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--surface-3); color: var(--text);
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 560; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }

.done { color: var(--faint); font-size: 12.5px; margin: 6px 0 2px; }
.done.err { color: var(--danger); }
.thinking { color: var(--muted); font-size: 14px; margin: 8px 0; }
.thinking .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 1.2s infinite ease-in-out; vertical-align: 1px; }
@keyframes pulse { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
.caret::after { content: ""; display: inline-block; width: 7px; height: 1.05em; background: var(--accent); margin-left: 2px; vertical-align: -0.15em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* composer */
.composer-wrap { padding: 0 22px 18px; }
.composer-wrap.bottom { max-width: 824px; width: 100%; margin: 0 auto; }
.empty .composer-wrap { width: 100%; max-width: 760px; padding: 0; }
.composer {
  background: var(--surface); border: 1px solid var(--surface-3); border-radius: 22px; padding: 12px 12px 10px 16px;
  position: relative; box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.composer:focus-within { border-color: #4a4a4a; }
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent; max-height: 40vh; min-height: 26px;
  padding: 2px 0 8px; line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); }
.bar { display: flex; align-items: center; gap: 6px; }
.bar .grow { flex: 1; }
.round {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none;
}
.round:hover { background: var(--surface-2); color: var(--text); }
.round svg { width: 19px; height: 19px; }
.send { background: var(--accent); color: var(--accent-ink); }
.send:hover { background: var(--accent); filter: brightness(1.07); color: var(--accent-ink); }
.send:disabled { opacity: 1; background: var(--surface-3); color: var(--faint); }
.pill {
  height: 32px; padding: 0 10px; border-radius: 10px; color: var(--text-2); display: flex; align-items: center; gap: 6px; font-size: 14px;
}
.pill:hover { background: var(--surface-2); }
.pill .sub { color: var(--muted); }
.pill svg { width: 14px; height: 14px; color: var(--muted); }

.menu {
  position: absolute; z-index: 30; background: var(--menu); border: 1px solid var(--surface-3); border-radius: 14px;
  padding: 6px; min-width: 240px; box-shadow: 0 16px 48px rgba(0,0,0,.55); max-height: 60vh; overflow-y: auto;
}
.menu .item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; color: var(--text);
}
.menu .item:hover, .menu .item.sel { background: var(--surface-2); }
.menu .item .hint { color: var(--muted); font-size: 13px; margin-left: 6px; }
.menu .item .right { margin-left: auto; color: var(--muted); font-size: 13px; }
.menu .item .check { margin-left: auto; color: var(--accent); }
.menu .item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu .label { color: var(--faint); font-size: 12px; padding: 6px 10px 4px; }
.menu .item.soon { color: var(--faint); cursor: default; }
.menu .item.soon:hover { background: none; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-left: auto; }

/* limits */
.limits-ring { width: 22px; height: 22px; }
.limits-panel { min-width: 300px; padding: 12px 14px; }
.limits-panel .vendor { font-weight: 600; margin: 8px 0 6px; }
.limits-panel .win { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 8px 0; font-size: 13.5px; }
.limits-panel .win .when { color: var(--muted); font-size: 12.5px; }
.limits-panel .meter { grid-column: 1 / -1; height: 5px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.limits-panel .meter i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.limits-panel .none { color: var(--muted); font-size: 13.5px; }

/* feedback */
.seg { display: flex; width: 100%; background: var(--bg); border: 1px solid var(--surface-3); border-radius: 11px; padding: 3px; margin-bottom: 12px; }
.seg-item { flex: 1; padding: 6px 8px; white-space: nowrap; border-radius: 8px; color: var(--muted); font-size: 14px; }
.seg-item.on { background: var(--surface-2); color: var(--text); }
.modal .field { width: 100%; background: var(--bg); border: 1px solid var(--surface-3); border-radius: 12px; padding: 11px 12px; outline: 0; resize: vertical; }
.modal .field:focus { border-color: var(--accent); }
.modal .answered { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* threads */
.side-top.home { width: 100%; text-align: left; }
.section-label.inner { padding: 14px 10px 4px; }
.chat-item.cli { color: var(--muted); }
.chat-item .pip.live { background: var(--warn); }
.divider { text-align: center; color: var(--faint); font-size: 12px; margin: 18px 0; }
.readonly { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap;
  border: 1px solid var(--surface-3); background: var(--surface); border-radius: 18px; padding: 12px 16px; color: var(--muted); }

/* workplace browser card */
.browser-card {
  border: 1px solid var(--surface-3); background: var(--surface); border-radius: var(--radius); overflow: hidden;
  margin: 12px 0; display: flex; flex-direction: column; height: min(62vh, 560px); width: 100%;
}
.browser-card.control { border-color: var(--accent); }
.browser-card.full { position: fixed; inset: 10px; height: auto; z-index: 55; margin: 0; }
.browser-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; color: var(--muted); font-size: 13.5px; }
.browser-bar .grow { flex: 1; }
.browser-bar .btn { padding: 5px 10px; font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.browser-card iframe { flex: 1; border: 0; width: 100%; background: #000; }
.empty .browser-card { max-width: 760px; }

/* previews of HTML and SVG from answers (preview.js), drawn by their own origin */
.md pre.has-tools { padding-top: 36px; }
.md pre.has-tools .lang { top: 11px; right: 92px; }
.md pre .pre-btn {
  position: absolute; top: 6px; right: 6px; padding: 3px 11px; border-radius: 8px; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--surface-3); color: var(--text-2);
}
.md pre .pre-btn:hover { background: var(--surface-3); color: var(--text); }
.preview-card {
  border: 1px solid var(--surface-3); background: var(--surface); border-radius: var(--radius); overflow: hidden;
  margin: 0.7em 0; display: flex; flex-direction: column; height: min(60vh, 520px); width: 100%;
}
.preview-card.full { position: fixed; inset: 10px; height: auto; z-index: 55; margin: 0; }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; color: var(--muted); font-size: 13.5px; }
.preview-bar .grow { flex: 1; }
.preview-bar .btn { padding: 5px 10px; font-size: 13px; }
.preview-card iframe { flex: 1; border: 0; width: 100%; background: #fff; }

/* charts from answers (charts.js): Mermaid and Vega-Lite source drawn by the preview origin */
.chart-card {
  border: 1px solid var(--surface-3); background: var(--surface); border-radius: var(--radius); overflow: hidden;
  margin: 0.7em 0; display: flex; flex-direction: column; width: 100%;
}
.chart-card iframe { display: block; border: 0; width: 100%; height: var(--chart-h, 240px); background: var(--bg); }
.chart-card > pre { display: none; margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.chart-card.code > pre { display: block; }
.chart-card.code iframe { display: none; }
.chart-card .btn.on { color: var(--accent); border-color: var(--accent); }
.chart-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-card.failed .chart-note { color: var(--warn); }
.chart-card.full { position: fixed; inset: 10px; z-index: 55; margin: 0; width: auto; }
.chart-card.full iframe { flex: 1; height: auto; }
.chart-card.full > pre { flex: 1; overflow: auto; }

/* the main conversation and its threads */
.icon-btn.back { display: none; }
.shell.in-thread .icon-btn.back { display: grid; }
.chat-item.main-item { color: var(--text); font-weight: 520; margin-bottom: 4px; }
.hello { text-align: center; padding: 18vh 0 4vh; }
.hello h1 { font-weight: 500; font-size: 30px; letter-spacing: -0.01em; margin: 0 0 10px; }
.hello p { color: var(--muted); margin: 0; }
.thread-card {
  border: 1px solid var(--surface-3); background: var(--surface); border-radius: var(--radius);
  padding: 12px 16px; margin: 14px 0; display: grid; gap: 8px; justify-items: start;
}
.thread-card .head { display: flex; align-items: center; gap: 8px; width: 100%; }
.thread-card .head b { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.thread-card .state { color: var(--muted); font-size: 13px; margin-left: auto; flex: none; }
.thread-card .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.thread-card .pip.wait { background: var(--warn); }
.thread-card .md { color: var(--text-2); font-size: 14.5px; max-height: 9.5em; overflow: hidden; width: 100%; }
.thread-card .btn { padding: 5px 12px; font-size: 13px; }
.msg-task { border-left: 2px solid var(--accent); padding: 2px 0 2px 14px; margin: 18px 0 8px; color: var(--text-2); }
.msg-task .who { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.msg-task.agent { border-left-color: var(--surface-3); }
.msg-task.agent summary { cursor: pointer; list-style: none; }
.msg-task.agent summary::-webkit-details-marker { display: none; }
.msg-task.agent[open] summary { margin-bottom: 6px; }

/* sign-in */
.gate { display: grid; place-items: center; height: 100%; padding: 22px; }
.card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px;
}
.card h2 { margin: 0 0 6px; font-weight: 560; font-size: 21px; }
.card p { color: var(--muted); margin: 0 0 18px; }
.card .field {
  width: 100%; background: var(--bg); border: 1px solid var(--surface-3); border-radius: 12px; padding: 11px 12px; outline: 0; margin-bottom: 14px;
}
.card .field:focus { border-color: var(--accent); }
.card .btn { width: 100%; padding: 11px 14px; }
.card .error { color: var(--danger); font-size: 13.5px; margin-top: 12px; min-height: 1em; }
.card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: var(--side); border: 1px solid var(--surface-3); border-radius: 18px; padding: 22px; max-height: 86vh; overflow: auto; }
.modal h3 { margin: 0 0 14px; font-weight: 580; }
.device { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.device .meta { color: var(--muted); font-size: 12.5px; }
.device .grow { flex: 1; }
.copy-box { font: 12.5px var(--mono); background: var(--bg); border: 1px solid var(--surface-3); border-radius: 10px; padding: 10px; overflow-wrap: anywhere; margin: 10px 0; }

.banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40; background: #2a1715; color: #ffb3ab;
  border: 1px solid #4a2522; padding: 7px 14px; border-radius: 10px; font-size: 13.5px; display: none;
}
.banner.on { display: block; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--surface-3);
  padding: 8px 14px; border-radius: 10px; font-size: 13.5px; z-index: 60;
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 0 minmax(0, 1fr); }
  .shell.open { grid-template-columns: minmax(0, 1fr) 0; }
  .composer textarea { font-size: 16px; }
  .shell.open .main { display: none; }
  .feed-inner { padding: 6px 14px 22px; }
  .composer-wrap { padding: 0 10px 10px; }
  .empty h1, .hello h1 { font-size: 24px; }
  .bubble { max-width: 90%; }
}

/* Adding a device by QR */
.qr { display: block; width: min(240px, 66vw); height: auto; margin: 4px auto 12px; border-radius: 10px; }
.qr-bg { fill: #ffffff; }
.qr-fg { fill: #000000; }
.pair-qr.expired .qr { opacity: 0.2; }
.pair-left { color: var(--muted); font-size: 13px; align-self: center; }
.pair-code { color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 0.06em; font-weight: 620; }
.pair-code.big { font-size: 38px; text-align: center; margin: 4px 0 14px; }
.pair-ask { z-index: 60; }
