/* ================================================================
   Startpage – "Liquid Glass" (iOS-inspiriert), hell & dunkel
   ================================================================ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --radius-xl: 28px; --radius-lg: 22px; --radius-md: 16px; --radius-sm: 11px;

  /* hell */
  --bg: #e9edf6;
  /* Verlaufsfarben: Basisfarben (--c1..4, per JS änderbar) werden hell mit Weiß, dunkel mit Schwarz gemischt */
  --c1: #ff6fa8; --c2: #4aa8ff; --c3: #8a6bff; --c4: #3fd6a0; --mix: 50%;
  --blob1: color-mix(in srgb, var(--c1) var(--mix), white); --blob2: color-mix(in srgb, var(--c2) var(--mix), white);
  --blob3: color-mix(in srgb, var(--c3) var(--mix), white); --blob4: color-mix(in srgb, var(--c4) var(--mix), white);
  --text: #1c1c1e; --text-2: rgba(28, 28, 30, .62); --text-3: rgba(28, 28, 30, .42);
  --glass: rgba(255, 255, 255, .34);
  --glass-strong: rgba(255, 255, 255, .62);
  --glass-hover: rgba(255, 255, 255, .55);
  --glass-border: rgba(255, 255, 255, .7);
  --glass-edge: rgba(255, 255, 255, .95);
  --glass-shade: rgba(0, 0, 0, .05);
  --shadow: 0 12px 40px rgba(40, 50, 110, .13), 0 2px 8px rgba(40, 50, 110, .06);
  --shadow-lift: 0 20px 50px rgba(40, 50, 110, .2), 0 4px 12px rgba(40, 50, 110, .1);
  --tile-icon: rgba(255, 255, 255, .7);
  --field: rgba(255, 255, 255, .55); --field-border: rgba(0, 0, 0, .08);
  --accent: var(--user-accent, #007aff); --accent-text: #fff;
  --danger: #ff3b30; --ok: #34c759; --warn: #ff9f0a; --unknown: rgba(120, 120, 128, .5);
  --sep: rgba(60, 60, 67, .12);
  --wall-dim: rgba(255, 255, 255, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #05060b;
    --blob1: color-mix(in srgb, var(--c1) var(--mix), black); --blob2: color-mix(in srgb, var(--c2) var(--mix), black);
    --blob3: color-mix(in srgb, var(--c3) var(--mix), black); --blob4: color-mix(in srgb, var(--c4) var(--mix), black);
    --text: #f5f5f7; --text-2: rgba(235, 235, 245, .66); --text-3: rgba(235, 235, 245, .4);
    --glass: rgba(40, 42, 54, .36);
    --glass-strong: rgba(44, 44, 52, .72);
    --glass-hover: rgba(255, 255, 255, .1);
    --glass-border: rgba(255, 255, 255, .13);
    --glass-edge: rgba(255, 255, 255, .28);
    --glass-shade: rgba(0, 0, 0, .25);
    --shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-lift: 0 24px 60px rgba(0, 0, 0, .6), 0 4px 14px rgba(0, 0, 0, .35);
    --tile-icon: rgba(255, 255, 255, .09);
    --field: rgba(255, 255, 255, .07); --field-border: rgba(255, 255, 255, .1);
    --accent: var(--user-accent, #0a84ff);
    --danger: #ff453a; --ok: #30d158; --warn: #ffd60a;
    --sep: rgba(84, 84, 88, .45);
    --wall-dim: rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #05060b;
  --blob1: color-mix(in srgb, var(--c1) var(--mix), black); --blob2: color-mix(in srgb, var(--c2) var(--mix), black);
  --blob3: color-mix(in srgb, var(--c3) var(--mix), black); --blob4: color-mix(in srgb, var(--c4) var(--mix), black);
  --text: #f5f5f7; --text-2: rgba(235, 235, 245, .66); --text-3: rgba(235, 235, 245, .4);
  --glass: rgba(40, 42, 54, .36);
  --glass-strong: rgba(44, 44, 52, .72);
  --glass-hover: rgba(255, 255, 255, .1);
  --glass-border: rgba(255, 255, 255, .13);
  --glass-edge: rgba(255, 255, 255, .28);
  --glass-shade: rgba(0, 0, 0, .25);
  --shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lift: 0 24px 60px rgba(0, 0, 0, .6), 0 4px 14px rgba(0, 0, 0, .35);
  --tile-icon: rgba(255, 255, 255, .09);
  --field: rgba(255, 255, 255, .07); --field-border: rgba(255, 255, 255, .1);
  --accent: var(--user-accent, #0a84ff);
  --danger: #ff453a; --ok: #30d158; --warn: #ffd60a;
  --sep: rgba(84, 84, 88, .45);
  --wall-dim: rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.4;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.muted { color: var(--text-2); }
kbd {
  font: 600 11px/1 var(--font); padding: 4px 7px; border-radius: 7px;
  background: var(--field); border: 1px solid var(--field-border); color: var(--text-3);
}
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Hintergrund ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .9; will-change: transform; }
.b1 { width: 55vmax; height: 55vmax; left: -15vmax; top: -18vmax; background: var(--blob1); animation: drift1 26s ease-in-out infinite alternate; }
.b2 { width: 50vmax; height: 50vmax; right: -18vmax; top: -10vmax; background: var(--blob2); animation: drift2 30s ease-in-out infinite alternate; }
.b3 { width: 48vmax; height: 48vmax; left: 15vmax; bottom: -25vmax; background: var(--blob3); animation: drift3 34s ease-in-out infinite alternate; }
.b4 { width: 36vmax; height: 36vmax; right: 5vmax; bottom: -10vmax; background: var(--blob4); animation: drift1 38s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(12vmax, 8vmax) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-10vmax, 12vmax) scale(.92); } }
@keyframes drift3 { to { transform: translate(8vmax, -10vmax) scale(1.08); } }
.wallpaper { position: absolute; inset: 0; background-size: cover; background-position: center; display: none; }
.wallpaper::after { content: ""; position: absolute; inset: 0; background: var(--wall-dim); }
body.has-wallpaper .wallpaper { display: block; }
body.has-wallpaper .blob { display: none; }
@media (prefers-reduced-motion: reduce) { .blob { animation: none; } }
body.no-anim .blob { animation: none; }

/* ---------- Glas ---------- */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 var(--glass-shade);
  isolation: isolate;
}
/* Spiegelung / Lichtkante */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, .35), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 40%);
  mix-blend-mode: soft-light;
}

