/* =====================================================================
   melmesh Dashboard – Design-System
   Schiefer-Blau mit Messing-Akzent · Punkt-Raster („Mesh“) als Signatur
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  --accent: #d9b26f;
  --on-accent: oklch(0.2 0.02 255);

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

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 40px; --s7: 64px; --s8: 96px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);

  --tile-min: 248px;
  --fav-min: 136px;
  --fav-icon: 60px;
  --tile-icon: 44px;
}

/* Dunkles Design (Standard) */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg:        oklch(0.17 0.016 255);
  --bg-deep:   oklch(0.135 0.014 255);
  --surface:   oklch(0.225 0.019 255 / 0.66);
  --surface-2: oklch(0.27 0.02 255 / 0.7);
  --surface-solid: oklch(0.21 0.018 255);
  --raised:    oklch(0.245 0.02 255);
  --line:      oklch(0.92 0.02 255 / 0.085);
  --line-strong: oklch(0.92 0.02 255 / 0.16);
  --text:      oklch(0.955 0.006 255);
  --muted:     oklch(0.74 0.018 255);
  --faint:     oklch(0.58 0.02 255);
  --dot:       oklch(0.9 0.02 255 / 0.11);
  --plate:     oklch(0.965 0.004 255);
  --danger:    oklch(0.7 0.16 25);
  --ok:        oklch(0.75 0.13 160);
  --accent-ink: var(--accent);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / .25), 0 2px 8px oklch(0 0 0 / .12);
  --shadow-md: 0 2px 4px oklch(0 0 0 / .2), 0 10px 30px oklch(0 0 0 / .28);
  --shadow-lg: 0 4px 10px oklch(0 0 0 / .25), 0 30px 80px oklch(0 0 0 / .45);
  --glow-2:    oklch(0.55 0.12 250 / 0.22);
}

/* Helles Design */
[data-theme="light"] {
  color-scheme: light;
  --bg:        oklch(0.968 0.005 255);
  --bg-deep:   oklch(0.94 0.008 255);
  --surface:   oklch(1 0 0 / 0.74);
  --surface-2: oklch(0.955 0.007 255 / 0.9);
  --surface-solid: oklch(0.995 0.002 255);
  --raised:    oklch(1 0 0);
  --line:      oklch(0.3 0.03 255 / 0.09);
  --line-strong: oklch(0.3 0.03 255 / 0.17);
  --text:      oklch(0.22 0.02 255);
  --muted:     oklch(0.45 0.02 255);
  --faint:     oklch(0.6 0.015 255);
  --dot:       oklch(0.35 0.03 255 / 0.12);
  --plate:     oklch(1 0 0);
  --danger:    oklch(0.55 0.19 25);
  --ok:        oklch(0.55 0.13 160);
  --accent-ink: color-mix(in oklab, var(--accent) 60%, #1a1f29);
  --shadow-sm: 0 1px 2px oklch(0.3 0.03 255 / .07), 0 2px 8px oklch(0.3 0.03 255 / .05);
  --shadow-md: 0 2px 4px oklch(0.3 0.03 255 / .06), 0 12px 32px oklch(0.3 0.03 255 / .1);
  --shadow-lg: 0 4px 10px oklch(0.3 0.03 255 / .08), 0 30px 80px oklch(0.3 0.03 255 / .2);
  --glow-2:    oklch(0.75 0.08 250 / 0.25);
}
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    color-scheme: light;
    --bg: oklch(0.968 0.005 255); --bg-deep: oklch(0.94 0.008 255);
    --surface: oklch(1 0 0 / 0.74); --surface-2: oklch(0.955 0.007 255 / 0.9);
    --surface-solid: oklch(0.995 0.002 255); --raised: oklch(1 0 0);
    --line: oklch(0.3 0.03 255 / 0.09); --line-strong: oklch(0.3 0.03 255 / 0.17);
    --text: oklch(0.22 0.02 255); --muted: oklch(0.45 0.02 255); --faint: oklch(0.6 0.015 255);
    --dot: oklch(0.35 0.03 255 / 0.12); --plate: oklch(1 0 0);
    --danger: oklch(0.55 0.19 25); --ok: oklch(0.55 0.13 160);
    --accent-ink: color-mix(in oklab, var(--accent) 60%, #1a1f29);
    --shadow-sm: 0 1px 2px oklch(0.3 0.03 255 / .07), 0 2px 8px oklch(0.3 0.03 255 / .05);
    --shadow-md: 0 2px 4px oklch(0.3 0.03 255 / .06), 0 12px 32px oklch(0.3 0.03 255 / .1);
    --shadow-lg: 0 4px 10px oklch(0.3 0.03 255 / .08), 0 30px 80px oklch(0.3 0.03 255 / .2);
    --glow-2: oklch(0.75 0.08 250 / 0.25);
  }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }
