.document-history-dialog { width: min(1100px, calc(100vw - 32px)); height: min(680px, calc(var(--mobile-viewport-height, 100dvh) - 32px)); max-height: none; padding: 0; border: 1px solid var(--zy-border); border-radius: 8px; color: var(--zy-text); background: var(--zy-surface); letter-spacing: 0; }
.document-history-dialog[open] { display: flex; flex-direction: column; }
.document-history-dialog::backdrop { background: rgb(0 0 0 / .36); }
.document-history-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 16px; border-bottom: 1px solid var(--zy-border); }
.document-history-dialog h2 { margin: 0; font: 600 18px/1.4 system-ui, sans-serif; }
.history-header-tools { display: flex; gap: 4px; }
.history-policy { margin: 0; padding: 8px 16px; font-size: 12px; color: var(--zy-muted); border-bottom: 1px solid var(--zy-border); }
.history-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); flex: 1; min-height: 0; }
.history-list { overflow-y: auto; min-height: 0; border-right: 1px solid var(--zy-border); scrollbar-color: var(--zy-border-strong) transparent; }
.history-list button { display: block; width: 100%; min-height: 60px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--zy-border); border-radius: 0; color: var(--zy-text); background: transparent; text-align: left; cursor: pointer; }
.history-list button:hover, .history-list button[aria-pressed="true"] { background: var(--zy-primary-soft); }
.history-list button:focus-visible { outline: 2px solid var(--zy-primary); outline-offset: -2px; }
.history-list strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.history-list small { display: block; margin-top: 5px; color: var(--zy-muted); font-size: 11px; }
.history-comparison { display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 14px; }
.history-view-switch { display: none; }
.history-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; flex: 1; min-height: 0; }
.history-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 6px; }
.history-pane > span { color: var(--zy-muted); font-size: 12px; }
.history-pane strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-height: 22px; font-size: 14px; }
.history-pane textarea { resize: none; flex: 1; min-height: 0; width: 100%; padding: 10px; border: 1px solid var(--zy-border); border-radius: 6px; color: var(--zy-text); background: var(--zy-surface); font: 14px/1.6 Consolas, monospace; letter-spacing: 0; scrollbar-color: var(--zy-border-strong) transparent; }
.history-pane textarea:focus-visible { outline: 2px solid var(--zy-primary); outline-offset: -2px; }
.document-history-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; min-height: 60px; border-top: 1px solid var(--zy-border); }
.history-feedback { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--zy-muted); font-size: 13px; }
.document-history-dialog > footer button { flex-shrink: 0; }
@media (max-width: 760px), (max-width: 980px) and (max-height: 500px) {
    .document-history-dialog { width: calc(100vw - 16px); height: calc(var(--mobile-viewport-height, 100dvh) - 16px); }
    .document-history-dialog .icon-button { min-width: 44px; min-height: 44px; }
    .document-history-dialog > header { min-height: 54px; padding: 5px 10px; }
    .history-policy { padding: 6px 12px; }
    .history-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 100px minmax(0, 1fr); }
    .history-list { border-right: 0; border-bottom: 1px solid var(--zy-border); }
    .history-list button { min-height: 48px; padding: 7px 12px; }
    .history-comparison { padding: 10px; gap: 8px; }
    .history-view-switch { display: flex; gap: 4px; }
    .history-view-switch button { min-height: 44px; flex: 1; border: 0; border-radius: 6px; color: var(--zy-text-soft); background: var(--zy-surface-soft); font-size: 14px; }
    .history-view-switch button[aria-pressed="true"] { color: var(--zy-primary); background: var(--zy-primary-soft); }
    .history-panes { display: flex; }
    .history-pane { flex: 1; }
    .history-pane > span { display: none; }
    .document-history-dialog[data-preview="selected"] .history-pane-current, .document-history-dialog[data-preview="current"] .history-pane-selected { display: none; }
    .history-pane textarea { font-size: 16px; }
    .document-history-dialog > footer { padding: 8px 10px; gap: 8px; }
    .document-history-dialog > footer button { min-height: 44px; }
    .history-feedback { font-size: 12px; }
}
@media (max-width: 980px) and (max-height: 500px) { .history-layout { grid-template-rows: 60px minmax(0, 1fr); } .history-pane strong { min-height: 18px; } }
