/* ===== Sync & Queue (Topbar-Indikatoren, Queue-Modal, Settings) ===== */

/* Mirror-Sync-Fortschritt in der Topbar */
#sync-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 6px 3px 10px; white-space: nowrap;
}
#sync-indicator .si-spin { display: inline-flex; align-items: center; animation: si-rotate 1.2s linear infinite; }
@keyframes si-rotate { to { transform: rotate(360deg); } }
#sync-indicator .si-spin svg.ico, #sync-indicator .si-cancel svg.ico { width: 12px; height: 12px; vertical-align: -2px; }
#sync-indicator .si-cancel {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  border-radius: 50%; padding: 0 5px; font-size: 12px; line-height: 1.4;
}
#sync-indicator .si-cancel:hover { color: var(--err); background: var(--panel); }

/* Upload-Queue-Badge in der Topbar */
#queue-indicator {
  font-size: 12px; color: var(--text); cursor: pointer; white-space: nowrap;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 11px; user-select: none;
}
#queue-indicator:hover { border-color: var(--muted); }
#queue-indicator.offline { color: var(--warn); border-color: var(--warn); }
#queue-indicator.has-err { color: var(--err); border-color: var(--err); }

/* Queue-Modal — pro Datei geclustert, aufklappbar */
.uq-list { display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.uq-empty { color: var(--muted); text-align: center; padding: 18px 0; }

.uq-cluster {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.uq-cluster.uq-active { border-color: var(--accent-dim); }
.uq-cluster.uq-error { border-left: 3px solid var(--err); }

.uq-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.uq-toggle {
  flex-shrink: 0; background: none; border: 0; color: var(--muted);
  cursor: pointer; font-size: 12px; width: 18px; line-height: 1;
  padding: 4px 0; border-radius: 5px;
}
.uq-toggle:hover { color: var(--text); background: var(--panel); }
.uq-toggle svg.ico { width: 12px; height: 12px; vertical-align: -2px; }

.uq-info { flex: 1; min-width: 0; cursor: pointer; }
.uq-info:hover .uq-name { color: var(--accent); }
.uq-name { font-weight: 600; font-size: 13px; }
.uq-path { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uq-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.uq-cluster.uq-error .uq-meta { color: var(--err); }

.uq-count {
  flex-shrink: 0; font-size: 10.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.uq-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* Aufgeklappte Einzeländerungen */
.uq-children { display: flex; flex-direction: column; background: var(--panel); border-top: 1px solid var(--line); }
.uq-child {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 28px; border-bottom: 1px solid var(--line);
}
.uq-child:last-child { border-bottom: 0; }
.uq-child.uq-active { background: var(--accent-dim); }
.uq-child-info { flex: 1; min-width: 0; }
.uq-child-desc { font-size: 12.5px; }
.uq-child-detail { color: var(--muted); font-size: 11px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uq-child-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.uq-child.uq-error .uq-child-meta { color: var(--err); }

/* ===== Settings-Modal ===== */
.settings .muted { color: var(--muted); font-size: 12.5px; }
.set-sec { border-bottom: 1px solid var(--line); padding: 12px 0 14px; }
.set-sec:last-child { border-bottom: 0; }
.set-sec h3 {
  margin: 0 0 9px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.set-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.set-spacer { flex: 1; }
.set-toggle {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13.5px; padding: 3px 0; user-select: none;
}
.set-toggle input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Zahlenfeld mit Beschriftung (RAM-Cache-Limits) */
.set-num {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; color: var(--muted);
}
.set-num .input { width: 100px; }

/* Ordner-Feld mit „Durchsuchen…"-Knopf (Diktat-Speicherort) */
.set-dir-pick { display: flex; gap: 6px; align-items: center; }
.set-dir-pick .input { width: auto; flex: 1; min-width: 120px; }
.set-dir-pick .btn { white-space: nowrap; flex: none; }

/* Fortschrittsbalken (Settings + generisch) */
.set-progress { margin-top: 10px; }
.set-pb {
  height: 7px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
.set-pb-fill {
  height: 100%; width: 0; background: var(--accent);
  border-radius: 999px; transition: width .2s ease;
}
.set-sync-status { margin-top: 5px; font-size: 12.5px; }

/* Statistik-Zeilen (Cache, Speicher) */
.set-stats { margin-top: 10px; }
.set-stat-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; padding: 3px 0; color: var(--text);
}
.set-stat-row span:last-child { color: var(--muted); }

/* Listen (Freigaben, versteckte Elemente) */
.set-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.set-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px;
}
.set-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* API-Key-Verwaltung (Settings → API) */
.api-cred-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.api-cred {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
.api-cred-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.api-cred-name { font-size: 13.5px; font-weight: 600; }
.api-cred-masked { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
.api-cred-sub { margin-top: 2px; font-size: 11.5px; }
.api-cred-row .input { flex: 1; min-width: 140px; }
.api-cred-row .btn { flex: none; }
.api-cred-state { margin-top: 5px; font-size: 12px; }
.api-cred-state:empty { display: none; }
.api-pill {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.api-pill svg.ico { width: 11px; height: 11px; vertical-align: -2px; }
.api-pill-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.api-pill-bad { color: var(--err); border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.api-pill-unknown { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* Freigaben */
.share-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
.share-row.share-dead { opacity: .55; }
.share-info { flex: 1; min-width: 0; }
.share-path { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--muted); font-size: 11.5px; margin-top: 3px;
}
.share-pill {
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
  font-size: 10.5px; color: var(--text);
}
.share-pill svg.ico { width: 11px; height: 11px; vertical-align: -2px; }
.share-pill-rw { border-color: var(--ok); color: var(--ok); }
.share-pill-ro { border-color: var(--accent); color: var(--accent); }
.share-pill-dl { border-color: var(--warn); color: var(--warn); }
.share-actions { display: flex; gap: 2px; flex-shrink: 0; }
.share-revoke:hover { color: var(--err); }

/* Speicher-Übersicht */
.stor-bar {
  display: flex; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--panel2); border: 1px solid var(--line); margin-top: 8px;
}
.stor-seg { display: block; min-width: 2px; }
.stor-legend {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px;
  color: var(--muted); font-size: 11.5px;
}
.stor-legend-item { display: flex; align-items: center; gap: 5px; }
.stor-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== Start-Sync-Mini-Pille (unten rechts, startup-sync.js) =====
   Bewusst dezent: kleine Pille, gedämpft, halbtransparent, leichter Schatten —
   keine große Karte mehr. Bei Hover etwas präsenter. */
.sync-card {
  position: fixed; right: 14px; bottom: 14px; z-index: 950;
  display: inline-flex; align-items: center; gap: 7px;
  max-width: min(260px, calc(100vw - 28px));
  padding: 5px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  border: 1px solid var(--line); box-shadow: 0 1px 5px rgba(0,0,0,.14);
  font-size: 12px; color: var(--muted); opacity: .82;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .2s, transform .3s;
}
.sync-card:hover { opacity: 1; }
.sync-card-hide { opacity: 0; transform: translateY(5px); }
.sync-card-status { color: var(--text); white-space: nowrap; }
.sync-card-meta { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-card-meta:empty { display: none; }
.sync-card-x {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; border-radius: 4px; padding: 0 2px; margin-left: 1px;
}
.sync-card-x:hover { color: var(--text); }
.sync-card-spin {
  width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: sync-card-spin .8s linear infinite;
}
@keyframes sync-card-spin { to { transform: rotate(360deg); } }

/* ===== Settings-Tabs ===== */
.set-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.set-tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); cursor: pointer; padding: 7px 13px; font-size: 13px;
}
.set-tab:hover { color: var(--text); }
.set-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.set-pane { min-height: 220px; }
#set-code-new {
  margin: 8px 0; padding: 9px 12px; border: 1px dashed var(--accent);
  border-radius: 8px; background: var(--accent-dim); font-size: 13.5px;
}

/* ---- Offline-Modus: Banner-Pill + ausgeblendete Schreib-Knöpfe ---- */
#offline-indicator {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--warn); white-space: nowrap;
  background: var(--panel2); border: 1px solid var(--warn);
  border-radius: 999px; padding: 3px 11px; user-select: none;
}
#offline-indicator .oi-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--warn);
  animation: oi-pulse 2s ease-in-out infinite;
}
#offline-indicator.online { color: var(--ok, #22c55e); border-color: var(--ok, #22c55e); }
#offline-indicator.online .oi-dot { background: var(--ok, #22c55e); animation: none; }
@keyframes oi-pulse { 50% { opacity: 0.35; } }
@media (max-width: 768px) { #offline-indicator { font-size: 0; gap: 0; padding: 3px 8px; } }

/* Offline weiterhin aus: Server-Upload und KI-Suche brauchen das Netz.
   #btn-new-note ("+") und der Mobile-FAB bleiben sichtbar — Dateien/Ordner lassen
   sich offline anlegen (gehen in die Upload-Queue, hochladen bei Verbindung). */
body.so-offline #btn-upload,
body.so-offline #btn-ai-search { display: none !important; }

/* Offline-Regeln je Ordner (Settings → Offline & Sync) ------------------------ */
.sr-tree {
  margin-top: 10px; max-height: 320px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel2); padding: 4px;
}
.sr-empty { padding: 10px; font-size: 12.5px; }
.sr-row {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 6px; border-radius: 6px; font-size: 13px;
}
.sr-row:hover { background: var(--panel); }
.sr-tw {
  flex: none; width: 18px; height: 18px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--muted); cursor: pointer;
}
.sr-tw-empty { cursor: default; }
.sr-tw svg { width: 14px; height: 14px; }
.sr-ico { display: inline-flex; color: var(--muted); flex: none; }
.sr-ico svg { width: 15px; height: 15px; }
.sr-name { flex: 1; min-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-size, .sr-hint { color: var(--muted); font-size: 11.5px; white-space: nowrap; flex: none; }
.sr-seg {
  display: inline-flex; flex: none; overflow: hidden;
  border: 1px solid var(--line); border-radius: 7px;
}
.sr-seg button {
  border: 0; background: var(--panel); color: var(--muted);
  font-size: 11.5px; padding: 3px 8px; cursor: pointer;
}
.sr-seg button + button { border-left: 1px solid var(--line); }
.sr-seg button:hover { color: var(--text); }
/* „Erben" ist der Normalfall → neutral. Nur echte Regeln stechen hervor. */
.sr-seg button.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.sr-seg button.on[data-mode="always"] { background: var(--accent); color: #fff; }
.sr-seg button.on.sr-never { background: var(--warn); color: #1b1b1f; }
.sr-fixed { font-size: 11.5px; color: var(--muted); flex: none; }
.sr-eff { font-size: 11px; color: var(--muted); width: 66px; text-align: right; flex: none; }
.sr-row.sr-off .sr-name, .sr-row.sr-off .sr-ico { opacity: .55; }
.sr-row.sr-off .sr-eff { color: var(--warn); }
.sr-note { margin-top: 6px; font-size: 11.5px; }
@media (max-width: 620px) {
  .sr-size, .sr-hint { display: none; }
  .sr-eff { width: auto; }
}

/* Fortschrittsbalken (Warteschlange + direkte Uploads) */
#queue-indicator.uq-running {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 28%, transparent) var(--uq-p, 0%), var(--panel2) var(--uq-p, 0%));
}
.uq-bar {
  position: relative; height: 5px; margin-top: 6px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.uq-bar > i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--accent); transition: width .2s linear;
}
.uq-bar-run > i {
  background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%);
  background-size: 14px 14px; animation: uq-stripes .8s linear infinite;
}
.uq-bar-indef > i { width: 30% !important; animation: uq-indef 1.2s ease-in-out infinite; }
@keyframes uq-stripes { to { background-position: 14px 0; } }
@keyframes uq-indef { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.uq-pct { color: var(--muted); font-size: 11px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.uq-pct:empty { display: none; }
.uq-total { padding: 2px 2px 6px; }
.uq-total-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; }
.uq-total-head .uq-pct { margin: 0; font-weight: 400; }
.uq-child-info .uq-bar { height: 4px; }
@media (prefers-reduced-motion: reduce) { .uq-bar > i { animation: none !important; transition: none; } }

/* ===== Downloads (sync/download-track.js) ===== */
#download-indicator {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; user-select: none;
  font-size: 12px; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 11px 3px 8px; font-variant-numeric: tabular-nums;
}
#download-indicator svg.ico { width: 13px; height: 13px; color: var(--accent); }
#download-indicator:hover { border-color: var(--muted); }
#download-indicator.dl-running {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 28%, transparent) var(--dl-p, 0%), var(--panel2) var(--dl-p, 0%));
}
#download-indicator.dl-running svg.ico { animation: dl-hop 1.1s ease-in-out infinite; }
#download-indicator.has-err { border-color: var(--err); }
@keyframes dl-hop { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(2px); } }
.dl-wrap { width: 100%; min-width: 0; }
.dl-leer { color: var(--muted); padding: 10px 2px; }
.dl-total .uq-total-head { gap: 10px; align-items: center; }
.dl-err { color: var(--err); }
.dl-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; margin-top: 4px; }
.dl-ordner { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); }
.dl-ohead { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; }
.dl-tw, .dl-oico { display: inline-flex; color: var(--muted); flex: none; }
.dl-tw svg, .dl-oico svg { width: 14px; height: 14px; }
.dl-oname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dl-ozahl { color: var(--muted); font-size: 11.5px; flex: none; font-variant-numeric: tabular-nums; }
.dl-dateien { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 2px 20px; }
.dl-datei { font-size: 12px; }
.dl-datei .uq-bar { height: 4px; margin-top: 3px; }
.dl-dkopf { display: flex; gap: 8px; align-items: baseline; }
.dl-dname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-dstat { color: var(--muted); font-size: 11px; flex: none; }
.dl-done .dl-dname { color: var(--muted); }
.dl-done .dl-dstat { color: #2e9d5b; }
.dl-err .dl-dstat, .dl-dfehler { color: var(--err); }
.dl-dfehler { font-size: 11px; }
.dl-mehr { color: var(--muted); font-size: 11.5px; padding: 2px 0; }

/* Ordner automatisch hochladen + KI-Sortierung (settings/autoupload-ui.js) */
.fw-rule .set-item-label, #set-as-list .set-item-label, .as-entry .set-item-label, .as-res .set-item-label { white-space: normal; }
.fw-st { font-size: 12px; margin-top: 2px; }
.fw-badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.fw-edit-body, .as-editor { display: flex; flex-direction: column; gap: 8px; }
.fw-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; min-width: 150px; }
.fw-field .input { color: var(--text); }
#fw-ai-box { border-left: 3px solid var(--accent); padding-left: 10px; }
.as-cats { display: flex; flex-direction: column; gap: 8px; }
.as-cat { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.as-log { display: flex; flex-direction: column; gap: 6px; max-height: 65vh; overflow-y: auto; }
.as-entry { flex-wrap: wrap; }
.as-move { width: auto; max-width: 180px; }
.fw-edit-body [hidden], .as-editor [hidden] { display: none !important; }
/* „✓ Alles aktuell" — Abgleich ohne Neues (download-track.js dlHinweis) */
#download-indicator.dl-note { border-color: color-mix(in srgb, var(--ok, #3fb950) 55%, var(--line)); animation: dl-note-in .25s ease-out; }
#download-indicator.dl-note svg.ico { color: var(--ok, #3fb950); }
@keyframes dl-note-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
/* Handy/Tablet: „✓ Alles aktuell" als Plakette oben mittig (download-track.js plakette) */
#dl-note-float {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 54px); z-index: 9000;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  background: var(--panel, #1c1f26); border: 1px solid color-mix(in srgb, var(--ok, #3fb950) 60%, var(--line));
  border-radius: 999px; padding: 7px 15px 7px 11px; box-shadow: 0 6px 22px rgba(0, 0, 0, .28);
  transition: opacity .22s ease, transform .22s ease;
}
#dl-note-float svg.ico { width: 15px; height: 15px; color: var(--ok, #3fb950); }
#dl-note-float.dl-float-show { opacity: 1; transform: translate(-50%, 0); }
#dl-note-float.dl-float-hide { opacity: 0; transform: translate(-50%, -8px); }