::selection { background: color-mix(in oklch, var(--accent) 40%, transparent); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ico { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Signatur: Punkt-Raster mit Akzentlicht ---------- */
.mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(42% 38% at 12% -4%, color-mix(in oklch, var(--accent) 24%, transparent), transparent 70%),
    radial-gradient(38% 42% at 96% 6%, var(--glow-2), transparent 70%),
    radial-gradient(60% 50% at 50% 115%, color-mix(in oklch, var(--accent) 7%, transparent), transparent 70%);
}
.mesh::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.1px, transparent 0);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 10%, transparent 72%);
          mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 10%, transparent 72%);
}
.mesh::after { /* feines Korn */
  content: ""; position: absolute; inset: 0; opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.bg-image { position: fixed; inset: 0; z-index: 0; pointer-events: none; background-size: cover; background-position: center; opacity: 0; transition: opacity .6s var(--ease); }
.bg-image.is-on { opacity: 1; }
.bg-image.is-on::after { content: ""; position: absolute; inset: 0; background: var(--bg); opacity: var(--bg-dim, .55); }
body.has-bg .mesh::before { opacity: .5; }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--surface-2); --b-fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 44px; padding: 0 var(--s4);
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--b-bg); color: var(--b-fg);
  font-weight: 560; font-size: 14.5px; letter-spacing: -0.005em; white-space: nowrap;
  transition: transform .18s var(--ease), background-color .18s var(--ease), border-color .18s, box-shadow .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--line-strong); background: color-mix(in oklab, var(--b-bg) 92%, var(--text)); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  --b-bg: var(--accent); --b-fg: var(--on-accent);
  border-color: color-mix(in oklch, var(--accent) 70%, white 30%);
  box-shadow: 0 1px 0 oklch(1 0 0 / .25) inset, 0 6px 20px -6px color-mix(in oklch, var(--accent) 60%, transparent);
}
.btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, white); border-color: color-mix(in oklch, var(--accent) 60%, white 40%); }
.btn-danger { --b-bg: var(--danger); --b-fg: white; border-color: transparent; }
.btn-danger:hover { background: color-mix(in oklch, var(--danger) 88%, white); }
.btn-ghost { --b-bg: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 var(--s3); font-size: 13.5px; border-radius: 10px; }
.btn .ico { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--muted);
  transition: background-color .18s var(--ease), color .18s, transform .18s var(--ease), border-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-active { background: color-mix(in oklch, var(--accent) 18%, transparent); color: var(--accent-ink); border-color: color-mix(in oklch, var(--accent) 35%, transparent); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm .ico { width: 17px; height: 17px; }

kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  font: 500 11.5px/1 var(--font-mono); color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
}

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; }
.field + .field, .field + .row, .row + .field { margin-top: var(--s4); }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.field-label .opt { font-weight: 400; color: var(--faint); }
.field-hint { font-size: 12.5px; color: var(--faint); }
.field-hint code { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.input, .field input[type="text"], .field input[type="password"], .field input[type="url"], .field input[type="search"], .field select, .field textarea {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 12px;
  outline: none; transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.field textarea { height: auto; min-height: 76px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.field select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: color-mix(in oklch, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent);
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field.has-error input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12.5px; }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; margin-top: 0; }

.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px !important; }
.pw-toggle { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; color: var(--faint); border-radius: 9px; }
.pw-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.pw-toggle:hover, .pw-toggle.is-on { color: var(--text); }
.strength { display: block; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .25s var(--ease), background-color .25s; }
.strength[data-level="1"] span { width: 25%; background: var(--danger); }
.strength[data-level="2"] span { width: 50%; background: oklch(0.75 0.15 70); }
.strength[data-level="3"] span { width: 75%; background: oklch(0.78 0.14 120); }
.strength[data-level="4"] span { width: 100%; background: var(--ok); }

