/* 9CXO Agent chat on "Heute" (REA P1, 2026-11-13) — views/agent_chat.js.
 * Only the theme tokens of app.css are used, so light and dark follow
 * automatically. Calm: one accent (petrol) for the person, a soft surface for
 * the agent, lime only on the "Ausführen" moment. No horizontal scroll at 360. */

/* ---- page layout: chat + day overview ---- */
.home-agent { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.home-today { order: -1; min-width: 0; }
.ac { min-width: 0; display: flex; flex-direction: column; max-width: 860px; width: 100%; margin: 0 auto; }
@media (min-width: 1180px) {
  .home-agent { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
  .home-today { order: 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}

/* ---- the collapsible overview ---- */
.today-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.today-panel > summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 12px 14px; font-weight: 600; font-size: 14px; border-radius: var(--radius);
}
.today-panel > summary::-webkit-details-marker { display: none; }
.today-panel > summary:focus-visible { outline: none; box-shadow: var(--ring); }
.today-ic, .today-chev { width: 18px; height: 18px; color: var(--accent-ink); display: inline-flex; }
.today-ic svg, .today-chev svg { width: 18px; height: 18px; }
.today-title { flex: 1; min-width: 0; }
.today-count:not(:empty) {
  background: var(--petrol-50); color: var(--accent-ink); border-radius: 999px;
  font-size: 12px; padding: 1px 8px; font-weight: 700;
}
.today-chev { color: var(--muted); transition: transform .15s; }
.today-panel[open] .today-chev { transform: rotate(180deg); }
.today-panel > .tiles, .today-panel > #homeAgenda { padding: 0 12px; }
.today-panel > #homeAgenda { padding-bottom: 12px; }
.today-panel .tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; margin-bottom: 12px; }
.today-panel .tile { padding: 10px 12px; box-shadow: none; }
.today-panel .tile-value { font-size: 18px; }
.today-panel .tile-ic { display: none; }
.today-panel .card { box-shadow: none; border: none; padding: 4px 0 0; background: transparent; }
.today-panel .card-head h3 { font-size: 14px; }
.today-panel .agenda-hit { padding: 10px 6px; font-size: 13.5px; }
.today-panel .agenda-due .pill { white-space: normal; }

/* ---- thread ---- */
.ac-thread { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 16px; min-height: 40vh; }
.ac-msg { display: flex; flex-direction: column; max-width: min(640px, 92%); min-width: 0; }
.ac-user { align-self: flex-end; align-items: flex-end; }
.ac-agent { align-self: flex-start; align-items: flex-start; }
.ac-bubble {
  padding: 11px 15px; border-radius: 18px; font-size: 15px; line-height: 1.55;
  overflow-wrap: anywhere; min-width: 0; max-width: 100%;
}
.ac-user .ac-bubble { background: var(--petrol); color: #fff; border-bottom-right-radius: 6px; }
.ac-agent .ac-bubble { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.ac-bubble p { margin: 0; }
.ac-bubble p + p, .ac-bubble p + ul, .ac-bubble ul + p, .ac-bubble p + ol, .ac-bubble ol + p { margin-top: 8px; }
.ac-bubble ul, .ac-bubble ol { margin: 0; padding-left: 20px; }
.ac-bubble li + li { margin-top: 3px; }
.ac-skel { width: 280px; max-width: 100%; }
.ac-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.ac-from { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }

/* ---- welcome ---- */
.ac-welcome { text-align: center; padding: 32px 8px 8px; }
.ac-welcome h2 { font-size: 22px; margin: 12px 0 6px; }
.ac-welcome p { color: var(--muted); margin: 0 auto 18px; max-width: 520px; font-size: 14.5px; }
.ac-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 9px; background: var(--petrol-900); color: var(--lime); font-family: var(--serif); font-weight: 600;
}
.ac-avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; }
.ac-ideas { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ac-idea {
  border: 1px solid var(--line-2); background: var(--btn-bg); color: var(--ink); border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: 13.5px; cursor: pointer; max-width: 100%; text-align: left;
}
.ac-idea:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.ac-idea:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---- "Arbeitete X s" ---- */
.ac-run { align-self: flex-start; max-width: min(640px, 100%); width: 100%; min-width: 0; }
.ac-run-head {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 4px 6px;
  margin-left: -6px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; border-radius: 8px;
  max-width: 100%; flex-wrap: wrap; text-align: left;
}
.ac-run-head:disabled { cursor: default; }
.ac-run-head:not(:disabled):hover { color: var(--ink); background: var(--soft); }
.ac-run-head:focus-visible { outline: none; box-shadow: var(--ring); }
.ac-run-ic, .ac-chev { width: 15px; height: 15px; display: inline-flex; }
.ac-run-ic svg, .ac-chev svg { width: 15px; height: 15px; }
.ac-chev { transition: transform .15s; }
.ac-chev.open { transform: rotate(90deg); }
.ac-count { color: var(--muted); }
.is-working .ac-run-head { color: var(--accent-ink); }
.ac-clock { font-variant-numeric: tabular-nums; }
.ac-thinking { font-size: 13px; color: var(--muted); padding: 2px 0 0 22px; font-style: italic; }
.ac-spin {
  width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--petrol-50);
  border-top-color: var(--accent-ink); display: inline-block; animation: ac-spin .8s linear infinite; flex: 0 0 auto;
}
@keyframes ac-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ac-spin { animation-duration: 2.4s; } }

