.history-view {
  --hist-text: #25243a;
  --hist-sub: #68687b;
  --hist-rule: #e4e3ea;
  --hist-accent: #6542be;
  display: grid;
  gap: 1.15rem;
  min-width: 0;
  color: var(--hist-text);
}
.history-view h1, .history-view h2, .history-view p { margin: 0; }
.history-view h1 { font-size: clamp(1.7rem, 3.1vw, 2.55rem); line-height: 1.2; letter-spacing: -.055em; }
.history-view h2 { font-size: 1.05rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.history-view .btn { text-decoration: none; text-align: center; }
.hist-header, .hist-section-heading, .hist-asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.hist-header { margin-bottom: .25rem; }
.hist-back { display: inline-block; color: var(--hist-sub); font-size: .8rem; text-decoration: none; margin-bottom: .6rem; }
.hist-link { color: var(--hist-accent); font-weight: 570; text-underline-offset: 3px; text-decoration: none; overflow-wrap: anywhere; }
.hist-link:hover, .hist-back:hover { text-decoration: underline; }
.hist-page-id, .hist-id, .hist-file-detail dd {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}
.history-view .hist-page-id { font-size: .78rem; margin-top: .55rem; color: var(--hist-sub); }
.hist-controls, .hist-filter, .hist-pagination, .hist-counts, .hist-confirm {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end;
}
.hist-controls { gap: 1rem; }
.hist-controls:empty, .hist-summary-slot:empty, .hist-error:empty,
.hist-pagination:empty, .hist-results:empty { display: none; }
.hist-field { display: grid; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--hist-sub); }
.hist-field input, .hist-field select {
  width: auto;
  height: 2.5rem;
  padding: .4rem .7rem;
  border: 1px solid #ceccd9;
  border-radius: .6rem;
  color: var(--hist-text);
  background: #fff;
  font: inherit;
  font-weight: 400;
}
.hist-field select { min-width: 9rem; }
.hist-filter .btn { min-height: 2.5rem; }
.hist-summary, .hist-panel { padding: clamp(1rem, 2vw, 1.55rem); }
.hist-panel h2 { margin-bottom: .95rem; }
.hist-section-heading { align-items: flex-start; margin-bottom: 1.25rem; }
.hist-section-heading h2 { margin-bottom: 0; }
.hist-summary .hist-count-bar { display: flex; width: 100%; height: 6px; border-radius: 6px; overflow: hidden; margin: .85rem 0; background: var(--hist-rule); }
.hist-count-bar span { background: var(--state-dot); }
.hist-counts { gap: .5rem; }
.hist-state, .hist-count-bar span { --state-dot: #79788d; --state-bg: #efeff4; --state-text: #525165; }
.history-view [data-state="QUEUED"] { --state-dot: #86859b; --state-bg: #efeff5; --state-text: #55546b; }
.history-view [data-state="EXECUTING"], .history-view [data-state="PUBLISHING"] { --state-dot: #8461c7; --state-bg: #f0eaf9; --state-text: #633a9a; }
.history-view [data-state="RECOVERING"], .history-view [data-state="RETRY_WAIT"] { --state-dot: #c08229; --state-bg: #fbf0de; --state-text: #845017; }
.history-view [data-state="SUCCEEDED"] { --state-dot: #3b956c; --state-bg: #e5f3ea; --state-text: #266442; }
.history-view [data-state="FAILED"] { --state-dot: #c45a5b; --state-bg: #fbe9e7; --state-text: #933e3e; }
.hist-state {
  display: inline-flex; align-items: center; gap: .35rem; border-radius: 1rem; padding: .25rem .56rem;
  color: var(--state-text); background: var(--state-bg); font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.hist-state::before { content: ""; width: .4rem; height: .4rem; border-radius: 100%; background: var(--state-dot); }
.hist-results { display: grid; gap: 1rem; min-width: 0; }
.hist-scroll, .hist-inbox, .hist-results > .hist-empty {
  min-width: 0; border: 1px solid var(--hist-rule); border-radius: .85rem; background: #fff;
}
.hist-scroll { overflow: auto; }
.hist-table { width: 100%; border-collapse: collapse; font-size: .87rem; text-align: left; }
.hist-table th, .hist-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--hist-rule); vertical-align: middle; }
.hist-table th { color: var(--hist-sub); font-size: .74rem; font-weight: 600; background: #f9f8fc; }
.hist-table tr:last-child td { border-bottom: 0; }
.hist-table tr:hover td { background: #fbfaff; }
.hist-id, .hist-secondary, .hist-date { font-size: .78rem; }
.hist-secondary, .hist-table small { display: block; margin-top: .25rem; color: var(--hist-sub); }
.hist-date { white-space: nowrap; }
.hist-pagination { align-items: center; justify-content: flex-end; }
.hist-pagination span { font-size: .8rem; }
.hist-error:not(:empty) {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; border: 1px solid #e6c8c2; background: #fff5f2;
  border-radius: .7rem; padding: .8rem 1rem; color: #853a2f; font-size: .85rem; overflow-wrap: anywhere;
}
.hist-error > span { flex: 1; }
.hist-loading, .hist-empty { text-align: center; padding: 2rem .8rem; }
.hist-empty { display: grid; gap: .4rem; justify-items: center; font-size: .9rem; }
.hist-empty .muted { font-size: .83rem; }
.hist-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 1rem 1.5rem; margin: .85rem 0 1.15rem;
}
.hist-facts dt { font-size: .75rem; color: var(--hist-sub); margin-bottom: .25rem; }
.hist-facts dd { margin: 0; font-size: .86rem; overflow-wrap: anywhere; }
.hist-confirm { align-items: center; }
.hist-confirm span { font-size: .85rem; }
.hist-danger { color: #943c3c; }
.hist-progress { display: grid; gap: .3rem; margin: .75rem 0; font-size: .85rem; }
.hist-progress progress { width: min(18rem, 100%); accent-color: var(--hist-accent); }
.hist-assets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(21rem, 100%), 1fr)); gap: 1rem; }
.hist-asset { border: 1px solid var(--hist-rule); border-radius: .6rem; padding: .8rem; display: grid; gap: .75rem; align-content: start; min-width: 0; }
.hist-asset-head > div { min-width: 0; overflow-wrap: anywhere; }
.hist-asset-head .btn { flex-shrink: 0; }
.hist-asset-head p { font-size: .75rem; margin-top: .25rem; }
.hist-asset video { width: 100%; border-radius: .45rem; background: #16141e; max-height: min(50vh, 28rem); }
.hist-file-detail { color: var(--hist-sub); font-size: .78rem; }
.hist-file-detail summary { cursor: pointer; }
.hist-file-detail .hist-facts { margin-bottom: 0; }
.hist-original-fields { margin: 0; }
.hist-original-fields > div { padding: .85rem 0; border-top: 1px solid var(--hist-rule); }
.hist-original-fields > div:last-child { padding-bottom: 0; }
.hist-original-fields dt { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; font-weight: 600; overflow-wrap: anywhere; }
.hist-original-fields dt code { color: var(--hist-sub); font-weight: 400; }
.hist-original-fields dd { margin: .4rem 0 0; }
.hist-original-fields pre {
  max-width: 100%; margin: 0; padding: .7rem .8rem; background: #f8f7fa;
  border-radius: .4rem; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6;
}
.hist-original-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.hist-section-heading .hist-original-actions { justify-content: flex-end; font-size: .85rem; }
.hist-original-assets { margin: 0; padding-inline-start: 1.4rem; }
.hist-original-asset { padding: .45rem .3rem; }
.hist-original-asset small { display: block; margin: .2rem 0; overflow-wrap: anywhere; }
.hist-original-asset .hist-note { display: block; }
.hist-original-preview img, .hist-original-preview video { display: block; max-width: 100%; max-height: min(55vh, 28rem); border-radius: .5rem; margin-top: .6rem; }
.hist-original-preview audio { max-width: 100%; margin-top: .6rem; }
.history-view .hist-note { padding: .65rem .8rem; border-radius: .45rem; background: #f4f0f9; font-size: .85rem; }
.hist-inbox { list-style: none; padding: 0; margin: 0; overflow: hidden; }
.hist-notice { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: 1rem; border-bottom: 1px solid var(--hist-rule); }
.hist-notice:last-child { border-bottom: 0; }
.hist-notice.unread { box-shadow: inset 3px 0 0 #8a6cc9; }
.hist-notice strong { font-size: .92rem; }
.hist-notice .hist-secondary { margin: .3rem 0; }
.hist-notice > .btn { flex-shrink: 0; }
@media (max-width: 650px) {
  .hist-table th, .hist-table td { padding: .65rem .5rem; }
  .hist-table { min-width: 32rem; }
  .hist-filter, .hist-field { max-width: 100%; }
  .hist-filter .hist-field input { max-width: min(12rem, 100%); }
  .hist-header { align-items: flex-start; }
}
