/* Deliberately scoped: Account and live messaging keep their existing styling. */
#account-history-section[hidden] { display: none !important; }
#account-history-section { display: block; width: 100%; text-align: left; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; text-transform: none; }
#account-history-section:focus-visible, #account-history-back:focus-visible { outline: 2px solid #15803d; outline-offset: 3px; }
#account-history-section::after { content: "›"; float: right; color: #6b7280; }
#account-history-view[hidden], .account-wrapper[hidden] { display: none !important; }
#account-history-back { margin: .5rem 0 .75rem; min-height: 40px; }
#account-history-content { --history-muted: #6b7280; --history-line: #e5e7eb; }
#account-history-content .history-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin: .75rem 0; }
#account-history-content h3 { margin: 0; font-size: 1rem; }
#account-history-content h4 { margin: 0 0 .65rem; font-size: .88rem; }
#account-history-content .history-note { margin: .4rem 0 .9rem; color: var(--history-muted); font-size: .8rem; line-height: 1.5; }
#account-history-content .history-categories { margin: 0 0 1rem; max-width: 22rem; flex-wrap: wrap; }
#account-history-content .history-list { display: grid; gap: .6rem; }
#account-history-content .history-row { display: block; width: 100%; text-align: left; font: inherit; cursor: pointer; text-transform: none; }
#account-history-content .history-row:hover { border-color: #86efac; }
#account-history-content .history-row strong { display: block; font-size: .85rem; margin-bottom: .3rem; }
#account-history-content .history-row span { display: block; color: var(--history-muted); font-size: .76rem; line-height: 1.6; }
#account-history-content button:focus-visible, #account-history-content a:focus-visible { outline: 2px solid #15803d; outline-offset: 3px; }
#account-history-content button:disabled { opacity: .6; cursor: default; }
#account-history-content .history-paging { margin: 1rem 0; text-align: center; }
#account-history-content .history-empty { padding: 1.5rem 1rem; text-align: center; }
#account-history-content .history-empty p { margin-bottom: 0; }
#account-history-content .history-section { margin: .75rem 0; }
#account-history-content .history-record + .history-record { border-top: 1px solid var(--history-line); margin-top: .85rem; padding-top: .85rem; }
#account-history-content dl { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 2fr); gap: .45rem 1rem; margin: 0; font-size: .78rem; line-height: 1.5; }
#account-history-content dt { color: var(--history-muted); }
#account-history-content dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#account-history-content .history-thread { position: relative; display: flex; flex-direction: column; gap: .75rem; max-height: 65dvh; min-height: 8rem; overflow-y: auto; overflow-anchor: none; padding: .75rem .25rem; }
#account-history-content .message-bubble { flex-shrink: 0; font-size: .82rem; overflow-wrap: anywhere; }
#account-history-content .message-meta { font-size: .68rem; margin-bottom: .35rem; color: #4b5563; }
#account-history-content .history-message-text { white-space: pre-wrap; }
#account-history-content .history-media { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
#account-history-content .history-media a { display: inline-block; }
#account-history-content .history-media img, #account-history-content .history-media video { display: block; width: 180px; max-width: 100%; max-height: 200px; object-fit: contain; border-radius: .5rem; }
#account-history-content .history-media video { width: 260px; }
#account-history-content .history-media-unavailable { color: #6b7280; font-size: .75rem; }
#account-history-content .history-skeleton { height: 3.5rem; margin: .6rem 0; border-radius: .8rem; background: #e5e7eb; }
#account-history-content .history-error { color: #991b1b; }
#account-history-content .history-row, #account-history-content .history-section { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 600px) {
  #account-history-content dl { grid-template-columns: 1fr; gap: .15rem; }
  #account-history-content dd { margin-bottom: .55rem; }
  #account-history-content .message-bubble { max-width: 94%; }
  #account-history-content .history-heading { align-items: flex-start; flex-wrap: wrap; }
}
