/* ==========================================================================
   RaspiNAS – Design-System v1.1
   Dunkles Theme als Standard, helles via [data-theme="light"].
   Akzentfarbe kommt zur Laufzeit aus den Server-Einstellungen (--accent).
   ========================================================================== */

:root {
  --accent: #3b82f6;
  --accent-hover: #2f6fd6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-glow: rgba(59, 130, 246, 0.35);

  --bg: #0a0f1e;
  --bg-elev: #0e1526;
  --panel: #131b30;
  --panel-2: #192339;
  --border: #243050;
  --border-soft: #1d2842;
  --text: #e9eefb;
  --text-muted: #93a3c4;
  --text-dim: #5f7099;

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 16px 40px rgba(2, 6, 20, 0.5);
  --shadow-sm: 0 2px 10px rgba(2, 6, 20, 0.28);
  --shadow-pop: 0 10px 32px rgba(2, 6, 20, 0.55);
  --sidebar-w: 248px;
  --topbar-h: 62px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f0f3f9;
  --bg-elev: #ffffff;
  --panel: #ffffff;
  --panel-2: #f4f7fc;
  --border: #dfe6f2;
  --border-soft: #e7ecf6;
  --text: #16223c;
  --text-muted: #566585;
  --text-dim: #93a1bd;
  --shadow: 0 16px 40px rgba(34, 55, 96, 0.13);
  --shadow-sm: 0 2px 10px rgba(34, 55, 96, 0.07);
  --shadow-pop: 0 10px 32px rgba(34, 55, 96, 0.16);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

::selection { background: var(--accent-soft); }

/* Dezente Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---- Boot ----
   Der Ladebildschirm lebt als #splash direkt in index.html (Inline-Stile),
   damit er sofort erscheint – noch bevor diese Datei geladen ist. */

/* ==========================================================================
   Auth (Login / Ersteinrichtung)
   ========================================================================== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 820px at 50% 42%, var(--accent-wall1, rgba(59,130,246,.5)), transparent 55%),
    radial-gradient(760px 620px at 30% 74%, rgba(126, 87, 224, 0.32), transparent 60%),
    radial-gradient(900px 720px at 74% 26%, rgba(37, 176, 214, 0.3), transparent 60%),
    linear-gradient(140deg, #0b1a3d 0%, #0a1330 55%, #0b1024 100%);
}
[data-theme="light"] .auth-wrap {
  background:
    radial-gradient(1100px 820px at 50% 42%, rgba(120, 170, 240, 0.7), transparent 55%),
    radial-gradient(760px 620px at 28% 74%, rgba(150, 130, 235, 0.4), transparent 60%),
    radial-gradient(900px 720px at 74% 26%, rgba(120, 200, 225, 0.45), transparent 60%),
    linear-gradient(140deg, #9ab8e6 0%, #aec8ee 55%, #c6d8f2 100%);
}

.auth-card {
  width: 100%; max-width: 384px; text-align: center; position: relative; z-index: 1;
  background: rgba(20, 26, 42, 0.72); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px;
  padding: 34px 30px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  backdrop-filter: saturate(180%) blur(26px); -webkit-backdrop-filter: saturate(180%) blur(26px);
  animation: rise .35s ease;
}
[data-theme="light"] .auth-card {
  background: rgba(255, 255, 255, 0.8); border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 80px rgba(20, 40, 80, .28);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.auth-logo {
  /* Weiß auf Dunkelblau – wie das RaspiNAS-Icon */
  width: 62px; height: 62px; border-radius: 17px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #1e3a7a 0%, #122452 55%, #0b1533 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 26px rgba(11, 21, 51, 0.55), 0 0 22px rgba(147, 197, 253, 0.18);
}
.auth-logo svg { width: 36px; height: 36px; }
.auth-card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-muted); margin: 0 0 22px; font-size: 13px; }
.auth-card form { text-align: left; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--text-dim); }

/* ==========================================================================
   Formulare
   ========================================================================== */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
