/* Read-only history uses the consultation's existing neutral/coral palette. */
dialog.kv-history-dialog{padding:0;max-width:820px;overflow:hidden}
dialog.kv-history-dialog[open]{display:flex;flex-direction:column;min-height:min(420px,calc(var(--chat-view-height,100dvh) - 32px))}
.kv-history-heading{flex:0 0 auto;margin:0;padding:20px 24px 8px;align-items:center}
.kv-history-heading h2{font-size:20px;line-height:1.6;overflow-wrap:anywhere}
.kv-history-heading .kv-history-close{background:transparent;border-color:transparent}
.kv-history-dialog .kv-history-note,.kv-history-dialog .kv-history-retention{flex:0 0 auto;font-size:12px;line-height:1.7;margin:0;padding:0 24px 8px;color:var(--ui-reading)}
.kv-history-dialog .kv-history-expiry{font-size:12px;line-height:1.7;color:var(--ui-reading);margin:0 0 8px}
.kv-history-navigation{flex:0 0 auto;padding:0 14px}
.kv-history-navigation:has(.kv-history-back[hidden]){display:none}
.kv-history-back{font-size:13px;text-align:left}
.kv-history-content{flex:1 1 auto;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-width:thin;padding:12px 24px 24px;overflow-wrap:anywhere}
.kv-history-content:focus-visible{outline-offset:-3px}
.kv-history-dialog .kv-history-state{font-size:15px;line-height:1.85;margin:16px 0}
.kv-history-list{list-style:none;padding:0;margin:0}
.kv-history-list>li{margin:0;border-bottom:1px solid var(--ui-line)}
.kv-history-list>li:first-child{border-top:1px solid var(--ui-line)}
.kv-history-item{display:flex;align-items:center;gap:14px;min-height:76px;width:100%;padding:16px 0;background:transparent;text-align:left}
.kv-history-item:hover:not(:disabled){color:var(--ui-ink)}
.kv-history-item:hover .kv-history-item-title{text-decoration:underline;text-underline-offset:4px;text-decoration-color:var(--ui-brand)}
.kv-history-item-copy{display:flex;flex:1 1 auto;flex-direction:column;min-width:0;gap:6px}
.kv-history-item-title{font-size:15px;font-weight:600;line-height:1.7;overflow-wrap:anywhere}
.kv-history-item-date,.kv-history-item-expiry{font-size:12px;line-height:1.6;color:var(--ui-reading)}
.kv-history-paging{padding-top:16px;display:flex;flex-direction:column;align-items:center;gap:8px}
.kv-history-more{min-height:44px;max-width:100%;padding:10px 18px}
.kv-history-dialog .kv-history-page-status{min-height:1.7em;font-size:12px;line-height:1.7;margin:0;color:var(--ui-reading);text-align:center}
.kv-history-current{font-size:11px;line-height:1.5;padding:4px 8px;border:1px solid var(--ui-line);border-radius:999px;white-space:nowrap;color:var(--ui-reading)}
.kv-history-item-arrow{flex:0 0 auto;font-size:20px}
.kv-history-dialog .kv-history-detail-title{margin:8px 0 8px;font-size:18px;line-height:1.7;font-weight:650;overflow-wrap:anywhere}
.kv-history-dialog .kv-history-readonly{font-size:12px;line-height:1.7;color:var(--ui-reading);margin:0 0 28px}
.kv-history-messages{list-style:none;padding:0;margin:0}
.kv-history-message{margin:0 0 28px;max-width:100%}
.kv-history-message.kv-history-visitor{padding:16px;background:#f7f3f2;border-radius:8px;margin-left:32px}
.kv-history-message-meta{display:flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline;margin-bottom:8px;color:var(--ui-reading)}
.kv-history-message-role{font-size:12px;font-weight:600;line-height:1.6}
.kv-history-message-date{font-size:11px;line-height:1.6}
.kv-history-dialog .kv-history-message-text{font-size:15px;line-height:1.9;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.kv-history-footer{flex:0 0 auto;display:flex;justify-content:flex-end;padding:8px 18px;border-top:1px solid var(--ui-line);background:#fff}
.kv-history-footer button{font-size:13px}
@media(max-width:760px){
 dialog.kv-history-dialog{padding:0}
 dialog.kv-history-dialog[open]{min-height:min(420px,calc(var(--chat-view-height,100dvh) - 16px))}
 .kv-history-heading{padding:14px 16px 8px;gap:10px}
 .kv-history-heading h2{font-size:17px}
 .kv-history-dialog .kv-history-note,.kv-history-dialog .kv-history-retention{padding-inline:16px}
 .kv-history-navigation{padding-inline:6px}
 .kv-history-content{padding:10px 16px 20px}
 .kv-history-item{gap:10px;padding-block:14px}
 .kv-history-item-title{font-size:14px}
 .kv-history-current{font-size:10px;padding:4px 6px}
 .kv-history-item-arrow{font-size:18px}
 .kv-history-dialog .kv-history-detail-title{font-size:17px}
 .kv-history-message.kv-history-visitor{margin-left:16px;padding:12px}
 .kv-history-footer{padding:6px 10px}
}
