/* =====================================================================
   PrivateCloud – Designsystem
   Mischung aus Apple (große Titel, weiche Rundungen, Vibrancy/Unschärfe,
   ruhige Typografie) und Windows 11 Fluent (Mica-Hintergrund, Acrylic-
   Flächen, Navigationsleiste mit Akzentmarker, Fluent-Bedienelemente).
   Keine externen Ressourcen (CSP: style-src 'self').
   ===================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  /* Hintergrund: iOS-„Grouped“-Grau mit einem Hauch Windows-Mica */
  --mica: radial-gradient(1200px 600px at 0% 0%, rgba(0, 122, 255, .07), transparent 60%),
          radial-gradient(900px 500px at 100% 0%, rgba(175, 82, 222, .06), transparent 60%),
          linear-gradient(180deg, #f5f5f8 0%, #f2f2f7 100%);
  --bg: #f2f2f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-raised: #ffffff;
  --surface-2: rgba(60, 60, 67, 0.04);
  --surface-3: rgba(118, 118, 128, 0.12);
  --sidebar: rgba(246, 246, 249, 0.7);
  --border: rgba(60, 60, 67, 0.12);
  --border-strong: rgba(60, 60, 67, 0.22);
  --separator: rgba(60, 60, 67, 0.14);
  --text: #1d1d1f;
  --text-2: #3a3a3c;
  --muted: #6e6e73;
  --accent: #007aff;
  --accent-hover: #0068d9;
  --accent-soft: rgba(0, 122, 255, 0.11);
  --on-accent: #ffffff;
  --danger: #e5352b;
  --danger-soft: rgba(255, 59, 48, 0.11);
  --warn: #b25b00;
  --warn-soft: rgba(255, 149, 0, 0.15);
  --ok: #248a3d;
  --ok-soft: rgba(52, 199, 89, 0.14);
  --info: #007aff;
  --info-soft: rgba(0, 122, 255, 0.1);
  --yellow: #ffcc00;
  --focus: #007aff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.2), 0 4px 14px rgba(0, 0, 0, 0.08);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius: 13px;
  --radius-sm: 10px;
  --sidebar-w: 264px;
  --mobilebar-h: 52px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mica: radial-gradient(1200px 600px at 0% 0%, rgba(10, 132, 255, .10), transparent 60%),
            radial-gradient(900px 500px at 100% 0%, rgba(191, 90, 242, .08), transparent 60%),
            linear-gradient(180deg, #0b0b0d 0%, #000 100%);
    --bg: #000000;
    --surface: rgba(28, 28, 30, 0.78);
    --surface-solid: #1c1c1e;
    --surface-raised: #2c2c2e;
    --surface-2: rgba(255, 255, 255, 0.04);
    --surface-3: rgba(118, 118, 128, 0.24);
    --sidebar: rgba(22, 22, 24, 0.72);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);
    --separator: rgba(84, 84, 88, 0.55);
    --text: #f5f5f7;
    --text-2: #d1d1d6;
    --muted: #98989f;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.2);
    --on-accent: #ffffff;
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.17);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, 0.16);
    --ok: #30d158;
    --ok-soft: rgba(48, 209, 88, 0.15);
    --info: #0a84ff;
    --info-soft: rgba(10, 132, 255, 0.18);
    --yellow: #ffd60a;
    --focus: #409cff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.7), 0 4px 14px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --mica: radial-gradient(1200px 600px at 0% 0%, rgba(10, 132, 255, .10), transparent 60%),
          radial-gradient(900px 500px at 100% 0%, rgba(191, 90, 242, .08), transparent 60%),
          linear-gradient(180deg, #0b0b0d 0%, #000 100%);
  --bg: #000000;
  --surface: rgba(28, 28, 30, 0.78);
  --surface-solid: #1c1c1e;
  --surface-raised: #2c2c2e;
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(118, 118, 128, 0.24);
  --sidebar: rgba(22, 22, 24, 0.72);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --separator: rgba(84, 84, 88, 0.55);
  --text: #f5f5f7;
  --text-2: #d1d1d6;
  --muted: #98989f;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-soft: rgba(10, 132, 255, 0.2);
  --on-accent: #ffffff;
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.17);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.16);
  --ok: #30d158;
  --ok-soft: rgba(48, 209, 88, 0.15);
  --info: #0a84ff;
  --info-soft: rgba(10, 132, 255, 0.18);
  --yellow: #ffd60a;
  --focus: #409cff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.7), 0 4px 14px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  background-image: var(--mica);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .6em; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.022em; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: .98rem; margin-top: 1.2em; }