/* ===== Settings-Layout (settings/index.js: .settings.set-layout) ==========
   Desktop/Tablet: großes Fenster, Navigation links (Symbol + Name, Suche),
   Inhalt rechts scrollt für sich, Abschnitte als Karten. Handy (≤768px):
   Vollbild, Reiter als wischbare Pillen-Leiste oben. Schalter statt Häkchen,
   Texte zweistufig (polishToggles: .st-title / .st-desc). */
.modal.modal-settings { width: min(1060px, 96vw); height: min(840px, 90vh); max-height: none; }
.modal.modal-settings > .modal-head { padding: 15px 20px 13px; border-bottom: 1px solid var(--line); }
.modal.modal-settings .modal-title { font-size: 17px; }
.modal.modal-settings > .modal-body { padding: 0; overflow: hidden; flex: 1; min-height: 0; display: flex; }
.modal.modal-settings > .modal-foot:empty { display: none; }

.set-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); flex: 1; min-height: 0; width: 100%; }
.set-nav {
  border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  background: color-mix(in srgb, var(--panel2) 50%, transparent);
}
.set-search {
  display: flex; align-items: center; gap: 7px; cursor: text;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px;
}
.set-search:focus-within { border-color: var(--accent); }
.set-search svg.ico { width: 14px; height: 14px; color: var(--muted); flex: none; }
.set-search input {
  background: none; border: 0; outline: none; color: var(--text);
  font: inherit; font-size: 13px; width: 100%; min-width: 0; padding: 0;
}
.set-layout .set-tabs { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px; border: 0; margin: 0; }
.set-layout .set-tab {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 11px; border: 0; border-radius: 8px; font-size: 13.5px; color: var(--muted);
  transition: background .12s, color .12s;
}
.set-layout .set-tab svg.ico { width: 16px; height: 16px; flex: none; }
.set-layout .set-tab:hover { background: var(--panel2); color: var(--text); }
.set-layout .set-tab.on {
  background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent);
  font-weight: 600; border: 0;
}
.set-layout .set-tab.hidden { display: none; }