/* Schalter */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .txt { display: grid; gap: 2px; }
.switch-row .txt strong { font-weight: 560; font-size: 14.5px; }
.switch-row .txt span { font-size: 13px; color: var(--faint); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background-color .2s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease-spring); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* Segmentierte Auswahl */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 560; white-space: nowrap; transition: background-color .18s, color .18s; }
.seg button .ico { width: 16px; height: 16px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Anmeldeseite ---------- */
.auth-page { display: grid; }
.auth { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: var(--s5); padding: var(--s5) var(--s4); }
.auth-card {
  width: min(420px, 100%); padding: clamp(28px, 5vw, 40px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: var(--shadow-lg);
  animation: rise .6s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s6); }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand-name { font: 650 19px/1 var(--font-display); letter-spacing: -0.02em; }
.auth h1 { margin: 0 0 6px; font: 680 clamp(26px, 4vw, 32px)/1.1 var(--font-display); letter-spacing: -0.03em; text-wrap: balance; }
.auth-lead { margin: 0 0 var(--s5); color: var(--muted); text-wrap: pretty; }
.auth-form { display: grid; gap: var(--s4); }
.auth-form .field + .field { margin-top: 0; }
.auth-form .btn { margin-top: var(--s2); height: 48px; }
.auth-msg { margin: 0 0 var(--s4); padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.auth-msg.is-error { background: color-mix(in oklch, var(--danger) 14%, transparent); color: color-mix(in oklab, var(--danger) 80%, var(--text)); border: 1px solid color-mix(in oklch, var(--danger) 30%, transparent); }
.auth-msg.is-info { background: color-mix(in oklch, var(--accent) 12%, transparent); border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent); }
.auth-foot { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--faint); font-size: 12.5px; }
.auth-foot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---------- App-Rahmen ---------- */
.app {
  position: relative; z-index: 1;
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: max(env(safe-area-inset-top), clamp(14px, 2.4vw, 28px)) max(16px, env(safe-area-inset-right), clamp(16px, 3vw, 40px)) calc(var(--s8) + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left), clamp(16px, 3vw, 40px));
}
.boot-loader { display: flex; align-items: center; gap: 12px; justify-content: center; min-height: 60vh; color: var(--faint); }
.boot-loader span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.topbar .brand { margin: 0; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 9px; }
.topbar .brand-name { font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }

/* Kopfbereich */
.hero {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--s5);
  margin: clamp(28px, 6vw, 72px) 0 clamp(20px, 3vw, 32px);
}
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font: 500 12px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent), 0 0 18px var(--accent); }
.greeting { margin: 0; font: 680 clamp(30px, 3.6vw + 12px, 56px)/1.02 var(--font-display); letter-spacing: -0.035em; text-wrap: balance; }
.greeting em { font-style: normal; color: var(--accent-ink); }
.hero-sub { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.clock { text-align: right; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.clock-time { font-size: clamp(44px, 5.5vw + 8px, 88px); font-weight: 200; line-height: .9; letter-spacing: -0.04em; }
.clock-time .sec { font-size: .38em; font-weight: 300; color: var(--faint); letter-spacing: -0.01em; margin-left: .15em; }
.clock-time .colon { opacity: .55; }

/* Befehlszeile: Suche + Hinzufügen */
.command { display: flex; gap: var(--s3); align-items: stretch; position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 20; }
.search {
  position: relative; flex: 1; display: flex; align-items: center;
  height: 58px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-md);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: color-mix(in oklch, var(--accent) 60%, transparent); box-shadow: var(--shadow-md), 0 0 0 4px color-mix(in oklch, var(--accent) 15%, transparent); }
.search > .ico { position: absolute; left: 20px; width: 21px; height: 21px; color: var(--faint); pointer-events: none; }
.search input { flex: 1; height: 100%; min-width: 0; padding: 0 12px 0 54px; border: 0; background: transparent; outline: none; font-size: 16.5px; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search .kbd-hint { display: flex; gap: 4px; padding-right: 16px; }
.search .clear { margin-right: 8px; }
.command .btn-add { height: 58px; padding: 0 22px; border-radius: 18px; font-size: 15px; }
.command .btn-add .ico { width: 20px; height: 20px; }

/* Zuletzt verwendet */
.recent { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); overflow-x: auto; scrollbar-width: none; padding: 2px; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.recent::-webkit-scrollbar { display: none; }
.recent-label { flex: none; font: 500 11.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 5px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 13.5px; font-weight: 520; color: var(--muted); transition: color .18s, border-color .18s, background-color .18s; }
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip .glyph { --size: 24px; border-radius: 99px; }

/* ---------- Abschnitte ---------- */
.section { margin-top: clamp(32px, 4vw, 48px); }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s4); min-height: 34px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; font: 640 17px/1.2 var(--font-display); letter-spacing: -0.015em; }
.section-head h2 button { display: flex; align-items: center; gap: 10px; border: 0; padding: 4px 6px 4px 0; background: none; font: inherit; letter-spacing: inherit; border-radius: 8px; }
.section-head .cat-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: color-mix(in oklch, var(--accent) 13%, transparent); color: var(--accent-ink); }
.section-head .cat-ico .ico { width: 17px; height: 17px; }
.section-head .count { font: 500 12px/1 var(--font-mono); color: var(--faint); padding: 4px 7px; border-radius: 6px; background: var(--surface-2); }
.section-head .chev { width: 18px; height: 18px; color: var(--faint); transition: transform .25s var(--ease); }
.section.is-collapsed .chev { transform: rotate(-90deg); }
.section-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.section-head .head-actions { display: flex; gap: 2px; opacity: .0; transition: opacity .2s; }
.section:hover .head-actions, .section:focus-within .head-actions, .is-arranging .head-actions { opacity: 1; }
@media (hover: none) { .section-head .head-actions { opacity: 1; } }
.section.is-drop-target .section-head .rule { background: linear-gradient(90deg, var(--accent), transparent); }

.fav-title .cat-ico { background: color-mix(in oklch, var(--accent) 22%, transparent); }

/* ---------- Kacheln ---------- */
.grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(var(--tile-min), 100%), 1fr)); min-height: 20px; }
.grid.is-favs { grid-template-columns: repeat(auto-fill, minmax(var(--fav-min), 1fr)); gap: var(--s3); }
.tile-add {
  display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 14px 18px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: transparent;
  color: var(--faint); font-weight: 540; text-align: left;
  transition: color .18s, border-color .18s, background-color .18s;
}
.tile-add .ico { width: 20px; height: 20px; }
.tile-add:hover { color: var(--accent-ink); border-color: color-mix(in oklch, var(--accent) 55%, transparent); background: color-mix(in oklch, var(--accent) 6%, transparent); }
.app[data-size="compact"] .tile-add { min-height: 60px; }