/* ---------- Buttons / Felder ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--field-border);
  background: var(--field); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: transform .15s, background .15s, opacity .15s;
}
.btn:hover { background: var(--glass-hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.small svg.i { width: 15px; height: 15px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2);
  transition: background .15s, color .15s, transform .15s;
}
.icon-btn:hover { background: var(--glass-hover); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.active { background: var(--accent); color: #fff; }
.field {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--field-border);
  background: var(--field); color: var(--text); font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- Login ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); padding: 34px 28px 28px; border-radius: var(--radius-xl); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h1 { margin: 6px 0 0; font-size: 26px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 10px; }
.login-logo img { width: 64px; height: 64px; filter: drop-shadow(0 8px 18px rgba(94, 92, 230, .4)); }

/* ---------- Topbar ---------- */
#app-view { max-width: 1440px; margin: 0 auto; padding: 16px 20px 60px; }
.topbar {
  position: sticky; top: 12px; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 8px 10px 8px 16px; border-radius: 999px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.search {
  flex: 1; display: flex; align-items: center; gap: 10px; max-width: 620px; margin: 0 auto;
  padding: 0 12px 0 14px; height: 42px; border-radius: 999px;
  background: var(--field); border: 1px solid var(--field-border); color: var(--text-2);
  transition: box-shadow .2s, border-color .2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.search input::-webkit-search-cancel-button { display: none; }
.actions { display: flex; align-items: center; gap: 4px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; font-weight: 700; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, #5ac8fa, #5e5ce6 60%, #bf5af2); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 12px rgba(94,92,230,.35);
}
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; padding: 6px; border-radius: var(--radius-md);
  background: var(--glass-strong); display: flex; flex-direction: column; animation: pop .18s ease-out; transform-origin: top right;
}
.menu-head { padding: 10px 12px 8px; display: flex; flex-direction: column; }
.menu-head span { font-size: 12px; }
.menu button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--glass-hover); }
.menu hr { border: 0; border-top: 1px solid var(--sep); margin: 4px 8px; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(-4px); } }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 34px 0 26px; }
.clock { font-size: clamp(54px, 9vw, 92px); font-weight: 200; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.greeting { margin-top: 8px; color: var(--text-2); font-size: 16px; font-weight: 500; }

.edit-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-radius: 999px;
  margin: 0 auto 18px; width: fit-content; max-width: 100%; font-size: 14px; color: var(--text-2);
}
.edit-banner svg { color: var(--accent); }

