/* Agent panel and terminal (agent.js). */

/* ---------------------------------------------------------------- agent panel */

.agent {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--line-2);
  background: #0b0a0d;
  box-shadow: -12px 0 30px rgba(0, 0, 0, 0.5);
  position: relative;
}
.agent-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1a161f, #0e0c11);
}
.agent-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #3a2f1c, #120e08);
  border: 1px solid var(--line-3);
  color: var(--gold-hi);
  box-shadow: var(--glow);
}
.agent-mark .glyph {
  width: 14px;
  height: 14px;
}
.agent-title {
  display: flex;
  flex-direction: column;
}
.agent-title b {
  font: 600 19px/1 var(--serif);
  font-style: italic;
  color: var(--gold-hi);
  letter-spacing: 0.02em;
}
.agent-title span {
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 3px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a4450;
  flex: none;
}
.status-dot.live {
  background: #6fe0ac;
  box-shadow: 0 0 10px rgba(111, 224, 172, 0.8);
}
.status-dot.warn {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.8);
}
.status-dot.bad {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(224, 112, 126, 0.8);
}
.agent-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #0e0c11;
}
.agent-context-label {
  color: var(--dim);
  font: 10px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: help;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #131116;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip b {
  color: var(--champagne);
  font-weight: 600;
}
.chip.warn {
  border-color: rgba(224, 112, 126, 0.5);
  color: var(--danger);
}
.term-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  padding: 8px 4px 4px 10px;
  background: radial-gradient(120% 60% at 50% 0%, rgba(212, 175, 55, 0.04), transparent 60%), #0b0a0d;
}
.term {
  position: absolute;
  inset: 8px 4px 4px 10px;
}
.term .xterm {
  height: 100%;
}
.term .xterm-viewport {
  background: transparent !important;
}
.term-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px;
  text-align: center;
  z-index: 2;
  background: #0b0a0d;
}
.term-empty h2 {
  margin: 0;
  font: italic 600 30px/1.1 var(--serif);
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.term-empty p {
  margin: 0;
  color: var(--muted);
  font: 15px/1.45 var(--serif);
  max-width: 320px;
}
.agent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 330px;
}
.agent-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--lacquer-hi);
  cursor: pointer;
  text-align: left;
}
.agent-choice:hover {
  border-color: var(--line-3);
  box-shadow: var(--glow);
}
.agent-choice b {
  color: var(--champagne);
  font-size: 12.5px;
}
.agent-choice span {
  color: var(--dim);
  font-size: 10px;
}
.agent-choice.na {
  opacity: 0.45;
}
.suggest {
  display: flex;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  background: #0e0c11;
}
.suggest .chip {
  cursor: pointer;
  color: var(--champagne);
  flex: none;
  max-width: none;
}
.suggest .chip:hover {
  border-color: var(--line-3);
  color: var(--gold-hi);
}
.agent-resize {
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 4;
}

/* ---------------------------------------------------------------- plugins */

.maestro-tabs {
  display: flex;
  gap: 2px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #0e0c11;
}
.maestro-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.maestro-tab .glyph {
  width: 13px;
  height: 13px;
}
.maestro-tab:hover {
  color: var(--gold-hi);
}
.maestro-tab.on {
  color: var(--gold-hi);
  border-bottom-color: var(--gold);
}
.maestro-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-hi);
  font-size: 9.5px;
  line-height: 16px;
  text-align: center;
  letter-spacing: 0;
}
/* A plugin covers the terminal (which keeps its size and keeps running). */
.maestro-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------------------------------------------------------------- critic */