.tile {
  --mx: 50%; --my: 50%;
  position: relative; isolation: isolate;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s, background-color .25s;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
/* Lichtkegel, der dem Mauszeiger folgt */
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0;
  background: radial-gradient(220px circle at var(--mx) var(--my), color-mix(in oklch, var(--accent) 14%, transparent), transparent 70%);
  transition: opacity .3s;
}
.tile::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; opacity: 0; pointer-events: none;
  background: radial-gradient(160px circle at var(--mx) var(--my), color-mix(in oklch, var(--accent) 75%, transparent), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  transition: opacity .3s;
}
@media (hover: hover) {
  .tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
  .tile:hover::before, .tile:hover::after { opacity: 1; }
}
.tile:active:not(.is-arranging .tile) { transform: translateY(0) scale(.985); }
.tile.is-selected { border-color: color-mix(in oklch, var(--accent) 70%, transparent); box-shadow: var(--shadow-md), 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent); }
.tile.is-selected::before { opacity: 1; }

.tile-link { display: flex; align-items: center; gap: 14px; padding: 14px 44px 14px 14px; min-height: 74px; border-radius: inherit; text-decoration: none; color: inherit; outline-offset: -2px; -webkit-user-drag: none; }
.tile-text { display: grid; gap: 2px; min-width: 0; }
.tile-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-desc { font-size: 13px; color: var(--faint); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-host { font: 400 12px/1.3 var(--font-mono); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tile-menu {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px;
  background: transparent; color: var(--faint); opacity: 0;
  transition: opacity .18s, background-color .18s, color .18s;
}
.tile-menu .ico { width: 18px; height: 18px; }
.tile:hover .tile-menu, .tile:focus-within .tile-menu, .tile-menu[aria-expanded="true"] { opacity: 1; }
.tile-menu:hover, .tile-menu[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
@media (hover: none) { .tile-menu { opacity: .75; } }
.tile-key { position: absolute; top: 9px; left: 9px; z-index: 2; opacity: 0; transition: opacity .18s; pointer-events: none; }
@media (hover: hover) { .tile:hover .tile-key { opacity: 1; } }
.tile-star { position: absolute; bottom: 10px; right: 12px; width: 13px; height: 13px; color: var(--accent-ink); fill: currentColor; opacity: .9; }

/* Favoriten: hochformatige App-Kacheln */
.grid.is-favs .tile-link { flex-direction: column; justify-content: center; text-align: center; gap: 12px; padding: 22px 12px 18px; min-height: 148px; }
.grid.is-favs .tile-text { justify-items: center; width: 100%; }
.grid.is-favs .tile-name { max-width: 100%; font-size: 14.5px; }
.grid.is-favs .tile-desc { -webkit-line-clamp: 1; font-size: 12.5px; }
.grid.is-favs .glyph { --size: var(--fav-icon); }

/* Kachelgrößen */
.app[data-size="compact"] { --tile-min: 210px; --fav-min: 112px; --fav-icon: 46px; --tile-icon: 36px; }
.app[data-size="compact"] .tile-link { min-height: 60px; padding-block: 10px; gap: 12px; }
.app[data-size="compact"] .grid.is-favs .tile-link { min-height: 120px; padding: 16px 10px 14px; gap: 10px; }
.app[data-size="compact"] .tile-desc { -webkit-line-clamp: 1; }
.app[data-size="large"] { --tile-min: 300px; --fav-min: 168px; --fav-icon: 76px; --tile-icon: 54px; }
.app[data-size="large"] .tile-link { min-height: 92px; padding-block: 18px; gap: 16px; }
.app[data-size="large"] .grid.is-favs .tile-link { min-height: 184px; }
.app[data-size="large"] .tile-name { font-size: 16px; }
.app.hide-desc .grid:not(.is-search) .tile-desc { display: none; }

/* Icon-Plättchen */
.glyph {
  --size: var(--tile-icon); --c: var(--accent);
  position: relative; flex: none; display: grid; place-items: center;
  width: var(--size); height: var(--size); border-radius: calc(var(--size) * .28);
  overflow: hidden;
}
.glyph.is-img { background: var(--plate); box-shadow: 0 0 0 1px oklch(0 0 0 / .06) inset, var(--shadow-sm); }
.glyph.is-img img { width: 70%; height: 70%; object-fit: contain; -webkit-user-drag: none; }
.glyph.is-img.is-full img { width: 100%; height: 100%; object-fit: cover; }
.glyph.is-sym { background: color-mix(in oklch, var(--c) 17%, transparent); color: var(--c); box-shadow: 0 0 0 1px color-mix(in oklch, var(--c) 22%, transparent) inset; }
.glyph.is-sym .ico { width: 54%; height: 54%; stroke-width: 1.6; }
.glyph.is-text { background: linear-gradient(145deg, color-mix(in oklch, var(--c) 34%, transparent), color-mix(in oklch, var(--c) 16%, transparent)); color: color-mix(in oklab, var(--c) 75%, var(--text)); box-shadow: 0 0 0 1px color-mix(in oklch, var(--c) 25%, transparent) inset; font: 700 calc(var(--size) * .4)/1 var(--font-display); letter-spacing: -0.03em; }
.glyph.is-text.is-emoji { font-size: calc(var(--size) * .52); background: var(--surface-2); }
.glyph.is-loading::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.glyph.is-loading > * { opacity: .25; }

/* Leerer Zustand */
.empty { margin-top: var(--s6); padding: clamp(28px, 5vw, 56px); text-align: center; border: 1.5px dashed var(--line-strong); border-radius: var(--r-xl); background: var(--surface); }
.empty h3 { margin: 0 0 8px; font: 650 22px/1.2 var(--font-display); letter-spacing: -0.02em; }
.empty p { margin: 0 auto var(--s5); color: var(--muted); max-width: 46ch; text-wrap: pretty; }
.empty-search { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.empty-search strong { color: var(--text); }
.empty-search .btn { margin-top: var(--s4); }

/* ---------- Anordnen (Drag & Drop) ---------- */
.is-arranging .tile { cursor: grab; touch-action: none; }
.is-arranging .tile-menu, .is-arranging .tile-key { display: none; }
.is-arranging .tile-link { pointer-events: none; }
.is-arranging .tile { animation: jiggle .5s ease-in-out infinite alternate; }
.is-arranging .tile:nth-child(2n) { animation-delay: -.25s; }
.tile.is-placeholder { opacity: .35; animation: none !important; border-style: dashed; border-color: var(--accent); box-shadow: none; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; margin: 0; box-shadow: var(--shadow-lg) !important; transform: rotate(1.5deg) scale(1.04); opacity: .96; transition: none; border-color: color-mix(in oklch, var(--accent) 60%, transparent) !important; animation: none !important; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.arrange-bar {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 60; translate: -50% 0;
  display: flex; align-items: center; gap: var(--s4); padding: 8px 8px 8px 20px; max-width: calc(100vw - 32px);
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: rise .35s var(--ease) both;
}
.arrange-bar p { margin: 0; font-size: 14px; color: var(--muted); }
.arrange-bar p strong { color: var(--text); }
.cat-move { display: none; }
.is-arranging .cat-move { display: inline-grid; }

/* ---------- Menüs ---------- */
.menu {
  position: fixed; z-index: 900; min-width: 220px; max-width: calc(100vw - 24px); max-height: min(70vh, 460px); overflow-y: auto; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-lg);
  transform-origin: top right; animation: pop .16s var(--ease) both;
}
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 14.5px; color: var(--text); }
.menu button .ico { width: 18px; height: 18px; color: var(--muted); }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button:disabled { color: var(--faint); cursor: default; background: none; }
.menu button.is-danger { color: var(--danger); }
.menu button.is-danger .ico { color: var(--danger); }
.menu button .end { margin-left: auto; color: var(--faint); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 4px; }
.menu .menu-title { padding: 8px 12px 6px; font: 500 11.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

/* ---------- Dialoge ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: min(88dvh, 860px); padding: 0;
  color: var(--text); background: var(--surface-solid);
  border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; animation: dialog-in .32s var(--ease) both; }
dialog.modal::backdrop { background: oklch(0.12 0.02 255 / .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s ease both; }
.modal-head { display: flex; align-items: center; gap: var(--s3); padding: 20px 20px 4px 24px; }
.modal-head h2 { flex: 1; margin: 0; font: 660 20px/1.2 var(--font-display); letter-spacing: -0.02em; }
.modal-body { padding: 16px 24px 8px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; gap: var(--s3); justify-content: flex-end; align-items: center; padding: 16px 24px 22px; border-top: 1px solid var(--line); margin-top: 12px; }
.modal-foot .spacer { flex: 1; }
.modal-text { margin: 0; color: var(--muted); text-wrap: pretty; }
dialog.modal.is-wide { width: min(900px, calc(100vw - 32px)); }

@media (max-width: 640px) {
  dialog.modal, dialog.modal.is-wide {
    width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; border-bottom: 0;
  }
  dialog.modal[open] { animation: sheet-in .38s var(--ease) both; }
  .modal-foot { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .modal-foot .spacer { display: none; }
}

/* Vorschau im Link-Dialog */
.preview { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: var(--s5); border-radius: var(--r-lg); background: var(--bg-deep); border: 1px solid var(--line); }
.preview .tile-text { flex: 1; }
.preview .tile-name { font-size: 16px; }

/* Icon-Auswahl */
.icon-pick { display: grid; gap: var(--s3); }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 196px; overflow-y: auto; padding: 4px; margin: -4px; }
.sym-grid button { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); transition: all .15s; }
.sym-grid button .ico { width: 21px; height: 21px; }
.sym-grid button:hover { color: var(--text); border-color: var(--line-strong); }
.sym-grid button[aria-pressed="true"] { color: var(--accent-ink); border-color: var(--accent); background: color-mix(in oklch, var(--accent) 14%, transparent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--sw); box-shadow: 0 0 0 1px oklch(0 0 0 / .15) inset; transition: transform .15s var(--ease-spring); }
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 4px var(--sw); }
.swatch.custom { background: conic-gradient(from 0deg, #f66, #fc6, #6f9, #6cf, #96f, #f6c, #f66); overflow: hidden; }
.swatch.custom input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); opacity: 0; cursor: pointer; }
.pick-hint { margin: 0; font-size: 13px; color: var(--faint); }
.pick-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }

