:root { --zy-accent: var(--zy-primary); --zy-accent-soft: var(--zy-primary-soft); }
.document-stage, .document-content-pane { min-width: 0; max-width: 100%; }
.document-stage.assistant-open { grid-template-columns: minmax(0, 1fr) 6px var(--document-assistant-width, 420px); }
.document-stage.assistant-open.assistant-left { grid-template-columns: var(--document-assistant-width, 420px) 6px minmax(0, 1fr); }
.document-assistant-resizer { width: 6px; background: transparent; }
.document-assistant-resizer::before { opacity: 0; }
.document-assistant-resizer:hover::before, .document-assistant-resizer:focus-visible::before { width: 1px; opacity: 1; }
.document-assistant-panel, .document-stage.assistant-left .document-assistant-panel { border-inline: 0; }
.document-assistant-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.document-assistant-header > div:first-child > div { min-width: 0; flex: 1; }
.document-assistant-header-actions { flex-shrink: 0; margin: 0; }
.document-assistant-header small { width: 100%; }
.document-assistant-composer { min-width: 0; }
.document-assistant-composer textarea { min-width: 0; }
@media (max-width: 900px), (max-width: 980px) and (max-height: 500px) {
    .document-stage.assistant-open, .document-stage.assistant-open.assistant-left { display: block; }
    .document-assistant-header-actions .icon-button { width: 44px; height: 44px; }
}
.import-feedback { flex-shrink: 0; max-height: min(160px, 30vh); overflow: auto; margin: 0; padding: 10px 18px; border-top: 1px solid var(--zy-border); color: var(--zy-text); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.import-drawer footer { grid-template-columns: minmax(0, 1fr) auto auto; flex-shrink: 0; }
.import-drawer header { flex-shrink: 0; }
.import-feedback.failed { color: #be123c; }
.import-drawer .selected-file { border-radius: 8px; }
.import-drawer button:disabled { cursor: default; opacity: .55; }
.import-drawer .selected-file-copy { min-width: 0; }
.document-header-actions .save-status { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-status.failed { color: #be123c; }
.document-draft-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--zy-border); background: var(--zy-surface); font-size: 13px; }
.document-draft-banner span { flex: 1 1 160px; }
.document-draft-banner button, .zy-proposal-button { padding: 6px 10px; border: 1px solid var(--zy-border); border-radius: 6px; color: var(--zy-text); background: var(--zy-surface); cursor: pointer; }
.zy-source-directory { margin: 8px 0; color: var(--zy-muted); font-size: 13px; }
.zy-source-directory summary { cursor: pointer; padding: 6px 0; }
.zy-source-directory ol { margin: 4px 0; padding-left: 26px; }
.zy-source-directory li { min-width: 0; padding: 2px 0; }
.zy-source-directory button { display: block; width: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; color: var(--zy-accent); background: transparent; cursor: pointer; }
.document-assistant-bubble .citation-attached { display: inline; white-space: nowrap; }
.document-assistant-bubble .inline-source { display: inline; vertical-align: super; font-size: 10px; line-height: 1; padding: 2px 3px; margin: 0 1px; border: 0; border-radius: 3px; color: var(--zy-accent); background: transparent; cursor: pointer; }
.document-assistant-bubble .inline-source:hover { background: var(--zy-accent-soft); }
.document-assistant-bubble table { display: block; max-width: 100%; overflow-x: auto; }
.document-assistant-bubble pre { max-width: 100%; overflow: auto; }
.document-assistant-message-actions { gap: 2px; }
.document-assistant-message-actions button { flex-shrink: 0; }
.zy-proposal-button { margin-top: 8px; }
.document-reference-policy { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--zy-muted); }
.document-reference-policy input { accent-color: var(--zy-primary); }
.zy-evidence-hover { position: fixed; z-index: 400; width: min(380px, calc(100vw - 16px)); max-height: 320px; overflow: auto; padding: 12px; border: 1px solid var(--zy-border); border-radius: 8px; color: var(--zy-text); background: var(--zy-surface); box-shadow: 0 6px 24px #0002; pointer-events: none; font-size: 13px; }
.zy-review-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(var(--mobile-vh, 100dvh) - 32px); padding: 0; border: 1px solid var(--zy-border); border-radius: 8px; color: var(--zy-text); background: var(--zy-surface); }
.zy-review-dialog::backdrop { background: #0005; }
.zy-review-dialog > header, .zy-review-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }
.zy-review-dialog > header { border-bottom: 1px solid var(--zy-border); }
.zy-review-dialog > header strong { min-width: 0; overflow-wrap: anywhere; }
.zy-review-dialog > footer { justify-content: flex-end; border-top: 1px solid var(--zy-border); }
.zy-review-dialog > footer button { min-height: 40px; padding: 8px 16px; border: 1px solid var(--zy-border); border-radius: 6px; color: var(--zy-text); background: var(--zy-surface); }
.zy-review-dialog > footer button:last-child { background: var(--zy-accent); color: #fff; }
.zy-review-body, .zy-review-dialog .zy-evidence-content { padding: 16px; }
.zy-review-body p { margin: 0 0 12px; font-size: 13px; overflow-wrap: anywhere; }
.zy-review-body [role="alert"] { color: #be123c; margin-top: 8px; }
.zy-review-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.zy-review-columns label { min-width: 0; font-size: 13px; }
.zy-review-columns textarea { display: block; width: 100%; height: 320px; margin-top: 8px; padding: 12px; border: 1px solid var(--zy-border); border-radius: 6px; color: var(--zy-text); background: var(--zy-bg); font-size: 14px; resize: vertical; }
.zy-evidence-content section { padding: 8px 0; border-bottom: 1px solid var(--zy-border); overflow-wrap: anywhere; }
.zy-evidence-content section:last-child { border: 0; }
.zy-evidence-content p { color: var(--zy-muted); font-size: 12px; }
.zy-evidence-content pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.zy-evidence-content a { color: var(--zy-accent); }
.zy-evidence-location { outline: 2px solid var(--zy-accent); outline-offset: 4px; }
@media (max-width: 900px) {
    .import-drawer .selected-file button, .import-drawer header .icon-button { width: 44px; height: 44px; }
    .import-drawer .selected-file { padding: 4px 8px; gap: 8px; }
    .import-drawer footer { gap: 6px; padding: 8px 12px; }
    .import-drawer footer button { min-height: 44px; }
    .import-drawer #importSelectionSummary { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
    .import-feedback { padding: 8px 12px; font-size: 13px; }
    .document-header { padding: 4px 12px; }
    .document-header .document-identity { padding-right: 92px; }
    .document-header-actions .save-status { display: block; position: absolute; top: 16px; right: 12px; max-width: 90px; font-size: 12px; }
    .document-header-actions { padding-bottom: 0; }
    .document-header-actions .mode-switch button { min-width: 44px; }
    .document-assistant-message-actions button span { display: none; }
    .document-assistant-message-actions button { width: 44px; height: 44px; padding: 0; }
    .document-reference-policy { min-height: 44px; }
    .zy-proposal-button { min-height: 44px; }
    #documentAssistantSendButton { width: 44px; min-height: 44px; }
    .zy-source-directory summary { min-height: 44px; display: flex; align-items: center; gap: 8px; }
    .zy-source-directory summary::before { content: '+'; }
    .zy-source-directory[open] summary::before { content: '-'; }
    .zy-source-directory button, .document-draft-banner button { min-height: 44px; }
    .zy-review-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .zy-review-columns { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .zy-review-columns textarea { height: 160px; font-size: 16px; }
    .zy-review-dialog .icon-button, .zy-review-dialog > footer button { min-height: 44px; }
}
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
    .document-header { display: flex; gap: 8px; min-height: 52px; padding: 4px 12px; }
    .document-header .document-identity { flex: 1; padding-right: 0; }
    .document-header-actions { width: auto; }
    .document-header-actions .save-status { position: static; max-width: 80px; margin: 0 4px; }
    .document-identity p { display: none; }
    .zy-review-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.document-inspection { flex: 0 0 auto; min-width: 0; border-bottom: 1px solid var(--zy-border); background: var(--zy-surface); font-size: 12px; }
.document-inspection summary { padding: 6px 20px; cursor: pointer; color: var(--zy-muted); }
.document-inspection summary span { margin-left: 8px; }
.document-inspection-body { display: flex; align-items: flex-start; gap: 12px; padding: 0 20px 8px; max-height: min(160px, 25dvh); overflow: auto; }
.document-inspection-body > div { flex: 1; min-width: 0; }
.document-inspection-body p { margin: 4px 0; overflow-wrap: anywhere; }
.document-inspection-body button { flex-shrink: 0; }
.duplicate-policy { margin-top: 6px; width: min(100%, 200px); min-height: 32px; padding: 4px 8px; border: 1px solid var(--zy-border); border-radius: 6px; color: var(--zy-text); background: var(--zy-surface); font: inherit; font-size: 13px; }
.selected-file-copy .duplicate-match { white-space: normal; overflow-wrap: anywhere; color: var(--zy-accent); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 900px) {
    .document-inspection summary { min-height: 44px; padding: 12px; }
    .document-inspection-body { padding: 0 12px 8px; }
    .document-inspection-body .icon-button { width: 44px; height: 44px; }
    .duplicate-policy { min-height: 44px; font-size: 16px; }
}
