:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-2: #efeee9;
  --ink: #1f2723;
  --muted: #64706a;
  --line: #d7d8d2;
  --accent: #2e7d6b;
  --accent-2: #315f9d;
  --warn: #8f580a;
  --bad: #ba3d3d;
  --good: #2f7d4f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

/* min-height, not height: pages that now render a .session-header as a sibling
   of #app (device/admin-usage) would otherwise force #app to exactly 100% of
   the viewport ON TOP OF the header's own height, overflowing the page. */
#app {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button[data-active="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  grid-template-rows: minmax(0, 1fr) 220px;
  height: 100%;
  min-width: 960px;
}

.runtime-shell {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  height: 100%;
  min-width: 0;
}

.top-tabs {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
}

.top-tabs > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-tabs span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.top-tabs nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0;
}

.top-tab {
  min-width: 92px;
}

.two-column {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 0;
}

.left-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 16px;
}

.left-panel h2,
.panel-header h2,
.manager-drawer h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

.list-button {
  display: block;
  height: auto;
  margin-bottom: 8px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.list-button strong,
.list-button span {
  display: block;
}

.list-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
}

.chat-panel,
.project-shell {
  min-height: 0;
  overflow: hidden;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 16px;
}

.panel-header,
.workspace-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.context-pill {
  background: #e7f0ec;
  border: 1px solid rgba(46, 125, 107, 0.24);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  max-width: 460px;
  overflow-wrap: anywhere;
  padding: 6px 10px;
}

.workspace-layout,
.admin-layout {
  height: 100%;
}

.project-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.project-panel {
  display: grid;
  grid-template-rows: auto 38vh minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
}

.project-graph {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
  min-height: 260px;
}

.history-panel {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  min-height: 0;
  overflow: hidden;
  padding: 14px 0;
}

.project-shell[data-manager-open="true"] .history-panel {
  grid-template-columns: minmax(0, 1fr);
}

.history-panel > div,
.chat-history {
  min-height: 0;
  overflow: auto;
}

.chat-message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.chat-message[data-role="system"],
.chat-message[data-role="event"] {
  background: #f1f0ea;
}

.chat-message header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.chat-message header span,
.chat-message small {
  color: var(--muted);
  font-size: 12px;
}

.chat-message p {
  line-height: 1.45;
  margin: 8px 0 0;
}

.composer {
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.composer label,
.composer span,
.composer textarea {
  display: block;
  width: 100%;
}

.composer span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.composer textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 72px;
  padding: 10px;
  resize: vertical;
}

.manager-drawer {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 16px;
  width: 380px;
}

.compact-event {
  grid-template-columns: 160px 130px minmax(220px, 1fr);
  font-size: 12px;
  min-width: 540px;
}

.playback-status {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}

.sidebar,
.details,
.timeline {
  background: var(--panel);
  border-color: var(--line);
}

.sidebar {
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 16px;
}

.graph-region {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-color: #fbfbf8;
  background-size: 28px 28px;
}

.static-graph {
  max-width: 100%;
  width: 100% !important;
}

.static-graph-inner {
  min-width: max-content;
}

.details {
  border-left: 1px solid var(--line);
  overflow: auto;
  padding: 16px;
}

.timeline {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
}

.section-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  margin: 0 0 10px;
}

.template-button,
.run-button {
  width: 100%;
  text-align: left;
  display: block;
  margin-bottom: 8px;
  padding: 10px;
  height: auto;
}

.template-button strong,
.run-button strong {
  display: block;
  font-size: 14px;
}

.template-button span,
.run-button span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 4px;
}

.toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.graph-content {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.edge-layer {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.edge-path {
  fill: none;
  stroke: #8b9690;
  stroke-width: 2;
}

.edge-path[data-back-edge="true"] {
  stroke-dasharray: 6 5;
  opacity: 0.45;
}

.edge-path[data-status="active"] {
  stroke: var(--accent-2);
  stroke-width: 3;
}

.edge-path[data-status="traversed"] {
  stroke: var(--good);
  stroke-width: 3;
}

.edge-path[data-status="failed"] {
  stroke: var(--bad);
  stroke-width: 3;
}

.node {
  position: absolute;
  width: 190px;
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(31, 39, 35, 0.08);
  padding: 14px 14px;
  cursor: pointer;
  overflow: visible;
}

.node[data-selected="true"] {
  outline: 3px solid rgba(46, 125, 107, 0.24);
  border-color: var(--accent);
}

.node[data-visual-state="not-reached"] {
  background: #f4f4f0;
  color: #737d78;
  border-color: #d7d8d2;
}

.node[data-visual-state="work-in-progress"] {
  background: #e9f1fb;
  border-color: var(--accent-2);
}

.node[data-visual-state="done"] {
  background: #e9f5ed;
  border-color: var(--good);
}

.node[data-status="failed"] {
  background: #f8e8e8;
  border-color: var(--bad);
}

.node[data-visual-state="human-escalation"] {
  background: #fff2dc;
  border-color: var(--warn);
  border-radius: 999px;
}

.node[data-emphasis="human"],
.node[data-emphasis="review"] {
  box-shadow: 0 0 0 2px rgba(46, 125, 107, .16), 0 12px 24px rgba(31, 39, 35, .1);
}

.node[data-status="skipped"] {
  opacity: 0.72;
}

.node[data-visual-state="work-in-progress"]::after {
  animation: pulse-star 1.1s ease-in-out infinite;
  color: var(--accent-2);
  content: "✦";
  font-size: 22px;
  line-height: 1;
  position: absolute;
  right: -10px;
  top: -12px;
}

.node-title {
  font-weight: 650;
  font-size: 14px;
  overflow-wrap: anywhere;
}

@keyframes pulse-star {
  0%, 100% { transform: scale(0.75) rotate(-8deg); opacity: 0.65; }
  50% { transform: scale(1.28) rotate(8deg); opacity: 1; }
}

@media (max-width: 1099px) {
  html,
  body,
  #app {
    min-width: 0;
    overflow-x: hidden;
  }

  .runtime-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .top-tabs {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }

  .top-tabs nav {
    width: 100%;
  }

  .top-tab {
    flex: 0 0 auto;
  }

  .two-column {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: auto;
  }

  .left-panel {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    max-height: none;
  }

  .project-shell {
    display: block;
    overflow: visible;
  }

  .project-panel {
    grid-template-rows: auto 320px auto auto;
    overflow: visible;
  }

  .history-panel {
    grid-template-columns: 1fr;
  }

  .manager-drawer {
    bottom: 0;
    box-shadow: 0 -12px 40px rgba(31, 39, 35, 0.18);
    left: 0;
    max-height: 86vh;
    overflow: auto;
    position: fixed;
    right: 0;
    top: auto;
    width: auto;
    z-index: 20;
  }
}

@media (max-width: 560px) {
  .left-panel,
  .project-panel,
  .chat-panel,
  .manager-drawer {
    padding: 12px;
  }

  .panel-header {
    display: block;
  }

  .context-pill {
    display: inline-block;
    margin-top: 8px;
    max-width: 100%;
  }

  .project-panel {
    grid-template-rows: auto 300px auto auto;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-wrap: wrap;
    max-width: calc(100% - 24px);
  }

  .graph-region {
    overflow: auto;
  }
}

.badge {
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  padding: 2px 7px;
}

.badge[data-kind="entry"] {
  background: rgba(46, 125, 107, 0.12);
  color: var(--accent);
}

.field {
  margin-bottom: 14px;
}

.field dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.field dd {
  margin: 0;
  overflow-wrap: anywhere;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #272d2a;
  color: #f5f2e9;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
}

.playback {
  padding: 16px;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.playback-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.events {
  overflow: auto;
  padding: 12px 16px;
}

.event-row {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  display: grid;
  grid-template-columns: 180px 150px minmax(0, 1fr);
  gap: 12px;
  font-size: 13px;
}

.event-row[data-active="true"] {
  background: rgba(46, 125, 107, 0.08);
}

.event-row span {
  overflow-wrap: anywhere;
}

.state-message {
  margin: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.state-message.compact {
  margin: 0;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.login-shell {
  align-content: center;
  align-items: center;
  display: grid;
  min-height: 100%;
  padding: 24px;
}

/* Browser QA C3: the console title sits with the Login/Register controls, centred above them. */
.login-shell > .eyebrow {
  margin: 0 0 10px;
  text-align: center;
}

.auth-entry-switch {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 0 auto 14px;
}

.auth-entry-switch button {
  min-width: 120px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 420px;
  padding: 28px;
  width: min(100%, 420px);
}

.login-card h1,
.l2-topbar h1,
.l2-panel-title h2,
.prompt-header h2 {
  letter-spacing: 0;
  margin: 0;
}

.login-card label,
.prompt-form label {
  display: grid;
  gap: 6px;
}

.login-card input,
.prompt-form textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-width: 0;
  padding: 10px 12px;
}

.login-card button,
.prompt-form button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.login-card button:disabled,
.prompt-form button:disabled,
.prompt-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-error {
  color: var(--bad);
  min-height: 20px;
  margin: 0;
}

.form-hint {
  color: var(--muted);
  font-size: 0.85em;
  margin: -8px 0 0;
}

.form-notice {
  color: var(--ink);
  margin: 0;
}

.form-switch {
  color: var(--muted);
  margin: 0;
  text-align: center;
}

.oauth-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  justify-content: center;
  padding: 10px 12px;
  width: 100%;
}

.oauth-button:hover:not(:disabled) {
  border-color: var(--accent);
}

.oauth-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.console-admin-tools {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 18px;
}

.console-admin-tools h2 {
  margin: 0;
}

.console-admin-tools-search {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.console-admin-tools-search label {
  display: grid;
  flex: 1 1 240px;
  gap: 6px;
}

.console-admin-tools-search input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-width: 0;
  padding: 10px 12px;
}

.console-admin-tools-search button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.console-admin-tools-search button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.console-admin-tools-result {
  overflow-x: auto;
}

.admin-tools-table {
  border-collapse: collapse;
  margin-top: 10px;
  width: 100%;
}

.admin-tools-table th,
.admin-tools-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.admin-tools-table th {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-tools-table button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.home-shell {
  align-items: start;
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 860px;
  padding: 18px 18px 28px;
}

.session-header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding: 14px 18px;
}

.session-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-header-user {
  margin: 0;
}

.session-header-action {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  text-decoration: none;
}

.session-header-action:hover {
  border-color: var(--accent);
}

.session-header-logout {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.home-hero {
  display: grid;
  gap: 6px;
}

.home-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}

.home-tools,
.home-how-to {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.home-tool {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  text-decoration: none;
}

.home-tool:hover {
  border-color: var(--accent);
}

.home-tool span {
  color: var(--muted);
  font-size: 13px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-action {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  min-height: 34px;
  padding: 0 12px;
  text-decoration: none;
}

.home-action:hover {
  border-color: var(--accent);
}

.device-code-display {
  background: #f4f8f6;
  border: 1px solid rgba(46, 125, 107, 0.28);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 14px;
  text-align: center;
}

.device-code-display span {
  color: var(--muted);
  font-size: 12px;
}

.device-code-display strong {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 26px;
  overflow-wrap: anywhere;
}

.form-divider {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto 1fr;
  margin: 0;
}

.form-divider::before,
.form-divider::after {
  background: var(--line);
  content: "";
  height: 1px;
}

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.link-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.l2-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-width: 0;
}

.l2-topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 16px;
}

.l2-session {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.l2-session > span:first-child {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.l2-status {
  background: #fff8e8;
  border-bottom: 1px solid #ead7ab;
  color: #6a4b12;
  padding: 8px 16px;
}

.quota-banner {
  align-items: center;
  background: #fceeee;
  border-bottom: 1px solid rgba(186, 61, 61, 0.32);
  color: #742323;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 16px;
}

.quota-banner button {
  border-color: rgba(186, 61, 61, 0.35);
}

.device-access-overlay {
  align-items: flex-start;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  overflow: auto;
  padding: 48px 16px;
  position: fixed;
  z-index: 50;
}

.device-access-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.25);
  display: grid;
  gap: 14px;
  max-width: 560px;
  padding: 20px;
  width: 100%;
}

.device-field {
  display: grid;
  gap: 6px;
}

.device-field > span {
  font-weight: 600;
}

.device-field-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.device-field-row input {
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-width: 0;
}

.device-caption {
  color: var(--muted, #555);
  font-size: 0.9em;
}

.device-caption code,
.device-access-card code {
  word-break: break-all;
}

.device-actions {
  display: flex;
  gap: 8px;
}

.device-regenerate {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.l2-body {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 0;
}

.l2-left,
.l2-main {
  min-width: 0;
  overflow: auto;
  padding: 16px;
}

.l2-left {
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.l2-panel-title,
.prompt-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.project-selector-list {
  display: grid;
  gap: 8px;
}

.project-selector-item {
  align-items: flex-start;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  justify-items: start;
  min-height: 56px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.project-selector-item small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.project-prompt {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  min-height: 100%;
  padding: 16px;
}

.prompt-form {
  display: grid;
  gap: 10px;
}

.prompt-results {
  display: grid;
  gap: 10px;
}

.prompt-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.prompt-result > div {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.prompt-result time {
  color: var(--muted);
  font-size: 12px;
}

.prompt-result[data-status="error"] {
  border-color: rgba(186, 61, 61, 0.45);
}

/* DX-2 Item 1 — paused runs (engine __paused__ / member attention_needed)
 * get a distinct yellow border + banner block so the operator sees the
 * escalation instead of staring at a "pending" status forever. */
.prompt-result[data-status="paused"] {
  background: rgba(214, 158, 46, 0.06);
  border-color: rgba(214, 158, 46, 0.55);
}

.paused-banner {
  background: rgba(214, 158, 46, 0.12);
  border-left: 3px solid rgba(214, 158, 46, 0.8);
  border-radius: 4px;
  color: #604200;
  font-size: 13px;
  margin: 8px 0 6px;
  padding: 8px 10px;
}

.paused-banner .paused-step {
  margin: 0 0 4px;
}

.paused-banner .paused-step code {
  background: rgba(214, 158, 46, 0.18);
  border-radius: 3px;
  padding: 1px 5px;
}

.paused-banner .paused-members {
  list-style: disc inside;
  margin: 4px 0 0;
  padding: 0;
}

/* DX-3 fixup — live-viz progress block. Replaces the DX-3 v1 linear
 * `<progress>` bar (deleted this commit) with a per-step viz: a
 * tier-colored header label + one row per completed step (green
 * check + actual duration) + the current step row (yellow/red
 * border + subtle pulsing animation when the step has overrun its
 * estimate).
 */
.live-viz {
  margin: 8px 0 10px;
  border-radius: 6px;
  border: 1px solid var(--panel-2);
  background: var(--panel-1, var(--panel-2));
  padding: 6px 10px;
}

.live-viz-header {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 2px 0 4px;
}

.live-viz-header[data-tier="warn"] {
  color: var(--warn);
}

.live-viz-header[data-tier="bad"] {
  color: var(--bad);
}

.live-viz-steps {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 4px;
  border-left: 3px solid transparent;
}

.step-row.completed {
  color: var(--muted);
  border-left-color: var(--ok, #2ea043);
}

.step-row.completed .step-icon {
  color: var(--ok, #2ea043);
}

.step-row.failed {
  color: var(--bad);
  border-left-color: var(--bad);
}

.step-row.failed .step-icon {
  color: var(--bad);
}

.step-row.current {
  border-left-color: var(--accent);
  background: var(--panel-2);
}

.step-row.current.pulse-ok {
  border-left-color: var(--accent);
}

.step-row.current.pulse-warn {
  border-left-color: var(--warn);
  animation: live-viz-pulse 1.6s ease-in-out infinite;
}

.step-row.current.pulse-bad {
  border-left-color: var(--bad);
  animation: live-viz-pulse 1.1s ease-in-out infinite;
}

.step-row.current.pulse-paused {
  border-left-color: var(--warn);
}

.step-row.current .step-icon {
  color: var(--accent);
}

.step-row .step-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-row .step-duration,
.step-row .step-progress,
.step-row .step-error {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.step-row .step-attention {
  grid-column: 1 / -1;
  color: var(--warn);
  font-size: 11px;
  padding-left: 20px;
}

@keyframes live-viz-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@media (max-width: 760px) {
  .l2-topbar,
  .l2-session,
  .l2-panel-title,
  .prompt-header {
    align-items: stretch;
    flex-direction: column;
  }

  .l2-body {
    grid-template-columns: 1fr;
  }

  .l2-left {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }
}

/* TXL-ui — admin transaction-log page */
.txl-page {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.txl-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.txl-form label {
  display: grid;
  gap: 4px;
}

.txl-form label span {
  color: var(--muted);
  font-size: 12px;
}

.txl-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  min-height: 32px;
}

.txl-status {
  color: var(--muted);
  min-height: 18px;
}

.txl-status-bad {
  color: var(--bad);
}

.txl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.txl-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--panel);
}

.txl-chip-complete { border-color: var(--good); }
.txl-chip-stuck { border-color: var(--warn); }
.txl-chip-dropped { border-color: var(--bad); }
.txl-chip-fnf { border-color: var(--line); }

.txl-window {
  margin: 4px 0 0;
}

.txl-table {
  border-collapse: collapse;
  width: 100%;
}

.txl-table th,
.txl-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.txl-table thead th {
  background: var(--panel-2);
}

.txl-row {
  cursor: pointer;
}

.txl-row:hover {
  background: var(--panel-2);
}

.txl-row-dropped td {
  border-color: var(--bad);
}

.txl-row-stuck td {
  border-color: var(--warn);
}

.txl-detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.txl-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.txl-detail-body {
  background: var(--panel-2);
  border-radius: 6px;
  max-height: 400px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.admin-nav-link {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  min-height: 32px;
  padding: 0 10px;
  text-decoration: none;
}

.admin-nav-link:hover {
  border-color: var(--accent);
}

.usage-progress-track {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 12px;
  margin-bottom: 4px;
  overflow: hidden;
  width: min(280px, 100%);
}

.usage-progress-fill {
  border-radius: 999px;
  height: 100%;
  min-width: 4px;
}

.usage-progress-fill[data-usage-tone="green"] {
  background: var(--good);
}

.usage-progress-fill[data-usage-tone="amber"] {
  background: var(--warn);
}

.usage-progress-fill[data-usage-tone="red"] {
  background: var(--bad);
}

.usage-page th,
.usage-page td,
.admin-usage-table th,
.admin-usage-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.usage-tier-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
}

.admin-usage-controls {
  align-items: flex-end;
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-usage-config {
  border: 1px solid var(--line);
  margin-bottom: 10px;
  padding: 10px;
}

.admin-usage-config-form {
  align-items: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-usage-config-form label {
  display: grid;
  gap: 4px;
}

.admin-usage-controls label {
  display: grid;
  gap: 4px;
}

.admin-usage-controls input {
  max-width: 170px;
}

.admin-usage-services {
  margin: 0;
  padding-left: 18px;
}

.admin-usage-services li {
  list-style: square;
}

.admin-usage-tier-row,
.admin-usage-limit-row {
  align-items: start;
  display: grid;
  gap: 6px;
}

.mail-mailbox-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mail-message-host {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.mail-thread {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.mail-message-half {
  display: grid;
  gap: 4px;
}

.mail-message-half p {
  white-space: pre-wrap;
}

.mail-messages {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mail-message-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: block;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.mail-message-row:hover {
  border-color: var(--accent);
}

.mail-thread-view {
  display: grid;
  gap: 12px;
}

.mail-compose {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 16px;
}

.mail-compose label {
  display: grid;
  gap: 6px;
}

.mail-compose input,
.mail-compose textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-width: 0;
  padding: 10px 12px;
}

.mail-compose textarea {
  min-height: 80px;
}

.mail-compose button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  justify-self: start;
}

.running-devices {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.running-device {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.running-device pre {
  background: var(--panel-2);
  color: var(--ink); /* Argon r10 P1-1: the global pre colour is for its dark background */
  border-radius: 6px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.sites-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

/* Links site-wide: never the browser's default blue/underline (QA G2); visible focus (G3). */
a {
  color: var(--accent-2);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Selected tab, wherever role="tab" is used (console panes, mailboxes, admin tabs). */
[role="tab"][aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Shared navigation of the static pages (mediator/assets/site/site-nav.js). */
.site-nav {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  padding: 8px 16px;
}

.site-nav-links,
.site-nav-admin,
.site-nav-account {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.site-nav-user {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* Static pages (/profile, /admin/*): readable width, tables that scroll inside their box at phone width. */
.site-page {
  margin: 0 auto;
  max-width: 1100px;
  padding: 16px;
}

.site-page h1 {
  font-size: 24px;
  margin: 8px 0 12px;
}

.site-page h2 {
  font-size: 18px;
  margin: 20px 0 8px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  max-width: 100%;
  overflow-x: auto;
}

.site-page table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.site-page th,
.site-page td {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.site-page th {
  background: var(--panel-2);
  font-weight: 600;
  white-space: nowrap;
}

.site-page td {
  /* break-word, not anywhere: anywhere shrinks a column to word fragments ("recor|ded") instead of letting the box scroll. */
  overflow-wrap: break-word;
}

.site-page pre {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.site-page [role="status"],
.site-page .status {
  color: var(--muted);
}

/* Owner round 10 (Argon P2-3, P2-4, P1-2): admin sessions' prompt form on one aligned row, its job status keeps its
   lines, the console's pane list stays at the top, the cost page's wide tables get the page's full width. */
#prompt { align-items: start; }
#prompt label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 6px; align-self: center; }
#job { white-space: pre-wrap; }
.left-panel { align-self: start; }
.site-page.wide { max-width: none; }

.site-page form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-page form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-page input,
.site-page select,
.site-page textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  max-width: 100%;
  padding: 6px 8px;
}

.site-page textarea {
  min-height: 80px;
  width: min(100%, 520px);
}

/* UC2: recent conversation of the selected session (/sessions). */
.conversation {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.conversation li {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}

.conversation-head {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 4px;
}

.conversation pre {
  margin: 0;
  max-height: 16em;
  overflow: auto;
}

/* UC3: scheduled prompts of the selected session (/sessions). */
.site-page fieldset {
  border: 1px solid var(--line);
  margin: 0;
  padding: 6px 10px;
  width: min(100%, 520px);
}

.site-page fieldset label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

#schedule-every {
  width: 5em;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#schedules .row-actions {
  flex-wrap: nowrap; /* Run now, Disable, Delete on one line (Argon visual r5 P2-11) */
}

#schedules .row-actions button {
  white-space: nowrap; /* "Run now" on one line too (Argon re-check r7) */
}

/* the shell is on another machine: the selected session's row is not highlighted next to it (Argon re-check r7) */
.tree.shell-elsewhere [aria-selected="true"] > .tree-row {
  border-color: var(--line);
  box-shadow: none;
}

.ns-archived {
  margin-top: 8px;
}

.ns-archived > summary {
  color: var(--muted);
  cursor: pointer;
}

#back-to-search {
  margin-right: 6px;
}

.site-nav-org select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 30px;
  padding: 2px 6px;
}

/* UC4: sessions that need attention (/sessions). */
.attention-summary {
  font-weight: 600;
}

tr.needs-attention td:first-child {
  box-shadow: inset 4px 0 0 #b3261e;
}

tr.attention-stalled td:first-child,
tr.attention-offline td:first-child {
  box-shadow: inset 4px 0 0 #b26a00;
}

.attention-reason {
  color: var(--muted);
}

.nav-badge {
  background: #b3261e;
  border-radius: 9px;
  color: #fff;
  font-size: 12px;
  margin-left: 4px;
  padding: 0 6px;
}

.inline-check {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

/* UC1 v2: /sessions as a chat. Left: sites, filter, sessions. Right: the conversation and the composer. */
.sr-only {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.site-page:has(.sessions-layout) {
  max-width: 1280px;
}

.sessions-layout {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
}

.sessions-side h2,
.chat-header h2 {
  font-size: 16px;
  margin: 12px 0 6px;
}

.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pick-list li + li {
  margin-top: 4px;
}

.pick {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px 8px;
  grid-template-columns: auto 1fr auto;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.pick[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.pick-name {
  grid-column: 1 / 3;
  overflow-wrap: anywhere;
}

.pick .dot + .sr-only + .pick-name {
  grid-column: 2 / 3;
}

.pick-detail {
  color: var(--muted);
  font-size: 13px;
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.dot.online {
  color: var(--good);
}

.dot.offline {
  color: var(--bad);
}

.badge {
  border-radius: 9px;
  font-size: 12px;
  padding: 1px 7px;
  white-space: nowrap;
}

.badge-stuck,
.badge-failed {
  background: #f6dada;
  color: #8a1f1f;
}

.badge-stalled,
.badge-offline {
  background: #f7e7cc;
  color: #7a4b07;
}

.badge-running {
  background: #dbe8f6;
  color: #1e4a7d;
}

.badge-idle,
.badge-unknown {
  background: #e6ece8;
  color: #39443e;
}

.session-list li.needs-attention .pick {
  box-shadow: inset 4px 0 0 var(--bad);
}

.session-list li.attention-stalled .pick,
.session-list li.attention-offline .pick {
  box-shadow: inset 4px 0 0 var(--warn);
}

.filter label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.chat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: 12px 14px;
}

.chat-empty {
  color: var(--muted);
}

.chat-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.chat-header h2 {
  margin-top: 0;
  overflow-wrap: anywhere;
}

.chat-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0;
}

.chat-state {
  border-radius: 6px;
  display: inline-block;
  font-size: 13px;
  margin: 4px 0 0;
  padding: 2px 8px;
}

.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 10px 0;
  max-height: 60vh;
  min-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.msg {
  border-radius: 12px;
  max-width: min(78%, 720px);
  padding: 8px 12px;
}

.msg-head {
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
  margin: 0 0 4px;
}

.msg-role {
  font-weight: 600;
}

.msg-time {
  color: var(--muted);
}

.msg-text {
  font-family: inherit;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg-request {
  align-self: flex-end;
  background: #e3efe9;
  border: 1px solid #b9d6c9;
}

.msg-response {
  align-self: flex-start;
  background: #f1f2ee;
  border: 1px solid var(--line);
}

.msg-error {
  align-self: flex-start;
  background: #fbeaea;
  border: 1px solid #e3b5b5;
  color: #7b1f1f;
}

.msg-sending {
  opacity: 0.7;
}

.msg-failed {
  border-style: dashed;
}

.msg-working {
  align-self: flex-start;
  color: var(--muted);
  font-size: 14px;
}

.msg-working .dots {
  animation: lmctl-pulse 1.2s ease-in-out infinite;
  letter-spacing: 2px;
  margin-right: 6px;
}

@keyframes lmctl-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.conversation-state {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.site-page form.composer {
  align-items: stretch;
  border-top: 1px solid var(--line);
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px;
  padding-top: 10px;
}

.site-page form.composer[hidden] {
  display: none;
}

.site-page form.composer label {
  font-weight: 600;
}

.site-page form.composer textarea {
  min-height: 72px;
  resize: vertical;
  width: 100%;
}

.composer-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.composer-reason {
  color: var(--warn);
  font-size: 13px;
  margin: 0;
}

.composer-row button {
  margin-left: auto;
}

.composer-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

#schedule,
.followup {
  margin-top: 14px;
}

.followup-list {
  columns: 2 260px;
  list-style: none;
  padding: 0;
}

@media (max-width: 800px) {
  .sessions-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .msg {
    max-width: 92%;
  }

  .messages {
    max-height: 70vh;
  }
}

.site-page .messages pre.msg-text {
  background: none;
  border: 0;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  max-height: none;
  padding: 0;
}

.msg-tools {
  align-self: flex-start;
  color: var(--muted);
  font-size: 13px;
  max-width: min(90%, 760px);
  padding: 0 4px;
}

.msg-tools summary {
  cursor: pointer;
}

.tool-head {
  font-size: 12px;
  margin: 6px 0 2px;
}

.site-page .messages pre.tool-text {
  background: none;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  margin: 0;
  max-height: 12em;
  overflow: auto;
  padding: 0 0 0 8px;
  white-space: pre-wrap;
}

.history-mark {
  display: none;
}


/* ---- Argon visual QA fixes for /sessions (2026-10-27) ------------------------------------------------------- */
/* P0-1: on the static site pages the document scrolls (the console app shell keeps its full-height layout). */
html:has(.site-page),
body:has(.site-page) {
  height: auto;
  min-height: 100%;
}

@media (max-width: 1099px) {
  html:has(.site-page),
  body:has(.site-page) {
    overflow-x: clip;
  }
}

/* P0-3: dark scheme for /sessions (tokens and the hard-coded fills). */
:root:has(.sessions-layout) {
  color-scheme: light dark;
  --panel-2: #f1f2ee;
}

@media (prefers-color-scheme: dark) {
  :root:has(.sessions-layout) {
    --bg: #111614;
    --panel: #18201d;
    --panel-2: #222c28;
    --ink: #e7ece9;
    --muted: #9aa8a1;
    --line: #2e3b36;
    --accent: #4db39b;
    --warn: #f0ad4e;
    --bad: #f27474;
    --good: #5cc28a;
  }

  :root:has(.sessions-layout) .msg-request { background: #19332b; border-color: #2b5649; }
  :root:has(.sessions-layout) .msg-response { background: #202925; border-color: var(--line); }
  :root:has(.sessions-layout) .msg-error,
  :root:has(.sessions-layout) .msg-failed { background: #381a1a; border-color: #6e2c2c; color: #f9b4b4; }
  :root:has(.sessions-layout) .badge-stuck,
  :root:has(.sessions-layout) .badge-failed { background: #4a1f1f; color: #f7b8b8; }
  :root:has(.sessions-layout) .badge-stalled,
  :root:has(.sessions-layout) .badge-offline,
  :root:has(.sessions-layout) .badge-running { background: #1d3550; color: #b5d3f5; }
  :root:has(.sessions-layout) .badge-idle,
  :root:has(.sessions-layout) .badge-unknown { background: #26302c; color: #c9d3ce; }
  :root:has(.sessions-layout) .site-page .composer-reason:not(:empty) { background: #3a2c12; color: #f5d39b; }
  :root:has(.sessions-layout) input,
  :root:has(.sessions-layout) select,
  :root:has(.sessions-layout) textarea { background: var(--panel-2); color: var(--ink); }
}

/* P0-4: a primary Send, and disabled buttons that look disabled. */
.site-page button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

.site-page #send {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 6px 18px;
}

.site-page form.composer textarea[readonly] {
  background: var(--panel-2);
  color: var(--muted);
  cursor: not-allowed;
}

/* P1-5: the reason Send is off is a visible warning, not muted grey. */
.site-page .composer-reason:not(:empty) {
  background: #fdf3e1;
  border-left: 3px solid var(--warn);
  border-radius: 4px;
  color: #6e4200;
  font-weight: 500;
  padding: 4px 8px;
}

.site-page .attention-summary {
  color: var(--ink);
}

/* The page waits behind this when the sign-in has run out (owner report, 7 Nov). */
.site-page .signin-again {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 600;
}
.site-page .signin-again[hidden] {
  display: none;
}
.site-page .auth-wait {
  margin: 0 0 12px;
  color: var(--ink);
}
.site-page .auth-wait[hidden] {
  display: none;
}

/* P1-7: prose wraps at words; fenced code in a monospace block. */
.site-page .messages pre.msg-text {
  overflow-wrap: break-word;
}

.site-page .messages pre.msg-code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  margin: 6px 0;
  max-height: 24em;
  overflow: auto;
  padding: 8px 10px;
  white-space: pre;
}

/* P1-8: an opened tool-steps group is a panel. */
.msg-tools details[open] {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
}

/* P1-9: a session held in a terminal. */
/* P1-10: a request that was not sent. */
.msg-failed {
  background: #fdf2f2;
  border-color: var(--bad);
  border-style: solid;
}

/* P0-2: on phones, a way back from the chat to the list. */
.back-to-sessions {
  display: none;
  font-size: 14px;
  margin-bottom: 6px;
}

@media (max-width: 800px) {
  .back-to-sessions {
    display: inline-block;
  }

  .chat-header {
    padding-bottom: 6px;
  }
}

/* P2-13: the schedule and follow-up forms as columns. */
.site-page #schedule-form,
.site-page #followup-form {
  align-items: flex-start;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
}

/* P2-12: the history status sits in the header. */
.chat-header .conversation-state {
  margin: 4px 0 0;
}

@media (max-width: 800px) {
  .chat {
    min-height: 0;
  }
}


/* ---- Argon review of the production screenshots (2026-10-27) ---------------------------------------------- */
/* P0-1: on a phone the whole chat (header, messages, composer with Send) fits one screen when it is scrolled in. */
@media (max-width: 800px) {
  .messages {
    max-height: calc(100dvh - 380px);
    min-height: 160px;
  }

  .chat-meta {
    font-size: 12px;
  }

  /* P2-9: no tall empty card under the list before a session is chosen */
  #chat:has(#chat-empty:not([hidden])) {
    min-height: 0;
    padding: 10px 14px;
  }

  #chat:has(#chat-empty:not([hidden])) .messages {
    display: none;
  }
}

/* P2-9: the empty state centred on wide screens */
.chat-empty {
  margin: auto;
  text-align: center;
}

/* P2-8: a real button back to the list */
.back-to-sessions {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 600;
  min-height: 36px;
  padding: 4px 10px;
  text-decoration: none;
}

@media (max-width: 800px) {
  .back-to-sessions {
    display: inline-flex;
  }
}

/* P2-10: the composer is a section of the chat card, not a box inside it */
.site-page form.composer {
  background: transparent;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  padding: 10px 0 0;
}

/* P1-3: a disabled Send is neutral and legible, not a washed-out green */
.site-page #send:disabled {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--muted);
  opacity: 1;
}

/* P1-7: a locked box is compact */
.site-page form.composer textarea[readonly] {
  height: 44px;
  min-height: 44px;
  resize: none;
}

/* P1-5: loading placeholder inside the messages */
.msg-loading {
  align-self: center;
  color: var(--muted);
  font-size: 14px;
  margin: auto 0;
}

@media (prefers-color-scheme: dark) {
  /* P1-3: links and Send readable in dark mode */
  :root:has(.sessions-layout) {
    --accent-2: #7ab3ef;
  }

  :root:has(.sessions-layout) .site-page #send:not(:disabled) {
    color: #0c1f1a;
  }

  :root:has(.sessions-layout) a {
    color: var(--accent-2);
  }
}

/* the schedule and follow-up prompts use the card's width (narrow on phones before) */
.site-page #schedule-form label,
.site-page #followup-form label {
  width: 100%;
}

.site-page #schedule-text,
.site-page #followup-text {
  width: 100%;
}

/* UC5: start a new session (/sessions) */
.side-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.small-button {
  font-size: 14px;
  min-height: 30px;
  padding: 0 10px;
}

#chat.creating > :not(#new-session) {
  display: none !important;
}

.site-page #new-session-form {
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}

.site-page #new-session-form select,
.site-page #new-session-form input,
.site-page #new-session-form textarea {
  width: 100%;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 0;
}

.field-hint.warn {
  color: var(--warn);
  font-weight: 600;
}

.ns-list .ns-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 2px 8px;
  grid-template-columns: 1fr auto;
  padding: 8px 10px;
}

.ns-row .pick-detail,
.ns-row .row-actions {
  grid-column: 1 / -1;
}

.ns-row .badge {
  align-self: start;
  justify-self: end;
}

/* UC6: search in conversations (/sessions) */
#chat.searching > :not(#search-results) {
  display: none !important;
}

.search-box form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.search-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-session {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
}

.search-head {
  font-weight: 600;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.site-page .search-hit {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  display: block;
  padding: 6px 0;
  text-align: left;
  width: 100%;
}

.search-hit .msg-role {
  color: var(--muted);
  font-size: 12px;
}

.search-snippet {
  margin: 2px 0 0;
  overflow-wrap: break-word;
}

.search-snippet mark {
  background: #fff1a8;
  color: inherit;
  padding: 0 1px;
}

.msg-highlight {
  box-shadow: 0 0 0 3px #f2c94c;
}

@media (prefers-color-scheme: dark) {
  :root:has(.sessions-layout) .search-snippet mark { background: #6b5a14; }
}

.site-page #search-form {
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
}

.site-page #search-form input,
.site-page #search-form select {
  width: 100%;
}

.site-page #search-form .search-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.site-page #search-form .search-row > label {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}

.site-page #search-form button {
  flex: 0 0 auto;
}

/* at the top of the left column, set apart from Sites below it */
.sessions-side .search-box {
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

/* ---- /sessions tree: All sites > site > session (owner feedback 1) ---------------------------------------------- */
.tree,
.tree-group {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-group {
  border-left: 1px solid var(--line);
  margin: 4px 0 2px 9px;
  padding-left: 10px;
}

.tree [role="treeitem"] {
  outline: none;
}

.tree [role="treeitem"] + [role="treeitem"] {
  margin-top: 4px;
}

.tree-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px 6px;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  padding: 7px 9px;
}

.tree-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tree-name {
  overflow-wrap: break-word; /* names break at their hyphens, not in the middle of a word */
}

/* "· team" moves to the next line as a whole rather than leaving one letter behind (Argon re-check r7) */
.tree-team {
  display: inline-block;
  max-width: 100%;
}

.tree-detail {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.tree-leaf .tree-detail {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.tree-gone .tree-detail {
  display: block; /* the whole reason, not cut after the site name (Argon visual r5 P1-3) */
  overflow: visible;
}

/* All sites and Pinned cannot close: no chevron column (Argon visual r5 P2-10) */
.tree-row.tree-fixed {
  grid-template-columns: minmax(0, 1fr) auto;
}

.tree-pinned > .tree-row {
  cursor: default;
}

.shell-open.shell-off {
  border-style: dashed;
  color: var(--muted);
}

.tree-side {
  align-items: center;
  display: flex;
  gap: 6px;
}

.tree-chevron::before {
  color: var(--muted);
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
}

[aria-expanded="true"] > .tree-row .tree-chevron::before {
  transform: rotate(90deg);
}

.tree [role="treeitem"]:focus-visible > .tree-row {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tree [aria-selected="true"] > .tree-row {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.tree .tree-current > .tree-row {
  border-color: var(--accent);
}

.tree .needs-attention > .tree-row {
  box-shadow: inset 4px 0 0 var(--bad);
}

.tree .attention-stalled > .tree-row,
.tree .attention-offline > .tree-row {
  box-shadow: inset 4px 0 0 var(--warn);
}

.tree .needs-attention[aria-selected="true"] > .tree-row {
  box-shadow: inset 4px 0 0 var(--bad), 0 0 0 1px var(--accent);
}

/* the progress star on a node while what it asked for loads: grows and shrinks */
.tree-busy {
  color: var(--accent);
  display: none;
  font-size: 18px;
  line-height: 1;
}

[aria-busy="true"] > .tree-row .tree-busy {
  animation: tree-pulse 0.9s ease-in-out infinite;
  display: inline-block;
}

@keyframes tree-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.6); }
  50% { opacity: 1; transform: scale(1.3); }
}

@media (prefers-reduced-motion: reduce) {
  [aria-busy="true"] > .tree-row .tree-busy { animation: none; }
  .tree-chevron::before { transition: none; }
}

/* ---- the original error, as the machine sent it (owner feedback 3) ----------------------------------------------- */
.error-detail {
  background: var(--panel);
  border: 1px solid var(--bad);
  border-radius: 8px;
  margin: 6px 0;
  padding: 6px 10px;
  position: relative;
}

.error-detail summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 30px; /* as tall as Copy, so Copy never sits on the block below (Argon visual r5 P1-2) */
  padding-right: 64px;
}

.error-copy {
  position: absolute;
  right: 8px;
  top: 4px;
}

.error-detail:not([open]) .error-copy {
  top: 2px;
}

.error-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  margin: 6px 0 2px;
  max-height: 360px;
  overflow: auto;
  padding-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-error:empty {
  display: none;
}

/* inside the messages the block grows: one scroll box (the messages), so no line is cut at a second box's edge */
.messages .error-text,
#followup-results .error-text,
#schedule-answers .error-text {
  max-height: none;
}

/* the header's state line repeats the error's first line; the block under it holds all of it */
.chat-state.has-error {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* on a phone the chat with an open error block still fits one screen: the block scrolls, the messages give way */
@media (max-width: 800px) {
  .chat-error .error-text {
    max-height: 120px;
  }

  #chat:has(#chat-error .error-detail[open]) .messages {
    max-height: calc(100dvh - 620px);
    min-height: 120px;
  }
}

/* ---- owner round 8: the cost of each turn (figure on the request bubble, breakdown tooltip) --------------------- */
.turn-cost {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  min-height: 0;
  min-width: 5.4em; /* reserved for "$0.000", "n/a" or "pending": the figure arriving later does not move the bubble */
  padding: 0 2px;
  text-align: center;
}

/* the role on the left, the time and the cost together on the right (Argon r8 P2-2) */
.msg-head > .msg-role {
  margin-right: auto;
}

.turn-cost:hover,
.turn-cost:focus-visible,
.turn-cost[aria-expanded="true"] {
  border-color: var(--line);
  color: var(--ink);
}

.turn-cost.cost-na {
  font-style: italic;
}

.chat-cost {
  margin: 2px 0 0;
}

.session-cost {
  font-size: 12px;
  margin-left: -3px;
  min-width: 0;
  padding: 0 2px;
  text-align: left;
}

.session-cost.cost-na {
  overflow-wrap: anywhere;
}

.cost-tip[hidden] {
  display: none;
}

.cost-tip {
  /* one grid for every row: the columns line up (Argon r8 P1-3) */
  column-gap: 12px;
  display: grid;
  grid-template-columns: minmax(8.5em, 1fr) auto auto auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 18%);
  color: var(--ink);
  font-size: 12px;
  max-width: min(420px, calc(100vw - 16px));
  padding: 8px 10px;
  position: fixed;
  z-index: 50;
}

.cost-title,
.cost-meta,
.cost-why {
  grid-column: 1 / -1;
}

.cost-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.cost-row {
  display: grid;
  font-variant-numeric: tabular-nums;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

.cost-row > span:not(:first-child) {
  text-align: right;
}

.cost-head {
  color: var(--muted);
}

.cost-total {
  border-top: 1px solid var(--line);
  font-weight: 600;
  margin-top: 2px;
  padding-top: 2px;
}

.cost-meta {
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.cost-why {
  color: var(--warn);
  margin-top: 4px;
}

/* ---- owner round 6: the live view of a terminal-held session ------------------------------------------------------- */
.live-bar {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  gap: 6px;
  margin: 4px 0;
}

.live-dot {
  background: var(--good);
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.live-bar.live-busy .live-dot {
  animation: live-pulse 0.9s ease-in-out infinite;
}

.live-bar.live-paused .live-dot {
  background: var(--muted);
}

.live-bar.live-error {
  color: var(--bad);
}

.live-bar.live-error .live-dot {
  background: var(--bad);
}

/* the live view's error stays open (the original error is never hidden) but scrolls in a short box, so the messages
   under the header keep their room (Argon r6 P2-3) */
#live-error .error-text {
  max-height: 140px;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
  .live-bar.live-busy .live-dot { animation: none; opacity: 0.5; }
}

/* ---- /sessions owner feedback round 4: pins, closed sites with badges, the shell panel ------------------------- */
.tree-tools {
  font-size: 13px;
  margin: -2px 0 6px;
}

.pin-toggle {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.pin-toggle[aria-pressed="true"] {
  color: #b8860b;
}

.tree .tree-pinned > .tree-row {
  background: var(--panel-2);
}

.tree .tree-gone > .tree-row {
  border-style: dashed;
  cursor: pointer;
  opacity: 0.85;
}

.gone-detail { padding: 16px; max-width: 760px; }
.gone-status { margin: 4px 0 12px; }
.gone-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
.gone-facts dt { color: var(--muted, #667); }
.gone-facts dd { margin: 0; overflow-wrap: anywhere; }
.gone-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }

.tree-side .badge[hidden] {
  display: none;
}

.tree-side .shell-open {
  font-size: 12px;
  padding: 1px 6px;
}

#chat.shelling > :not(#shell) {
  display: none !important;
}

.shell-panel form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shell-panel input,
.shell-panel textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  width: 100%;
}

.shell-panel label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shell-panel .shell-timeout {
  align-items: center;
  flex-direction: row;
}

.shell-panel .shell-timeout input {
  width: 5em;
}

.shell-result {
  border-color: var(--warn);
}

.shell-result.shell-ok {
  border-color: var(--accent);
}

.shell-recent {
  font-size: 13px;
  margin: 0;
  padding-left: 18px;
}

.chat-tools {
  margin: 4px 0;
}

.site-page #shell-form {
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
}

.site-page #shell-form .composer-row {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.site-page #shell-form .composer-row .composer-reason {
  flex: 1;
}

/* Owner round 7: a session's label (first line in the tree and the header), a prompt waiting to send, Send to terminal. */
.chat-label { margin: 0 0 0.15rem; font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.chat-tmux { margin: 0.1rem 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: #4a5560; overflow-wrap: anywhere; }
.pane-state { margin: 0.2rem 0 0; font-size: 0.9rem; font-weight: 600; color: #34404a; }
.pane-state.pane-is-choice { color: #7a4b00; }
.pane-state.pane-is-error { color: #8a1f1f; }
.pane-choice { margin: 0.4rem 0; padding: 0.6rem 0.8rem; border: 1px solid #c9d1d9; border-radius: 6px; }
.pane-choice[hidden] { display: none; }
.pane-choice-q { margin: 0 0 0.4rem; font-weight: 600; overflow-wrap: anywhere; }
.pane-choice-options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pane-choice-opt { display: flex; gap: 0.35rem; align-items: center; }
.pane-choice-note { margin: 0.3rem 0 0; font-size: 0.85rem; min-height: 1.1em; }
.tree-name.tree-labelled strong { font-weight: 700; }
.badge-queue { background: #e3e8f7; color: #243a7a; margin-left: 0.25rem; }
.label-edit { margin: 0.35rem 0 0; }
.label-edit > summary { cursor: pointer; font-size: 0.9rem; }
.label-edit form { margin-top: 0.35rem; }
.label-edit input[type="text"] { flex: 1 1 14rem; min-width: 0; }
.pending { display: flex; align-items: center; gap: 0.6rem; margin: 0.4rem 0 0; padding: 0.35rem 0.6rem; border: 1px solid #c9d3f0; border-radius: 6px; background: #f3f6fd; }
.pending[hidden] { display: none; }
.pending-text { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.pending.pending-failed { border-color: #e7b4b4; background: #fdf3f3; }
.pending.pending-failed .pending-text { color: #8a1c1c; }
.tmux-pane-choice { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
@media (prefers-color-scheme: dark) {
  :root:has(.sessions-layout) .badge-queue { background: #25305a; color: #c9d5ff; }
  :root:has(.sessions-layout) .chat-tmux { color: #b8c2cc; }
  :root:has(.sessions-layout) .pane-state { color: #c3ccd5; }
  :root:has(.sessions-layout) .pane-state.pane-is-choice { color: #f0c36b; }
  :root:has(.sessions-layout) .pane-state.pane-is-error { color: #f7b8b8; }
  :root:has(.sessions-layout) .pane-choice { border-color: #46515c; }
  :root:has(.sessions-layout)   :root:has(.sessions-layout) .pending { background: #1f2638; border-color: #34406a; }
  :root:has(.sessions-layout) .pending.pending-failed { background: #3a2222; border-color: #6a3434; }
  :root:has(.sessions-layout) .pending.pending-failed .pending-text { color: #f2a6a6; }
}
/* Argon r7 review: the label form spans the row and its status is neutral (P1-1); the queue's buttons sit together (P1-2);
   the queue's prompt is as wide as the other prompts and its fieldsets are not the page's boxed ones (P2-1); a row with a
   state badge and a queued badge wraps its badges, not its name (P2-2). */
.label-edit form { display: block; }
.label-edit .composer-row { width: 100%; }
.label-edit .composer-row input[type="text"] { flex: 1 1 auto; width: auto; min-width: 8rem; }
.label-edit .composer-row button { margin-left: 0; }
.label-state { margin: 0.25rem 0 0; font-size: 0.9rem; }
.tree-side:has(.badge-queue) { flex-wrap: wrap; justify-content: flex-end; max-width: 6.5rem; row-gap: 2px; }

/* Temp web space on the account page: long names wrap, Open and Delete are two comfortable targets. */
#tempweb-list td:first-child {
  overflow-wrap: anywhere;
}

#tempweb-list td:nth-child(2),
#tempweb-list td:nth-child(3) {
  white-space: nowrap;
}

.tempweb-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.tempweb-actions a,
.tempweb-actions button {
  align-items: center;
  box-sizing: border-box;
  display: inline-flex;
  justify-content: center;
  min-height: 32px;
  min-width: 60px;
  padding: 0 10px;
}

.tempweb-actions a {
  border: 1px solid var(--line);
  border-radius: 6px;
}

@media (max-width: 560px) {
  #tempweb-list td:nth-child(2),
  #tempweb-list td:nth-child(3) {
    white-space: normal;
  }

  .tempweb-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Owner 6 Nov: sub-agents nest under the session that prompted them; each level costs little width, so a phone keeps the rows readable. */
.tree-group .tree-group {
  margin-left: 6px;
  padding-left: 8px;
}

.tree-parent > .tree-row > .tree-chevron {
  align-items: center;
  align-self: stretch;
  display: inline-flex;
  justify-content: center;
  margin: -7px -9px;
  min-width: 32px;
}

/* The deepest rows put their badges on a second line: the column is narrow and the name comes first. */
.tree-group .tree-group .tree-group .tree-group > [role="treeitem"] > .tree-row {
  grid-template-columns: 14px minmax(0, 1fr);
}

.tree-group .tree-group .tree-group .tree-group > [role="treeitem"] > .tree-row > .tree-side {
  grid-column: 2;
  justify-content: flex-start;
  max-width: none;
}

.tree-kids {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.8rem;
  gap: 2px 6px;
  margin-top: 2px;
}

.tree-kids .badge[hidden] {
  display: none;
}

.tree .tree-context > .tree-row {
  opacity: 0.72;
}

@media (max-width: 560px) {
  .tree-group .tree-group {
    margin-left: 3px;
    padding-left: 5px;
  }
}

.composer .draft-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
  text-align: right;
}

.composer .draft-note:empty {
  display: none;
}

/* The cost dialog: the page's colours in both schemes, a sheet the width of a phone, and it scrolls by itself. */
.cost-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 25%);
  color: var(--ink);
  font-size: 14px;
  max-height: min(80vh, 640px);
  max-width: min(460px, calc(100vw - 24px));
  overflow: auto;
  padding: 14px 16px;
  width: 100%;
}

.cost-dialog::backdrop {
  background: rgb(0 0 0 / 45%);
}

/* Add a site (owner, 8 Nov): the steps as plain text, the commands in blocks that scroll sideways. */
.add-site {
  max-width: min(680px, calc(100vw - 24px));
}

.add-site h3 {
  font-size: 14px;
  margin: 14px 0 4px;
}

.add-site p {
  margin: 4px 0;
}

/* .site-page .add-site-code: the page's own pre rules (light text for a dark block, wrap anywhere) must not apply here. */
.site-page .add-site-code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  margin: 6px 0;
  overflow-wrap: normal;
  overflow-x: auto;
  padding: 8px 10px;
  white-space: pre;
}

/* A finger needs 44 px (visual QA 8 Nov): the pin star, the side actions and the dialog's Close on touch screens. */
@media (pointer: coarse) {
  .pin-toggle { min-height: 44px; min-width: 44px; }
  .site-page .side-actions .small-button,
  #add-site-close { min-height: 44px; min-width: 44px; }
}

.site-page .current-mark {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  padding: 0 6px;
  white-space: nowrap;
}

.site-page .side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cost-dialog-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.cost-dialog-head h2 {
  font-size: 16px;
  margin: 0;
}

.cost-dialog-head button {
  flex: 0 0 auto;
  min-height: 36px;
}

.cost-dialog-when {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 8px;
}

.cost-grid {
  column-gap: 12px;
  display: grid;
  grid-template-columns: minmax(7em, 1fr) auto auto auto;
}

.cost-dialog .cost-why {
  font-size: 14px;
}

/* One line per row: the long type names keep their width, and the total, the widest value, takes the row. */
.cost-row > span:first-child {
  white-space: nowrap;
}

.cost-tip,
.cost-grid {
  grid-template-columns: minmax(max-content, 1fr) auto auto auto;
}

.cost-total > span:nth-child(2),
.cost-total > span:nth-child(3) {
  display: none;
}

.cost-total > span:last-child {
  grid-column: 2 / -1;
  white-space: nowrap;
}

/* the focus goes to Close by script, which :focus-visible skips after a mouse click */
.cost-dialog-head button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .cost-grid {
    column-gap: 8px;
    font-size: 13px;
  }

  .cost-dialog {
    padding: 12px;
  }
}

/* These lines span the table: they take its width, they do not set it, or a long sentence would widen every column. */
.cost-title,
.cost-meta,
.cost-why {
  min-width: 100%;
  width: 0;
}

.cost-tip {
  width: min(340px, calc(100vw - 16px));
}

/* Owner 6 Nov: a session in a terminal. Its state is not measured, and Send types into a live pane: both look different. */
.badge-terminal {
  background: #f6e7c8;
  color: #6a4708;
}

.composer-terminal textarea {
  border-color: var(--warn);
}

.site-page form.composer-terminal label {
  color: var(--warn);
}

@media (prefers-color-scheme: dark) {
  :root:has(.sessions-layout) .badge-terminal { background: #47361a; color: #f5d39b; }
}
