#history-open { position: relative; min-height: 44px; padding: 0 6px; background: transparent; color: inherit; font: inherit; font-size: 13px; white-space: nowrap; }
#history-open.has-review-unread::after { content: ''; position: absolute; width: 6px; height: 6px; top: 9px; inset-inline-end: 0; border-radius: 50%; background: var(--accent); }
.review-reminder { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(100%, 800px); min-height: 44px; margin: 0 auto 16px; padding: 9px 14px; border: 1px solid var(--line); border-inline-start: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 13px; text-align: left; }
.review-reminder:hover { background: var(--surface-alt); }
.review-reminder span:last-child { color: var(--accent); white-space: nowrap; }
.history-dialog { --history-dialog-height: calc(100dvh - 32px); width: min(860px,calc(100% - 32px)); max-height: var(--history-dialog-height); overflow: auto; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-dialog); }
.history-dialog:has(#history-works-panel:not([hidden])) { height: var(--history-dialog-height); scrollbar-gutter: stable; }
.history-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-dialog .dialog-tabs { margin: 0 0 8px; }
.history-head h2 { margin: 0; font-size: 24px; font-weight: 500; }
.history-head-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.history-head-actions button { padding-inline: 8px; white-space: nowrap; }
.history-dialog .dialog-tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.history-dialog button { min-height: 42px; background: transparent; color: inherit; font: inherit; font-size: 13px; }
.history-note,.history-status,.history-empty { color: var(--muted); font-size: 12px; line-height: 1.85; overflow-wrap: anywhere; }
.history-status { color: var(--accent); }
.history-status:empty { display: none; }
#history-filters { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 8px; align-items: center; border: 0; border-bottom: 1px solid var(--line); margin: 0 0 8px; padding: 0 0 8px; min-width: 0; }
.history-list-filters { display: grid; grid-template-columns: auto minmax(110px,145px); gap: 8px; align-items: center; }
.history-dialog label { display: grid; gap: 6px; font-size: 12px; min-width: 0; }
.history-dialog input,.history-dialog select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: inherit; font: inherit; font-size: 13px; }
.history-state-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.history-state-buttons button { min-height: 38px; padding: 6px 4px; border-radius: 0; white-space: nowrap; font-size: 12px; }
.history-state-buttons button[aria-pressed="true"] { color: var(--surface); background: var(--ink); }
.history-state-buttons button:focus-visible { outline-offset: -3px; }
#history-query-submit,.history-rename button[type=submit] { border: 1px solid var(--ink); background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: var(--radius-sm); }
#history-query-submit:hover,.history-rename button[type=submit]:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.history-list,#history-review-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,345px),1fr)); gap: 0 16px; align-items: start; }
.history-item { display: flex; align-items: center; gap: 5px 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 5px 0; }
.history-item-main { min-width: 0; flex: 1 1 106px; }
#history-panel-list>.history-note:empty { display: none; }
.history-list>.history-empty { grid-column: 1/-1; }
.history-dialog .history-title { display: block; width: 100%; min-height: 36px; padding: 0; text-align: left; font-size: 14px; font-weight: 500; line-height: 1.7; overflow-wrap: anywhere; }
.history-title:hover { text-decoration: underline; text-underline-offset: 4px; background: transparent; color: var(--accent); }
.history-item-main p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.history-item-actions { display: flex; gap: 2px; flex: none; }
.history-item-actions button { font-size: 12px; padding: 4px 6px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); }
.history-item-actions button:hover { border-color: var(--line); background: var(--surface-alt); color: var(--ink); }
.history-item-actions [data-history-delete]:hover { border-color: var(--danger); color: var(--danger); background: var(--wash); }
.history-rename { display: flex; gap: 10px; flex-basis: 100%; align-items: end; margin-top: 6px; }
.history-rename label { flex: 1; }
#history-more,#history-reviews-more,#history-reviews-retry { display: block; margin: 16px auto 0; text-decoration: underline; text-underline-offset: 4px; }
.history-review-count { margin-inline-start: 5px; color: var(--accent); font-weight: 600; }
.history-dialog .review-history-row { display: grid; gap: 4px; width: 100%; padding: 8px 10px; margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: left; overflow-wrap: anywhere; }
.history-dialog .review-history-row:hover { background: var(--surface-alt); }
.history-dialog .review-history-row[data-review-read="false"] { border-inline-start: 3px solid var(--accent); }
.review-history-head { display: flex; align-items: center; gap: 8px; }
.review-history-new { color: var(--accent); }
.review-history-comment { white-space: pre-line; }
.review-history-row small { color: var(--muted); }
.work-review-item:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.archived-note { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 16px; line-height: 1.8; }
.archived-note button { min-height: 44px; }
@media (max-width: 640px) {
  .history-dialog { --history-dialog-height: calc(100dvh - 20px); width: calc(100% - 20px); max-width: none; padding: 12px; border-radius: var(--radius-md); }
  .history-head h2 { font-size: 21px; }
  .history-head-actions button { padding-inline: 6px; }
  #history-filters { grid-template-columns: auto minmax(0,1fr) auto; }
  .history-list-filters { grid-column: 1/-1; grid-template-columns: auto minmax(0,145px); }
  .history-dialog input,.history-dialog select { font-size: 16px; }
  #history-search-scope,#history-query-submit { padding-inline: 8px; }
  .history-rename { flex-wrap: wrap; }
  .history-rename label { flex-basis: 100%; }
  .history-item-actions { gap: 4px; }
}
