/* Small extension of Zana's existing History styles; no app-wide layout changes. */
.history-explorer-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; margin: .6rem 0 1rem; }
.history-explorer-form .history-search-label { flex-basis: 100%; }
.history-explorer-form input { flex: 1 1 14rem; min-width: 0; border: 1px solid var(--line); border-radius: .65rem; background: var(--input-bg); color: var(--ink); padding: .65rem; font: inherit; }
.history-explorer .history-focus-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.history-explorer .history-focus-chip[aria-pressed="true"] { border-color: var(--app-accent); background: var(--accent-soft); }
.history-explorer .history-focus-results { display: grid; gap: .65rem; margin-top: 1rem; }
.history-explorer-person { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.history-explorer-person .history-conversation-row { flex: 1 1 12rem; }
.history-explorer-source { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.history-self-discovery { display: grid; gap: .75rem; border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.history-self-discovery h3, .history-self-discovery-record h4 { margin: .25rem 0; }
.history-self-discovery-form { display: grid; gap: .75rem; }
.history-self-discovery-form > label { display: grid; gap: .35rem; }
.history-self-discovery-form input:not([type="checkbox"]), .history-self-discovery-form textarea, .history-self-discovery-form select, .history-self-discovery-fact input { min-width: 0; border: 1px solid var(--line); border-radius: .55rem; background: var(--input-bg); color: var(--ink); padding: .6rem; font: inherit; }
.history-self-discovery-form textarea { min-height: 5rem; resize: vertical; }
.history-self-discovery-form fieldset { display: grid; gap: .4rem; border: 1px solid var(--line); border-radius: .65rem; padding: .75rem; }
.history-self-discovery-choice, .history-self-discovery-confirm { display: flex !important; align-items: flex-start; gap: .5rem !important; }
.history-self-discovery-record { display: grid; gap: .6rem; border: 1px solid var(--line); border-radius: .75rem; padding: .85rem; }
.history-inline-confirm { display: grid; gap: .5rem; border: 1px solid var(--app-accent); border-radius: .65rem; padding: .75rem; }
.history-inline-confirm > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.history-self-discovery-fact { display: grid; gap: .5rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.history-self-discovery-fact blockquote { margin: 0; border-left: 3px solid var(--app-accent); padding-left: .7rem; color: var(--muted); }
.history-self-discovery-code { display: block; overflow-wrap: anywhere; padding: .6rem; border-radius: .5rem; background: var(--panel-strong); }
.history-zana-self { max-height: 28rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--ink); }
@media (max-width: 620px) { .history-explorer-person { align-items: stretch; } .history-explorer-person .history-conversation-row { flex-basis: 100%; } }

/* Same History explorer as the left rail; visible where chat users already look. */
#workspace.workspace .header-history-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: .4rem;
  height: 2.55rem;
  padding: 0 .75rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-size: .84rem;
  font-weight: 650;
  cursor: pointer;
}
#workspace.workspace .header-history-tool svg { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }
#workspace.workspace .header-history-tool:hover { border-color: var(--app-accent); }
#workspace.workspace .header-history-tool:focus-visible { outline: 3px solid var(--app-focus); outline-offset: 2px; }
@media (min-width: 700px) and (max-width: 980px) {
  #workspace.workspace .header-history-tool { width: 2.55rem; padding: 0; }
  #workspace.workspace .header-history-tool span { display: none; }
}
/* Below 700px the existing clearly labelled History tab is already visible. */
@media (max-width: 699px) {
  #workspace.workspace .header-history-tool { display: none; }
}