.ac-steps { list-style: none; margin: 4px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
.ac-step { display: flex; gap: 10px; padding: 6px 0 6px 10px; min-width: 0; }
.ac-step-ic { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; color: var(--success); }
.ac-step-ic svg { width: 18px; height: 18px; }
.ac-step.muted .ac-step-ic { color: var(--muted); }
.ac-step.warn .ac-step-ic { color: var(--warn); }
.ac-step.err .ac-step-ic { color: var(--danger); }
.ac-step-text { min-width: 0; display: flex; flex-direction: column; }
.ac-step-title { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.ac-step-meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.ac-step-note { font-size: 12.5px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.ac-open { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.ac-open:hover { text-decoration: underline; }

/* ---- approval card ---- */
.ac-approve {
  margin-top: 8px; background: var(--card); border: 1px solid var(--line-2); border-left: 4px solid var(--lime);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0;
}
.ac-approve-head { display: flex; gap: 10px; align-items: flex-start; }
.ac-approve-head b { display: block; font-size: 14.5px; overflow-wrap: anywhere; }
.ac-approve-head span { display: block; font-size: 12.5px; color: var(--muted); }
.ac-approve-ic { flex: 0 0 auto; width: 20px; height: 20px; color: var(--accent-ink); margin-top: 1px; }
.ac-approve-ic svg { width: 20px; height: 20px; }
.ac-approve-note { margin: 10px 0 0; font-size: 13.5px; }
.ac-fields { margin: 10px 0 0; display: grid; gap: 6px; background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.ac-field { display: grid; grid-template-columns: minmax(80px, 30%) minmax(0, 1fr); gap: 10px; font-size: 13px; }
.ac-field dt { color: var(--muted); overflow-wrap: anywhere; font-size: 12.5px; }
.ac-field dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.ac-approve-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ac-approve-actions .btn svg { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
.ac-ro { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ---- composer ---- */
.ac-composer {
  position: sticky; bottom: 12px; z-index: var(--z-sticky); background: var(--card);
  border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 12px 8px;
  margin-top: 4px;
}
.ac-composer:focus-within { border-color: var(--accent-ink); }
.ac-composer textarea {
  display: block; width: 100%; border: none; outline: none; resize: none; background: transparent;
  color: var(--ink); font: inherit; font-size: 15px; line-height: 1.5; padding: 4px 2px; min-height: 28px; max-height: 220px;
}
.ac-composer textarea::placeholder { color: var(--muted); }
.ac-composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ac-mode {
  position: relative; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted);
  border-radius: 999px; padding: 4px 8px; min-width: 0; max-width: calc(100% - 52px);
}
.ac-mode:hover { background: var(--soft); color: var(--ink); }
.ac-mode:focus-within { box-shadow: var(--ring); }
.ac-mode select {
  appearance: none; -webkit-appearance: none; border: none; background: transparent; color: inherit;
  font: inherit; font-weight: 600; cursor: pointer; padding: 0 16px 0 0; min-width: 0; max-width: 100%;
  text-overflow: ellipsis; outline: none;
}
.ac-mode select option { color: var(--ink); background: var(--card); }
.ac-mode-ic, .ac-mode-chev, .ac-mode.ro svg { width: 14px; height: 14px; display: inline-flex; flex: 0 0 auto; }
.ac-mode-ic svg, .ac-mode-chev svg { width: 14px; height: 14px; }
.ac-mode-chev { position: absolute; right: 8px; pointer-events: none; }
.ac-mode.ro { font-weight: 600; }
.ac-send {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--petrol); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.ac-send:hover { background: var(--petrol-700); }
.ac-send:focus-visible { outline: none; box-shadow: var(--ring); }
.ac-send:disabled { opacity: .45; cursor: not-allowed; }
.ac-send .ac-spin { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

/* ---- offline / error ---- */
.ac-offline {
  display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px dashed var(--line-2);
  border-radius: var(--radius); padding: 16px; color: var(--ink);
}
.ac-offline > svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--accent-ink); }
.ac-offline p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

@media (max-width: 720px) {
  .ac-msg { max-width: 94%; }
  .ac-bubble { font-size: 14.5px; padding: 10px 13px; }
  .ac-composer { bottom: 8px; border-radius: 16px; }
  .ac-welcome { padding-top: 16px; }
  .ac-welcome h2 { font-size: 19px; }
}

/* ---- no model provider yet: point to the customer's own agent (MCP) ---- */
.ac-byo {
  display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line-2);
  border-left: 4px solid var(--lime); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 4px;
}
.ac-byo-ic { flex: 0 0 auto; width: 22px; height: 22px; color: var(--accent-ink); }
.ac-byo-ic svg { width: 22px; height: 22px; }
.ac-byo b { display: block; font-size: 15px; }
.ac-byo p { margin: 4px 0 12px; color: var(--muted); font-size: 14px; max-width: 60ch; }
.ac-byo > div { min-width: 0; }
.ac-byo .btn { white-space: normal; }