.set-main { overflow-y: auto; min-width: 0; padding: 20px 24px 32px; overscroll-behavior: contain; }
.set-layout .set-pane { display: flex; flex-direction: column; gap: 14px; min-height: 0; max-width: 820px; }
.set-layout .set-pane.hidden { display: none; }
.set-layout .set-sec {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 17px 17px;
}
.set-layout .set-sec:last-child { border-bottom: 1px solid var(--line); }
.set-layout .set-sec h3 {
  margin: 0 0 10px; font-size: 14px; font-weight: 700; letter-spacing: 0;
  text-transform: none; color: var(--text);
}
.set-layout .set-sec .muted, .settings.set-layout .muted { font-size: 12.5px; line-height: 1.5; }
.set-layout .set-sec > p { margin: 0 0 10px; }
.set-layout .set-sec > p:last-child { margin-bottom: 0; }
.set-layout .set-list .set-item, .set-layout .api-cred { background: var(--panel); }
.set-layout .set-row { gap: 8px; }
.set-layout .set-row + p, .set-layout .set-row + .muted { margin-top: 10px; }
.set-layout .set-stats { border-top: 1px solid var(--line); padding-top: 8px; }
.set-sec-hide { display: none !important; }
.set-searching .set-pane:not(.hidden)::before {
  content: attr(data-label); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin: 4px 0 -4px;
}
.set-search-empty { padding: 30px 0; text-align: center; }

