Configure server through web onboarding and encrypt backups

This commit is contained in:
Ludwig Lehnert committed 2026-10-05 16:47:49 +00:00
1 parent 5cb3b5bedf
commit 88f803daf2
35 files changed
+4250 -981

No files matched your search

+7 -1
View File
@@ -108,6 +108,7 @@ function empty(message) { return `<div class="empty">${esc(message)}</div>`; }
function badge(text, kind = "") { return `<span class="badge ${kind}">${esc(text)}</span>`; }
function routeFor(path) {
if (path.startsWith('/admin/settings') || path.startsWith('/settings')) return 'settings';
path = path.replace(/^\/admin(?=\/|$)/, "") || "/overview";
if (path.startsWith("/storage/data")) return "storage-data";
if (path.startsWith("/storage/users")) return "storage-users";
@@ -152,6 +153,10 @@ async function navigate(path, replace = false) {
if (route === "backup") await renderBackup();
if (route === "report") await renderReport();
if (route === "system") await renderSystem();
if (route === 'settings') {
content.innerHTML = pageHead('Einstellungen', 'Serverkonfiguration dauerhaft speichern.') + '<div id="configuration-settings"></div>';
await ConfigurationUI.mount(document.querySelector('#configuration-settings'), {api, notice, onDirty: dirty => { state.accessDirty = dirty; }});
}
content.focus();
} catch (error) {
content.innerHTML = pageHead("Seite konnte nicht geladen werden", error.message) + `<section class="panel">${empty("Dienststatus prüfen und erneut versuchen.")}</section>`;
@@ -563,7 +568,8 @@ async function renderBackup() {
"Sicherungen",
"Sicherungen manuell starten sowie Fortschritt und Ausgabe verfolgen.",
'<button id="start-backup" type="button">Sicherung jetzt starten</button>'
) + '<div id="backup-body"></div>';
) + '<details class="panel"><summary>Sicherungsziel, Zeitplan und Verschlüsselung</summary><div id="backup-settings" class="settings-advanced"></div></details><div id="backup-body"></div>';
void ConfigurationUI.mount(document.querySelector('#backup-settings'), {api, notice, section:'backup', onDirty: dirty => { state.accessDirty = dirty; }}).catch(error => notice(error.message));
const button = document.querySelector("#start-backup");
const body = document.querySelector("#backup-body");
let logLines = [];
+1
View File
@@ -0,0 +1 @@
<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>HTTPS einrichten · Dateiserver</title><link rel="stylesheet" href="/assets/styles.css"></head><body><header class="portal-header"><strong>Dateiserver · HTTPS einrichten</strong></header><main class="setup-main"><h1>HTTPS zuerst einrichten</h1><p>Über HTTP können Sie ausschließlich das HTTPS-Zertifikat einrichten. Domänenbeitritt und alle Zugangsdaten werden anschließend über HTTPS konfiguriert.</p><section class="panel"><form id="https-form" class="stack"><label>HTTPS-Einrichtungscode<input name="code" type="password" autocomplete="off" required></label><small class="muted">Den Code finden Sie unter „HTTPS setup code“ in <code>docker compose logs samba</code>.</small><label>HTTPS-Hostname<input name="hostname" required placeholder="files.example.org"></label><label>ACME-Verzeichnisadresse<input name="acme" type="url" required placeholder="https://ca.example.org/acme/acme/directory"></label><label>Eigenes Root-CA-Zertifikat (optional, PEM)<input name="root" type="file" accept=".pem,.crt,.cer"></label><small class="muted">Ohne eigenen Upload werden die öffentlichen System-CAs verwendet.</small><p id="https-error" class="error" role="alert" hidden></p><button type="submit">HTTPS einrichten</button></form></section><p id="https-status" role="status"></p><a id="https-next" hidden>Über HTTPS mit der Einrichtung fortfahren</a></main><script src="/assets/https-setup.js" defer></script></body></html>
+21
View File
@@ -0,0 +1,21 @@
(() => {
const form = document.querySelector('#https-form'), status = document.querySelector('#https-status'), errorBox = document.querySelector('#https-error'), next = document.querySelector('#https-next');
form.elements.hostname.value = location.hostname;
form.onsubmit = async event => {
event.preventDefault(); errorBox.hidden = true; const button = form.querySelector('button'); button.disabled = true;
try {
const root = form.elements.root.files[0];
const response = await fetch('/api/https/configure', {method:'POST', headers:{'Content-Type':'application/json', 'X-HTTPS-Setup-Code':form.elements.code.value}, body:JSON.stringify({WEB_HOSTNAME:form.elements.hostname.value, ACME_CA_SERVER:form.elements.acme.value, ACME_CA_CERTIFICATES_PEM:root ? await root.text() : ''})});
const data = await response.json(); if (!response.ok) throw new Error(data.error);
form.elements.code.value = ''; status.textContent = 'ACME-Zertifikat wird angefordert …';
} catch (error) { errorBox.textContent = error.message; errorBox.hidden = false; }
finally { button.disabled = false; }
};
setInterval(async () => {
try {
const data = await (await fetch('/api/https/status')).json(); status.textContent = data.message || '';
next.hidden = !(data.state === 'ready' || data.configured);
if (!next.hidden) { next.href = data.httpsUrl; }
} catch { status.textContent = 'Dienst wird neu gestartet …'; }
}, 2000);
})();
+2
View File
@@ -37,6 +37,7 @@
<a href="/admin/backup" data-route="backup">Sicherungen</a>
<a href="/admin/report" data-route="report">PDF-Bericht</a>
<a href="/admin/system" data-route="system">System</a>
<a href="/admin/settings" data-route="settings">Einstellungen</a>
</nav>
<div class="sidebar-footer"><a href="/">Dateiansicht</a><span id="session-user"></span><button id="logout" class="link-button">Abmelden</button></div>
</aside>
@@ -44,6 +45,7 @@
<main id="content" class="content" tabindex="-1"></main>
</div>
<div id="toast" class="toast" role="status" hidden></div>
<script src="/assets/settings.js" defer></script>
<script src="/assets/app.js" defer></script>
</body>
</html>
+121
View File
@@ -0,0 +1,121 @@
/* Configuration controls share the application's existing form styles. */
(() => {
const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;', "'":'&#39;'}[c]));
const labels = {'self-signed':'Selbstsigniert', acme:'ACME', ca:'Smallstep CA', files:'Zertifikat und Schlüssel hochladen'};
function fieldMarkup(field, groups = [], bootstrap = false) {
const {key, kind, label, value, configured} = field;
const id = 'setting-' + key;
let input;
if (kind === 'bool') return `<label class="settings-check"><input id="${id}" name="${key}" type="checkbox" ${value ? 'checked' : ''}>${esc(label)}</label>`;
if (kind === 'group') {
const options = [...groups];
if (value && !options.some(group => group.sid === value)) options.push({sid:value, name:value});
input = `<select id="${id}" name="${key}" required>${options.map(group => `<option value="${esc(group.sid)}" ${group.sid === value ? 'selected' : ''}>${esc(group.name)}</option>`).join('')}</select>`;
} else if (kind === 'choice') input = `<select id="${id}" name="${key}">${field.choices.map(option => `<option value="${esc(option)}" ${value === option ? 'selected' : ''}>${esc(labels[option] || option)}</option>`).join('')}</select>`;
else if (kind.includes('pem')) input = `<textarea id="${id}" name="${key}" rows="5" spellcheck="false" autocomplete="off" placeholder="${configured ? 'Gespeichert; leer lassen zum Beibehalten' : '-----BEGIN …-----'}">${esc(value)}</textarea>`;
else input = `<input id="${id}" name="${key}" type="${kind === 'int' ? 'number' : ['secret', 'secreturl'].includes(kind) ? 'password' : 'text'}" value="${esc(value)}" ${kind === 'int' ? `min="${field.minimum}" max="${field.maximum}" step="1"` : ''} ${!bootstrap && ['REALM','WORKGROUP'].includes(key) ? 'readonly' : ''} ${field.required ? 'required' : ''} autocomplete="${kind === 'secret' ? 'new-password' : 'off'}" placeholder="${configured ? 'Gespeichert; leer lassen zum Beibehalten' : key === 'BACKUP_DESTINATION' ? 'sftp://benutzer:passwort@server/pfad' : ''}">`;
const hint = field.summary ? `<small class="muted">Aktuelles Ziel: ${esc(field.summary)}</small>` : key === 'BACKUP_DESTINATION' ? '<small class="muted">Unterstützt rsync, SFTP, SMB und WebDAV. Zugangsdaten in der Adresse bitte URL-kodieren.</small>' : '';
input = input.replace(/^<(input|select|textarea)\b/, `<$1 aria-label="${esc(label)}"`);
const clear = configured && ['secret','secretpem'].includes(kind) ? `<label class="settings-check"><input name="clear-${key}" type="checkbox">Gespeicherten Wert löschen</label>` : '';
return `<div data-setting="${key}"><label>${esc(label)}${input}${hint}</label>${clear}</div>`;
}
function readValues(form, fields) {
const values = {};
for (const field of fields) {
const input = form.elements.namedItem(field.key);
if (!input || input.disabled) continue;
if (form.elements.namedItem('clear-' + field.key)?.checked) { values[field.key] = ''; continue; }
if (['secret','secreturl','secretpem'].includes(field.kind) && !input.value) continue;
values[field.key] = field.kind === 'bool' ? input.checked : field.kind === 'int' ? Number(input.value) : input.value;
}
return values;
}
function tlsVisibility(form) {
const mode = form.elements.namedItem('WEB_TLS_MODE');
if (!mode) return;
const update = () => form.querySelectorAll('[data-setting]').forEach(label => {
const key = label.dataset.setting;
const active = key.startsWith('ACME_') ? mode.value === 'acme' : key.startsWith('TLS_CA_') ? mode.value === 'ca' : ['WEB_TLS_CERT_PEM','WEB_TLS_KEY_PEM'].includes(key) ? mode.value === 'files' : true;
label.hidden = !active;
label.querySelectorAll('input,textarea,select').forEach(input => { input.disabled = !active; });
});
mode.addEventListener('change', update); update();
}
async function recoveryDialog(api, configuration, refreshed) {
const result = await api('/api/settings/backup-key/generate', {method:'POST', body:'{}'});
const oldKey = configuration.encryption.keyId || configuration.encryption.legacy;
const dialog = document.createElement('dialog');
dialog.className = 'access-dialog settings-key-dialog';
dialog.setAttribute('aria-labelledby', 'recovery-title');
dialog.innerHTML = `<h2 id="recovery-title">Wiederherstellungsphrase notieren</h2><p>Diese Phrase wird nur jetzt angezeigt. Sie entschlüsselt die vollständige Sicherung, einschließlich Zugangsdaten und Serverzustand. Bewahren Sie sie getrennt vom Server auf.</p><ol class="recovery-words">${result.phrase.split(' ').map(word => `<li>${esc(word)}</li>`).join('')}</ol><p class="muted">Schlüsselkennung: ${esc(result.keyId)}</p><form class="stack"><label class="settings-check"><input name="written" type="checkbox" required>Ich habe alle 24 Wörter in der richtigen Reihenfolge sicher notiert.</label>${oldKey ? '<p class="error">Alte Sicherungen bleiben erhalten und benötigen weiterhin ihre alte Phrase bzw. ihr altes Passwort. Geht diese Information verloren, sind die darin gespeicherten Daten nicht wiederherstellbar.</p><label class="settings-check"><input name="old" type="checkbox" required>Ich bewahre auch die bisherige Phrase bzw. das bisherige Passwort auf.</label>' : ''}<p class="error" role="alert" hidden></p><div class="access-dialog-actions"><button type="button" data-close>Abbrechen</button><button type="submit">Schlüssel aktivieren</button></div></form>`;
// The phrase stays in this dialog only; it is never stored in browser storage.
result.phrase = '';
document.body.append(dialog);
dialog.addEventListener('close', () => { dialog.replaceChildren(); dialog.remove(); }, {once:true});
dialog.querySelector('[data-close]').onclick = () => dialog.close();
dialog.querySelector('form').onsubmit = async event => {
event.preventDefault(); const form = event.currentTarget, button = form.querySelector('[type=submit]'); button.disabled = true;
try {
await api('/api/settings/backup-key/activate', {method:'POST', body:JSON.stringify({nonce:result.nonce, writtenDown:form.elements.written.checked, acknowledgeOldBackups:oldKey ? form.elements.old.checked : false})});
dialog.close(); await refreshed();
} catch (error) { const target = form.querySelector('[role=alert]'); target.textContent = error.message; target.hidden = false; button.disabled = false; }
};
dialog.showModal();
}
async function mount(host, {api, notice, section = '', initialSection = '', onDirty = () => {}}) {
const data = await api('/api/settings' + (section ? '?section=' + section : ''));
if (!host.isConnected) return;
let selected = section || initialSection || data.sections[0].id;
const render = async () => {
const current = data.sections.find(item => item.id === selected);
let groups = [];
if (selected === 'groups') groups = (await api('/api/settings/groups')).groups;
if (!host.isConnected) return;
host.innerHTML = `${!section ? `<div class="settings-tabs" role="group" aria-label="Einstellungen">${data.sections.map(item => `<button type="button" data-section="${item.id}" aria-pressed="${item.id === selected}">${esc(item.label)}</button>`).join('')}</div>` : ''}<section class="panel"><h2>${esc(current.label)}</h2><form class="stack settings-form">${current.fields.map(field => fieldMarkup(field, groups)).join('')}${selected === 'backup' ? `<div class="settings-encryption"><strong>Verschlüsselungsschlüssel</strong><p>${data.encryption.keyId ? 'Aktiver Schlüssel: ' + esc(data.encryption.keyId) : data.encryption.legacy ? 'Bisheriges Archivpasswort übernommen. Eine neue Phrase aktiviert die Verschlüsselung aller Sicherungsdaten.' : 'Noch kein Wiederherstellungsschlüssel eingerichtet.'}</p><button type="button" data-generate>${data.encryption.keyId || data.encryption.legacy ? 'Neue Wiederherstellungsphrase erzeugen' : 'Wiederherstellungsphrase erzeugen'}</button></div><label class="settings-check"><input type="checkbox" name="clearDestination">Sicherungsziel entfernen und Sicherungen deaktivieren</label>` : ''}<p class="error" role="alert" hidden></p><div class="toolbar"><button type="submit">Änderungen speichern</button><span class="muted" role="status"></span></div></form></section>`;
const form = host.querySelector('form'); tlsVisibility(form);
form.addEventListener('input', () => onDirty(true));
host.querySelectorAll('[data-section]').forEach(button => { button.onclick = async () => {
if (form.dataset.dirty === 'true' && !confirm('Ungespeicherte Änderungen verwerfen?')) return;
onDirty(false); selected = button.dataset.section; await render();
}; });
form.addEventListener('input', () => { form.dataset.dirty = 'true'; });
if (selected === 'backup') host.querySelector('[data-generate]').onclick = async () => {
try {
const draft = form.dataset.dirty === 'true' ? readValues(form, current.fields) : null;
const clearDestination = form.elements.clearDestination?.checked;
await recoveryDialog(api, data, async () => {
onDirty(false);
await mount(host, {api, notice, section, initialSection:selected, onDirty});
if (draft) {
draft.BACKUP_ENCRYPTION_ENABLED = true;
const next = host.querySelector('form');
for (const [key, value] of Object.entries(draft)) {
const input = next.elements.namedItem(key);
if (input) { if (input.type === 'checkbox') input.checked = value; else input.value = value; }
}
if (next.elements.clearDestination) next.elements.clearDestination.checked = clearDestination;
next.dataset.dirty = 'true'; onDirty(true);
}
notice('Verschlüsselungsschlüssel aktiviert.');
});
} catch (error) { notice(error.message); }
};
form.onsubmit = async event => {
event.preventDefault(); const button = form.querySelector('[type=submit]'); button.disabled = true;
const errorBox = form.querySelector('[role=alert]'); errorBox.hidden = true;
try {
const values = readValues(form, current.fields);
if (form.elements.clearDestination?.checked) { values.BACKUP_DESTINATION = ''; values.BACKUP_AUTO_ENABLED = false; }
const saved = await api('/api/settings', {method:'POST', body:JSON.stringify({revision:data.revision, values})});
onDirty(false); form.dataset.dirty = 'false';
Object.assign(data, saved);
form.querySelector('[role=status]').textContent = saved.restartRequired ? 'Gespeichert. Dienste starten neu; anschließend die Seite neu laden.' : 'Gespeichert.';
form.querySelectorAll('input[type=password],textarea[name=WEB_TLS_KEY_PEM]').forEach(input => { input.value = ''; });
} catch (error) { errorBox.textContent = error.message; errorBox.hidden = false; }
finally { button.disabled = false; }
};
};
await render();
}
window.ConfigurationUI = {mount, fieldMarkup, readValues, tlsVisibility};
})();
+7
View File
@@ -0,0 +1,7 @@
<!doctype html>
<html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Dateiserver einrichten</title><link rel="stylesheet" href="/assets/styles.css"></head><body>
<header class="portal-header"><strong>Dateiserver · Ersteinrichtung</strong></header>
<main class="setup-main"><h1>Dateiserver einrichten</h1><p id="setup-status" role="status"></p><p id="setup-error" class="error" role="alert" hidden></p>
<section id="setup-unlock" class="panel"><h2>Einrichtung entsperren</h2><p>Den einmaligen Einrichtungscode finden Sie im Containerprotokoll: <code>docker compose logs samba</code>.</p><form class="stack"><label>Einrichtungscode<input name="code" type="password" autocomplete="off" required autofocus></label><button type="submit">Weiter</button></form></section>
<div id="setup-content" hidden></div></main>
<script src="/assets/settings.js" defer></script><script src="/assets/setup.js" defer></script></body></html>
+62
View File
@@ -0,0 +1,62 @@
(() => {
let token = '', snapshot = null, polling = false;
const content = document.querySelector('#setup-content'), errorBox = document.querySelector('#setup-error'), status = document.querySelector('#setup-status');
const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({'&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;', "'":'&#39;'}[c]));
const showError = error => { errorBox.textContent = error.message; errorBox.hidden = false; };
async function api(path, options = {}) {
const response = await fetch('/api/bootstrap/' + path, {...options, headers:{'Content-Type':'application/json', 'X-Setup-Token':token}, credentials:'same-origin'});
const result = await response.json();
if (!response.ok) throw new Error(result.error || 'Einrichtung konnte nicht geladen werden');
return result;
}
async function refresh() {
snapshot = await api('settings');
status.textContent = snapshot.services?.message || '';
if (snapshot.phase === 'groups' && !content.querySelector('#setup-groups')) await renderGroups();
}
async function renderGroups() {
const {groups} = await api('groups');
const fields = snapshot.sections.find(item => item.id === 'groups').fields.map(field => ({...field, value:field.value || groups.find(group => group.sid.endsWith(field.key === 'DOMAIN_ADMINS_SID' ? '-512' : '-513'))?.sid || groups[0]?.sid || ''}));
content.innerHTML = `<section class="panel"><h2>Gruppen auswählen</h2><p>Diese Gruppen steuern SMB-Anmeldung, Verwaltung und FSLogix. Dateizugriffe werden später individuell pro Benutzer zugeordnet.</p><form id="setup-groups" class="stack">${fields.map(field => ConfigurationUI.fieldMarkup(field, groups, true)).join('')}<label>Administratorkonto für die erste Anmeldung<input name="username" value="${esc(snapshot.sections.find(item => item.id === 'domain').fields.find(field => field.key === 'JOIN_USER').value)}" autocomplete="username" required></label><label>Passwort<input name="password" type="password" autocomplete="current-password" required></label><button type="submit">Einrichtung abschließen</button></form></section>`;
content.querySelector('form').onsubmit = async event => {
event.preventDefault(); const form = event.currentTarget, button = form.querySelector('button'); button.disabled = true; errorBox.hidden = true;
try {
await refresh();
await api('finish', {method:'POST', body:JSON.stringify({revision:snapshot.revision, values:ConfigurationUI.readValues(form, fields), username:form.elements.username.value, password:form.elements.password.value})});
form.elements.password.value = ''; token = ''; status.textContent = 'Einrichtung abgeschlossen. Dienste werden gestartet.';
content.innerHTML = '<section class="panel"><a href="/">Zur Anmeldung</a></section>';
polling = false;
} catch (error) { showError(error); button.disabled = false; }
};
}
function renderDomain() {
const essentials = new Set(['REALM','WORKGROUP','DOMAIN','JOIN_USER','JOIN_PASSWORD','NETBIOS_NAME','SAMBA_HOSTNAME','WEB_HOSTNAME','WEB_TLS_MODE','AD_DNS_IP','AD_DNS_NAME']);
const fields = snapshot.sections.filter(section => ['domain','network','tls'].includes(section.id)).flatMap(section => section.fields);
const hostname = fields.find(field => field.key === 'WEB_HOSTNAME');
if (hostname.value === 'localhost') hostname.value = location.hostname;
content.innerHTML = `<section class="panel"><h2>Domäne und Server</h2><form id="setup-domain" class="stack">${fields.filter(field => essentials.has(field.key)).map(field => ConfigurationUI.fieldMarkup(field, [], true)).join('')}<details><summary>LDAP- und Zertifikatseinstellungen</summary><div class="stack settings-advanced">${fields.filter(field => !essentials.has(field.key)).map(field => ConfigurationUI.fieldMarkup(field, [], true)).join('')}</div></details><button type="submit">Domäne beitreten</button></form></section><details class="panel"><summary>Bestehende Installation übernehmen</summary><p>Die bisherige .env-Datei einmalig importieren. Dateien, bestehender Domänenbeitritt, Rechte und Sicherungen bleiben erhalten.</p><form id="setup-import" class="stack"><label>Bisherige Konfigurationsdatei<input type="file" name="legacy" required></label><button type="submit">Konfiguration importieren</button></form></details>`;
const form = content.querySelector('#setup-domain'); ConfigurationUI.tlsVisibility(form);
form.onsubmit = async event => {
event.preventDefault(); errorBox.hidden = true; const button = form.querySelector('[type=submit]'); button.disabled = true;
try {
await refresh();
snapshot = await api('domain', {method:'POST', body:JSON.stringify({revision:snapshot.revision, values:ConfigurationUI.readValues(form, fields)})});
form.elements.JOIN_PASSWORD.value = ''; status.textContent = 'Domänenbeitritt läuft. Bei einem Fehler können Sie die Angaben korrigieren und erneut versuchen.';
polling = true;
} catch (error) { showError(error); }
finally { button.disabled = false; }
};
content.querySelector('#setup-import').onsubmit = async event => {
event.preventDefault(); errorBox.hidden = true;
try { const text = await event.currentTarget.elements.legacy.files[0].text(); await api('import', {method:'POST', body:JSON.stringify({text})}); token = ''; location.assign('/'); }
catch (error) { showError(error); }
};
}
document.querySelector('#setup-unlock form').onsubmit = async event => {
event.preventDefault(); const form = event.currentTarget; errorBox.hidden = true; token = form.elements.code.value;
try { await refresh(); form.elements.code.value = ''; document.querySelector('#setup-unlock').hidden = true; content.hidden = false; if (snapshot.phase !== 'groups') renderDomain(); polling = snapshot.phase !== 'unconfigured'; }
catch (error) { token = ''; showError(error); }
};
setInterval(async () => { if (polling && token) { try { await refresh(); } catch (error) { showError(error); } } }, 3000);
api('status').then(result => { if (result.configured) location.replace('/'); }).catch(showError);
})();
+16
View File
@@ -251,3 +251,19 @@ mark { background: #fff0a0; color: #111; }
.document-dialog-head { gap: .5rem; }
.document-dialog-head .row-actions { flex-wrap: nowrap; }
}
/* Setup and configuration use the existing typography, borders and controls. */
.setup-main { max-width: 780px; margin: 2rem auto; padding: 0 1rem 2rem; }
.settings-form { max-width: 700px; }
.settings-form textarea, .settings-advanced textarea { width: 100%; padding: .4rem; font: inherit; border: 1px solid #999; resize: vertical; }
.settings-check { display: flex; align-items: flex-start; gap: .5rem; }
.settings-check input { width: auto; flex-shrink: 0; margin-top: .25rem; }
.settings-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.settings-tabs button[aria-pressed=true] { font-weight: bold; border-color: #111; background: #ddd; }
.settings-encryption { padding: .8rem 0; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; }
.settings-encryption p { margin: .4rem 0; overflow-wrap: anywhere; }
.settings-advanced { margin-top: .8rem; }
.recovery-words { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .5rem 1.5rem; padding-left: 2rem; font-family: monospace; }
.settings-key-dialog { width: min(660px,calc(100vw - 2rem)); }
html:has(.settings-key-dialog[open]), body:has(.settings-key-dialog[open]) { overflow: hidden; }
@media (max-width: 480px) { .recovery-words { grid-template-columns: repeat(2,minmax(0,1fr)); } .settings-encryption button { white-space: normal; } }