/* ---------- Panels ---------- */
.sections { display: flex; flex-direction: column; gap: 20px; }
.panel { border-radius: var(--radius-xl); padding: 14px 18px 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.panel-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.panel-head .count { color: var(--text-3); font-size: 13px; font-weight: 600; }
.panel-head .add { margin-left: auto; }
.panel-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.panel-icon svg.i { width: 17px; height: 17px; }
.panel-icon.admin { background: linear-gradient(135deg, #ff6b6b, #ff3b30); }
.panel-icon.selfhosted { background: linear-gradient(135deg, #64d2ff, #0a84ff); }
.panel-icon.fav { background: linear-gradient(135deg, #ffd60a, #ff9f0a); }
.panel-icon.fav svg { fill: currentColor; }
.collapse { width: 28px; height: 28px; margin-left: -6px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--text-3); display: grid; place-items: center; transition: transform .25s, background .15s; }
.collapse:hover { background: var(--glass-hover); color: var(--text); }
.panel.collapsed .collapse { transform: rotate(-90deg); }
.panel-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s ease; }
.panel-body > * { min-height: 0; }
.panel.collapsed .panel-body { grid-template-rows: 0fr; overflow: hidden; }
.panel.collapsed .panel-body > * { padding-top: 0 !important; overflow: hidden; }

/* ---------- Kacheln (Admin / Selbst gehostet) ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; padding-top: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 16px 8px 13px; border-radius: var(--radius-lg); text-align: center;
  border: 1px solid transparent; transition: background .2s, transform .2s, box-shadow .2s, border-color .2s;
}
.tile:hover { background: var(--glass-hover); border-color: var(--glass-border); box-shadow: var(--shadow); transform: translateY(-2px); }
.tile:active { transform: scale(.97); }
.tile-icon {
  width: 60px; height: 60px; border-radius: 17px; display: grid; place-items: center;
  background: var(--tile-icon); box-shadow: inset 0 1px 0 var(--glass-edge), 0 4px 14px rgba(0,0,0,.08);
  border: 1px solid var(--glass-border); overflow: hidden;
}
.tile-icon img { width: 38px; height: 38px; object-fit: contain; }
.tile-title { font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { font-size: 12px; color: var(--text-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -6px; }
.status-dot { position: absolute; top: 12px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--unknown); box-shadow: 0 0 0 2px var(--glass-strong); }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 2px var(--glass-strong), 0 0 10px var(--ok); }
.status-dot.off { background: var(--danger); box-shadow: 0 0 0 2px var(--glass-strong), 0 0 10px var(--danger); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.letter { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 24px; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.emoji { font-size: 32px; line-height: 1; }

.empty { grid-column: 1 / -1; padding: 22px; text-align: center; color: var(--text-3); font-size: 14px; border: 1.5px dashed var(--sep); border-radius: var(--radius-lg); }

/* ---------- Favoriten ---------- */
.categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; padding-top: 14px; align-items: start; }
.cat {
  border-radius: var(--radius-lg); padding: 10px 8px 8px; background: var(--glass);
  border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-edge);
  transition: box-shadow .2s, transform .2s;
}
.cat-head { display: flex; align-items: center; gap: 8px; padding: 2px 8px 8px; min-height: 34px; }
.cat-head h3 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-head .cat-ic { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--tile-icon); font-size: 14px; color: var(--text-2); }
.cat-head .cat-ic svg.i { width: 14px; height: 14px; }
.cat-head .n { font-size: 12px; color: var(--text-3); font-weight: 600; }
.cat-links { display: flex; flex-direction: column; gap: 1px; min-height: 8px; }
.row {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 7px 8px; border-radius: 12px;
  transition: background .15s;
}
.row:hover { background: var(--glass-hover); }
.row-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; overflow: hidden; background: var(--tile-icon); border: 1px solid var(--glass-border); flex: none; }
.row-icon img { width: 18px; height: 18px; object-fit: contain; }
.row-icon .letter { font-size: 13px; }
.row-icon .emoji { font-size: 16px; }
.row-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.row-title { font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-add { display: none; width: 100%; margin-top: 4px; padding: 8px; border-radius: 12px; border: 1.5px dashed var(--sep); background: none; color: var(--text-3); cursor: pointer; font-size: 13px; font-weight: 600; align-items: center; justify-content: center; gap: 6px; }
.cat-add:hover { color: var(--accent); border-color: var(--accent); }
.cat-add svg.i { width: 15px; height: 15px; }
.cat .empty-row { padding: 10px; font-size: 13px; color: var(--text-3); text-align: center; }

/* ---------- Bearbeitungsmodus ---------- */
.edit-only { display: none !important; }
body.editing .edit-only { display: inline-flex !important; }
body.editing .cat-add { display: flex; }
body:not(.is-admin) .admin-only { display: none !important; }
.edit-tools { display: none; gap: 2px; }
body.editing .edit-tools { display: flex; }
.edit-tools button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--field); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.edit-tools button:hover { color: var(--text); background: var(--glass-hover); }
.edit-tools button.del:hover { color: #fff; background: var(--danger); }
.edit-tools svg.i { width: 14px; height: 14px; }
.tile .edit-tools { position: absolute; top: 6px; left: 0; right: 0; justify-content: center; gap: 6px; }
body.editing .tile { padding-top: 38px; }
.row .edit-tools { margin-left: auto; }
body.editing .tile, body.editing .row { cursor: grab; animation: jiggle .3s ease-in-out infinite alternate; }
body.editing .tile:nth-child(2n), body.editing .row:nth-child(2n) { animation-delay: -.15s; }
body.editing .row { animation: none; border: 1px dashed transparent; }
body.editing .row:hover { border-color: var(--sep); }
body.editing .cat-head { cursor: grab; }
body.editing .status-dot { display: none; }
@keyframes jiggle { from { transform: rotate(-.8deg); } to { transform: rotate(.8deg); } }
@media (prefers-reduced-motion: reduce) { body.editing .tile { animation: none; } }
.dragging { opacity: .35; }
.cat.dragging { opacity: .4; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* ---------- Suche ---------- */
.hide-search { display: none !important; }
.no-results { text-align: center; padding: 30px; }
.first-hit { box-shadow: 0 0 0 2px var(--accent) !important; background: var(--glass-hover); }
mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .2s ease-out;
}
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: var(--radius-xl); background: var(--glass-strong); padding: 18px 22px 22px; animation: rise .25s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { width: min(760px, 100%); }
.modal > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .form .lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.form .hint { font-weight: 400; font-size: 12px; color: var(--text-3); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .switch { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--field); border: 1px solid var(--field-border); color: var(--text); font-weight: 500; font-size: 14px; }
.form .buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.form .buttons .left { margin-right: auto; }
.icon-input { display: flex; gap: 10px; align-items: center; }
.icon-input .preview { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--tile-icon); border: 1px solid var(--glass-border); }
.icon-input .preview img { width: 28px; height: 28px; object-fit: contain; }
.icon-input .preview .letter { font-size: 18px; }

/* iOS-Schalter */
.toggle { position: relative; width: 51px; height: 31px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: rgba(120, 120, 128, .32); transition: background .25s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.1); transition: transform .25s cubic-bezier(.3, .7, .4, 1.3); }
.toggle input:checked + span { background: var(--ok); }
.toggle input:checked + span::after { transform: translateX(20px); }

