/* E2EE: existing application palette, scoped styles, no build step. */
.e2ee-docs {
    display: flex; flex-direction: column; gap: 16px; min-width: 0;
    padding: 20px; color: var(--text-main, #18181b); background: var(--bg-surface, #fff);
    border: 1px solid var(--border-main, #e4e4e7); border-radius: 14px;
}
.e2ee-docs__title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }
.e2ee-docs__hint { margin: 0; color: var(--text-muted, #71717a); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.e2ee-docs__hint:empty { display: none; }
.e2ee-docs__head, .e2ee-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.e2ee-docs__head { justify-content: space-between; }
.e2ee-docs button, .e2ee-dialog button, .e2ee-docs__action, .e2ee-docs__upload {
    box-sizing: border-box; width: auto; min-height: 42px; margin: 0; padding: 10px 16px;
    border: 1px solid var(--border-main, #e4e4e7); border-radius: 9px;
    background: var(--bg-surface, #fff); color: var(--text-main, #18181b);
    font: inherit; font-size: 13px; font-weight: 500; line-height: 1.4;
    text-align: center; text-decoration: none; cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.e2ee-docs button:hover:not(:disabled), .e2ee-dialog button:hover:not(:disabled), a.e2ee-docs__action:hover {
    background: var(--bg-btn-secondary, #e4e4e7);
}
.e2ee-docs .e2ee-docs__primary, .e2ee-dialog .e2ee-docs__upload, .e2ee-docs .e2ee-docs__upload {
    color: white; background: var(--accent-brand, #ca5038); border-color: transparent;
}
.e2ee-docs .e2ee-docs__primary:hover:not(:disabled), .e2ee-dialog .e2ee-docs__upload:hover:not(:disabled) {
    background: var(--accent-brand-hover, #b3422d);
}
.e2ee-docs .e2ee-docs__quiet { background: transparent; border-color: transparent; color: var(--text-muted); }
.e2ee-docs button:disabled, .e2ee-dialog button:disabled { opacity: .5; cursor: default; }
.e2ee-docs :focus-visible, .e2ee-dialog :focus-visible { outline: 2px solid var(--accent-brand, #ca5038); outline-offset: 3px; }
.e2ee-docs [hidden], .e2ee-dialog [hidden] { display: none !important; }
.e2ee-docs input:not([type=checkbox]), .e2ee-dialog input:not([type=checkbox]), .e2ee-dialog textarea {
    box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 11px 12px;
    color: var(--text-main, #18181b); background: var(--bg-input, #fff);
    border: 1px solid var(--border-input, #d4d4d8); border-radius: 9px;
    font: inherit; font-size: 16px; line-height: 1.5;
}
.e2ee-docs input[type=file] { font-size: 13px; border-style: dashed; padding: 14px; }
.e2ee-docs input[type=file]::file-selector-button { border: 0; border-radius: 6px; padding: 8px 10px; margin-right: 10px; background: var(--bg-btn-secondary); color: var(--text-main); cursor: pointer; }
.e2ee-docs__list, .e2ee-file-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.e2ee-docs__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-main); }
.e2ee-docs__item:last-child { border-bottom: 0; }
.e2ee-docs__name { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.e2ee-docs__sub, .e2ee-docs__empty { color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.e2ee-docs__empty { text-align: center; padding: 24px 12px; border: 1px dashed var(--border-main); border-radius: 10px; }
.e2ee-docs__error { padding: 12px; border-radius: 9px; color: var(--status-error-text); background: var(--status-error-bg); }
.e2ee-file-list li { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
/* Explicit margin:auto overrides the global application reset. */
dialog.e2ee-dialog {
    position: fixed; inset: 0; margin: auto; box-sizing: border-box;
    width: min(540px, calc(100vw - 32px)); height: fit-content;
    max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
    overflow-y: auto; overscroll-behavior: contain; padding: 24px;
    color: var(--text-main, #18181b); background: var(--bg-surface, #fff);
    border: 1px solid var(--border-main, #e4e4e7); border-radius: 16px;
    box-shadow: 0 20px 70px rgba(0,0,0,.22); text-align: left;
}
.e2ee-dialog::backdrop { background: rgba(0,0,0,.55); }
.e2ee-dialog__head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.e2ee-dialog__head h3 { flex: 1; margin: 0; min-width: 0; font-size: 18px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
dialog.e2ee-dialog button.e2ee-dialog__close {
    display: inline-flex; flex: 0 0 40px; align-items: center; justify-content: center;
    width: 40px; height: 40px; min-height: 40px; margin: -8px -8px 0 0; padding: 0;
    border: 0; background: transparent; color: var(--text-muted); font: 26px/1 sans-serif;
}
.e2ee-dialog p { margin: 0 0 16px; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.e2ee-dialog form { display: grid; gap: 16px; margin: 0; }
.e2ee-dialog form p:empty { display: none; }
.e2ee-dialog form p { margin: 0; }
.e2ee-dialog label { display: grid; gap: 8px; margin-bottom: 16px; font-size: 13px; line-height: 1.5; }
.e2ee-dialog form label { margin-bottom: 0; }
.e2ee-dialog textarea { min-height: 74px; resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; }
.e2ee-dialog .e2ee-actions { margin-bottom: 16px; }
.e2ee-dialog .e2ee-choice { display: flex; align-items: center; gap: 10px; margin-block: 16px; }
.e2ee-choice input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-brand); }
.e2ee-dialog .e2ee-docs { padding: 0; border: 0; background: transparent; }
.e2ee-settings-list { display: grid; }
.e2ee-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-top: 1px solid var(--border-main); }
.e2ee-setting-copy { min-width: 0; }
.e2ee-setting-copy h4 { margin: 0 0 4px; font-size: 14px; line-height: 1.4; font-weight: 500; }
.e2ee-setting-copy p { margin: 0; font-size: 12px; }
.e2ee-setting-row button { flex-shrink: 0; }
.e2ee-advanced { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border-main); }
.e2ee-advanced summary { padding: 8px 0; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.e2ee-advanced p { margin: 8px 0 12px; }
.e2ee-dialog .e2ee-docs__danger { color: var(--status-error-text); border-color: var(--border-main); background: transparent; }
@media (max-width: 480px) {
    .e2ee-docs { padding: 16px; }
    dialog.e2ee-dialog { padding: 20px; }
    .e2ee-setting-row { flex-wrap: wrap; gap: 12px; }
    .e2ee-docs__item { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    .e2ee-docs button, .e2ee-dialog button { transition: none; }
}
/* Registration's two-column grid must give attachments the whole row. */
#registration-documents-container { grid-column: 1 / -1; width: 100%; min-width: 0; align-self: stretch; }
#registration-documents-container .e2ee-docs { box-sizing: border-box; width: 100%; }
.e2ee-docs button.e2ee-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; width: 100%; min-height: 132px; padding: 22px 16px;
    border: 1px dashed var(--border-input, #d4d4d8); border-radius: 12px;
    background: var(--bg-input, #fafafa); text-align: center;
}
.e2ee-docs button.e2ee-dropzone:hover:not(:disabled) { border-color: var(--accent-brand, #ca5038); background: var(--bg-surface, #fff); }
.e2ee-dropzone__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--accent-brand, #ca5038); background: var(--bg-btn-secondary, #f4f4f5); font-size: 23px; }
.e2ee-file-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-main, #e4e4e7); border-radius: 10px; }
.e2ee-file-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
.e2ee-file-name { overflow-wrap: anywhere; font-weight: 500; }
.e2ee-docs button.e2ee-file-remove { flex: 0 0 36px; width: 36px; min-height: 36px; padding: 4px; border: 0; background: transparent; color: var(--text-muted, #71717a); font-size: 22px; }
