.message-history { display: grid; gap: var(--space-4); margin-top: var(--space-5); padding: var(--space-4); box-shadow: none; }
.history-heading { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: var(--space-3); }
.history-heading > div { flex: 1 1 240px; min-width: 0; }
.history-heading h2 { font-size: 20px; }
.history-heading p { color: var(--muted); font-size: 13px; line-height: 1.65; margin-top: var(--space-2); }
.history-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.history-filters button { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: var(--space-1); min-height: var(--mobile-action-height, 72px); padding: var(--mobile-action-padding, var(--space-3)); border: 1px solid var(--border); border-radius: var(--mobile-action-radius, var(--space-2)); background: var(--surface); text-align: left; font-size: 12px; }
.history-filters button[aria-pressed="true"] { border-color: var(--brand); background: var(--soft-green); color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand); }
.history-filters strong { font-size: 18px; }
.history-explainer { line-height: 1.7; }
.history-list { display: grid; gap: var(--space-4); }
.history-item { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--space-3); background: var(--surface); box-shadow: none; }
.history-item-heading { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2) var(--space-3); }
.history-item-heading > h3 { min-width: 0; flex: 1 1 240px; }
.history-item h3 { font-size: 16px; line-height: 1.5; letter-spacing: 0; }
.history-item-meta { display: grid; gap: var(--space-2); }
.history-service, .history-appointment { color: var(--muted); font-size: 12px; }
.history-attribute { display: grid; grid-template-columns: var(--space-4) minmax(0, 1fr); align-items: start; gap: var(--space-2); line-height: 1.7; }
.history-attribute-copy { min-width: 0; overflow-wrap: anywhere; }
.history-attribute-icon { display: flex; align-items: center; justify-content: center; height: 1.7em; color: var(--muted); }
.history-attribute-icon > svg, .history-status-icon > svg { display: block; flex-shrink: 0; }
.history-item h3 .history-attribute-icon { height: 1.5em; }
.history-item .badge { display: inline-grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-1); max-width: 100%; white-space: normal; line-height: 1.5; }
.history-status-icon { display: flex; align-items: center; height: 1.5em; }
.history-when { font-size: 12px; color: var(--muted); }
.history-reason, .history-next { font-size: 13px; line-height: 1.7; }
.history-next { padding: var(--space-3); background: var(--background); border-radius: var(--space-2); color: var(--muted); }
.history-next strong { color: var(--text); }
.history-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.message-history .btn, .history-message summary { min-height: var(--mobile-action-height, 44px); }
.history-message { border: 1px solid var(--border); border-radius: var(--space-2); padding: 0 var(--space-3); }
.history-message summary { display: flex; align-items: center; gap: var(--space-2); list-style: none; cursor: pointer; color: var(--brand); font-size: 12px; font-weight: 600; padding-block: var(--space-3); }
.history-message summary::-webkit-details-marker { display: none; }
.history-message-chevron { display: flex; margin-left: auto; }
.history-message[open] .history-message-chevron { transform: rotate(180deg); }
.history-message .whatsapp-bubble { margin: 0 0 var(--space-3); font-size: 13px; }
.history-results-summary { padding-bottom: var(--space-2); }
.history-jump { min-height: var(--mobile-action-height, 44px); }
@media (min-width: 768px) {
  .message-history { padding: var(--space-5); }
  .history-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .history-filters button { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; min-height: var(--mobile-action-height, 52px); }
}