/* :where() hält die Spezifität niedrig, damit Komponenten (z. B. die
   Startmenü-Suche) das Aussehen ihrer Eingabefelder überschreiben können. */
.input,
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"])),
select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus,
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"])):focus,
select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
/* Vom Browser automatisch ausgefüllte Felder im dunklen Design lesbar halten */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elev) inset;
  box-shadow: 0 0 0 1000px var(--bg-elev) inset;
  caret-color: var(--text);
}
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
input[type="color"] { padding: 3px; height: 40px; width: 56px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer; }

/* Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); transition: background .18s, border-color .18s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px;
  border-radius: 50%; background: var(--text-dim); transition: transform .18s, background .18s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(17px); background: #fff; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--panel-2); color: var(--text); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, transform .06s, box-shadow .15s;
  white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--border-soft); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff; box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--accent), var(--accent-hover)); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #dc2626; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 10px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.btn-icon:hover { background: var(--panel-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.active-toggle { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ==========================================================================
   Layout
   ========================================================================== */
.layout {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main"; height: 100vh;
}

.topbar {
  grid-area: topbar; display: flex; align-items: center; gap: 12px;
  padding: 0 22px; border-bottom: 1px solid var(--border-soft); background: var(--bg-elev);
}
.topbar .spacer { flex: 1; }
.topbar .page-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }

.sidebar {
  grid-area: sidebar; background: var(--bg-elev); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 18px 13px 14px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 16px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #38bdf8, var(--accent));
  box-shadow: 0 4px 14px var(--accent-glow);
}
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-dim); margin: 16px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-muted); cursor: pointer; font-weight: 600; font-size: 13.5px; border: none;
  background: transparent; text-align: left; width: 100%; position: relative;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.nav-item svg { width: 19px; height: 19px; flex: none; }

.side-foot { margin-top: auto; padding: 14px 10px 2px; border-top: 1px solid var(--border-soft); }
.side-usage { margin-bottom: 10px; }
.side-usage .lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.side-version { font-size: 11px; color: var(--text-dim); }

.main { grid-area: main; overflow-y: auto; padding: 26px; }
.view { max-width: 1160px; margin: 0 auto; animation: viewin .22s ease; }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Avatar / Benutzermenü */
.avatar {
  width: 33px; height: 33px; border-radius: 50%; color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px;
}
.usermenu { position: relative; }
.usermenu-trigger {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 5px 8px 5px 5px; border-radius: 11px; border: none; background: transparent; color: var(--text);
  font-size: 13.5px; font-weight: 600;
}
.usermenu-trigger:hover { background: var(--panel-2); }

/* ==========================================================================
   Karten / Kacheln / Statistiken
   ========================================================================== */
.card {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 14px; font-size: 15.5px; letter-spacing: -.01em; }
.card .card-sub { color: var(--text-muted); font-size: 13px; margin: -8px 0 16px; }

