/* ── Gorgias HIL widget ──
 * Extracted from the inline <style> in layouts/hil.html.erb and the inline
 * style= attributes of app/views/gorgias/hil/*. Everything is scoped to
 * .hil-card (the layout root) so nothing leaks to other pages.
 * Data-driven values (rating button + badge colours computed in Ruby) stay
 * inline in the Haml — they cannot live in a static stylesheet.
 */

/* ── Layout chrome (was the <style> block in layouts/hil.html.erb) ── */
body:has(.hil-card) * { box-sizing: border-box; margin: 0; padding: 0; }
body:has(.hil-card) { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; background: #f9fafb; color: #1f2937; min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.hil-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 34px 38px; max-width: 640px; width: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.hil-card .hil-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f3f4f6; }
.hil-card .hil-logo { font-size: 22px; }
.hil-card .hil-brand { font-weight: 700; color: #0891b2; font-size: 15px; }
.hil-card .hil-action-title { font-size: 18px; font-weight: 700; margin-bottom: 9px; }
.hil-card .hil-description { color: #6b7280; font-size: 13px; line-height: 1.6; margin-bottom: 24px; }
.hil-card .hil-preview { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; font-size: 13px; line-height: 1.6; color: #374151; margin-bottom: 18px; white-space: pre-wrap; }
.hil-card .hil-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.hil-card .hil-badge-green  { background: #d1fae5; color: #065f46; }
.hil-card .hil-badge-yellow { background: #fef3c7; color: #92400e; }
.hil-card .hil-badge-red    { background: #fee2e2; color: #991b1b; }
.hil-card .hil-badge-gray   { background: #f3f4f6; color: #374151; }
.hil-card .hil-meta { font-size: 11px; color: #9ca3af; margin-top: 26px; padding-top: 18px; border-top: 1px solid #f3f4f6; }
.hil-card .hil-meta code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 10px; }
.hil-card .btn { display: inline-block; padding: 8px 18px; border-radius: 6px; font-weight: 600; font-size: 13px; text-decoration: none; cursor: pointer; border: none; }
.hil-card .btn-primary { background: #0891b2; color: #fff; }
.hil-card .btn-gray    { background: #e5e7eb; color: #374151; }
.hil-card .hil-note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 10px 14px; font-size: 12px; color: #92400e; margin-bottom: 14px; }

/* ── Shared view helpers ── */
.hil-card .hil-field-label { font-size: 12px; font-weight: 700; color: #374151; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.hil-card .hil-field-label--mb10 { margin-bottom: 10px; }
.hil-card .hil-badge--lg { font-size: 13px; padding: 4px 12px; }
.hil-card .hil-note--warn { border-color: #fcd34d; }
.hil-card .hil-error { background: #fee2e2; border: 1px solid #fca5a5; border-radius: 6px; padding: 8px 12px; font-size: 12px; color: #991b1b; margin-bottom: 12px; }
.hil-card .hil-hidden { display: none; }
.hil-card .hil-btn-row { display: flex; gap: 8px; }
.hil-card .hil-rate-option { flex: 1; cursor: pointer; }

/* ── refine ── */
.hil-card .hil-refine-textarea { width: 100%; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; background: #f9fafb; color: #9ca3af; resize: vertical; min-height: 80px; margin-bottom: 14px; font-family: inherit; cursor: not-allowed; }
.hil-card .hil-refine-disabled { cursor: default; opacity: 0.5; background: #7c3aed; color: #fff; }

/* ── chat (session history timeline) ── */
.hil-card .hil-chat-ticket { font-size: 13px; font-weight: 500; color: #6b7280; margin-left: 8px; }
.hil-card .hil-chat-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.hil-card .hil-chip { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.hil-card .hil-chip--brand { background: #eff6ff; color: #1d4ed8; }
.hil-card .hil-chip--category { background: #f0fdf4; color: #15803d; }
.hil-card .hil-chip--language { background: #faf5ff; color: #7e22ce; }
.hil-card .hil-events { display: flex; flex-direction: column; gap: 10px; }
.hil-card .hil-event { padding: 10px 14px; border-radius: 0 6px 6px 0; }
.hil-card .hil-event--start { border-left: 3px solid #6b7280; background: #f9fafb; }
.hil-card .hil-event--text { border-left: 3px solid #0891b2; background: #f0f9ff; }
.hil-card .hil-event--result { border-left: 3px solid #16a34a; background: #f0fdf4; }
.hil-card .hil-event--error { border-left: 3px solid #ef4444; background: #fef2f2; }
.hil-card .hil-event-label { font-size: 10px; margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.hil-card .hil-event--start .hil-event-label { color: #9ca3af; }
.hil-card .hil-event--text .hil-event-label { color: #0e7490; }
.hil-card .hil-event--result .hil-event-label { color: #15803d; margin-bottom: 4px; }
.hil-card .hil-event--error .hil-event-label { color: #dc2626; margin-bottom: 4px; }
.hil-card .hil-event--start .hil-event-content { font-size: 12px; color: #374151; white-space: pre-wrap; line-height: 1.6; }
.hil-card .hil-event--text .hil-event-content { font-size: 13px; color: #1e293b; white-space: pre-wrap; line-height: 1.7; }
.hil-card .hil-event--result .hil-event-content { font-size: 11px; color: #16a34a; }
.hil-card .hil-event--error .hil-event-content { font-size: 12px; color: #b91c1c; }
.hil-card .hil-event-details { padding: 8px 14px; border-radius: 0 6px 6px 0; }
.hil-card .hil-event-details--tool { border-left: 3px solid #d1d5db; background: #f9fafb; }
.hil-card .hil-event-details--thinking { border-left: 3px solid #e9d5ff; background: #fdf4ff; }
.hil-card .hil-event-summary { font-size: 11px; cursor: pointer; font-weight: 600; }
.hil-card .hil-event-details--tool .hil-event-summary { color: #6b7280; }
.hil-card .hil-event-details--thinking .hil-event-summary { color: #7e22ce; }
.hil-card .hil-event-time { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.hil-card .hil-event-details--tool .hil-event-time { color: #9ca3af; }
.hil-card .hil-event-details--thinking .hil-event-time { color: #a855f7; }
.hil-card .hil-event-pre { margin-top: 8px; font-size: 11px; white-space: pre-wrap; }
.hil-card .hil-event-details--tool .hil-event-pre { color: #374151; background: #fff; border: 1px solid #e5e7eb; border-radius: 4px; padding: 8px 10px; font-family: monospace; overflow-x: auto; }
.hil-card .hil-event-details--thinking .hil-event-pre { color: #6b21a8; line-height: 1.6; }
.hil-card .hil-event-toolname { background: #e5e7eb; padding: 1px 5px; border-radius: 3px; font-size: 10px; }

/* ── rate (.rating-btn name is referenced by inline JS) ── */
.hil-card .hil-rate-saved { text-align: center; padding: 10px 0 18px; }
.hil-card .hil-rate-emoji { font-size: 36px; margin-bottom: 8px; }
.hil-card .hil-rate-badge-wrap { margin-top: 8px; }
.hil-card .hil-rate-reason { font-size: 12px; color: #6b7280; margin-top: 10px; font-style: italic; }
.hil-card .hil-rate-by { font-size: 11px; color: #9ca3af; margin-top: 6px; }
.hil-card .hil-rate-close-note { font-size: 12px; color: #9ca3af; text-align: center; margin-bottom: 16px; }
.hil-card .hil-rate-greeter { font-size: 14px; color: #374151; margin-bottom: 14px; }
.hil-card .hil-rate-row { display: flex; gap: 10px; margin-bottom: 24px; }
.hil-card .rating-btn { text-align: center; padding: 13px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; transition: all .15s; }
.hil-card .hil-rate-reason-group { margin-bottom: 20px; }
.hil-card .hil-rate-reason-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.hil-card .hil-rate-reason-hint { font-weight: 400; color: #9ca3af; }
.hil-card .hil-rate-textarea { width: 100%; border: 1px solid #d1d5db; border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.5; resize: vertical; font-family: inherit; }
.hil-card .hil-rate-submit { background: #0891b2; color: #fff; padding: 12px 20px; border-radius: 6px; font-weight: 600; font-size: 13px; border: none; cursor: pointer; width: 100%; }

/* ── fire (.fire-rating-btn name is referenced by inline JS) ── */
.hil-card .hil-fire-ticket { font-size: 12px; color: #6b7280; margin-bottom: 14px; }
.hil-card .hil-fire-message { width: 100%; font-size: 13px; line-height: 1.6; resize: vertical; border: 1px solid #e5e7eb; border-radius: 6px; padding: 12px 14px; font-family: inherit; color: #1f2937; margin-bottom: 16px; }
.hil-card .hil-fire-checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.hil-card .hil-fire-checkbox-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #374151; cursor: pointer; }
.hil-card .hil-fire-checkbox { width: 15px; height: 15px; accent-color: #0891b2; }
.hil-card .hil-fire-rate-section { border-top: 1px solid #e5e7eb; padding-top: 16px; margin-bottom: 20px; }
.hil-card .hil-fire-rated { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 10px 14px; }
.hil-card .hil-fire-rated-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.hil-card .hil-fire-rated-badge { color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.hil-card .hil-fire-rated-tag { font-size: 11px; color: #9ca3af; }
.hil-card .hil-fire-rated-reason { font-size: 12px; color: #4b5563; font-style: italic; }
.hil-card .hil-fire-rated-by { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.hil-card .hil-fire-rate-row { display: flex; gap: 10px; margin-bottom: 12px; }
.hil-card .fire-rating-btn { text-align: center; padding: 8px 6px; border-radius: 6px; font-size: 13px; font-weight: 600; transition: all .15s; }
.hil-card .hil-fire-reason { width: 100%; font-size: 12px; line-height: 1.5; resize: vertical; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px 10px; font-family: inherit; color: #374151; }
.hil-card .hil-fire-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.hil-card .hil-fire-sending { font-size: 12px; color: #9ca3af; }

/* ── lucas_opt_in (enable / disable) ── */
.hil-card .hil-optin-header { text-align: center; padding: 10px 0 18px; }
.hil-card .hil-optin-emoji { font-size: 36px; margin-bottom: 8px; }
.hil-card .hil-optin-ticket { font-size: 13px; color: #374151; margin-top: 8px; }
.hil-card .hil-description--mb16 { margin-bottom: 16px; }
.hil-card .hil-optin-beta { background: #fef9c3; border: 1px solid #fde047; border-radius: 6px; padding: 8px 12px; font-size: 12px; color: #713f12; margin-bottom: 16px; }
.hil-card .hil-optin-back-wrap { text-align: center; margin-bottom: 16px; }
.hil-card .hil-optin-back { font-size: 13px; padding: 8px 16px; text-decoration: none; }
.hil-card .hil-optin-footer { font-size: 12px; color: #9ca3af; text-align: center; }

/* ── BMythos research details (collapsible, default closed) on Fire/Rate ── */
.hil-card .hil-research { margin-top: 28px; border-top: 1px solid #f3f4f6; padding-top: 22px; }
.hil-card .hil-research-summary {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: #6b7280;
  background: #f3f4f6; padding: 9px 16px; border-radius: 999px;
  cursor: pointer; list-style: none; user-select: none;
  transition: background .15s ease, color .15s ease;
}
.hil-card .hil-research-summary:hover { background: #e5e7eb; color: #374151; }
.hil-card .hil-research-summary::-webkit-details-marker { display: none; }
.hil-card .hil-research-summary::after { content: "▾"; font-size: 10px; color: #9ca3af; transition: transform .15s ease; }
.hil-card details[open] .hil-research-summary { background: #e0f2fe; color: #0e7490; }
.hil-card details[open] .hil-research-summary::after { transform: rotate(180deg); color: #0891b2; }
.hil-card .hil-research-summary:focus { outline: none; }
.hil-card .hil-research-summary:focus-visible { box-shadow: 0 0 0 3px rgba(8,145,178,.18); }
.hil-card .hil-research-body { margin-top: 20px; }