/* Schalter statt Häkchen */
.set-layout .set-toggle { align-items: flex-start; gap: 12px; padding: 9px 0; font-size: 13.5px; line-height: 1.45; }
.set-layout .set-toggle + .set-toggle { border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent); }
.set-layout .set-toggle input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; cursor: pointer;
  width: 36px; height: 21px; margin: 0; border-radius: 999px; background: var(--line);
  transition: background .15s;
}
.set-layout .set-toggle input[type="checkbox"]::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s;
}
.set-layout .set-toggle input[type="checkbox"]:checked { background: var(--accent); }
.set-layout .set-toggle input[type="checkbox"]:checked::before { transform: translateX(15px); }
.set-layout .set-toggle input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-layout .set-toggle input[type="checkbox"]:disabled { opacity: .5; cursor: default; }
.st-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-title { font-weight: 600; color: var(--text); }
.st-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* Tablet hochkant: schmalere Navigation */
@media (max-width: 1024px) and (min-width: 769px) {
  .set-layout { grid-template-columns: 196px minmax(0, 1fr); }
  .set-main { padding: 18px 18px 28px; }
}

/* Handy: Vollbild, Reiter als wischbare Pillen oben */
@media (max-width: 768px) {
  .modal-overlay:has(> .modal-settings) { padding: 0; }
  .modal.modal-settings.modal-settings {
    width: 100vw; height: 100vh; height: 100dvh; max-height: none;
    border-radius: 0; border: 0;
  }
  .modal.modal-settings > .modal-head { padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 9px; }
  .modal-settings .modal-x { font-size: 24px; padding: 2px 8px; }
  .set-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .set-nav { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px 0; gap: 9px; overflow: visible; background: none; }
  .set-search { padding: 8px 11px; }
  .set-search input { font-size: 15px; }       /* < 16px zoomt iOS nicht, 15 reicht mit -webkit-text-size-adjust */
  .set-layout .set-tabs {
    flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 10px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 0 12px;
  }
  .set-layout .set-tabs::-webkit-scrollbar { display: none; }
  .set-layout .set-tab {
    width: auto; flex: none; gap: 6px; padding: 7px 13px; font-size: 13.5px;
    border-radius: 999px; background: var(--panel2); border: 1px solid var(--line);
  }
  .set-layout .set-tab svg.ico { width: 15px; height: 15px; }
  .set-layout .set-tab.on { border-color: transparent; }
  .set-main { padding: 12px 12px calc(env(safe-area-inset-bottom, 0px) + 28px); }
  .set-layout .set-pane { gap: 12px; }
  .set-layout .set-sec { padding: 13px 14px 15px; border-radius: 11px; }
  .set-layout .set-toggle { font-size: 14px; }
  .set-layout .set-row > .btn { flex: 1 1 auto; justify-content: center; }
  .set-layout .set-row > .input, .set-layout .api-cred input.input { flex: 2 1 180px; min-width: 0; }
  .set-layout .set-row > select.input, .set-layout .set-row > select { flex: 1 1 140px; width: auto; }
  .set-layout .set-dir-pick { flex-wrap: wrap; }
}
.set-layout .set-toggle.set-toggle-off { opacity: .55; }

/* Einstellungen → Apps: je Zusatz-App eine Karte */
.set-app-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.set-app-h { display: flex; flex-direction: column; gap: 2px; }
.set-app-h b { font-size: 15px; }
.set-app-card a.btn { color: inherit; text-decoration: none; }