/* Segment-Control */
.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 11px; background: rgba(120, 120, 128, .16); }
.segment button { border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.segment button.on { background: var(--glass-strong); box-shadow: 0 3px 8px rgba(0,0,0,.12), inset 0 1px 0 var(--glass-edge); }
.segment svg.i { width: 15px; height: 15px; }

/* Tabs */
.tabs { margin-bottom: 16px; }

/* Benutzertabelle */
.ulist { display: flex; flex-direction: column; gap: 6px; }
.urow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--field); border: 1px solid var(--field-border); }
.urow .avatar { width: 32px; height: 32px; font-size: 13px; cursor: default; flex: none; }
.urow .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.urow .meta small { color: var(--text-3); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 8px; }
.drop {
  display: block; padding: 22px; border-radius: var(--radius-md); border: 1.5px dashed var(--sep); text-align: center; cursor: pointer; color: var(--text-2);
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 60; padding: 11px 18px; border-radius: 999px; background: var(--glass-strong); font-weight: 600; font-size: 14px; animation: rise .25s ease-out; max-width: calc(100vw - 32px); }
.toast.err { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  #app-view { padding: 10px 12px 40px; }
  .topbar { flex-wrap: wrap; border-radius: var(--radius-lg); padding: 10px; gap: 8px; }
  .brand span { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search kbd { display: none; }
  .actions { margin-left: auto; }
  .hero { padding: 22px 0 16px; }
  .panel { padding: 12px 12px 14px; border-radius: var(--radius-lg); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; }
  .tile { padding: 12px 4px 10px; }
  .tile-icon { width: 54px; height: 54px; border-radius: 15px; }
  .tile-sub { display: none; }
  .categories { grid-template-columns: 1fr; }
  .form .row2 { grid-template-columns: 1fr; }
  .edit-banner { border-radius: var(--radius-md); font-size: 13px; }
}

/* Farb-Einstellungen */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.preset { border: 2px solid transparent; border-radius: 14px; padding: 0; background: none; cursor: pointer; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-2); }
.preset .sw { display: block; height: 56px; border-radius: 12px; margin-bottom: 5px; border: 1px solid var(--field-border); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.preset.on { border-color: var(--accent); color: var(--text); }
.preset.on .sw { border-color: transparent; }
.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.color-in { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); font-weight: 600; }
.color-in input { width: 100%; height: 40px; border: 1px solid var(--field-border); border-radius: 11px; padding: 3px; background: var(--field); cursor: pointer; }
.color-in input::-webkit-color-swatch-wrapper { padding: 0; }
.color-in input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.color-in input::-moz-color-swatch { border: 0; border-radius: 8px; }
.accents { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.accent-dot { width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 2px 6px rgba(0,0,0,.15); position: relative; }
.accent-dot.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--text-2); }
.accent-custom { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; border: 1px dashed var(--text-3); padding: 0; cursor: pointer; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.accent-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.tabpane[hidden] { display: none; }
