/* ── Hitch design system ─────────────────────────────────────────────
   Tokens + shared primitives for the calm paper/green visual language
   (source mockup: chat_1.html). Loaded globally from base.html AFTER
   Tailwind's CDN preflight, so rules here assume preflight resets.
   Legacy pages keep their Tailwind utility classes (the gray/brand
   scales are remapped to these tones in base.html's tailwind.config);
   new surfaces build on these primitives instead. */

:root {
  --ink: #1C2420;
  --paper: #F7F8F5;
  --card: #FFFFFF;
  --line: #E3E7E0;
  --line2: #CFD6CE;
  --green: #17845A;
  --green-deep: #0E5A3E;
  --green-tint: #E7F3ED;
  --amber: #A96F1F;
  --amber-tint: #FAF1E0;
  --amber-line: #EBDCBB;
  --red: #B4372F;
  --red-tint: #F9ECEA;
  --muted: #6E7871;
  --faint: #98A29C;
  --r-card: 14px;
  --r-btn: 10px;
  --r-chip: 9px;
  --font-display: "Bricolage Grotesque", sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;
}

/* Display face for headings app-wide; body font is set in base.html. */
h1, h2, h3, .font-display { font-family: var(--font-display); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: var(--r-btn); padding: 8px 15px;
  font-size: 13.5px; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--line2); background: var(--card); color: var(--ink);
  cursor: pointer; font-family: inherit; transition: background .12s;
}
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-deep); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #9A2E27; }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); font-weight: 500; }
.btn.quiet:hover { background: var(--paper); color: var(--ink); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ── Status chips ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-chip); white-space: nowrap;
}
.chip.run  { background: var(--green-tint); color: var(--green-deep); }
.chip.wait { background: var(--amber-tint); color: var(--amber); }
.chip.done { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.chip.fail { background: var(--red-tint); color: var(--red); }

.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: hi-pulse 1.6s infinite; }
@keyframes hi-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ── Cards ── */
.hi-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }

/* ── Whisper divider — centered quiet system notice ── */
.whisper { text-align: center; font-size: 12px; color: var(--faint); }
.whisper > span {
  background: var(--paper); border: 1px solid var(--line);
  padding: 3px 12px; border-radius: 10px; display: inline-block;
}

/* ── Avatar circles ── */
.face {
  border-radius: 50%; background: var(--green-tint); color: var(--green-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; flex: none;
}
.face.f32 { width: 32px; height: 32px; font-size: 12px; }
.face.f28 { width: 28px; height: 28px; font-size: 11px; }
.face.f24 { width: 24px; height: 24px; font-size: 10px; }

/* ── Plan-step list: vertical timeline with done/now/todo/gate markers ── */
.plan { margin-top: 10px; }
.step { display: flex; gap: 11px; position: relative; padding-bottom: 13px; font-size: 13px; color: var(--muted); }
.step:last-child { padding-bottom: 2px; }
.step::before { content: ""; position: absolute; left: 8.5px; top: 19px; bottom: 1px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.pt {
  width: 19px; height: 19px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; margin-top: 1px; background: var(--card);
}
.pt.done { background: var(--green); color: #fff; }
.pt.now  { border: 2px solid var(--green); color: var(--green); }
.pt.todo { border: 2px solid var(--line2); color: transparent; }
.pt.gate { background: var(--amber-tint); border: 1px solid var(--amber-line); color: var(--amber); border-radius: 6px; }
.step .lbl b { color: var(--ink); font-weight: 500; }
.gatechip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--amber-tint); color: var(--amber); border: 1px solid var(--amber-line);
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 7px;
}

/* ── Markdown rendering (single source of truth for chat bubbles/cards) ── */
.markdown-body, .markdown-body * { overflow-wrap: anywhere; word-break: break-word; }
.markdown-body p { margin-bottom: 0.5em; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body ul, .markdown-body ol { margin: 0.5em 0; padding-left: 1.5em; }
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin-bottom: 0.25em; }
.markdown-body strong { font-weight: 600; }
.markdown-body em { font-style: italic; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { font-weight: 600; margin: 0.75em 0 0.25em; }
.markdown-body h1 { font-size: 1.1em; }
.markdown-body h2 { font-size: 1.05em; }
.markdown-body h3 { font-size: 1em; }
.markdown-body code { background: var(--paper); padding: 0.15em 0.35em; border-radius: 0.25em; font-size: 0.9em; font-family: var(--font-mono); }
.markdown-body pre { background: var(--paper); padding: 0.75em; border-radius: 0.5em; overflow-x: auto; margin: 0.5em 0; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { border-left: 3px solid var(--line2); padding-left: 0.75em; margin: 0.5em 0; color: var(--muted); }
.markdown-body a { color: var(--green); text-decoration: underline; }
.markdown-body hr { border: none; border-top: 1px solid var(--line); margin: 0.75em 0; }