.critic {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 50% at 50% 0%, rgba(212, 175, 55, 0.04), transparent 60%), #0b0a0d;
}
.crit-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.crit-seg {
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #131116;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.crit-seg:hover {
  color: var(--gold-hi);
  border-color: var(--line-3);
}
.crit-seg.on {
  color: var(--gold-hi);
  border-color: var(--line-3);
  background: rgba(212, 175, 55, 0.12);
}
.crit-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 10px 16px;
}
.crit-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0 2px;
}
.crit-summary:empty {
  display: none;
}
.crit-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.crit-empty .glyph {
  width: 26px;
  height: 26px;
  color: var(--gold);
}
.crit-empty h3 {
  margin: 0;
  font: italic 600 24px/1.1 var(--serif);
  color: var(--gold-hi);
}
.crit-empty p {
  margin: 0;
  font: 14px/1.45 var(--serif);
  max-width: 300px;
}
.crit-cat {
  margin: 14px 0 6px;
  font: italic 600 17px/1 var(--serif);
  color: var(--gold-hi);
  letter-spacing: 0.02em;
}
.crit-rulegroup {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f0d12;
  overflow: hidden;
}
.crit-rulehead {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  cursor: pointer;
  user-select: none;
}
.crit-rulehead:hover {
  background: rgba(212, 175, 55, 0.05);
}
.crit-rulehead b {
  color: var(--champagne);
  font-size: 12px;
}
.crit-caret {
  color: var(--dim);
  font-size: 10px;
  transition: transform 0.15s;
}
.crit-caret.folded {
  transform: rotate(-90deg);
}
.crit-count {
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: #1b1820;
  color: var(--muted);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.crit-link {
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.crit-link.quiet {
  color: var(--dim);
  font-weight: 500;
}
.crit-link:hover {
  color: var(--gold-hi);
  text-decoration: underline;
}
.crit-why {
  margin: 0;
  padding: 0 12px 6px 27px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
}
.crit-item {
  display: flex;
  gap: 9px;
  padding: 8px 10px 8px 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.07);
}
.crit-item.suppressed {
  opacity: 0.45;
}
.critic.busy .crit-scroll {
  opacity: 0.7;
}
.crit-error {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(224, 112, 126, 0.5);
  color: var(--danger);
  font-size: 11.5px;
}
.crit-offlist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 8px 0 2px;
  color: var(--dim);
  font-size: 11px;
}
.crit-offchip {
  cursor: pointer;
}
.crit-offchip:hover {
  border-color: var(--line-3);
  color: var(--gold-hi);
}
.crit-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--dim);
}
.crit-item.warn .crit-dot {
  background: var(--rose);
  box-shadow: 0 0 8px rgba(208, 138, 147, 0.6);
}
.crit-item.info.fixable .crit-dot {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}
.crit-body {
  flex: 1;
  min-width: 0;
}
.crit-title {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}
.crit-detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}
.crit-acts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.crit-where {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #131116;
  color: var(--champagne);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.crit-where .glyph {
  width: 11px;
  height: 11px;
  flex: none;
}
.crit-where:hover {
  border-color: var(--line-3);
  color: var(--gold-hi);
}
.crit-where.static {
  cursor: default;
  color: var(--dim);
}
.crit-where span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.crit-intro {
  margin: 8px 0 0;
  color: var(--muted);
  font: 14px/1.45 var(--serif);
}
.crit-rule {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--dim);
}
.crit-rule:hover {
  background: rgba(212, 175, 55, 0.05);
}
.crit-rule input {
  margin-top: 2px;
  accent-color: var(--gold);
}
.crit-rule-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crit-rule-text b {
  font-size: 12px;
  color: var(--muted);
}
.crit-rule.on .crit-rule-text b {
  color: var(--champagne);
}
.crit-rule-text .crit-default {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 8px;
  background: #1b1820;
  color: var(--dim);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.crit-rule-text span {
  font-size: 11px;
  line-height: 1.4;
}

/* ---------------------------------------------------------------- Maestro in the cloud (maestro.js) */

.maestro-chat {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 50% at 50% 0%, rgba(212, 175, 55, 0.04), transparent 60%), #0b0a0d;
}
.mae-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}
.mae-item {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13.5px/1.55 var(--sans);
  color: var(--champagne);
}
/* Maestro's answers: their Markdown as elements (ui/maestro.js answerView). */
.mae-md {
  white-space: normal;
}
.mae-md > :first-child {
  margin-top: 0;
}
.mae-md > :last-child {
  margin-bottom: 0;
}
.mae-md p,
.mae-md ul,
.mae-md ol,
.mae-md pre {
  margin: 0 0 9px;
}
.mae-md ul,
.mae-md ol {
  padding-left: 20px;
}
.mae-md li {
  margin: 0 0 4px;
}
.mae-md li::marker {
  color: var(--gold);
}
.mae-md h4,
.mae-md h5,
.mae-md h6 {
  margin: 14px 0 6px;
  font: 600 14.5px/1.4 var(--sans);
  color: var(--gold-hi);
}
.mae-md strong {
  font-weight: 650;
  color: var(--gold-hi);
}
.mae-md em {
  font-style: italic;
}
.mae-md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}
.mae-code {
  font: 12px var(--mono);
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}
.mae-pre {
  white-space: pre-wrap;
  font: 12px/1.5 var(--mono);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #0f0d12;
}
.mae-user {
  align-self: flex-end;
  max-width: 85%;
  padding: 7px 11px;
  border-radius: 12px 12px 3px 12px;
  border: 1px solid var(--line-3);
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-hi);
}
.mae-note {
  color: var(--muted);
}
.mae-error {
  color: #f3c0c6;
  font-size: 12.5px;
  font-family: inherit;
}
.mae-tool {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f0d12;
  font-size: 11px;
}
.mae-tool-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  cursor: pointer;
  min-width: 0;
}
.mae-tool-head b {
  color: var(--champagne);
  font-weight: 600;
}
.mae-tool-in {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
  font: 10.5px var(--mono);
}
.mae-tool-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: #6fbf8a;
}
.mae-tool.bad .mae-tool-dot {
  background: var(--rose);
}
.mae-tool.pending .mae-tool-dot {
  background: var(--gold);
  animation: mae-pulse 1s ease-in-out infinite;
}
.mae-tool-out {
  margin: 0;
  padding: 6px 9px 8px;
  border-top: 1px solid var(--line);
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font: 10.5px/1.4 var(--mono);
}
.mae-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-size: 11.5px;
}
.mae-spin {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.25);
  border-top-color: var(--gold-hi);
  animation: mae-turn 0.8s linear infinite;
}
.mae-compose {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
}
.mae-input {
  flex: 1;
  min-width: 0;
  resize: none;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #131116;
  color: var(--champagne);
  font: 13px/1.4 var(--sans);
}
.mae-input:focus {
  outline: none;
  border-color: var(--line-3);
}
.mae-input:disabled {
  opacity: 0.55;
}
.mae-banner {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.22), rgba(212, 175, 55, 0.05));
  border-bottom-color: var(--line-3);
  color: var(--gold-hi);
}
@keyframes mae-turn {
  to {
    transform: rotate(360deg);
  }
}
@keyframes mae-pulse {
  50% {
    opacity: 0.35;
  }
}