.grid { display: grid; gap: 14px; }
.grid-tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.tile {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: transform .14s, border-color .14s, box-shadow .14s;
  display: flex; flex-direction: column; gap: 10px;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.tile-ico {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.tile-ico svg { width: 22px; height: 22px; }
.tile-title { font-weight: 700; font-size: 14px; }
.tile-desc { color: var(--text-muted); font-size: 12.5px; line-height: 1.45; }

.stat { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 17px 18px 15px; box-shadow: var(--shadow-sm); }
.stat .label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 7px; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat .spark { width: 100%; height: 44px; margin-top: 10px; display: block; }

.bar { height: 7px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s; }
.bar.warn { background: rgba(245, 158, 11, .16); }
.bar.warn > span { background: var(--warning); }
.bar.crit { background: rgba(239, 68, 68, .16); }
.bar.crit > span { background: var(--danger); }
.bar.slim { height: 5px; margin-top: 0; }

/* Ring-Anzeige */
.ring-wrap { position: relative; flex: none; }
.ring { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--accent-soft); }
.ring-fill { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s; }
.ring.warn .ring-fill { stroke: var(--warning); }
.ring.warn .ring-track { stroke: rgba(245, 158, 11, .16); }
.ring.crit .ring-fill { stroke: var(--danger); }
.ring.crit .ring-track { stroke: rgba(239, 68, 68, .16); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-value { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.ring-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ==========================================================================
   Tabellen & Chips
   ========================================================================== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-dim); padding: 9px 12px; border-bottom: 1px solid var(--border-soft); font-weight: 700;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr.selected { background: var(--accent-soft); }
.table .num { font-variant-numeric: tabular-nums; }
.row-click { cursor: pointer; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-amber { background: rgba(245, 158, 11, .15); color: var(--warning); }
.chip-red { background: rgba(239, 68, 68, .13); color: var(--danger); }
.chip-green { background: rgba(34, 197, 94, .13); color: var(--success); }
.chip-gray { background: var(--panel-2); color: var(--text-muted); }

/* ==========================================================================
   Dateimanager
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.searchbox { position: relative; min-width: 210px; }
.searchbox svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.searchbox input { padding-left: 34px; padding-right: 30px; height: 38px; }
.searchbox .clear-q { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; padding: 5px; }

.breadcrumb { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13px; margin-bottom: 14px; }
.breadcrumb button {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px;
  padding: 5px 8px; border-radius: 8px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.breadcrumb button:hover { background: var(--panel-2); color: var(--text); }
.breadcrumb button.current { color: var(--text); }
.breadcrumb .sep { color: var(--text-dim); }

.file-ico {
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); font-size: 16px; flex: none;
}

/* Eigene Datei-Symbole (statt Emojis): farbige Kacheln, Bilder mit Mini-Vorschau */
.fi {
  position: relative; width: 34px; height: 34px; border-radius: 9px; flex: none; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.fi img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.fi.fi-lg { width: 64px; height: 64px; border-radius: 14px; margin: 0 auto; }
.fi-folder { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.fi-img    { background: linear-gradient(135deg, #34d399, #10b981); }
.fi-vid    { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.fi-aud    { background: linear-gradient(135deg, #f472b6, #ec4899); }
.fi-pdf    { background: linear-gradient(135deg, #f87171, #ef4444); }
.fi-zip    { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.fi-doc    { background: linear-gradient(135deg, #818cf8, #6366f1); }
.fi-sheet  { background: linear-gradient(135deg, #4ade80, #22c55e); }
.fi-txt    { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.fi-file   { background: linear-gradient(135deg, #94a3b8, #64748b); }
.file-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-name .nm { font-weight: 600; word-break: break-all; }
.file-name .pth { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; word-break: break-all; }
.file-actions { display: flex; gap: 2px; justify-content: flex-end; }
.file-actions .btn-icon { width: 31px; height: 31px; padding: 6px; }
.file-actions .btn-icon svg { width: 17px; height: 17px; }
td.chk, th.chk { width: 34px; padding-right: 0; }

/* Raster-Ansicht */
.grid-files { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
.fcard {
  position: relative; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 14px;
  padding: 18px 12px 13px; text-align: center; cursor: pointer;
  transition: transform .13s, border-color .13s, box-shadow .13s;
}
.fcard:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.fcard.selected { border-color: var(--accent); background: var(--accent-soft); }
.fcard .big-ico { display: flex; justify-content: center; margin-bottom: 10px; }
.fcard .nm { font-size: 12.5px; font-weight: 600; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.fcard .meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.fcard .chk { position: absolute; top: 8px; left: 8px; opacity: 0; transition: opacity .12s; }
.fcard:hover .chk, .fcard.selected .chk { opacity: 1; }
.fcard .more { position: absolute; top: 5px; right: 5px; opacity: 0; transition: opacity .12s; }
.fcard:hover .more { opacity: 1; }

/* Auswahl-Leiste */
.bulkbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 150;
  display: flex; align-items: center; gap: 8px; padding: 9px 12px 9px 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop);
  animation: bulkin .18s ease;
}
.bulkbar .count { font-size: 13px; font-weight: 700; margin-right: 4px; white-space: nowrap; }
@keyframes bulkin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.dropzone { position: relative; }
.dropzone.drag::after {
  content: "Dateien hier ablegen zum Hochladen"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  background: var(--accent-soft); border: 2px dashed var(--accent); border-radius: var(--radius);
  color: var(--accent); z-index: 20; backdrop-filter: blur(2px);
}

.empty { text-align: center; color: var(--text-muted); padding: 46px 20px; }
.empty-ico {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 18px;
  background: var(--panel-2); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.empty-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }

/* Upload-Panel */
.uploads { position: fixed; right: 20px; bottom: 20px; width: 330px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.upload-item { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; padding: 12px 14px; box-shadow: var(--shadow-pop); }
.upload-item .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.upload-item .nm { font-size: 12.5px; font-weight: 600; word-break: break-all; }

/* ==========================================================================
   Dropdown-Menü
   ========================================================================== */
.menu {
  position: fixed; z-index: 500; min-width: 195px; padding: 5px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop);
  animation: menuin .12s ease;
}
@keyframes menuin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; border: none; background: transparent; color: var(--text);
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.menu-item svg { color: var(--text-muted); flex: none; }
.menu-item:hover { background: var(--panel-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-item.danger:hover { background: rgba(239, 68, 68, .1); }
.menu-sep { height: 1px; background: var(--border-soft); margin: 5px 6px; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(3, 7, 20, .62); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 300;
  backdrop-filter: blur(3px); animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px; width: 100%;
  max-width: 440px; box-shadow: var(--shadow-pop); overflow: hidden; animation: modalin .18s ease;
  display: flex; flex-direction: column; max-height: calc(100vh - 40px);
}
@keyframes modalin { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.modal.modal-lg { max-width: 780px; }
.modal-head {
  padding: 16px 18px; border-bottom: 1px solid var(--border-soft); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.modal-body { padding: 20px 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border-soft); display: flex; gap: 9px; justify-content: flex-end; }

.editor-area {
  width: 100%; min-height: 46vh; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: 12.8px; line-height: 1.6; tab-size: 4; white-space: pre;
}
.preview-frame { width: 100%; height: 62vh; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-elev); }
.preview-media { max-width: 100%; max-height: 62vh; border-radius: 10px; display: block; margin: 0 auto; }
.preview-text {
  max-height: 58vh; overflow: auto; background: var(--bg-elev); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, Consolas, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}

/* Ordner-Auswahl (Verschieben/Kopieren) */
.picker-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 11px; }
.picker-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  background: transparent; border: none; border-bottom: 1px solid var(--border-soft);
  color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: var(--panel-2); }
.picker-item svg { color: var(--accent); flex: none; }
.picker-item:disabled { opacity: .4; cursor: not-allowed; }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 600; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-pop);
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  animation: toastin .2s ease; transition: opacity .25s;
}
.toast.out { opacity: 0; }
.toast svg { flex: none; }
.toast-success { border-color: rgba(34, 197, 94, .5); }
.toast-success svg { color: var(--success); }
.toast-error { border-color: rgba(239, 68, 68, .5); }
.toast-error svg { color: var(--danger); }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Skeleton & Diverses
   ========================================================================== */
.skel-wrap { display: flex; flex-direction: column; gap: 12px; padding: 6px 0; }
.skel {
  height: 15px; border-radius: 7px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--border-soft) 50%, var(--panel-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.page-head .sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.muted { color: var(--text-muted); }
.mt { margin-top: 16px; }
.hint { font-size: 12.5px; color: var(--text-muted); }
.spin { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; margin: 44px auto; }
@keyframes rot { to { transform: rotate(360deg); } }
.hamburger { display: none; }
.row-flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; transition: transform .12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--text); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.perm-row:last-of-type { border-bottom: none; }
.perm-row .t { font-weight: 600; font-size: 13.5px; }
.perm-row .d { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.kv td:first-child { color: var(--text-muted); width: 42%; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 262px; z-index: 250;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .hamburger { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .48); z-index: 240; }
  .main { padding: 16px; }
  .searchbox { min-width: 150px; flex: 1; }
  .topbar { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
