/* Private Base – ein Stylesheet für alle Seiten.
   Aufbau: 1 Farben (hell/dunkel) · 2 Grundlagen · 3 Kopf/Fuß · 4 Formulare & Dialoge · 5 Bausteine · 6 Anwendungen
           (Dateien, Fotos) · 7 Konto & Sicherheit · 8 Admin · 9 Mail · 10 Barrierefreiheit
   Farben nie fest eintragen, immer über die Variablen aus Abschnitt 1 – nur so funktioniert der Dunkelmodus. */

/* ---- 1 Farben ------------------------------------------------------------------------------------------- */
:root {
  --ink: #17212b; --muted: #53616a; --bg: #f3f5f0; --surface: #fff; --surface-2: #eef2ef; --line: #b9c5bf;
  --accent: #9f3928; --green: #17665d; --hover: #e3ebe7; --active: #dcece5; --on-ink: #fff; --focus: #17665d55;
  --shadow: #17212b33; --backdrop: #17212b88; --ok: #1e6b3f; --star: #d18b00;
  --tag-new: #d6efe1; --tag-fixed: #fbe3d6; --tag-security: #e0dcf5; --tag-improved: #e3ebe7;
  --a11y-scale: 1; color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #e8eef1; --muted: #9fb0b8; --bg: #0e1418; --surface: #161e24; --surface-2: #1c262d; --line: #33434c;
  --accent: #ff9a85; --green: #4fc9b4; --hover: #22303a; --active: #1d3b3c; --on-ink: #0e1418; --focus: #4fc9b488;
  --shadow: #000a; --backdrop: #000b; --ok: #62d08f; --star: #f0b429;
  --tag-new: #1b3d31; --tag-fixed: #4a2b22; --tag-security: #322c55; --tag-improved: #26343d;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --ink: #e8eef1; --muted: #9fb0b8; --bg: #0e1418; --surface: #161e24; --surface-2: #1c262d; --line: #33434c;
    --accent: #ff9a85; --green: #4fc9b4; --hover: #22303a; --active: #1d3b3c; --on-ink: #0e1418; --focus: #4fc9b488;
    --shadow: #000a; --backdrop: #000b; --ok: #62d08f; --star: #f0b429;
    --tag-new: #1b3d31; --tag-fixed: #4a2b22; --tag-security: #322c55; --tag-improved: #26343d;
    color-scheme: dark;
  }
}
:root.high-contrast { --ink: #000; --muted: #111; --bg: #fff; --surface: #fff; --surface-2: #fff; --line: #000; --accent: #000; --green: #000; --on-ink: #fff; --hover: #ddd; --active: #ccc; }
:root.high-contrast[data-theme="dark"] { --ink: #fff; --muted: #eee; --bg: #000; --surface: #000; --surface-2: #000; --line: #fff; --accent: #fff; --green: #fff; --on-ink: #000; --hover: #333; --active: #444; }
@media (prefers-color-scheme: dark) {
  :root.high-contrast[data-theme="auto"] { --ink: #fff; --muted: #eee; --bg: #000; --surface: #000; --surface-2: #000; --line: #fff; --accent: #fff; --green: #fff; --on-ink: #000; --hover: #333; --active: #444; }
}
.high-contrast button, .high-contrast input, .high-contrast select, .high-contrast .cookie-banner { border-width: 3px; }

/* Layout-Maße (theme-unabhängig, gelten für alle Seiten) */
:root { --gutter: clamp(14px, 3vw, 32px); --page-max: none; --header-h: 56px; --radius: 8px; }

/* ---- Symbole: eigene SVG-Icons statt Emojis (icons.js), skalieren mit der Schrift ------------------------ */
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; line-height: 0; flex: none; }
.icon-svg { width: 1.25em; height: 1.25em; display: block; }
button .icon-wrap, .link-button .icon-wrap, a .icon-wrap { margin-inline-end: .4em; }
button.icon-only .icon-wrap, .icon-button .icon-wrap { margin: 0; }
.icon-only { display: inline-flex; align-items: center; justify-content: center; }

/* ---- 2 Grundlagen --------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.i18n-wait body { visibility: hidden; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 1rem/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; zoom: var(--a11y-scale); width: 100%; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
/* Globales Seitenraster: jede Seite ist entweder Inhaltsseite (Standard), Textseite (.prose), Formularseite (.narrow) oder Vollbild-Anwendung (.app). */
main { flex: 1 0 auto; width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 28px max(var(--gutter), env(safe-area-inset-right)) 56px max(var(--gutter), env(safe-area-inset-left)); }
main.wide { max-width: var(--page-max); }
/* Alle Seiten beginnen bündig mit der Kopfzeile; nur der Lesetext bzw. das Formular selbst wird zeilenlang begrenzt. */
main.prose > * { max-width: 90ch; }
main.narrow { padding-top: 6vh; }
main.narrow > .view { max-width: 600px; }
main.app { max-width: none; margin: 0; padding: 0; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
a { color: var(--ink); }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.15; margin: 0 0 14px; }
h2 { font-size: 1.5rem; line-height: 1.25; }
.view { max-width: none; }
.eyebrow { font: 12px ui-monospace, 'Space Mono', monospace; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }
.bad { color: var(--accent); }
.ok { color: var(--ok); }
.pad { padding: 14px; }
.center { text-align: center; }
[hidden], #message:empty { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 10px; top: -60px; background: var(--ink); color: var(--on-ink); padding: 10px; z-index: 10; }
.skip-link:focus { top: 10px; }
button, input, select, textarea { font: inherit; }
button { border: 2px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); padding: 8px 12px; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:hover, button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { border-color: var(--green); outline: 3px solid var(--focus); outline-offset: 2px; }
button.primary, form button[type="submit"], .modal button.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
button.danger, .danger > strong { color: var(--accent); }
button.primary.danger { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.link-button { border: 0; background: none; padding: 2px 0; text-align: start; font-weight: 700; text-decoration: underline; color: var(--ink); }
.icon-button { min-width: 42px; padding: 8px; line-height: 1; font-size: 1.1rem; }
.button-like { display: inline-block; border: 2px solid var(--line); border-radius: 4px; padding: 8px 12px; cursor: pointer; background: var(--surface); font-weight: 400 !important; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; background: var(--surface); font-size: .8em; }
details summary { cursor: pointer; margin: 8px 0; }

/* Vollbild-Anwendungen (main.app): Fensterhöhe wird komplett genutzt, Kopf und Fuß bleiben schlank. */
body:has(main.app) { height: calc(100dvh / var(--a11y-scale)); min-height: 0; }
body:has(main.app) > footer { min-height: 34px; padding-top: 2px; padding-bottom: max(2px, env(safe-area-inset-bottom)); font-size: .82rem; }

/* ---- 3 Kopf, Fuß, Hinweise ---------------------------------------------------------------------------------- */
/* Kopfzeile und Fußleiste sind auf JEDER Seite identisch (gleiche Höhe, gleiche Ränder). */
body > header, body > footer { --edge: var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); padding: 0 max(var(--edge), env(safe-area-inset-right)) 0 max(var(--edge), env(safe-area-inset-left)); }
body > header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); min-height: var(--header-h); }
body > footer { border-top: 1px solid var(--line); min-height: 44px; padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); font-size: .88rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; text-decoration: none; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--green); color: var(--surface); }
.brand-mark .icon-svg { width: 18px; height: 18px; }
nav { display: flex; gap: 8px; align-items: center; }
header nav { flex: 1; min-width: 0; justify-content: space-between; }
footer nav { flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; }
header nav a, footer nav a, header nav button, footer nav button, header select { white-space: nowrap; }
footer nav a { color: var(--muted); }
footer nav button { border: 0; background: none; padding: 2px 4px; color: var(--muted); text-decoration: underline; }
.nav-apps, .nav-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav-apps { margin-inline-start: 12px; }
.nav-link, .nav-app { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 500; }
.nav-link:hover, .nav-app:hover { background: var(--hover); }
.nav-app[aria-current="page"], .nav-link[aria-current="page"] { background: var(--active); color: var(--green); font-weight: 700; }
.nav-app .icon-wrap, .nav-link .icon-wrap { margin: 0; }
.nav-app .icon-svg { width: 1.3em; height: 1.3em; }
.nav-cta { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.nav-cta:hover { background: var(--ink); opacity: .88; }
header .icon-button, header .avatar-button { border: 0; background: none; border-radius: var(--radius); }
header .icon-button:hover, header .avatar-button:hover { background: var(--hover); }
.icon-button { min-width: 40px; min-height: 40px; padding: 8px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.language-control select { min-width: 58px; min-height: 40px; padding: 6px 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer; font-weight: 600; width: auto; }
.language-control select:hover { background: var(--hover); }
.user-menu { position: relative; }
.avatar-button { padding: 3px; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: var(--surface); font-weight: 700; text-transform: uppercase; }
.menu-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 230px; display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px var(--shadow); z-index: 30; }
.menu-pop > a, .menu-pop > button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: none; color: var(--ink); text-align: start; text-decoration: none; }
.menu-pop > a:hover, .menu-pop > button:hover { background: var(--hover); }
.menu-pop .icon-wrap { margin: 0; color: var(--muted); }
.menu-pop hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-user { margin: 0; padding: 8px 12px 10px; display: grid; line-height: 1.3; }
.menu-user strong { overflow: hidden; text-overflow: ellipsis; }
.version-link { font-size: .8rem; color: var(--muted) !important; text-decoration: none; align-self: center; }
.a11y-toggle { font-weight: 700; min-width: 32px; min-height: 32px; padding: 2px 8px; }
.a11y-panel { position: fixed; inset-inline-end: 1rem; top: 5rem; z-index: 7; display: grid; gap: 8px; padding: 16px; background: var(--surface); border: 2px solid var(--ink); box-shadow: 0 10px 30px var(--shadow); }
.a11y-panel h2 { margin: 0; font-size: 1.2rem; }
.zoom-options { display: flex; gap: 6px; flex-wrap: wrap; }
.cookie-banner { position: fixed; left: 1rem; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); max-width: 680px; margin: auto; padding: 22px; background: var(--surface); border: 2px solid var(--ink); box-shadow: 0 10px 30px var(--shadow); z-index: 5; }
.cookie-banner h2 { margin-top: 0; font-size: 1.4rem; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cookie-banner fieldset { display: grid; gap: 10px; margin-top: 16px; border: 1px solid var(--line); padding: 14px; }
.cookie-banner legend { font-weight: 700; }
.cookie-banner label { display: flex; gap: 8px; align-items: center; }
#toast, #message { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); max-width: min(560px, 92vw); background: var(--surface); border: 2px solid var(--green); padding: 10px 16px; z-index: 50; margin: 0; box-shadow: 0 8px 24px var(--shadow); }
#toast.error { border-color: var(--accent); }
.notice { background: var(--surface); border-inline-start: 5px solid var(--green); padding: 10px 14px; margin: 14px 0; }
.notice.bad { border-inline-start-color: var(--accent); }

/* ---- 4 Formulare und Dialoge ----------------------------------------------------------------------------- */
input, select, textarea { width: 100%; padding: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
input[type="checkbox"], input[type="radio"] { width: auto; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { border-color: var(--green); outline: 3px solid var(--focus); outline-offset: 1px; }
.forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel-form, form#upload { background: var(--surface); border: 1px solid var(--line); padding: 20px; display: grid; gap: 10px; margin: 18px 0; }
.panel-form h2, .panel-form h3 { margin: 0; font-size: 1.4rem; }
.panel-form label { font-weight: 700; }
.field { display: grid; gap: 4px; align-content: start; }
.field label { font-weight: 700; }
.field-hint { margin: 0; font-size: .82rem; color: var(--muted); }
.required-note { margin: -4px 0 2px; font-size: .82rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.form-status { margin: 0; font-weight: 700; }
#auth-message, #account-message { margin: 0; font-weight: 700; }
.captcha { display: grid; gap: 8px; }
.captcha img { max-width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
.captcha-question { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 1.05rem; }
.captcha-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; }
dialog.modal { border: 2px solid var(--ink); padding: 22px; max-width: min(560px, 94vw); width: 100%; max-height: calc(100dvh - 2rem); overflow: auto; background: var(--surface); color: var(--ink); }
dialog.modal::backdrop { background: var(--backdrop); }
dialog.modal.wide, dialog.modal.compose { max-width: min(760px, 96vw); }
dialog.modal form { display: grid; gap: 10px; }
dialog.modal h2 { margin: 0; font-size: 1.4rem; }
dialog.modal h3 { margin: 14px 0 4px; }
dialog.modal label, .inline-form label { font-weight: 700; }
dialog.modal fieldset { border: 1px solid var(--line); display: grid; gap: 8px; padding: 12px; margin: 0; }
dialog.modal legend { font-weight: 700; padding: 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.inline-form { display: grid; gap: 8px; margin-top: 10px; }

/* ---- 5 Bausteine ---------------------------------------------------------------------------------------- */
.menu-list { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 10px; }
.menu-list button, .menu-link { display: grid; gap: 2px; width: 100%; text-align: start; padding: 14px 16px; background: var(--surface); border: 2px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu-list button:hover, .menu-link:hover, .menu-link:focus-visible { border-color: var(--green); }
.menu-list span { color: var(--muted); font-size: .9rem; }
/* Startseite: öffentliche Ansicht vs. Homescreen nach Login (siehe boot.js/shell.js, kein Flackern). */
#home-view { display: none; }
html[data-session="in"] #public-view { display: none; }
html[data-session="in"] #home-view { display: block; }
.hero-title { max-width: 18ch; font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.05; margin: 14px 0 20px; }
.hero-text { max-width: 62ch; font-size: 1.1rem; color: var(--muted); }
.home-head { margin-bottom: 20px; }
.home-head h1 { margin: 2px 0 0; }
.home-head .eyebrow { margin: 0; }
.home-widgets { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.home-widgets > .widget { grid-column: span 4; }
.home-widgets > .widget-mail { grid-column: span 8; }
.widget { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 18px; border-radius: var(--radius); }
.widget[hidden] { display: none; }
.widget-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; border: 0; min-height: 36px; background: none; }
.widget-head h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.widget-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--active); color: var(--green); }
.widget-icon .icon-wrap { margin: 0; }
.widget-actions { display: flex; gap: 2px; }
.widget-actions .icon-button { border: 0; background: none; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.widget-actions .icon-button:hover { background: var(--hover); color: var(--ink); }
.widget-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.widget-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.widget-row:hover, .widget-row:focus-visible { background: var(--hover); }
.widget-row.unread .row-from { font-weight: 700; }
.widget-row.unread .row-subject { color: var(--ink); }
.widget-row .row-avatar { width: 36px; height: 36px; }
.widget-row .row-meta { display: flex; align-items: center; gap: 8px; justify-items: unset; white-space: nowrap; }
.widget-row .row-meta .icon-wrap { margin: 0; }
.widget-row.slim { padding: 6px 10px; }
.widget-row.slim .row-from { white-space: normal; }
.widget-empty { margin: 0; padding: 8px 10px; }
.widget-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.widget-foot .button-like { text-decoration: none; display: inline-flex; align-items: center; }
.file-avatar, .row-avatar.warn { background: var(--surface-2); }
.file-avatar .icon-wrap, .row-avatar .icon-wrap { margin: 0; }
.row-avatar.warn { color: var(--accent); }
.photo-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-strip:empty { display: none; }
.photo-thumb { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--hover); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ai-quick { display: flex; gap: 8px; }
.ai-quick input { flex: 1; min-width: 0; border-radius: var(--radius); }
.storage { display: grid; gap: 6px; }
.storage-line { display: flex; justify-content: space-between; font-size: .9rem; }
.tiles-title { margin: 40px 0 12px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { display: grid; align-content: start; gap: 8px; height: 100%; padding: 20px; background: var(--surface); border: 2px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.tile:hover, .tile:focus-visible { border-color: var(--green); transform: translateY(-2px); }
.tile-icon { font-size: 2rem; }
.tile span:last-child { color: var(--muted); font-size: .95rem; }
@media (max-width: 1000px) { .home-widgets > .widget, .home-widgets > .widget-mail { grid-column: span 6; } .home-widgets > .widget-mail { grid-column: 1 / -1; } }
@media (max-width: 700px) { .home-widgets > .widget { grid-column: 1 / -1; } }
.pane { background: var(--surface); border: 1px solid var(--line); padding: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); padding: 20px; min-width: 0; }
.card > h3 { margin: 0 0 10px; font-size: 1.2rem; }
.card h4 { margin: 18px 0 8px; }
.card form { display: grid; gap: 8px; }
.card label { font-weight: 700; }
.card .check { display: flex; gap: 8px; align-items: center; }
.card .check input { width: auto; }
.sub-block { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.sub-block h4, .sub-card h4 { margin: 0 0 8px; }
.sub-card { border: 1px solid var(--line); padding: 14px 16px; margin: 14px 0; background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { text-align: start; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.data-table tbody tr:hover { background: var(--hover); }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 9px; border-radius: 10px; background: var(--hover); }
.pill.admin, .pill.on { background: var(--tag-new); color: var(--ok); }
.bar { height: 8px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); }
.bar.warn span { background: var(--accent); }
.badge, .badge-count { background: var(--green); color: var(--surface); font-size: .7rem; padding: 2px 8px; border-radius: 10px; vertical-align: middle; }
.badge-count { background: var(--accent); font-size: .75rem; padding: 0 7px; }

/* ---- 6 Anwendungen: Dateien, Fotos, Versionsseite ------------------------------------------------------------- */
/* Dateien (files.html): wie Mail ein Vollbild-Fenster: Seitenleiste mit „Neu“, Werkzeugleiste, sortierbare Liste oder Raster. */
.files { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(200px, 17vw, 260px) minmax(0, 1fr); background: var(--surface); }
.files > * { min-width: 0; min-height: 0; overflow: auto; }
.files-side { padding: 14px 10px; display: flex; flex-direction: column; gap: 14px; border-inline-end: 1px solid var(--line); background: var(--bg); }
.new-menu { position: relative; }
.new-button { display: inline-flex; align-items: center; gap: 8px; width: 100%; justify-content: center; border-radius: 22px; padding: 11px 16px; font-weight: 600; }
.new-button .icon-wrap { margin: 0; }
.new-menu .menu-pop { inset-inline-start: 0; inset-inline-end: auto; min-width: 100%; }
.new-menu .menu-pop button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 12px; text-align: start; border-radius: 6px; }
.new-menu .menu-pop button:hover { background: var(--hover); }
.files-storage { margin-top: auto; display: grid; gap: 6px; padding: 0 4px; }
.files-state { margin: 0; font-size: .8rem; }
.files-list-pane, .files-editor-pane { grid-column: 2; display: flex; flex-direction: column; }
.files-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 8px 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.files-toolbar .crumbs { margin: 0; font-size: 1.05rem; min-width: 0; }
.crumbs .crumb-sep { color: var(--muted); }
.crumbs .crumb-sep .icon-svg { width: 1em; height: 1em; }
.crumbs button { border: 0; background: none; padding: 4px 8px; border-radius: 6px; text-decoration: none; }
.crumbs button:hover { background: var(--hover); outline: none; }
.crumbs strong { padding: 4px 8px; }
.files-tools { display: flex; gap: 8px; align-items: center; }
.search-field input { min-width: 220px; padding: 8px 12px; border-radius: 20px; background: var(--surface-2); border-color: transparent; }
.search-field input:focus { background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: none; padding: 7px 10px; }
.seg button[aria-pressed="true"] { background: var(--active); color: var(--green); }
.files-head, .items li.item { display: grid; grid-template-columns: minmax(0, 1fr) 120px 90px 132px; gap: 10px; align-items: center; padding: 0 16px; }
.files-head { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-inline-start: 66px; }
.files-head button { border: 0; background: none; padding: 8px 0; text-align: start; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; border-radius: 0; }
.files-head button::after { content: attr(data-dir); margin-inline-start: 4px; font-size: .7em; }
.files-head button:hover { color: var(--ink); }
.items { list-style: none; margin: 0; padding: 0; flex: 1; }
.items li.item { position: relative; min-height: 52px; border-bottom: 1px solid var(--hover); grid-template-columns: 40px minmax(0, 1fr) 120px 90px 132px; padding: 0 16px; cursor: default; }
.files-head { grid-template-columns: minmax(0, 1fr) 120px 90px 132px; }
.items li.item:hover, .items li.item:focus-within { background: var(--hover); }
.items li.item.dragging { opacity: .45; }
.items li.item.drop-target, .crumbs .drop-target { background: var(--active); outline: 2px dashed var(--green); outline-offset: -2px; }
.item-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.item.folder .item-icon { background: var(--active); color: var(--green); }
.item-label { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; min-width: 0; }
.item-name { font-weight: 600; text-decoration: none; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.item-name:hover { text-decoration: underline; }
.item-sub { flex-basis: 100%; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-shared { color: var(--muted); }
.item-shared .icon-svg { width: 1em; height: 1em; }
.item-modified, .item-size { font-size: .88rem; white-space: nowrap; }
.item-tools { display: flex; justify-content: flex-end; gap: 2px; }
.item-tool, .row-more { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 6px; min-width: 32px; min-height: 32px; }
.item-tool:hover, .row-more:hover { background: var(--active); color: var(--ink); }
.item-tool.danger:hover { color: var(--accent); }
@media (hover: hover) { .item-tool { opacity: 0; } .items li.item:hover .item-tool, .items li.item:focus-within .item-tool { opacity: 1; } }
.items .icon-wrap { margin: 0; }
.items[data-view="grid"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 16px; align-content: start; }
.items[data-view="grid"] li.item { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.items[data-view="grid"] .item-icon { width: 56px; height: 56px; border-radius: 12px; }
.items[data-view="grid"] .item-icon .icon-svg { width: 2em; height: 2em; }
.items[data-view="grid"] .item-modified { font-size: .78rem; }
.items[data-view="grid"] .item-size { display: none; }
.items[data-view="grid"] .item-tools { position: absolute; top: 6px; inset-inline-end: 6px; }
.items[data-view="grid"] .item-label { width: 100%; }
.files-empty { display: grid; justify-items: center; gap: 10px; padding: 8vh 20px; text-align: center; }
.files-empty p { margin: 0; max-width: 40ch; }
.empty-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.empty-icon .icon-svg { width: 2em; height: 2em; }
.files-editor-pane { padding: 0; }
.files-editor-pane .editor-head { padding: 10px 16px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: nowrap; }
.files-editor-pane .back-button { display: inline-flex; margin: 0; }
.files-editor-pane #editor-text { flex: 1; min-height: 0; border: 0; border-radius: 0; resize: none; padding: 20px max(16px, 6vw); }
/* share.html (Link-Gast): schlanke, zentrierte Variante ohne Bereichs-Seitenleiste. */
.explorer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 16px; }
.explorer .editor { grid-column: 1 / -1; }
.crumbs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; margin-bottom: 6px; }
.row-more { flex: none; }
.editor-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.editor-head h2 { margin: 0; font-size: 1.3rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#editor-text { width: 100%; min-height: 340px; padding: 12px; border: 2px solid var(--line); font: 15px/1.5 ui-monospace, 'Space Mono', monospace; background: var(--surface); color: var(--ink); resize: vertical; }
/* "Mehr"-Aktionsmenü je Zeile (Teilen/Umbenennen/Verschieben/Löschen) statt vier Dauerknöpfen. */
dialog.action-sheet { border: 2px solid var(--ink); padding: 18px; max-width: min(340px, 92vw); width: 100%; background: var(--surface); color: var(--ink); }
dialog.action-sheet::backdrop { background: var(--backdrop); }
dialog.action-sheet h2 { margin: 0 0 10px; font-size: 1.1rem; }
.action-list { display: grid; gap: 2px; }
.action-list button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; border: 0; border-radius: 4px; background: none; padding: 11px 8px; color: var(--ink); }
.action-list button:hover, .action-list button:focus-visible { background: var(--hover); outline: none; }
.action-list button.danger { color: var(--accent); }
dialog.action-sheet > .link-button { display: block; margin-top: 10px; text-align: center; }
.photo-grid { list-style: none; margin: 18px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.photo-card { background: var(--surface); border: 1px solid var(--line); padding: 12px; display: grid; gap: 6px; align-content: start; }
.photo-card img { width: 100%; height: 190px; object-fit: cover; background: var(--hover); }
.photo-card p { margin: 0; }
.expired { color: var(--accent); font-weight: 700; }
.releases { list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 16px; }
.release { background: var(--surface); border: 1px solid var(--line); padding: 18px 20px; }
.release h2 { margin: 0; font-size: 1.3rem; }
.release p { margin: 2px 0 10px; }
.changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tag { display: inline-block; min-width: 78px; text-align: center; font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: var(--tag-improved); margin-inline-end: 6px; }
.tag.new { background: var(--tag-new); }
.tag.fixed { background: var(--tag-fixed); }
.tag.security { background: var(--tag-security); }

/* ---- KI-Chat: Vollbild, Gespräch in lesbarer Mittelspalte, Eingabe unten fixiert --------------------------------- */
.ai-app { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.ai-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.ai-bar h1 { margin: 0; font-size: 1.15rem; }
.ai-bar-actions { display: flex; gap: 6px; }
.ai-bar-actions .icon-only { border: 0; background: none; color: var(--muted); }
.ai-privacy { flex: none; margin: 0; border-radius: 0; font-size: .9rem; }
.ai-messages { flex: 1; min-height: 0; overflow: auto; padding: 20px 16px; }
.ai-column { width: 100%; max-width: 820px; margin: 0 auto; display: grid; gap: 14px; align-content: start; }
.ai-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8vh 0 2vh; }
.ai-empty > .icon-wrap { width: 64px; height: 64px; border-radius: 50%; background: var(--active); color: var(--green); }
.ai-empty > .icon-wrap .icon-svg { width: 2em; height: 2em; }
.ai-empty h2 { margin: 8px 0 0; font-size: 1.6rem; }
.ai-empty p { margin: 0; }
.ai-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.ai-chips button { border-radius: 18px; border-width: 1px; padding: 8px 14px; background: var(--surface-2); }
.ai-message { max-width: min(680px, 88%); padding: 10px 14px; border-radius: 14px; background: var(--surface-2); }
.ai-message strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.ai-message p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.ai-message.user { justify-self: end; background: var(--active); }
.ai-message.assistant { justify-self: start; }
.ai-wait { margin: 0; }
.ai-form { flex: none; padding: 8px 16px max(10px, env(safe-area-inset-bottom)); }
.ai-compose { max-width: 820px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; padding: 8px 8px 8px 14px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.ai-compose:focus-within { border-color: var(--green); outline: 3px solid var(--focus); }
.ai-compose textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; border: 0; outline: 0; padding: 8px 0; background: transparent; }
.ai-compose textarea:focus { outline: 0; }
.ai-compose button { flex: none; min-width: 40px; min-height: 40px; border-radius: 50%; }
.ai-hint { max-width: 820px; margin: 4px auto 0; text-align: center; font-size: .78rem; }

/* ---- 7 Konto und Sicherheit ------------------------------------------------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; align-items: start; margin: 18px 0; }
.qr { display: grid; justify-items: center; gap: 8px; padding: 12px; background: #fff; border: 1px solid var(--line); }
.qr img { width: 200px; height: 200px; }
.secret { font: 1.1rem ui-monospace, monospace; letter-spacing: .08em; word-break: break-all; background: var(--surface-2); padding: 8px 10px; }
.recovery-codes { list-style: none; margin: 8px 0; padding: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 14px; font: 1rem ui-monospace, monospace; background: var(--surface-2); border: 1px dashed var(--line); }
.device-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.device-list li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
.device-list .name { display: grid; min-width: 0; }
.choice-group { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-group button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.notify-row { align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--hover); }
.notify-row > span { display: grid; gap: 2px; }
.notify-row input { margin-top: 5px; }
/* Konto: Kopfbereich + Einstellungskarten in Gruppen */
.account-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.account-hero-text { flex: 1; min-width: 200px; }
.account-hero h1 { margin: 0 0 2px; }
.account-hero p { margin: 0; }
.avatar.big { width: 64px; height: 64px; font-size: 1.6rem; }
.group-title { margin: 28px 0 10px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.setting-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.setting { display: flex; align-items: center; gap: 14px; width: 100%; height: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-align: start; text-decoration: none; cursor: pointer; }
.setting:hover, .setting:focus-visible { border-color: var(--green); background: var(--surface); }
.setting-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.setting-text span { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.setting-chevron { color: var(--muted); display: inline-flex; }
.setting-chevron .icon-wrap { margin: 0; }
.setting .widget-icon { flex: none; }
.setting.danger .widget-icon { background: var(--tag-fixed); color: var(--accent); }
.setting.danger strong { color: var(--accent); }

/* Zahlungen: Spendenfeld, Konto-Seite, Admin */
.donate { margin-top: 40px; max-width: 720px; display: grid; gap: 12px; }
.donate h2, .card-title { margin: 0; font-size: 1.4rem; }
.donate form { display: grid; gap: 12px; }
.donate-custom { max-width: 240px; }
.donate-manual { white-space: pre-line; }
.billing .card { margin-bottom: 18px; }
.billing h3 { margin: 16px 0 6px; font-size: 1.05rem; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; border: 1px solid var(--line); padding: 12px; margin: 0; }
.method-grid legend { font-weight: 700; padding: 0 6px; }
.method-grid p { grid-column: 1 / -1; margin: 0; }
.span-2 { grid-column: 1 / -1; }
.form-grid textarea { width: 100%; padding: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
code { font: .9em ui-monospace, monospace; background: var(--surface-2); padding: 1px 5px; word-break: break-all; }

/* ---- 8 Administration ------------------------------------------------------------------------------------------ */
.admin-head p { margin: 0 0 6px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 2px solid var(--line); margin: 14px 0 18px; }
.tab { border: 0; border-bottom: 4px solid transparent; border-radius: 0; background: none; padding: 11px 18px; font-weight: 600; color: var(--muted); margin-bottom: -2px; }
.tab:hover { color: var(--ink); background: var(--hover); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); background: var(--surface); }
.tab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0; }
.metric { border: 1px solid var(--line); padding: 12px; display: grid; gap: 4px; align-content: start; background: var(--surface-2); }
.metric dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.metric dd { margin: 0; font-size: 1.6rem; font-weight: 700; }
.metric small { color: var(--muted); }
.services { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 6px; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--accent); }
.dot.warn { background: var(--star); }
.chart { margin: 18px 0 0; }
.chart canvas { display: block; width: 100%; height: 220px; background: var(--surface-2); border: 1px solid var(--line); }
.test-mail { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; align-items: end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.backup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.backup-list li { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; }
.backup-name { display: grid; min-width: 0; word-break: break-all; }
.job { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); }
.job .bar { margin-top: 6px; }

/* Admin: Server-Verbund */
.server-head { display: flex; justify-content: space-between; align-items: baseline; }
.server-head h3 { margin: 0; }
.server-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 12px; }
.server-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface-2); }
.server-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, .8fr) minmax(150px, auto); gap: 12px; align-items: start; }
.server-flags { align-content: end; align-self: end; }
.server-row .toolbar { margin: 10px 0 0; }
.server-check:empty { display: none; }
@media (max-width: 900px) { .server-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .server-grid { grid-template-columns: 1fr; } }

/* ---- 9 Mail-Client: nutzt die ganze Seitenbreite und -höhe ----------------------------------------------------------- */
.empty-state { max-width: 640px; margin: 8vh auto; text-align: center; display: grid; gap: 12px; justify-items: center; }
.mail { flex: 1; min-height: 0; display: grid; grid-template-columns: clamp(190px, 16vw, 250px) clamp(300px, 28vw, 440px) minmax(0, 1fr); background: var(--surface); }
.mail > * { min-width: 0; min-height: 0; overflow: auto; }
.mail-side { padding: 14px 10px; display: flex; flex-direction: column; gap: 12px; border-inline-end: 1px solid var(--line); background: var(--bg); overflow-x: hidden; }
.account-switch { display: flex; gap: 6px; min-width: 0; }
.account-switch select { flex: 1; min-width: 0; border-radius: var(--radius); }
.account-switch button { flex: none; padding: 8px 12px; border-radius: var(--radius); }
.folders { display: grid; gap: 2px; min-width: 0; }
.folder { display: flex; gap: 12px; align-items: center; width: 100%; min-width: 0; text-align: start; border: 0; border-radius: 6px; background: none; padding: 8px 12px; }
.folder .icon-wrap { margin: 0; }
.folder:hover { background: var(--hover); }
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: grid; gap: 2px; margin-top: auto; }
.side-link { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 8px 12px; text-align: start; color: var(--muted); border-radius: 6px; }
.side-link .icon-wrap { margin: 0; }
.side-link:hover { background: var(--hover); color: var(--ink); }
.mail-list-pane { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; }
.mail-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); min-height: 56px; }
.mail-toolbar .search-field { flex: 1; min-width: 0; }
.mail-toolbar .search-field input { min-width: 0; }
.compact-select { width: auto; flex: none; padding: 7px 8px; border-radius: 20px; border-color: transparent; background: var(--surface-2); }
.mail-toolbar > button, .view-menu > button { border: 0; background: none; border-radius: var(--radius); padding: 8px; color: var(--muted); }
.mail-toolbar > button:hover, .view-menu > button:hover { background: var(--hover); color: var(--ink); }
.view-menu { position: relative; }
.view-menu .menu-pop { min-width: 200px; padding: 12px; gap: 6px; }
.view-menu .menu-pop label { font-weight: 700; font-size: .85rem; }
.view-menu .menu-pop select { width: 100%; }
.bulk { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 12px; border-bottom: 1px solid var(--line); font-size: .85rem; min-height: 40px; }
.bulk-actions { display: flex; gap: 2px; }
.bulk-actions button { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 6px; }
.bulk-actions button:hover { background: var(--hover); color: var(--ink); }
.bulk-actions .danger:hover { color: var(--accent); }
.messages { list-style: none; margin: 0; padding: 0; flex: 1; overflow: auto; }
.message-row { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 12px; line-height: 1.35; border-bottom: 1px solid var(--hover); cursor: pointer; }
.row-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 700; }
.message-row.unread .row-avatar { background: var(--active); color: var(--ink); }
body[data-mail-density="compact"] .message-row { padding-block: 4px; grid-template-columns: auto auto minmax(0, 1fr) auto; }
body[data-mail-density="compact"] .row-avatar { display: none; }
body[data-mail-font="large"] .mail-read-pane, body[data-mail-font="large"] .mail-list-pane { font-size: 1.1rem; }
.message-row:hover { background: var(--hover); }
.message-row.active { background: var(--active); }
.message-row.unread .row-from, .message-row.unread .row-subject { font-weight: 700; }
.row-main { display: grid; min-width: 0; }
.row-from, .row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-subject { color: var(--muted); font-size: .9rem; }
.row-meta { font-size: .78rem; color: var(--muted); display: grid; justify-items: end; gap: 2px; }
.star { border: 0; background: none; padding: 0 2px; font-size: 1.1rem; color: var(--muted); }
.star.on { color: var(--star); }
.row-check { width: auto; }
#more { margin: 10px; }
.mail-read-pane { padding: 0 0 20px; overflow: auto; }
.reader-empty { min-height: 60%; padding: 24px; display: grid; gap: 10px; align-content: center; justify-items: center; text-align: center; }
.reader-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.reader-tools .danger { margin-inline-start: auto; }
.reader-head { padding: 12px 16px; }
.reader-head h2 { margin: 0 0 8px; font-size: 1.3rem; }
.reader-head dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: .9rem; }
.reader-head dt { color: var(--muted); }
.reader-head dd { margin: 0; word-break: break-word; }
.mail-frame { width: 100%; border: 0; min-height: 160px; display: block; background: #fff; }
.mail-text { white-space: pre-wrap; word-wrap: break-word; padding: 8px 16px; font: 14px/1.55 system-ui, sans-serif; margin: 0; }
.attachments { padding: 8px 16px; }
.attachments h3 { margin: 8px 0; }
.mail-read-pane .notice { margin: 8px 16px; }
.back-button { display: none; margin: 8px 16px 0; }
.shortcuts { font-size: .85rem; }
.test-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.test-steps li { display: grid; gap: 2px; }
.cc-rows { display: grid; gap: 8px; }
.editor-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rich-tools { display: flex; gap: 4px; }
.rich-editor { min-height: 260px; border: 2px solid var(--line); padding: 10px; background: var(--surface); overflow: auto; }
#compose-text { width: 100%; padding: 10px; border: 2px solid var(--line); font: 14px/1.5 system-ui, sans-serif; }
.attach-list { margin-top: 6px; }

/* ---- Anpassung an kleine Bildschirme -------------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .nav-app .nav-label { display: none; }
  .nav-app[aria-current="page"] .nav-label { display: inline; }
  .mail { grid-template-columns: 200px minmax(0, 1fr); }
  .mail-read-pane { display: none; }
  .mail[data-view="read"] .mail-read-pane { display: block; grid-column: 2; }
  .mail[data-view="read"] .mail-list-pane { display: none; }
  .back-button { display: inline-block; }
}
@media (max-width: 700px) {
  :root { --header-h: 52px; }
  .forms { grid-template-columns: 1fr; }
  /* Bedienbare Fingerziele (min. 44px) statt der knapperen Desktop-Maße. */
  button, .button-like, select, .icon-button, .a11y-toggle { min-height: 44px; touch-action: manipulation; }
  input, textarea { min-height: 44px; touch-action: manipulation; }
  input[type="checkbox"], input[type="radio"] { min-height: 22px; min-width: 22px; }
  .data-table th, .data-table td { padding: 11px 10px; }
  dialog.modal { padding: 18px; }
  main { padding-top: 18px; padding-bottom: 32px; }
  footer { justify-content: center; text-align: center; }
  footer nav { justify-content: center; }
  .cookie-banner { left: .5rem; right: .5rem; bottom: max(.5rem, env(safe-area-inset-bottom)); }
  .test-mail { grid-template-columns: 1fr; }
  .tab { padding: 9px 12px; }
  /* Angemeldet: Anwendungen als untere Leiste (Daumen-Reichweite), Kopfzeile bleibt schlank. */
  html[data-session="in"] body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  html[data-session="in"] .nav-apps { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; margin: 0; justify-content: space-around; gap: 0; padding: 4px 4px max(4px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  html[data-session="in"] .nav-app { flex: 1; flex-direction: column; gap: 2px; min-height: 52px; padding: 6px 2px; font-size: .72rem; border-radius: 10px; }
  html[data-session="in"] .nav-app .nav-label, html[data-session="in"] .nav-app[aria-current="page"] .nav-label { display: inline; }
  html[data-session="in"] .nav-app .icon-svg { width: 1.45em; height: 1.45em; }
  html[data-session="in"] .a11y-panel { top: auto; bottom: 70px; }
  .brand { font-size: 1rem; }
  .language-control select { min-width: 52px; }
  /* Abgemeldet auf dem Handy: „Start“ doppelt das Logo; ohne ihn passen Anmelden, Registrieren, Design und Sprache
     nebeneinander (auf einem echten 412-px-Gerät waren Design- und Sprachauswahl sonst aus dem Bild geschoben). */
  html:not([data-session="in"]) .nav-apps { display: none; }
  .nav-link { padding: 6px 10px; }
  body:has(main.app) { height: auto; min-height: 100dvh; }
  body:has(main.ai-page) { height: calc(100dvh / var(--a11y-scale)); min-height: 0; }
  main.app { flex: 1 0 auto; }
  main.ai-page { flex: 1 1 0; }
  .mail { grid-template-columns: 1fr; }
  .mail > * { overflow: visible; }
  .mail-side { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .folders { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .mail[data-view="read"] .mail-side { display: none; }
  .mail[data-view="read"] .mail-read-pane { grid-column: 1; }
  .mail[data-view="list"] .mail-read-pane { display: none; }
  .files { grid-template-columns: 1fr; }
  .files > * { overflow: visible; }
  .files-side { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .files-side .folders { display: flex; flex-wrap: wrap; gap: 6px; }
  .files-list-pane, .files-editor-pane { grid-column: 1; }
  .files-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .files-storage { display: none; }
  .new-menu { flex: none; }
  .new-button { width: auto; }
  .files-head { display: none; }
  .items li.item, .items li.item { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .item-modified { display: none; }
  .item-size { display: none; }
  .item-tool { opacity: 1; display: none; }
  .search-field input { min-width: 0; width: 100%; }
  .files-tools { width: 100%; }
  .search-field { flex: 1; }
  .files-toolbar { padding: 8px 12px; }
}

/* ---- 10 Barrierefreiheit ----------------------------------------------------------------------------------------------------- */
@media (max-width: 440px) {
  /* Sehr schmal: nur das Logo zeigen, der Name bleibt für Screenreader lesbar. */
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tile { transition: none; } }

/* Sicherheits-Assistent: Hinweiskarte auf der Startseite */
.nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 0 0 18px; border-inline-start: 4px solid var(--green); }
.nudge .nudge-text { flex: 1 1 260px; }
.nudge h2 { margin: 0 0 4px; font-size: 1.1rem; }
.nudge p { margin: 0; }
.primary-link { background: var(--ink); color: var(--on-ink); border-color: var(--ink); text-decoration: none; font-weight: 700 !important; }

/* Mail: Kontakte und OAuth-Anmeldung */
.contact-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.oauth-buttons { display: grid; gap: 8px; margin-bottom: 14px; }

/* Rechts-nach-links (Arabisch): Abstände und Ränder folgen über logische Eigenschaften (inline-start/-end) automatisch;
   Richtungspfeile werden gespiegelt, Zahlen, Adressen und Codes bleiben links-nach-rechts. */
[dir="rtl"] .icon-flip { transform: scaleX(-1); }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] code, [dir="rtl"] .ltr { direction: ltr; text-align: start; }

/* ---- Themen-App: web/theme.css ---- */
/* Design der App: nur Variablen der Grundstruktur überschreiben (Farben nie fest in Regeln, sonst bricht der Dunkelmodus).
   Jede Farbe braucht einen hellen (:root) und einen dunklen (:root[data-theme="dark"] + automatisch) Wert. */
:root { --green: #17665d; }
:root[data-theme="dark"] { --green: #4fc9b4; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { --green: #4fc9b4; }
}
