/* assistant.css: the subscriber assistant on the home (/reports), version 1 (2 Oct 2026; assets/js/assistant.js).
 * The card sits in the cockpit above the tiles; the panel is a drawer on a wide screen and a full-screen sheet at phone
 * width, with no sideways scroll. Tokens only (the page's own, light and dark through html[data-home-theme], home.css),
 * so it follows the visitor's look. CSP: style-src 'self'; everything here is a class. */

/* ── the card ── */
.as-card { margin: 0 0 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border-color: var(--cp-gold-line); }
.as-card[hidden] { display: none; }
.as-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.as-card-head h2 { font-size: 22px; }
.as-left { margin: 0; font: 600 12.5px var(--font-mono); color: var(--cp-gold); }
.as-card-say { color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.cp .as-sugs, .as-sugs { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.as-sug { appearance: none; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); border-radius: 999px;
  padding: 8px 14px; min-height: 40px; font: 500 14px/1.3 var(--font-body); text-align: left; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.as-sug:hover { border-color: var(--cp-mint); background: var(--cp-mint-soft); }
.as-sug:disabled { cursor: not-allowed; opacity: .55; }
.as-sug:disabled:hover { border-color: var(--line-2); background: var(--surface-2); }
.as-sug:focus-visible, .as-panel :focus-visible { outline: 2px solid var(--cp-gold); outline-offset: 2px; }
.as-card-form { display: flex; gap: 8px; }
.as-card-form input { flex: 1 1 auto; min-width: 0; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface-3, var(--surface)); color: var(--ink); font: 400 15px var(--font-body); }
.as-card-note { margin: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--cp-amber); color: var(--ink); font-size: 14px; line-height: 1.45; }
.as-card-note[hidden] { display: none; }
.as-card-past { justify-self: start; }

/* ── the panel: a drawer ── */
.as-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(5, 10, 9, .55); }
.as-scrim[hidden], .as-panel[hidden] { display: none; }
body.as-open { overflow: hidden; }
.as-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 91; width: min(560px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border-left: 1px solid var(--line-2); box-shadow: -20px 0 50px -20px rgba(0, 0, 0, .45);
  font-family: var(--font-body); overflow: hidden; }
.as-panel *, .as-panel *::before, .as-panel *::after { min-width: 0; box-sizing: border-box; }
.as-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 8px; }
.as-top h2 { margin: 0; font: 700 22px/1.1 var(--font-display); color: var(--ink); }
.as-x { appearance: none; border: 1px solid var(--line-2); background: transparent; color: var(--ink); border-radius: 10px; width: 40px; height: 40px;
  font: 400 24px/1 var(--font-body); cursor: pointer; flex: none; }
.as-x:hover { background: var(--surface-2); }
.as-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 18px 8px; flex-wrap: wrap; }
.as-hist { margin: 0 18px 8px; border: 1px solid var(--line); border-radius: 10px; }
.as-hist[hidden] { display: none; }
.as-hist summary { cursor: pointer; padding: 8px 12px; font: 600 13.5px var(--font-body); color: var(--ink); min-height: 40px; display: flex; align-items: center; }
.as-threads { list-style: none; margin: 0; padding: 0 6px 6px; max-height: 220px; overflow-y: auto; }
.as-past { appearance: none; display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--ink); padding: 8px 8px; min-height: 40px; border-radius: 8px; cursor: pointer; font: 400 14px/1.3 var(--font-body); overflow-wrap: anywhere; }
.as-past:hover { background: var(--surface-2); }
.as-past-d { flex: none; font: 500 12.5px var(--font-mono); color: var(--muted); }

/* the conversation */
.as-thread { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 6px 18px 12px; display: flex; flex-direction: column; gap: 12px; }
.as-msg { border-radius: 14px; padding: 10px 14px; max-width: 100%; overflow-wrap: anywhere; line-height: 1.5; font-size: 15px; }
.as-msg p { margin: 0 0 8px; }
.as-msg p:last-child { margin-bottom: 0; }
.as-who { font: 600 11px/1.3 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.as-msg.is-user { align-self: flex-end; background: var(--cp-gold-soft); border: 1px solid var(--cp-gold-line); max-width: 88%; }
.as-msg.is-bot { align-self: stretch; background: var(--surface-2); border: 1px solid var(--line); }
.as-msg.is-note { align-self: stretch; background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
.as-msg.is-bad { border: 1px solid var(--cp-amber); color: var(--ink); }
.as-msg.is-wait { color: var(--muted); }
.as-rich ul, .as-rich ol { margin: 0 0 8px; padding-left: 20px; }
.as-rich li { margin: 2px 0; }
.as-rich strong { font-weight: 700; color: var(--ink); }

/* drafts: a box with Copy */
.as-draft { margin: 10px 0 4px; border: 1px solid var(--cp-mint-line); background: var(--cp-mint-soft); border-radius: 12px; padding: 10px 12px; }
.as-draft-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.as-draft-l { font: 600 12px var(--font-mono); letter-spacing: .06em; color: var(--cp-mint); }
.as-draft-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; color: var(--ink); }
.as-copy-src { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* sources and thumbs */
.as-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.as-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.as-chip { font: 500 12px/1.2 var(--font-mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 9px; }
.as-thumbs { display: flex; gap: 6px; margin-left: auto; }
.as-thumb { appearance: none; border: 1px solid var(--line-2); background: transparent; border-radius: 10px; width: 40px; height: 40px; cursor: pointer; font-size: 17px; line-height: 1; }
.as-thumb[aria-pressed="true"] { background: var(--cp-gold-soft); border-color: var(--cp-gold); }

/* the states, the form */
.as-state { margin: 0 18px 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--cp-amber); font-size: 14px; line-height: 1.45; }
.as-state[hidden] { display: none; }
.as-form { padding: 10px 18px 6px; border-top: 1px solid var(--line); }
.as-form textarea { width: 100%; resize: vertical; min-height: 56px; max-height: 200px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface-3, var(--surface)); color: var(--ink); font: 400 15px/1.45 var(--font-body); }
.as-form textarea:disabled, .as-card-form input:disabled { opacity: .55; }
.as-form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.as-count { font: 500 12.5px var(--font-mono); color: var(--muted); }
.as-fine { margin: 0; padding: 0 18px 12px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

/* ── a phone: the card stacks, the panel is a full-screen sheet ── */
@media (max-width: 760px) {
  .as-card-form { flex-direction: column; }
  .as-card-form .btn { width: 100%; }
  .as-card-head h2 { font-size: 20px; }
  .as-panel { width: 100vw; left: 0; border-left: 0; box-shadow: none; }
  .as-top { padding: 12px 16px 6px; }
  .as-bar, .as-thread, .as-form, .as-fine { padding-left: 16px; padding-right: 16px; }
  .as-hist, .as-state { margin-left: 16px; margin-right: 16px; }
  .as-msg.is-user { max-width: 100%; }
  /* every control at least 44 px on a phone (the plan of record's phone rule) */
  .as-sug, .as-past, .as-hist summary, .as-card-form input { min-height: 44px; }
  .as-x, .as-thumb { width: 44px; height: 44px; }
  .as-panel .btn, .as-card .btn { min-height: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  .as-panel { animation: as-in .18s ease-out; }
  @keyframes as-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