p { margin: 0 0 .8em; }
code, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-3); padding: .12em .4em; border-radius: 6px; overflow-wrap: anywhere; }
pre.code { background: var(--surface-3); padding: .8em 1em; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
.visually-hidden { position: absolute !important; 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; left: -999px; top: 8px; background: var(--surface-solid); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.text-warn { color: var(--warn); }
.mobile-only { display: none; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-xl { width: 52px; height: 52px; stroke-width: 1.35; }

/* "Acrylic"-Flächen: durchscheinend mit Unschärfe */
.card, .stat, .files-pane, .table-wrap, .dialog, .menu, .upload-panel, .vault-list-pane, .vault-detail-pane {
  -webkit-backdrop-filter: saturate(1.6) blur(24px);
  backdrop-filter: saturate(1.6) blur(24px);
}

/* ---------- Shell: Seitenleiste + Inhalt ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px 14px;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(1.8) blur(30px);
  backdrop-filter: saturate(1.8) blur(30px);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; color: var(--text); padding: 4px 10px 14px; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-logo { border-radius: 8px; box-shadow: var(--shadow-sm); }
.sidenav { display: grid; gap: 2px; }
.sidenav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .12s ease;
}
.sidenav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--surface-solid); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.sidenav a.active::before { /* Fluent-Auswahlmarker */
  content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; transform: translateY(-50%);
  border-radius: 3px; background: var(--accent);
}
.sidenav a.active .icon { color: var(--accent); }
.sidebar-spacer { flex: 1; }
.side-storage { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 8px; font-size: .84rem; }
.side-storage-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.side-storage-head .muted { font-weight: 400; text-align: right; }
.side-user { display: flex; align-items: center; gap: 8px; padding: 8px 4px 0 8px; border-top: 1px solid var(--border); margin-top: 6px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3b8cff, #7c4dff); flex: none; font-size: .9rem; }
.side-user-name { flex: 1; min-width: 0; display: grid; font-weight: 600; font-size: .9rem; overflow: hidden; }
.side-user-name small { color: var(--muted); font-weight: 400; font-size: .76rem; }
.side-user .icon-btn { width: 34px; height: 34px; }
.inline-form { display: inline; margin: 0; }
.main { padding: 28px 32px 48px; min-width: 0; max-width: 1480px; width: 100%; }
.mobilebar, .tabbar { display: none; }

:root .theme-dark-icon { display: none; }
:root[data-theme="dark"] .theme-dark-icon { display: inline; }
:root[data-theme="dark"] .theme-light-icon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-dark-icon { display: inline; }
  :root:not([data-theme="light"]) .theme-light-icon { display: none; }
}

/* ---------- Bedienelemente (Fluent + Apple) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--border); border-bottom-color: var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid); color: var(--text);
  font: inherit; font-size: .93rem; font-weight: 550; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, transform .06s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: color-mix(in srgb, var(--surface-solid) 92%, var(--text)); color: var(--text); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: transparent; border-bottom-color: rgba(0, 0, 0, .2); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-danger-solid, .dialog .btn-danger[type="submit"] { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger-solid:hover, .dialog .btn-danger[type="submit"]:hover { background: color-mix(in srgb, var(--danger) 88%, #000); color: #fff; }
.btn-small { min-height: 30px; padding: 3px 10px; font-size: .86rem; }
.btn-block { width: 100%; min-height: 42px; }
.btn-ghost-sm { background: transparent; box-shadow: none; }
.btn.is-disabled, .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy="true"] { opacity: .75; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 4px; display: inline-flex; gap: 6px; align-items: center; }
.link-btn:hover { text-decoration: underline; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.button-row form { margin: 0; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 550; font-size: .9rem; color: var(--text-2); }
.field-inline { display: inline-grid; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 38px; padding: 7px 12px;
  border: 1px solid var(--border); border-bottom: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid); color: var(--text); font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 -1px 0 var(--accent); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 10px; margin: 0; }
.fieldset legend { font-weight: 600; padding: 0 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.field-error { color: var(--danger); font-size: .9rem; margin: 0; }
.input-group { display: flex; gap: 4px; align-items: center; }
.input-group input { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: center; }
.filters .field-inline { min-width: 180px; flex: 1 1 180px; }
.filters .btn { flex: none; }
.manual-password { display: grid; gap: 10px; }
[data-password-mode-form]:has(input[value="generate"]:checked) .manual-password { display: none; }

/* Segmentierte Steuerung (Apple) */
.segmented { display: inline-flex; align-items: center; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented .icon-btn { width: 34px; height: 30px; border-radius: 7px; }
.segmented .icon-btn[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: .9rem; font-weight: 550; padding: 5px 14px; border-radius: 7px; cursor: pointer; min-height: 30px; }
.seg-btn .icon { width: 17px; height: 17px; }
.seg-btn[aria-selected="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Karten & Layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.page { max-width: 1240px; }
.page-narrow { max-width: 780px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.head-badges { display: flex; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2.tight { gap: 14px; }
.tabs { display: inline-flex; gap: 2px; margin-bottom: 18px; background: var(--surface-3); padding: 3px; border-radius: 10px; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 6px 16px; color: var(--text-2); border-radius: 7px; white-space: nowrap; font-weight: 550; font-size: .92rem; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.kv { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 7px 18px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: .84rem; }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-sub { color: var(--muted); font-size: .8rem; }

/* ---------- Hinweise & Badges ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin: 0 0 14px; border: 1px solid transparent; }
.alert .icon { margin-top: 1px; }
.alert span { color: var(--text); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .icon { width: 13px; height: 13px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-3); color: var(--muted); }

/* ---------- Fortschritt ---------- */
.meter-block { display: grid; gap: 8px; margin-bottom: 4px; }
.meter-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.meter-head strong { font-family: var(--font-display); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.meter { width: 100%; height: 8px; border-radius: 999px; overflow: hidden; border: 0; background: var(--surface-3); appearance: none; -webkit-appearance: none; display: block; }
.meter::-webkit-meter-bar { background: var(--surface-3); border-radius: 999px; border: 0; height: 8px; }
.meter::-webkit-meter-optimum-value, .meter::-webkit-meter-suboptimum-value, .meter::-webkit-meter-even-less-good-value { border-radius: 999px; background: var(--accent); }
.meter::-moz-meter-bar { border-radius: 999px; background: var(--accent); }
.meter-warn::-webkit-meter-optimum-value { background: var(--warn); }
.meter-warn::-moz-meter-bar { background: var(--warn); }
.meter-danger::-webkit-meter-optimum-value { background: var(--danger); }
.meter-danger::-moz-meter-bar { background: var(--danger); }
.meter-small { height: 6px; }
.meter-small::-webkit-meter-bar { height: 6px; }
.meter-foot { font-size: .86rem; }
.meter-note { display: flex; gap: 6px; flex-wrap: wrap; }
.strength { display: flex; gap: 10px; align-items: center; }
.strength-bar { flex: 0 0 120px; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.strength-bar > span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .2s; }
.strength-1 { background: var(--danger); } .strength-2 { background: var(--warn); } .strength-3 { background: #3aa76d; } .strength-4 { background: var(--ok); }

/* ---------- Tabellen & Listen ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; background: transparent; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .76rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-compact th, .table-compact td { padding: 8px 12px; font-size: .9rem; }
.details-cell { max-width: 360px; overflow-wrap: anywhere; color: var(--muted); }
.issue-list, .event-list, .session-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.event-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.session-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.session-list li form { margin: 0; }
.secret-box { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 14px; margin: 12px 0; background: var(--accent-soft); }
.secret-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.secret { font-size: 1.15rem; padding: 6px 10px; background: var(--surface-solid); user-select: all; }

/* ---------- Anmeldung ---------- */
.auth-body { display: grid; place-items: center; padding: 24px 16px; }
.auth-main { width: 100%; max-width: 400px; display: grid; gap: 20px; justify-items: center; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; }
.auth-brand img { width: 64px; height: 64px; border-radius: 16px; box-shadow: var(--shadow); }
.auth-card { width: 100%; padding: 28px; }
.auth-card h1 { font-size: 1.35rem; text-align: center; }
.auth-links { text-align: center; margin: 14px 0 0; }
.auth-theme { color: var(--muted); }
.error-card { max-width: 560px; margin: 40px auto; text-align: center; }
.error-code { font-family: var(--font-display); font-size: 3rem; font-weight: 800; color: var(--accent); margin: 0; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Dateimanager ---------- */
.files-app { display: grid; gap: 14px; }
.files-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; font-family: var(--font-display); }
.breadcrumbs a, .breadcrumbs span { padding: 2px 6px; border-radius: 6px; color: var(--muted); max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.15rem; font-weight: 600; }
.breadcrumbs a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.breadcrumbs .sep { color: var(--muted); padding: 0; font-weight: 400; }
.breadcrumbs .current { color: var(--text); font-size: 1.85rem; font-weight: 700; letter-spacing: -0.022em; padding-left: 4px; }
.breadcrumbs a.current:hover { background: none; }
.breadcrumbs.small a, .breadcrumbs.small span, .breadcrumbs.small .current { font-size: .92rem; }
.search { position: relative; flex: 0 1 320px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 18px; height: 18px; }
.search input { padding-left: 36px; border-radius: 10px; background: var(--surface-3); border-color: transparent; }
.search input:focus { background: var(--surface-solid); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; padding: 8px 0; }
.toolbar::before { content: ""; position: absolute; inset: 0 -32px; z-index: -1; background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.toolbar-main, .toolbar-selection, .toolbar-view { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar-selection { background: var(--accent-soft); border-radius: var(--radius); padding: 4px 6px 4px 14px; }
.sel-count { font-weight: 650; color: var(--accent); margin-right: 4px; }
.sort select { min-height: 36px; width: auto; border-radius: var(--radius-sm); }
.storage-strip { padding: 14px 16px; }

.files-pane { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-height: 320px; overflow: hidden; }
.list-header, .file-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 110px 160px 48px; align-items: center; gap: 4px; }
.list-header { padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.check-cell { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.check-cell input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.file-list { display: block; padding: 4px 6px; }
.file-row { padding: 0 4px; border-radius: var(--radius-sm); }
.file-row + .file-row { margin-top: 1px; }
.file-row:hover { background: var(--surface-2); }
.file-row.selected { background: var(--accent-soft); }
.file-row.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.file-main { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 7px 4px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 6px; }
.file-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); overflow: hidden; }
.file-icon img { width: 100%; height: 100%; object-fit: cover; }
.file-icon.is-folder { color: #fff; background: linear-gradient(160deg, #5aa9ff, #2f7cf0); }
.file-icon.is-folder .icon { fill: rgba(255, 255, 255, .25); }
.file-icon.is-image { color: #a24bf0; background: rgba(162, 75, 240, .12); }
.file-icon.is-video { color: #e5367f; background: rgba(229, 54, 127, .12); }
.file-icon.is-audio { color: #f06a1d; background: rgba(240, 106, 29, .12); }
.file-icon.is-archive { color: #b07d06; background: rgba(176, 125, 6, .13); }
.file-icon.is-doc { color: #2f7cf0; background: rgba(47, 124, 240, .12); }
.file-text { display: grid; min-width: 0; }
.file-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: none; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-size, .col-date { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-actions { display: grid; place-items: center; }
.file-row .col-actions .icon-btn { opacity: .6; }
.file-row:hover .col-actions .icon-btn, .file-row .col-actions .icon-btn:focus-visible { opacity: 1; }

.files-app[data-view="grid"] .list-header { display: none; }
.files-app[data-view="grid"] .file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 14px; }
.files-app[data-view="grid"] .file-row { display: flex; flex-direction: column; position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 0 8px; overflow: hidden; background: var(--surface-solid); margin: 0; }
.files-app[data-view="grid"] .file-row .check-cell { position: absolute; left: 4px; top: 4px; z-index: 2; background: color-mix(in srgb, var(--surface-solid) 85%, transparent); border-radius: 8px; width: 34px; height: 34px; }
.files-app[data-view="grid"] .file-row .col-actions { position: absolute; right: 4px; top: 4px; z-index: 2; background: color-mix(in srgb, var(--surface-solid) 85%, transparent); border-radius: 8px; }
.files-app[data-view="grid"] .file-main { flex-direction: column; align-items: stretch; width: 100%; padding: 0; gap: 8px; }
.files-app[data-view="grid"] .file-icon { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; }
.files-app[data-view="grid"] .file-icon .icon { width: 46px; height: 46px; }
.files-app[data-view="grid"] .file-text { padding: 0 10px; }
.files-app[data-view="grid"] .file-meta { display: block; }
.files-app[data-view="grid"] .col-size, .files-app[data-view="grid"] .col-date { display: none; }

.loading { display: flex; align-items: center; gap: 10px; padding: 32px; color: var(--muted); justify-content: center; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: grid; justify-items: center; gap: 4px; padding: 52px 16px; color: var(--muted); text-align: center; }
.empty .icon-xl { color: var(--accent); opacity: .55; }
.empty-title { font-weight: 650; color: var(--text); margin: 8px 0 0; font-size: 1.05rem; }
.drop-overlay { position: absolute; inset: 6px; display: grid; place-content: center; justify-items: center; gap: 8px; background: color-mix(in srgb, var(--accent-soft) 85%, var(--surface-solid)); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 650; z-index: 5; }

/* Kontextmenü (Fluent-Flyout) */
.menu { position: fixed; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 5px; display: grid; }
.menu button { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: .93rem; text-align: left; border-radius: 7px; cursor: pointer; }
.menu button .icon { width: 18px; height: 18px; color: var(--text-2); }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); }
.menu button.danger, .menu button.danger .icon { color: var(--danger); }

/* Upload-Panel */
.upload-panel { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: min(420px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.upload-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 10px 16px; }
.upload-panel-head > div { display: flex; align-items: center; gap: 4px; }
.upload-panel.collapsed .upload-list { display: none; }
.progress-total { height: 3px; background: var(--surface-3); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; border-radius: 99px; }
.upload-list { list-style: none; margin: 0; padding: 0; max-height: 45vh; overflow-y: auto; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 16px; border-top: 1px solid var(--border); align-items: center; }
.upload-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.upload-item .progress { grid-column: 1 / -1; height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.upload-item.done .upload-status { color: var(--ok); }
.upload-item.error .upload-status { color: var(--danger); }
.upload-item.error .progress-bar { background: var(--danger); }

/* Dialoge (Apple-Sheet / Fluent ContentDialog) */
.dialog { border: 1px solid var(--border); padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.dialog[open] { animation: dlg-in .16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog::backdrop { background: rgba(10, 12, 16, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog-wide { width: min(640px, calc(100vw - 32px)); }
.dialog-body { padding: 22px; display: grid; gap: 14px; }
.dialog-body h2 { margin: 0; font-size: 1.2rem; }
.dialog-body p { margin: 0; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.folder-picker { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); max-height: 320px; overflow-y: auto; background: var(--surface-solid); }
.folder-picker li button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.folder-picker li button:hover { background: var(--surface-3); }
.folder-picker li button[disabled] { opacity: .45; cursor: not-allowed; }
.folder-picker .icon { color: var(--accent); }
.folder-picker .picker-empty { padding: 12px; color: var(--muted); }
.dialog-preview { width: min(1100px, calc(100vw - 24px)); height: min(860px, calc(100dvh - 24px)); }
.dialog-preview[open] { display: grid; grid-template-rows: auto 1fr; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.preview-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-actions { display: flex; gap: 6px; align-items: center; }
.preview-body { display: grid; place-items: center; overflow: auto; background: var(--surface-2); min-height: 0; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 100%; object-fit: contain; }

.toast-region { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); animation: dlg-in .16s ease-out; font-weight: 500; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Kapazität (Admin) ---------- */
.capacity-card { margin-bottom: 16px; display: grid; gap: 14px; }
.capacity-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.capacity-label { display: block; color: var(--muted); font-size: .85rem; font-weight: 550; }
.capacity-big { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; color: var(--accent); }
.capacity-facts { display: flex; gap: 22px; margin: 0; flex-wrap: wrap; }
.capacity-facts div { display: grid; }
.capacity-facts dt { color: var(--muted); font-size: .8rem; }
.capacity-facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.capbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.capbar > span { display: block; height: 100%; width: 0; transition: width .4s ease; }
.capbar-used, .dot-used { background: var(--accent); }
.capbar-committed, .dot-committed { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.capbar-free, .dot-free { background: var(--ok); }
.capbar-blocked, .dot-blocked { background: var(--border-strong); }
.capbar-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; font-size: .82rem; color: var(--text-2); }
.capbar-legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.capacity-note { margin: 0; }
.cell-actions { text-align: right; white-space: nowrap; }
.kv-tight { gap: 4px 14px; margin: 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: .85rem; font-weight: 550; cursor: pointer; min-height: 32px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Galerie ---------- */
.gallery-head { margin-bottom: 4px; }
.gallery-note { margin-bottom: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; }
.gallery-month { grid-column: 1 / -1; font-size: 1.05rem; margin: 22px 2px 6px; color: var(--text); }
.gallery-month:first-child { margin-top: 0; }
.gallery-tile { position: relative; aspect-ratio: 1 / 1; border: 0; padding: 0; margin: 0; border-radius: 6px; overflow: hidden; background: var(--surface-3); cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.gallery-tile img, .gallery-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; transition: transform .25s ease; }
.gallery-tile:hover img, .gallery-tile:hover video { transform: scale(1.035); }
.gallery-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile-play { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: #fff; display: grid; place-items: center; }
.tile-play .icon { width: 15px; height: 15px; stroke: none; }
.gallery-sentinel { height: 1px; }

/* ---------- Vollbildansicht ---------- */
.lightbox { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: #000; color: #f2f5f6; }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr; }
.lightbox::backdrop { background: #000; }
html.lb-open { overflow: hidden; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(8px, env(safe-area-inset-top)) 10px 8px 18px; position: relative; z-index: 2; }
.lb-meta { display: grid; min-width: 0; }
.lb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-counter { font-size: .8rem; color: #a9b0b8; }
.lb-actions { display: flex; gap: 6px; }
.lb-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: #f2f5f6; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; text-decoration: none; }
.lb-stage { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; touch-action: pan-y pinch-zoom; padding-bottom: env(safe-area-inset-bottom); }
.lb-media { max-width: 100%; max-height: 100%; object-fit: contain; }
video.lb-media { width: 100%; height: 100%; background: #000; }
.lb-audio { width: min(560px, 92vw); }
.lb-text { width: min(900px, 96vw); height: 100%; margin: 0; padding: 18px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #111316; color: #e8eef0; border-radius: 10px; }
.lb-error { color: #c3cfd3; }
.lb-spinner { position: absolute; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 50px; height: 50px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* ---------- Tresor ---------- */
.vault-center { max-width: 480px; margin: 6vh auto 0; text-align: center; display: grid; gap: 6px; padding: 32px; }
.vault-center .form { text-align: left; margin-top: 10px; }
.vault-hero { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 6px; border-radius: 24px; color: #fff; background: linear-gradient(150deg, #3b8cff, #6b4dff); box-shadow: 0 10px 30px rgba(59, 140, 255, .35); }
.vault-hero .icon-xl { width: 44px; height: 44px; stroke-width: 1.6; }
.vault-main { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.vault-list-pane, .vault-detail-pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.vault-list-pane { padding: 16px 10px 10px; position: sticky; top: 20px; max-height: calc(100dvh - 60px); display: flex; flex-direction: column; gap: 10px; }
.vault-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; }
.vault-list-head h1 { margin: 0; font-size: 1.6rem; }
.vault-head-actions { display: flex; align-items: center; gap: 2px; }
.vault-search { flex: none; margin: 0 4px; }
.vault-filter { margin: 0 4px; align-self: flex-start; }
.vault-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.vault-list-empty { padding: 18px 10px; color: var(--muted); text-align: center; }
.vault-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; border-radius: 10px; cursor: pointer; }
.vault-row:hover { background: var(--surface-3); }
.vault-row.active { background: var(--accent); color: var(--on-accent); }
.vault-row.active .vault-row-sub { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }
.vault-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.vault-row-text { display: grid; min-width: 0; }
.vault-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-row-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-lockhint { padding: 0 8px; margin: 0; font-size: .76rem; }
.vault-detail-pane { min-height: 420px; padding: 24px; }
.vault-empty-detail { padding-top: 80px; }
.vault-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.vault-detail-title { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.vault-detail-title .vault-avatar { width: 52px; height: 52px; border-radius: 14px; font-size: 1.3rem; }
.vault-detail-title h2 { margin: 0; font-size: 1.5rem; overflow-wrap: anywhere; }
.vault-detail-actions { display: flex; gap: 6px; }
.vault-back { display: none; }
.vault-card { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.vfield { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 8px 10px 16px; }
.vfield + .vfield { border-top: 1px solid var(--border); }
.vfield-label { color: var(--muted); font-size: .88rem; }
.vfield-value { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vfield-text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
pre.vfield-text { white-space: pre-wrap; margin: 0; font-family: var(--font); font-size: .95rem; font-weight: 400; }
.secret-mask { letter-spacing: .15em; }
.vfield-actions { display: flex; gap: 2px; flex: none; }
.vfield-actions .icon-btn { width: 34px; height: 34px; }
.extra-fields { display: grid; gap: 8px; }
.extra-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 8px; align-items: center; }

/* ---------- Installationshinweis (PWA) ---------- */
.install-hint { position: fixed; left: 10px; right: 10px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 45; display: flex; gap: 12px; align-items: center; padding: 12px 12px 12px 14px; background: var(--surface); -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: dlg-in .2s ease-out; }
.install-hint img { width: 42px; height: 42px; border-radius: 10px; flex: none; }
.install-hint-text { flex: 1; min-width: 0; font-size: .88rem; }
.install-hint-text strong { display: block; font-size: .95rem; }
.ios-share { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vault-main { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .list-header, .file-row { grid-template-columns: 44px minmax(0, 1fr) 48px; }
  .col-size, .col-date { display: none; }
  .file-meta { display: block; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-only { display: block; }
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    position: sticky; top: 0; z-index: 30; height: calc(var(--mobilebar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px);
    border-bottom: 1px solid var(--border);
  }
  .mobilebar .brand { padding: 0; font-size: 1rem; }
  .mobilebar-actions { display: flex; gap: 2px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
    background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
    -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px);
    border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; padding: 6px 2px; color: var(--muted); font-weight: 550; border-radius: 10px; }
  .tabbar a .icon { width: 24px; height: 24px; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent); }
  .main { padding: 14px max(14px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  h1 { font-size: 1.6rem; }
  .breadcrumbs .current { font-size: 1.6rem; }
  .card { padding: 16px; border-radius: var(--radius); }
  .upload-panel { bottom: calc(76px + env(safe-area-inset-bottom)); right: 10px; width: calc(100vw - 20px); }
  .toast-region { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .search { flex: 1 1 100%; }
  .toolbar .btn span { display: none; }
  .toolbar .btn-primary span { display: inline; }
  .toolbar::before { inset: 0 -14px; }
  .toolbar-selection { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table td { border: 0; padding: 4px 14px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .files-app[data-view="grid"] .file-list { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); padding: 8px; gap: 8px; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 0 -14px; }
  .gallery-tile { border-radius: 0; }
  .gallery-month { margin-left: 14px; }
  .lb-prev, .lb-next { display: none; }
  .dialog { width: calc(100vw - 20px); }
  .dialog-preview { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
  /* Tresor: Liste → Detail wie in iOS */
  .vault-main { grid-template-columns: 1fr; }
  .vault-list-pane { position: static; max-height: none; }
  .vault-detail-pane { display: none; padding: 16px; }
  .vault-app.show-detail .vault-list-pane { display: none; }
  .vault-app.show-detail .vault-detail-pane { display: block; }
  .vault-back { display: inline-grid; }
  .storage-strip { padding: 10px 14px; }
  .storage-strip .meter-block { gap: 6px; margin: 0; }
  .storage-strip .meter-head strong { font-size: 1rem; }
  .storage-strip .meter-foot, .storage-strip .meter-note { display: none; }
  .list-header { display: none; }
  .file-list { padding: 4px; }
  .toolbar-view .sort select { max-width: 150px; }
  .vault-detail-head { flex-wrap: wrap; }
  .vault-detail-title { flex: 1 1 calc(100% - 56px); }
  .vault-detail-title h2 { font-size: 1.3rem; }
  .vault-detail-title .vault-avatar { width: 44px; height: 44px; }
  .vault-detail-actions { width: 100%; justify-content: flex-end; }
  .gallery-note { display: none; }
  .vfield { grid-template-columns: 1fr; gap: 2px; }
  .extra-field { grid-template-columns: 1fr 1fr; }
  .vault-center { margin-top: 2vh; padding: 22px; }
}
@media (min-width: 861px) {
  .hide-desktop { display: none; }
  .install-hint { display: none; }
}
/* Touch-Geräte: große Trefferflächen, Aktionen immer sichtbar, kein iOS-Zoom beim Tippen in Felder */
@media (hover: none) and (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .file-row .col-actions .icon-btn { opacity: 1; }
  .btn { min-height: 44px; }
  .btn-small { min-height: 38px; }
  .seg-btn { min-height: 36px; }
  .file-main { padding-top: 9px; padding-bottom: 9px; }
  .menu button { padding: 12px 14px; }
  .vault-row { padding: 10px; }
  body { -webkit-tap-highlight-color: transparent; }
  .tabbar, .sidenav, .gallery-tile, .file-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
@media (max-width: 860px) {
  input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea { font-size: 16px; }
}
/* Als installierte App (Startbildschirm) */
@media (display-mode: standalone) {
  .mobilebar { padding-top: max(env(safe-area-inset-top), 8px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .card, .stat, .files-pane, .table-wrap, .dialog, .menu, .upload-panel, .sidebar, .vault-list-pane, .vault-detail-pane { background: var(--surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* =====================================================================
   Version 2 – modernisiertes Design (stärker Apple, mit Windows-Akzenten)
   Ergänzt und verfeinert die Regeln oben. Neue Bausteine: Blätter von
   unten (iOS), Auswahlleiste, Aktionsmenüs, Vollbildansicht mit Leiste,
   Informationen, Speicherübersicht.
   ===================================================================== */

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

body { font-size: 15px; letter-spacing: -0.003em; }
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.12rem; font-weight: 650; letter-spacing: -0.012em; }

/* Acrylic/Vibrancy-Flächen */
.card, .stat, .files-pane, .table-wrap, .vault-list-pane, .vault-detail-pane {
  border-radius: var(--radius-lg); border-color: var(--border); box-shadow: var(--shadow);
}

/* ---------- Seitenleiste ---------- */
.sidebar { padding: 20px 12px 14px; gap: 4px; }
.brand { padding: 2px 10px 16px; font-size: 1.12rem; }
.brand-logo { border-radius: 9px; }
.sidenav { gap: 1px; }
.sidenav-label { display: block; padding: 14px 12px 4px; font-size: .72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sidenav-label:first-child { padding-top: 0; }
.sidenav a { padding: 8px 12px; border-radius: 9px; font-weight: 500; transition: background .15s var(--ease), color .15s; }
.sidenav a .icon { color: var(--accent); width: 19px; height: 19px; }
.sidenav a.active { background: var(--accent-soft); box-shadow: none; color: var(--text); font-weight: 600; }
.sidenav a.active::before { background: var(--accent); height: 18px; }
.side-storage { color: inherit; text-decoration: none; transition: background .15s; border: 1px solid transparent; }
.side-storage:hover { background: var(--surface-3); color: inherit; text-decoration: none; }
.side-storage.active { border-color: var(--accent); }
.side-storage-head { align-items: center; }
.side-storage-head > span:first-child { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.side-storage-head .muted { font-size: .78rem; white-space: nowrap; }
.side-storage-head .icon { width: 16px; height: 16px; color: var(--accent); }
.user-avatar { background: linear-gradient(145deg, #5e9eff, #0a62e0 55%, #6e46e8); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.user-avatar-lg { width: 46px; height: 46px; font-size: 1.15rem; }

/* ---------- Bedienelemente ---------- */
.btn { min-height: 36px; padding: 6px 15px; border-radius: 10px; font-weight: 590; border-color: var(--border); border-bottom-color: var(--border-strong); transition: background .15s, transform .12s var(--ease), box-shadow .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); color: var(--accent); }
.btn-quiet[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.btn-danger-solid { background: var(--danger); color: #fff; border-color: transparent; }
.icon-btn { border-radius: 10px; }
.segmented { background: var(--surface-3); border-radius: 10px; padding: 2px; }
.segmented .icon-btn[aria-pressed="true"], .seg-btn[aria-selected="true"] { background: var(--surface-raised); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }
.seg-btn { border-radius: 8px; padding: 5px 14px; transition: background .15s; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea { border-radius: 10px; }
.page-title h1 { margin: 0; }
.page-title p { margin: 2px 0 0; }
.hide-mobile { }
@media (max-width: 860px) { .hide-mobile { display: none !important; } }
@media (min-width: 861px) { .hide-desktop { display: none !important; } }

/* ---------- Dateien: Kopf & Pfad ---------- */
.files-head { align-items: flex-end; }
.breadcrumbs { display: grid; gap: 2px; font-family: var(--font-display); min-width: 0; }
.breadcrumbs h1.current { font-size: 2rem; margin: 0; padding: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.crumb-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: .9rem; }
.crumb-trail a { color: var(--muted); padding: 1px 6px; border-radius: 6px; font-weight: 550; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-trail a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.crumb-trail .sep { color: var(--muted); }
.crumb-back { display: none; align-items: center; gap: 2px; color: var(--accent); font-weight: 500; font-size: 1rem; margin-left: -6px; }
.crumb-back .icon { width: 22px; height: 22px; stroke-width: 2.2; }
.crumb-back span { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-back:hover { text-decoration: none; }
.crumb-trail a.drop-target, .crumb-back.drop-target { outline: 2px dashed var(--accent); }
.search input { border-radius: 11px; min-height: 38px; background: var(--surface-3); }

/* ---------- Werkzeugleiste ---------- */
.toolbar { padding: 8px 0; }
.toolbar::before { background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); }
.toolbar-view { margin-left: auto; }
.toolbar-main .muted { margin-left: 6px; }

/* ---------- Dateiliste ---------- */
.files-pane { border-radius: var(--radius-lg); }
.file-list { padding: 6px; }
.file-row { border-radius: 11px; transition: background .12s; }
.file-row + .file-row { margin-top: 0; }
.file-row:hover { background: var(--surface-2); }
.file-row.selected { background: var(--accent-soft); }
.file-icon { width: 42px; height: 42px; border-radius: 11px; position: relative; }
.file-icon.is-folder { background: linear-gradient(170deg, #6cb5ff, #1b7cf5); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.file-icon.is-pdf { color: #e5352b; background: rgba(229, 53, 43, .12); }
.file-icon.has-play::after { content: ""; position: absolute; inset: auto 4px 4px auto; width: 14px; height: 14px; border-radius: 50%; background: rgba(0,0,0,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3.5 2.5v5l4-2.5z' fill='white'/%3E%3C/svg%3E") center/10px no-repeat; }
.file-badge { position: absolute; bottom: 3px; font-size: .52rem; font-weight: 800; letter-spacing: .04em; color: inherit; }
.file-name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.file-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-app:not([data-mode="folder"]) .file-meta, .files-app.searching .file-meta { display: block; }
.fav-dot { display: inline-grid; color: var(--yellow); flex: none; }
.fav-dot .icon { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.file-row .check-cell { transition: width .2s var(--ease), opacity .2s; }
.check-cell input { width: 20px; height: 20px; border-radius: 50%; }
/* Auswahlmodus: runde Haken wie in iOS */
.files-app.select-mode .file-row .col-actions .icon-btn { visibility: hidden; }
.files-app .file-row .file-main { touch-action: manipulation; }
.drop-overlay { border-radius: var(--radius-lg); background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface-solid)); }
.drop-overlay .muted { font-weight: 400; }
.empty { padding: 64px 16px; }
.empty-icon { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 26px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.empty-icon .icon-xl { width: 42px; height: 42px; opacity: 1; stroke-width: 1.6; }
.empty-title { font-size: 1.15rem; }

/* Kachelansicht */
.files-app[data-view="grid"] .file-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 16px; }
.files-app[data-view="grid"] .file-row { border: 0; background: transparent; padding: 6px; border-radius: 16px; }
.files-app[data-view="grid"] .file-row:hover { background: var(--surface-2); }
.files-app[data-view="grid"] .file-row.selected { background: var(--accent-soft); }
.files-app[data-view="grid"] .file-icon { aspect-ratio: 1 / 1; border-radius: 14px; box-shadow: 0 0 0 .5px var(--border); }
.files-app[data-view="grid"] .file-icon.is-folder { box-shadow: none; }
.files-app[data-view="grid"] .file-text { padding: 2px 2px 0; text-align: center; }
.files-app[data-view="grid"] .file-name { justify-content: center; font-size: .9rem; }
.files-app[data-view="grid"] .file-meta { font-size: .76rem; text-align: center; }
.files-app[data-view="grid"] .file-row .check-cell { left: 10px; top: 10px; width: 30px; height: 30px; border-radius: 50%; background: transparent; }
.files-app[data-view="grid"] .file-row .col-actions { right: 8px; top: 8px; background: color-mix(in srgb, var(--surface-solid) 80%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: 50%; }
.files-app[data-view="grid"] .file-row .col-actions .icon-btn { width: 32px; height: 32px; border-radius: 50%; }

/* Schwebender Hinzufügen-Knopf (Handy) */
.fab { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 34; width: 58px; height: 58px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; background: var(--accent); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px rgba(0,0,0,.2); cursor: pointer; transition: transform .2s var(--ease); }
.fab .icon { width: 28px; height: 28px; stroke-width: 2.2; }
.fab:active { transform: scale(.92); }
.fab.is-disabled { opacity: .45; }
body.has-selection-bar .fab { display: none; }

/* ---------- Auswahlleiste (unten, schwebend) ---------- */
.selection-bar { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; width: min(560px, calc(100vw - 20px)); padding: 8px 10px 10px; border-radius: 22px; background: var(--surface); -webkit-backdrop-filter: saturate(1.8) blur(30px); backdrop-filter: saturate(1.8) blur(30px); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: bar-in .3s var(--ease); }
@keyframes bar-in { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.selection-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 6px; }
.selection-info strong { font-size: .95rem; }
.selection-info .link-btn { font-weight: 600; min-width: 52px; }
.selection-info .link-btn:last-child { text-align: right; justify-content: flex-end; }
.selection-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.sel-btn { display: grid; justify-items: center; gap: 3px; padding: 8px 4px 6px; border: 0; border-radius: 14px; background: var(--surface-3); color: var(--accent); font: inherit; font-size: .76rem; font-weight: 600; cursor: pointer; transition: background .15s, transform .12s var(--ease); }
.sel-btn .icon { width: 22px; height: 22px; }
.sel-btn:hover { background: var(--accent-soft); }
.sel-btn:active { transform: scale(.95); }
.sel-btn.danger { color: var(--danger); }
.sel-btn.danger:hover { background: var(--danger-soft); }
.sel-btn.on .icon { fill: var(--yellow); stroke: var(--yellow); }
.sel-btn:disabled { opacity: .4; pointer-events: none; }
body.has-selection-bar .main { padding-bottom: 170px; }

/* ---------- Upload-Panel ---------- */
.upload-panel { border-radius: 20px; -webkit-backdrop-filter: saturate(1.8) blur(30px); backdrop-filter: saturate(1.8) blur(30px); }
.upload-panel.all-done .progress-bar { background: var(--ok); }
body.has-selection-bar .upload-panel { display: none; }

/* ---------- Dialoge ---------- */
.dialog { border-radius: var(--radius-xl); background: var(--surface-solid); border: 1px solid var(--border); }
.dialog[open] { animation: dlg-pop .28s var(--ease); }
@keyframes dlg-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.dialog::backdrop, .sheet::backdrop, .menu-pop::backdrop { background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dialog-body { padding: 24px; gap: 14px; }
.dialog-confirm { width: min(400px, calc(100vw - 32px)); text-align: center; }
.dialog-confirm .dialog-actions { justify-content: stretch; }
.dialog-confirm .dialog-actions .btn { flex: 1; }
.dialog-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 2px; background: var(--accent-soft); color: var(--accent); }
.dialog-icon.danger { background: var(--danger-soft); color: var(--danger); }
.dialog-icon .icon { width: 28px; height: 28px; }
.folder-picker { border-radius: var(--radius); }
.folder-picker li button .chev { margin-left: auto; color: var(--muted); width: 16px; height: 16px; }

/* Kontextmenü am Desktop (Popover) */
.menu-pop { position: fixed; margin: 0; padding: 5px; min-width: 240px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); -webkit-backdrop-filter: saturate(1.8) blur(30px); backdrop-filter: saturate(1.8) blur(30px); box-shadow: var(--shadow-lg); color: var(--text); animation: menu-in .16s var(--ease); }
.menu-pop::backdrop { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
@keyframes menu-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.menu-list { display: grid; }
.menu-list button { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: .93rem; text-align: left; border-radius: 9px; cursor: pointer; }
.menu-list button .icon { width: 18px; height: 18px; color: var(--accent); }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu-list button:hover .icon, .menu-list button:focus-visible .icon { color: #fff; }
.menu-list button.danger, .menu-list button.danger .icon { color: var(--danger); }
.menu-list button.danger:hover { background: var(--danger); color: #fff; }
.menu-list button.danger:hover .icon { color: #fff; }
.menu-sep { height: 1px; background: var(--separator); margin: 4px 8px; }

/* Blatt von unten (iOS-Sheet) – auch Aktionsblätter und „Mehr“ */
.sheet { margin: auto auto 0; padding: 0 0 env(safe-area-inset-bottom); width: min(520px, 100vw); max-width: 100vw; max-height: 88dvh; border: 0; border-radius: 24px 24px 0 0; background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-lg); overflow: auto; transition: transform .25s var(--ease); }
.sheet[open] { animation: sheet-up .38s var(--ease); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 861px) { .sheet { margin: auto; border-radius: 24px; padding-bottom: 8px; } .sheet[open] { animation: dlg-pop .28s var(--ease); } }
.sheet-grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 8px auto 4px; }
.sheet-body { padding: 4px 14px 16px; display: grid; gap: 12px; }
.sheet-user { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.sheet-user .side-user-name { font-size: 1.05rem; }
.sheet-storage { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); color: var(--text); }
.sheet-storage:hover { text-decoration: none; color: var(--text); }
.sheet-storage-text { display: flex; align-items: center; gap: 10px; }
.sheet-storage-text > span { flex: 1; }
.sheet-storage-text .icon { color: var(--accent); }
.sheet-storage-text .chev { color: var(--muted); width: 16px; height: 16px; }
.sheet-list { display: grid; border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.sheet-list > a, .sheet-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 16px; border: 0; background: none; color: var(--text); font: inherit; font-size: 1rem; text-align: left; cursor: pointer; text-decoration: none; }
.sheet-list > a + a, .sheet-list > * + * { border-top: .5px solid var(--separator); }
.sheet-list .icon { color: var(--accent); }
.sheet-list > a.active { color: var(--accent); font-weight: 600; }
.sheet-list .danger, .sheet-list .danger .icon { color: var(--danger); }
.sheet-list form { margin: 0; }
.action-sheet { background: transparent; box-shadow: none; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); overflow: visible; }
.action-sheet .sheet-grabber { display: none; }
.action-sheet .sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); -webkit-backdrop-filter: saturate(1.8) blur(30px); backdrop-filter: saturate(1.8) blur(30px); border-radius: 16px 16px 0 0; border-bottom: .5px solid var(--separator); }
.action-sheet .sheet-head .file-icon { width: 40px; height: 40px; }
.sheet-head-text { display: grid; min-width: 0; }
.sheet-head-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head-text .muted { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-sheet .menu-list { background: var(--surface); -webkit-backdrop-filter: saturate(1.8) blur(30px); backdrop-filter: saturate(1.8) blur(30px); border-radius: 16px; overflow: hidden; }
.action-sheet .sheet-head + .menu-list { border-radius: 0 0 16px 16px; }
.action-sheet .menu-list button { padding: 15px 18px; font-size: 1.02rem; border-radius: 0; gap: 14px; }
.action-sheet .menu-list button + button { border-top: .5px solid var(--separator); }
.action-sheet .menu-list button:hover, .action-sheet .menu-list button:focus-visible { background: var(--surface-3); color: var(--text); }
.action-sheet .menu-list button:hover .icon { color: var(--accent); }
.action-sheet .menu-list button.danger:hover, .action-sheet .menu-list button.danger:hover .icon { color: var(--danger); background: var(--danger-soft); }
.action-sheet .menu-sep { height: 6px; margin: 0; background: transparent; }
.sheet-cancel { width: 100%; margin-top: 8px; padding: 15px; border: 0; border-radius: 16px; background: var(--surface-solid); color: var(--accent); font: inherit; font-size: 1.05rem; font-weight: 650; cursor: pointer; }

/* Mobile Kopfzeile: Profil-Knopf */
.avatar-btn { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar-btn .user-avatar { width: 32px; height: 32px; }

/* Tab-Leiste: „Mehr“ */
.tabbar .tab-more { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; font-size: .68rem; padding: 6px 2px; color: var(--muted); font-weight: 550; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.tabbar .tab-more .icon { width: 24px; height: 24px; }
.tabbar .tab-more.active { color: var(--accent); }

/* ---------- Toasts ---------- */
.toast { border-radius: 16px; padding: 12px 16px; background: color-mix(in srgb, #1c1c1e 92%, transparent); color: #fff; box-shadow: var(--shadow-lg); animation: toast-in .3s var(--ease); }
:root[data-theme="dark"] .toast { background: color-mix(in srgb, #3a3a3c 94%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: color-mix(in srgb, #3a3a3c 94%, transparent); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.toast-action { display: flex; align-items: center; gap: 12px; }
.toast-action span { flex: 1; }
.toast-btn { border: 0; background: rgba(255,255,255,.14); color: #64b5ff; font: inherit; font-weight: 700; padding: 6px 12px; border-radius: 10px; cursor: pointer; }
.toast-btn:hover { background: rgba(255,255,255,.22); }
body.has-selection-bar .toast-region { bottom: calc(170px + env(safe-area-inset-bottom)); }

/* ---------- Vollbildansicht ---------- */
.lightbox { background: #000; --lb-fade: 1; }
.lightbox::backdrop { background: #000; }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; animation: lb-in .25s ease-out; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: max(6px, env(safe-area-inset-top)) 12px 6px 6px; background: linear-gradient(rgba(0,0,0,.55), transparent); transition: opacity .25s, transform .25s var(--ease); }
.lb-meta { text-align: center; min-width: 0; }
.lb-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.lb-sub { display: block; font-size: .75rem; color: #a1a1a6; }
.lb-counter { font-size: .8rem; color: #a1a1a6; min-width: 50px; text-align: right; font-variant-numeric: tabular-nums; }
.lb-btn { width: 44px; height: 44px; background: rgba(255,255,255,.08); }
.lb-close { background: transparent; }
.lb-close .icon { width: 26px; height: 26px; stroke-width: 2.2; }
.lb-stage { opacity: var(--lb-fade); grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
img.lb-media { width: 100%; height: 100%; object-fit: contain; }
.lb-media { transition: transform .3s var(--ease), opacity .3s; user-select: none; -webkit-user-select: none; }
img.lb-media { opacity: 0; }
img.lb-media.loaded { opacity: 1; }
.lb-stage.zoomed { overflow: auto; cursor: zoom-out; touch-action: auto; }
.lb-stage.zoomed img.lb-media { max-width: none; max-height: none; cursor: grab; }
.lb-bar { display: flex; justify-content: center; gap: 10px; padding: 8px 12px max(10px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); transition: opacity .25s, transform .25s var(--ease); }
.lb-bar .lb-btn { width: 48px; height: 48px; }
.lb-bar .lb-btn.on { color: var(--yellow); }
.lb-bar .lb-btn.on .icon { fill: currentColor; }
.lb-bar .lb-btn.danger:hover { background: rgba(255, 69, 58, .3); }
.lightbox.chrome-hidden .lb-head { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.lightbox.chrome-hidden .lb-bar { opacity: 0; transform: translateY(10px); pointer-events: none; }
.lightbox.chrome-hidden .lb-prev, .lightbox.chrome-hidden .lb-next { opacity: 0; pointer-events: none; }
.lightbox.slideshow img.lb-media { animation: kenburns 3.6s ease-out both; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.04); } }
.lb-notice { display: grid; justify-items: center; gap: 14px; max-width: 420px; padding: 24px; text-align: center; color: #d1d1d6; }
.lb-audio-card { display: grid; justify-items: center; gap: 14px; width: min(420px, 90vw); padding: 28px; border-radius: 26px; background: #1c1c1e; }
.lb-audio-art { width: 180px; height: 180px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #ff6b6b, #c03edb 50%, #4f46e5); box-shadow: 0 20px 50px rgba(192, 62, 219, .35); }
.lb-audio-art .icon { width: 72px; height: 72px; stroke-width: 1.3; }
.lb-audio-card audio { width: 100%; }
.lightbox.lb-doc .lb-stage { place-items: stretch; }
.lb-text { margin: 0 auto; width: min(960px, 100%); height: 100%; border-radius: 0; background: #fff; color: #1d1d1f; font-size: .9rem; padding: 22px 26px; }
.lb-trunc { color: #6e6e73; font-style: italic; }
.lb-pdf { overflow: auto; height: 100%; padding: 12px; display: grid; justify-items: center; align-content: start; gap: 12px; background: #2c2c2e; -webkit-overflow-scrolling: touch; }
.lb-pdf-status { color: #a1a1a6; font-size: .85rem; padding: 4px; }
.lb-pdf-page { width: min(1100px, 100%); background: #fff; border-radius: 4px; box-shadow: 0 4px 20px rgba(0,0,0,.4); overflow: hidden; }
.lb-pdf-page canvas { display: block; width: 100% !important; height: auto; }

/* ---------- Informationen ---------- */
.info-dialog { width: min(460px, calc(100vw - 24px)); }
.info-head { display: flex; align-items: center; gap: 14px; }
.info-thumb { width: 64px; height: 64px; flex: none; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.info-thumb img { width: 100%; height: 100%; object-fit: cover; }
.info-title { flex: 1; min-width: 0; display: grid; }
.info-title h2 { margin: 0; overflow-wrap: anywhere; font-size: 1.05rem; }
.info-list { margin: 0; border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.info-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 10px 14px; }
.info-row + .info-row { border-top: .5px solid var(--separator); }
.info-row dt { color: var(--muted); font-size: .88rem; }
.info-row dd { margin: 0; overflow-wrap: anywhere; font-size: .92rem; }
.info-list .loading { padding: 18px; }
.info-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.info-actions .btn { flex: 1; }

/* ---------- Fotos ---------- */
.gallery-head { align-items: flex-end; }
.gallery-actions { display: flex; gap: 8px; }
.gallery-filters { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 14px; position: sticky; top: 0; z-index: 9; padding: 8px 0; }
.gallery-filters::before { content: ""; position: absolute; inset: 0 -32px; z-index: -1; background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); }
.seg-btn .icon { width: 15px; height: 15px; }
.gallery { gap: 3px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery-app[data-size="s"] .gallery { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 2px; }
.gallery-month { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; margin: 26px 2px 10px; }
.gallery-tile { border-radius: 4px; background: var(--surface-3); transition: transform .2s var(--ease), opacity .2s; }
.gallery-tile img { opacity: 0; transition: opacity .3s, transform .25s ease; }
.gallery-tile.loaded img { opacity: 1; }
.gallery-tile video { opacity: 1; }
.gallery-tile.removing { transform: scale(.6); opacity: 0; }
.tile-fav { position: absolute; left: 6px; bottom: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tile-fav .icon { width: 16px; height: 16px; fill: currentColor; }
.tile-check { position: absolute; right: 7px; bottom: 7px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #fff; background: rgba(0,0,0,.18); display: none; place-items: center; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.tile-check .icon { width: 15px; height: 15px; stroke-width: 3; opacity: 0; }
.gallery-app.select-mode .tile-check { display: grid; }
.gallery-tile.selected .tile-check { background: var(--accent); border-color: #fff; }
.gallery-tile.selected .tile-check .icon { opacity: 1; }
.gallery-tile.selected img, .gallery-tile.selected video { opacity: .7; transform: scale(.94); }
.gallery-app.select-mode .gallery-tile:hover img { transform: none; }
.gallery-tile.selected:hover img { transform: scale(.94); }
.tile-pending { display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); }
.tile-label { font-size: .72rem; font-weight: 600; }

/* ---------- Speicher ---------- */
.storage-app { display: grid; gap: 16px; }
.storage-hero { display: grid; gap: 16px; }
.storage-hero-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.storage-hero-head .capacity-big { margin-right: 6px; }
.storage-ring { --p: 0; width: 92px; height: 92px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; }
.storage-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface-solid); }
.storage-ring span { position: relative; font-weight: 750; font-variant-numeric: tabular-nums; }
.storage-bar { height: 16px; gap: 2px; background: var(--surface-3); }
.storage-bar > span { border-radius: 2px; }
.c-photos { background: #ff9f0a; } .c-videos { background: #ff375f; } .c-audio { background: #bf5af2; }
.c-docs { background: #0a84ff; } .c-archives { background: #8e8e93; } .c-other { background: #64d2ff; } .c-trash { background: #636366; }
.usage-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; }
.usage-legend li { display: flex; align-items: center; gap: 12px; }
.usage-legend li.is-zero { opacity: .5; }
.usage-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.usage-icon .icon { width: 19px; height: 19px; }
.usage-text { flex: 1; display: grid; min-width: 0; }
.usage-text .muted { font-size: .8rem; }
.usage-size { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.storage-guarantee { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.storage-guarantee .icon { width: 16px; height: 16px; }
.tip-card { display: flex; gap: 16px; align-items: flex-start; }
.tip-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.tip-text { flex: 1; min-width: 0; }
.tip-text h2 { margin: 2px 0 4px; }
.tip-text p { margin: 0 0 4px; }
.dupes-card .page-head h2 { margin: 0; }
.dupe-group { border-radius: 14px; background: var(--surface-2); padding: 6px; margin-bottom: 10px; }
.dupe-head { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; flex-wrap: wrap; }
.dupe-row { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; cursor: pointer; }
.dupe-row:hover { background: var(--surface-3); }
.dupe-row input { width: 20px; height: 20px; accent-color: var(--danger); flex: none; }
.dupe-row .file-icon { width: 38px; height: 38px; }

/* ---------- Handy ---------- */
@media (max-width: 860px) {
  html { scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom)); scroll-padding-top: 70px; }
  body { font-size: 16px; }
  h1, .breadcrumbs h1.current { font-size: 2.05rem; letter-spacing: -0.03em; }
  .mobilebar { height: calc(var(--mobilebar-h) + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 70%, transparent); border-bottom: .5px solid var(--separator); }
  .tabbar { background: color-mix(in srgb, var(--surface-solid) 86%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(24px); backdrop-filter: saturate(1.8) blur(24px); border-top: .5px solid var(--separator); padding-top: 6px; }
  .tabbar a, .tabbar .tab-more { font-size: .66rem; }
  .files-head { display: grid; gap: 10px; }
  .crumb-trail { display: none; }
  .crumb-back { display: inline-flex; }
  .search { flex: 1 1 100%; width: 100%; }
  .toolbar { gap: 6px; flex-wrap: nowrap; }
  .toolbar-view { flex-wrap: nowrap; gap: 6px; }
  .toolbar-view .btn-quiet { margin-right: auto; padding-left: 4px; }
  .toolbar-view .sort select { min-height: 36px; font-size: 15px; padding: 4px 28px 4px 10px; max-width: 150px; background-color: var(--surface-3); border-color: transparent; }
  .toolbar-view .segmented .icon-btn { width: 38px; height: 34px; }
  .toolbar-main .btn-primary { display: none; }
  .toolbar-main:empty { display: none; }
  .toolbar-view { width: 100%; justify-content: space-between; }
  .toolbar-view .btn-quiet span { display: inline; }
  .files-pane { background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; margin: 0 -6px; }
  .file-list { padding: 0; }
  .list-header, .file-row { grid-template-columns: 0 minmax(0, 1fr) 44px; }
  .file-row { border-radius: 0; padding: 0 0 0 4px; position: relative; }
  .file-row::after { content: ""; position: absolute; left: 62px; right: 0; bottom: 0; height: .5px; background: var(--separator); }
  .file-row .check-cell { width: 0; overflow: hidden; opacity: 0; }
  .files-app.select-mode .list-header, .files-app.select-mode .file-row { grid-template-columns: 40px minmax(0, 1fr) 44px; }
  .files-app.select-mode .file-row .check-cell { width: 40px; opacity: 1; }
  .file-icon { width: 44px; height: 44px; }
  .file-main { padding: 10px 4px; }
  .file-row.selected { background: var(--accent-soft); }
  .files-app[data-view="grid"] .file-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 4px 6px; }
  .files-app[data-view="grid"] .file-row::after { display: none; }
  .files-app[data-view="grid"] .file-row .check-cell { width: 30px; opacity: 1; display: none; }
  .files-app.select-mode[data-view="grid"] .file-row .check-cell { display: grid; }
  .files-app[data-view="grid"] .file-row .col-actions { display: none; }
  .files-app[data-view="grid"] .file-row { padding: 4px; }
  .selection-bar { bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 24px; }
  body.has-selection-bar .tabbar { display: none; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 0 -14px; }
  .gallery-app[data-size="s"] .gallery { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; }
  .gallery-tile { border-radius: 0; }
  .gallery-month { margin-left: 2px; font-size: 1.25rem; }
  .gallery-filters::before { inset: 0 -14px; }
  .gallery-head .btn-primary span { display: none; }
  .gallery-head .page-title p { display: none; }
  .gallery-filters .segmented-text { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .gallery-filters .segmented-text::-webkit-scrollbar { display: none; }
  .gallery-filters .seg-btn { padding: 5px 11px; flex: none; }
  .gallery-filters > .segmented:not(.segmented-text) { flex: none; }
  .main { overflow-x: clip; }
  .toolbar-view .sort { flex: 0 1 auto; min-width: 0; }
  .files-app[data-mode="trash"] .toolbar { flex-wrap: wrap; }
  .files-app[data-mode="trash"] .toolbar-main { width: 100%; }
  .toolbar .btn-danger span { display: inline; }
  .toolbar-view .sort select { width: 100%; }
  .gallery-head .btn-primary { width: 40px; padding: 0; border-radius: 50%; }
  .page-head { flex-wrap: nowrap; }
  .lb-prev, .lb-next { display: none; }
  .lb-bar { justify-content: space-around; gap: 4px; }
  .lb-bar .lb-btn { background: transparent; }
  .lb-text { padding: 16px; font-size: .85rem; }
  .lb-pdf { padding: 8px 4px; }
  .dialog { width: calc(100vw - 20px); }
  .info-row { grid-template-columns: 105px 1fr; }
  .storage-hero-head .capacity-big { font-size: 1.7rem; }
  .storage-ring { width: 76px; height: 76px; }
  .tip-card { flex-wrap: wrap; }
  .tip-card .btn { margin-left: 62px; }
  .upload-panel { bottom: calc(80px + env(safe-area-inset-bottom)); border-radius: 18px; }
}
@media (hover: none) and (pointer: coarse) {
  .sel-btn { padding: 9px 4px 7px; }
  .menu-list button { padding: 12px 14px; }
}

/* Runde Auswahlhaken wie in iOS */
.check-cell input[type="checkbox"] { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin: 0; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface-solid); cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check-cell input[type="checkbox"]:checked, .check-cell input[type="checkbox"]:indeterminate { background: var(--accent); border-color: var(--accent); }
.check-cell input[type="checkbox"]:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check-cell input[type="checkbox"]:indeterminate::after { content: ""; width: 10px; height: 2px; background: #fff; border-radius: 1px; }
.action-sheet .menu-sep { height: 8px; background: color-mix(in srgb, var(--text) 6%, transparent); }

/* ---------- Profilbild ---------- */
.user-avatar { overflow: hidden; }
.user-avatar.has-photo { background: var(--surface-3); }
.user-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar-xl { width: 96px; height: 96px; font-size: 2.4rem; }
.profile-card { display: flex; align-items: center; gap: 22px; margin-bottom: 16px; }
.profile-photo { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; flex: none; }
.profile-photo:hover .user-avatar { filter: brightness(.92); }
.profile-photo-badge { position: absolute; right: 0; bottom: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; border: 3px solid var(--surface-solid); }
.profile-photo-badge .icon { width: 16px; height: 16px; }
.profile-text { flex: 1; min-width: 0; }
.profile-text h2 { margin: 0; font-size: 1.4rem; }
.profile-text p { margin: 2px 0 0; }
.profile-text .button-row { margin: 12px 0 8px; }
.sheet-avatar { border-radius: 50%; }
.cropper-dialog { width: min(360px, calc(100vw - 24px)); }
.cropper { width: 280px; height: 280px; margin: 0 auto; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); touch-action: none; cursor: grab; }
.cropper canvas { width: 280px; height: 280px; display: block; }
.cropper-zoom { width: 100%; accent-color: var(--accent); }
@media (max-width: 560px) { .profile-card { flex-direction: column; text-align: center; } .profile-text .button-row { justify-content: center; } }

/* Installationshinweis oben statt unten (verdeckt keine Bedienelemente) */
.install-hint { top: calc(60px + env(safe-area-inset-top)); bottom: auto; border-radius: 18px; }
@media (prefers-reduced-transparency: reduce) {
  .selection-bar, .menu-pop, .action-sheet .menu-list, .action-sheet .sheet-head, .upload-panel { background: var(--surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* =====================================================================
   Tresor – Version 3: Icons, Kategorien, 2FA, Sicherheitscheck, Verlauf
   ===================================================================== */
.vault-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 4px 4px; margin: 0; scrollbar-width: none; flex: none; }
.vault-chips::-webkit-scrollbar { display: none; }
.vault-chips .chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: none; background: var(--surface-3); border-color: transparent; color: var(--text-2); }
.vault-chips .chip .icon { width: 15px; height: 15px; }
.vault-chips .chip[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.vault-chips .chip:hover { color: inherit; border-color: transparent; }
.vault-chips .chip[aria-selected="false"]:hover { background: color-mix(in srgb, var(--surface-3) 70%, var(--accent-soft)); }

.vault-health { display: flex; align-items: center; gap: 8px; margin: 0 4px; padding: 9px 12px; border: 0; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font: inherit; font-size: .86rem; font-weight: 600; text-align: left; cursor: pointer; flex: none; }
.vault-health span { flex: 1; }
.vault-health .icon { width: 18px; height: 18px; flex: none; }

.vault-li { position: relative; }
.vault-row { padding-right: 46px; }
.vault-row-title { display: flex; align-items: center; gap: 5px; }
.vault-row-title .fav-star { width: 13px; height: 13px; flex: none; fill: #ffcc00; stroke: #e0a800; }
.vault-row-title .row-badge { width: 14px; height: 14px; flex: none; color: var(--muted); }
.vault-row.active .row-badge { color: inherit; }
.vault-row-copy { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; opacity: 0; transition: opacity .15s; }
.vault-li:hover .vault-row-copy, .vault-row-copy:focus-visible { opacity: 1; }
.vault-row.active + .vault-row-copy { color: var(--on-accent); }
@media (hover: none) { .vault-row-copy { opacity: .75; } }
.vault-trash-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 10px 8px; }
.link-btn.danger { color: var(--danger); }

/* Avatare: Buchstabe, Emoji oder eigenes Bild */
.vault-avatar.on-light { color: #1d1d1f; }
.vault-avatar.is-emoji { background: color-mix(in srgb, var(--av, #007aff) 18%, var(--surface-solid)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av, #007aff) 30%, transparent); font-size: 1.25rem; line-height: 1; }
.vault-avatar.has-img { background: #fff; box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; padding: 0; }
.vault-avatar.has-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.vault-detail-title .vault-avatar.is-emoji { font-size: 1.7rem; }
.vault-avatar-lg { width: 64px !important; height: 64px !important; border-radius: 16px !important; font-size: 1.6rem; }
.vault-avatar-lg.is-emoji { font-size: 2rem; }
.vault-avatar-xl { width: 96px !important; height: 96px !important; border-radius: 24px !important; font-size: 2.4rem; }
.vault-avatar-xl.is-emoji { font-size: 3rem; }

.vault-detail-titletext { display: grid; min-width: 0; }
.vault-detail-titletext h2 { margin: 0; font-size: 1.5rem; overflow-wrap: anywhere; }
.fav-btn.is-fav .icon { fill: #ffcc00; stroke: #e0a800; }
.vfield-text.mono { font-family: var(--mono); letter-spacing: .02em; }
.vfield-empty { padding: 14px 16px; margin: 0; }
.pw-warn { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; font-size: .72rem; font-weight: 650; vertical-align: 1px; }
.pw-warn.bad { background: var(--danger-soft); color: var(--danger); }
.pw-warn.mid { background: var(--warn-soft); color: var(--warn); }
.vault-history summary { padding: 12px 16px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.vault-history[open] summary { border-bottom: 1px solid var(--border); }

/* 2FA-Code */
.totp-code { font-family: var(--mono); font-size: 1.45rem; font-weight: 650; letter-spacing: .06em; color: var(--accent); flex: 0 1 auto !important; }
.totp-ring { --p: 100; position: relative; width: 30px; height: 30px; border-radius: 50%; flex: none; margin-left: auto;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; transition: background .3s; }
.totp-ring::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface-solid); }
.totp-ring.ending { background: conic-gradient(var(--danger) calc(var(--p) * 1%), var(--surface-3) 0); }
.totp-secs { position: relative; font-size: .72rem; font-weight: 700; color: var(--text-2); }

/* Sicherheitscheck */
.health-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; position: relative; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-3) 0); }
.health-ring.mid { background: conic-gradient(#ff9500 calc(var(--p) * 1%), var(--surface-3) 0); }
.health-ring.bad { background: conic-gradient(var(--danger) calc(var(--p) * 1%), var(--surface-3) 0); }
.health-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface-solid); }
.health-ring span { position: relative; font-weight: 750; font-size: 1.2rem; }
.health-title { display: grid; gap: 2px; min-width: 0; }
.health-title h2 { margin: 0; }
.health-sec { padding-bottom: 4px; }
.health-sec-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 2px; }
.health-sec-head .icon { width: 18px; height: 18px; }
.health-sec-head.bad .icon { color: var(--danger); }
.health-sec-head.mid .icon { color: #ff9500; }
.health-sec-head.info .icon { color: var(--accent); }
.health-sec-head.ok .icon { color: var(--ok); }
.health-count { margin-left: auto; min-width: 26px; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); text-align: center; font-weight: 650; font-size: .82rem; }
.health-desc { margin: 2px 16px 8px; }
.health-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.health-item:hover { background: var(--surface-2); }
.health-item .vault-avatar { width: 30px; height: 30px; border-radius: 8px; font-size: .9rem; }
.health-item .vault-row-title { flex: 1; }
.health-item > .icon { color: var(--muted); width: 16px; height: 16px; }

/* Editor */
.vault-edit-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 4px; }
.vault-edit-main { flex: 1; min-width: 0; display: grid; gap: 0; }
.vault-edit-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.vault-edit-row .field { flex: 1 1 180px; }
.vault-fav-check { margin-bottom: 18px; }
.vault-fav-check span { display: inline-flex; align-items: center; gap: 5px; }
.vault-fav-check .icon { width: 16px; height: 16px; fill: #ffcc00; stroke: #e0a800; }
.vault-icon-pick { position: relative; border: 0; background: none; padding: 0; cursor: pointer; margin-top: 22px; border-radius: 18px; flex: none; }
.vault-icon-pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vault-icon-pick-badge { position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); border: 2px solid var(--surface-solid); }
.vault-icon-pick-badge .icon { width: 13px; height: 13px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gen-opts { margin-top: 6px; }
.gen-opts summary { cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 550; width: max-content; }
.gen-opts-body { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 10px 2px 2px; }
.gen-len { display: grid; gap: 2px; font-size: .85rem; min-width: 180px; flex: 1; }
.gen-len input { width: 100%; accent-color: var(--accent); }

/* Icon-Auswahl */
.vault-icon-dialog { width: min(460px, calc(100vw - 24px)); }
.icon-preview-wrap { display: grid; place-items: center; padding: 6px 0 10px; }
.icon-fit { display: flex; justify-content: center; margin-bottom: 10px; }
.icon-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.icon-sub { font-size: .9rem; margin: 14px 0 8px; color: var(--text-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
.emoji-btn { height: 40px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 1.3rem; cursor: pointer; line-height: 1; }
.emoji-btn:hover { background: var(--surface-3); }
.emoji-own { margin-top: 10px; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.color-dot.selected { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Verlauf */
.versions-list { display: grid; gap: 8px; max-height: 50vh; overflow: auto; margin: 6px 0; }
.version-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-solid); }
.version-text { display: grid; flex: 1; min-width: 0; }

@media (max-width: 760px) {
  .vault-edit-top { gap: 12px; }
  .vault-icon-pick { margin-top: 24px; }
  .vault-avatar-lg { width: 56px !important; height: 56px !important; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :first-child { grid-column: 1 / -1; }
  .version-row { flex-wrap: wrap; }
  .totp-code { font-size: 1.3rem; }
}
