/* agent-chat.css: the agent core's chat parts (js/agent-chat.js) inside the
   eDash bot sheet and on the Operations > Surat page.

   Every size and radius reads a token (--type-*-size, --r-*), per
   scripts/check-type-roles.py. The glass stays on the chrome the sheet
   already paints (DESIGN.md: glass is chrome, never content): tool chips
   carry the landing's chip rim, while charts, draft previews and confirm
   cards are flat opaque surfaces, because they are content. */

.ac-bubble { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.ac-text:empty { display: none; }
.ac-wait { color: var(--muted, #5B6B75); font-size: var(--type-caption-size); }
.ac-wait::after { content: " ..."; }
.ac-note { color: var(--muted, #5B6B75); font-size: var(--type-caption-size); margin: 2px 0 0; }
.eb-bubble.is-error { border-color: var(--danger, #B42318); }

/* Tool chips: glass chips, the landing's rim on a light tint. */
.ac-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.ac-tools:empty { display: none; }
.ac-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-chip);
  font-size: var(--type-chip-size);
  color: var(--primary-dark, #0B4F54);
  background: var(--primary-soft, #E4F1F1);
  box-shadow: var(--gl-chip-rim, inset 0 1px 0 rgba(255, 255, 255, .35));
  border: 1px solid var(--border, #E7EDEE);
}
.ac-chip.is-denied, .ac-chip.is-error { color: var(--danger, #B42318); background: var(--danger-soft, #FDECEA); }
.ac-chip i { font-size: var(--type-caption-size); }

.ac-extras { display: flex; flex-direction: column; gap: 8px; }
.ac-extras:empty { display: none; }

/* Charts are content: flat and opaque. */
.ac-chart { margin: 0; padding: 8px; background: var(--surface, #fff); border: 1px solid var(--border, #E7EDEE); border-radius: var(--r-ctl); }
.ac-chart-title { font-size: var(--type-label-size); font-weight: 600; color: var(--ink, #25343F); margin-bottom: 4px; }
.ac-chart-box { position: relative; height: 180px; }
.ac-chart-cap { font-size: var(--type-caption-size); color: var(--muted, #5B6B75); margin: 4px 0 0; }

.ac-confirm, .ac-map {
  padding: 8px 10px;
  background: var(--surface-alt, #F4F8F8);
  border: 1px solid var(--border-strong, #CFDCDD);
  border-radius: var(--r-ctl);
}
.ac-confirm p, .ac-map p { margin: 0 0 6px; font-size: var(--type-body-size); }
.ac-result { color: var(--primary-dark, #0B4F54); font-weight: 600; }
.ac-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ac-btn {
  border: 1px solid var(--border-strong, #CFDCDD);
  background: var(--surface, #fff);
  color: var(--ink, #25343F);
  border-radius: var(--r-ctl);
  padding: 6px 12px;
  font-family: inherit;
  font-size: var(--type-button-size);
  font-weight: 600;
  cursor: pointer;
}
.ac-btn.is-primary { background: var(--gl-action, #0B7A82); border-color: transparent; color: #fff; box-shadow: var(--gl-action-rim, none); }
.ac-btn:disabled { opacity: .6; cursor: default; }

/* The draft panel: a flat document preview. */
.ac-draft {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px;
  background: var(--surface, #fff);
  border-top: 1px solid var(--border, #E7EDEE);
}
.ac-draft[hidden] { display: none; }
.ac-draft-head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--type-card-title-size); }
.ac-draft-state { font-size: var(--type-caption-size); color: var(--muted, #5B6B75); }
.ac-draft-missing { margin: 0; padding-left: 18px; color: var(--warning, #B54708); font-size: var(--type-caption-size); }
.ac-draft-missing:empty { display: none; }
.ac-draft-preview {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: var(--type-caption-size);
  line-height: 1.45;
  padding: 8px;
  background: var(--surface-alt, #F4F8F8);
  border-radius: var(--r-ctl);
}

/* The bot sheet grows when it carries a draft (desktop only). */
@media (min-width: 901px) {
  .eb-sheet.has-draft { width: min(520px, calc(100vw - 32px)); }
}
.eb-draft-host { flex: none; max-height: 45%; overflow: auto; }

/* ---------------------------------------------------------------- the Surat page */

.sr-head { margin-bottom: 16px; max-width: 760px; }
.sr-head h1 { margin: 0; font-size: var(--type-page-title-size); font-weight: var(--type-page-title-weight); line-height: var(--type-page-title-lh); color: var(--ink, #25343F); }
.sr-head p { margin: 6px 0 0; color: var(--muted, #5B6B75); font-size: var(--type-body-size); }

.sr-root { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .sr-root { grid-template-columns: minmax(0, 1fr); } }
.sr-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #E7EDEE);
  border-radius: var(--r-card);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sr-card-head { padding: 12px 14px; border-bottom: 1px solid var(--border, #E7EDEE); }
.sr-card-head h2 { margin: 0; font-size: var(--type-section-head-size); }
.sr-card-head p { margin: 4px 0 0; color: var(--muted, #5B6B75); font-size: var(--type-caption-size); }
.sr-chat { height: min(70vh, 720px); }
.sr-chat .eb-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sr-chat .eb-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border, #E7EDEE); }
.sr-chat .eb-form textarea {
  flex: 1; resize: vertical; min-height: 44px; max-height: 200px;
  border: 1px solid var(--border, #E7EDEE); border-radius: var(--r-ctl);
  padding: 8px 10px; font-family: inherit; font-size: var(--type-body-size);
  background: var(--surface, #fff); color: inherit;
}
.sr-side .ac-draft { border-top: 0; }
.sr-side .ac-draft-preview { max-height: 60vh; font-size: var(--type-body-size); }
.sr-empty { padding: 14px; color: var(--muted, #5B6B75); font-size: var(--type-body-size); }
.sr-saved { list-style: none; margin: 0; padding: 0 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.sr-saved button { width: 100%; text-align: left; }
.sr-rules { margin: 0; padding: 0 14px 12px 30px; font-size: var(--type-caption-size); color: var(--muted, #5B6B75); }

:root[data-theme="dark"] .ac-chip { color: var(--primary-soft, #E4F1F1); background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
