/* Agent console (index.html): header with the sections, Chat (agent tabs and threads) and Information (status cards). */
body.chat {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px 24px;
  font-weight: 300;
}

.chat a {
  color: #ffb39f;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.chat-header .logo-container {
  text-decoration: none;
}

.chat-header .mode-switch {
  margin: 0 auto;
}

.panel-bar .mode-switch {
  flex-wrap: wrap;
}

.mode-switch button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 24px;
  height: calc(100vh - 110px);
}

.chat-intro h2 {
  margin: 4px 0 2px;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.chat-intro p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.55;
}

.chat-intro .hint {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.messages {
  flex: 1;
  overflow-y: auto;
  margin: 16px -8px 12px 0;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty {
  margin: auto;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
}

.thread {
  border-radius: 14px;
  padding: 12px 14px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message + .message {
  margin-top: 10px;
}

.meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

.meta .author {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.message.user .author {
  color: #ffb39f;
}

.body {
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
  overflow-wrap: anywhere;
}

.body pre {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.body code {
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.body pre code {
  padding: 0;
  background: none;
}

.body blockquote {
  margin: 4px 0;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.65);
}

.context {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.45);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.reactions {
  font-size: 13px;
}

.replies {
  margin: 10px 0 0 14px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.thread-toggle {
  margin-top: 8px;
  align-self: flex-start;
}

.reply-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.reply-form .field,
.composer .field {
  flex: 1;
  resize: none;
  font-family: inherit;
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.composer .field {
  font-size: 13.5px;
  padding: 10px 14px;
}

.notice {
  margin-bottom: 10px;
  font-size: 12.5px;
  color: #ffb39f;
}

@media (max-width: 640px) {
  body.chat {
    padding: 12px;
  }

  .chat-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .chat-panel {
    padding: 16px;
    height: calc(100vh - 150px);
  }
}

/* ── Sections ── */
.header-spacer {
  width: 120px;
}

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-bar h2 {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.panel-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-switch--small button {
  min-height: 26px;
  padding: 3px 12px;
  font-size: 10.5px;
}

[hidden] {
  display: none !important;
}

/* ── Information ── */
.info-panel {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 24px;
  height: calc(100vh - 110px);
  overflow-y: auto;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.info-card {
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 0;
}

.info-card.wide {
  grid-column: 1 / -1;
}

.info-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px 14px;
  margin: 0;
  font-size: 12.5px;
}

.kv dt {
  color: rgba(255, 255, 255, 0.45);
}

.kv dd {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  overflow-wrap: anywhere;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.info-table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  padding: 4px 8px 6px 0;
}

.info-table td {
  padding: 6px 8px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.pill.ok {
  color: #7ee2a8;
}

.pill.warn {
  color: #ffc178;
}

.pill.bad {
  color: #ff7d7d;
}

.pill.off {
  color: rgba(255, 255, 255, 0.45);
}

.muted {
  color: rgba(255, 255, 255, 0.45);
}

.error-text {
  color: #ff9f9f;
  font-size: 11.5px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tags code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
}

.info-card code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
}

/* ── Backend check: covers the page while the controller does not answer ── */
.backend-down {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 8, 14, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.backend-down-card {
  max-width: 440px;
  padding: 26px 28px;
  text-align: center;
}

.backend-down-card h2 {
  margin: 6px 0 8px;
  font-size: 20px;
  font-weight: 400;
}

.backend-down-card p {
  margin: 0 0 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* ── Costs ── */
.cost-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.cost-summary .kpi-value {
  margin: 4px 0 2px;
}

.cost-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
}

.cost-bar {
  width: 140px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.cost-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: color-mix(in oklab, var(--accent) 70%, transparent);
}

.info-table th.tabular,
.info-table td.tabular {
  text-align: right;
}