/* ---------- Einstellungen ---------- */
.settings { display: grid; grid-template-columns: 200px 1fr; min-height: 0; flex: 1; overflow: hidden; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 20px 16px; border-right: 1px solid var(--line); overflow-y: auto; }
.settings-nav button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 540; text-align: left; white-space: nowrap; }
.settings-nav button .ico { width: 18px; height: 18px; }
.settings-nav button:hover { color: var(--text); background: var(--surface-2); }
.settings-nav button[aria-selected="true"] { color: var(--text); background: color-mix(in oklch, var(--accent) 14%, transparent); }
.settings-nav button[aria-selected="true"] .ico { color: var(--accent-ink); }
.settings-panel { padding: 8px 28px 28px; overflow-y: auto; overscroll-behavior: contain; }
.settings-panel h3 { margin: 22px 0 6px; font: 640 15px/1.3 var(--font-display); letter-spacing: -0.01em; }
.settings-panel h3:first-child { margin-top: 6px; }
.settings-panel .section-text { margin: 0 0 14px; color: var(--faint); font-size: 13.5px; text-wrap: pretty; }
.card { padding: 4px 18px; border-radius: var(--r-lg); background: var(--bg-deep); border: 1px solid var(--line); }
.card.pad { padding: 18px; }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: var(--s3); }
.cat-list { display: grid; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border-radius: 14px; background: var(--bg-deep); border: 1px solid var(--line); }
.cat-row .glyph { --size: 34px; }
.cat-row input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; outline: none; font-weight: 560; }
.cat-row input:hover { border-color: var(--line); }
.cat-row input:focus { border-color: color-mix(in oklch, var(--accent) 60%, transparent); background: var(--surface-2); }
.cat-row .count { font: 500 12px/1 var(--font-mono); color: var(--faint); min-width: 28px; text-align: right; }
.cat-row .cat-sym { border: 0; background: none; padding: 0; border-radius: 10px; }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 13.5px; }
.info-list dt { color: var(--faint); }
.info-list dd { margin: 0; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check-list .ico { width: 18px; height: 18px; margin-top: 1px; }
.check-list .ok { color: var(--ok); }
.check-list .bad { color: var(--danger); }
.check-list .wait { color: var(--faint); }
.check-list small { display: block; color: var(--faint); font-size: 12.5px; }
.accent-row { display: flex; flex-wrap: wrap; gap: 10px; }
.accent-row .swatch { width: 36px; height: 36px; }
.range { width: 100%; accent-color: var(--accent); }
.bg-thumb { width: 120px; height: 72px; border-radius: 12px; background: var(--surface-2) center/cover; border: 1px solid var(--line); flex: none; }

@media (max-width: 640px) {
  .settings { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 16px 12px; scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav button { flex: none; height: 36px; }
  .settings-panel { padding: 4px 18px 28px; }
}

/* ---------- Hinweise (Toasts) ---------- */
.toasts { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 1100; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); font-size: 14px; pointer-events: auto; animation: toast-in .3s var(--ease) both; }
.toast .ico { width: 18px; height: 18px; color: var(--ok); }
.toast.is-error .ico { color: var(--danger); }
.toast.is-out { animation: toast-out .25s var(--ease) both; }
.toast button { border: 0; background: none; color: var(--accent-ink); font-weight: 600; padding: 0 0 0 6px; }

/* Schwebender Hinzufügen-Knopf (Smartphone) */
.fab {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 50;
  display: none; place-items: center; width: 60px; height: 60px; border-radius: 20px; border: 0;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 10px 30px -6px color-mix(in oklch, var(--accent) 70%, transparent), var(--shadow-md);
  transition: transform .2s var(--ease-spring);
}
.fab:active { transform: scale(.92); }
.fab .ico { width: 26px; height: 26px; stroke-width: 2; }

/* ---------- Responsiv ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: var(--s3); margin-top: 28px; }
  .clock { order: -1; text-align: left; }
  .clock-time { font-size: 40px; }
  .search .kbd-hint { display: none; }
  .command .btn-add { display: none; }
  .fab { display: grid; }
  .is-arranging .fab { display: none; }
  .grid.is-favs { grid-template-columns: repeat(auto-fill, minmax(min(30%, 104px), 1fr)); gap: 10px; }
  .grid.is-favs .tile-link { min-height: 116px; padding: 16px 8px 12px; gap: 10px; }
  .grid.is-favs .tile-desc { display: none; }
  .grid.is-favs .glyph { --size: 52px; }
  .grid.is-favs .tile-name { font-size: 13px; }
  .grid.is-favs .tile-menu { top: 4px; right: 4px; }
  .arrange-bar p { font-size: 13px; }
}
@media (max-width: 420px) {
  .topbar-actions .icon-btn { width: 38px; height: 38px; }
  .search { height: 52px; border-radius: 16px; }
  .tile-link { min-height: 66px; padding: 12px 40px 12px 12px; }
}

/* ---------- Bewegung ---------- */
@keyframes spin { to { rotate: 360deg; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes jiggle { from { rotate: -.6deg; } to { rotate: .6deg; } }

.reveal > * { animation: rise .55s var(--ease) both; }
.reveal > *:nth-child(2) { animation-delay: .04s; }
.reveal > *:nth-child(3) { animation-delay: .08s; }
.reveal > *:nth-child(4) { animation-delay: .12s; }
.reveal > *:nth-child(5) { animation-delay: .16s; }
.reveal > *:nth-child(n+6) { animation-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .is-arranging .tile { animation: none; }
}
