/* ── Desktop-Oberfläche: obere Leiste, Dock, Hintergrund, Uhr-Widget ─────────── */
.screen { --panel-h: 32px; --dock-h: calc(var(--dock-size) + 32px); position: fixed; inset: 0; overflow: hidden; background: var(--bg-1); isolation: isolate; }

/* Hintergrund: Verlauf aus den konfigurierten Farben + feine Linien/Funkeln (oder eigenes Bild aus dem Admin-Panel) */
.wallpaper {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(1000px 760px at 80% 32%, color-mix(in srgb, var(--accent2) 36%, transparent), transparent 64%),
    radial-gradient(760px 640px at 56% 40%, color-mix(in srgb, var(--accent) 26%, var(--wp-b)), transparent 62%),
    radial-gradient(1100px 820px at 6% 92%, var(--wp-glow), transparent 62%),
    radial-gradient(900px 520px at 18% 0%, color-mix(in srgb, var(--accent2) 14%, var(--wp-c)), transparent 66%),
    linear-gradient(135deg, var(--wp-a), var(--wp-b) 48%, var(--wp-c));
}
.wallpaper::before { /* Linien & Funkeln – in den Akzentfarben getönt */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.9;
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 40%, white) 45%, var(--accent2));
  -webkit-mask: url(/img/wallpaper-lines.svg) center / cover no-repeat; mask: url(/img/wallpaper-lines.svg) center / cover no-repeat;
}
.wallpaper::after { /* Logo-Wasserzeichen */
  content: ''; position: absolute; right: 9%; top: 18%; width: min(30vw, 480px); aspect-ratio: 1380 / 1130; opacity: 0.05;
  background: var(--logo-url, url(/img/logo.webp)) center / contain no-repeat; pointer-events: none;
}
.has-wallpaper .wallpaper { background: var(--wallpaper-url) center / cover no-repeat, #0b0820; }
.has-wallpaper .wallpaper::before { display: none; }
.logo-phoenix { width: 100%; aspect-ratio: 1380 / 930; background: var(--logo-url, url(/img/logo.webp)) top center / 100% auto no-repeat; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35)); }
/* Eigenes Logo (beliebiges Seitenverhältnis): ganz anzeigen statt zuzuschneiden */
.custom-logo .logo-phoenix { aspect-ratio: 1 / 1; background-size: contain; background-position: center; }

.desktop { position: absolute; inset: 0; display: grid; grid-template-rows: var(--panel-h) minmax(0, 1fr) var(--dock-h); }
.desktop-area { position: relative; overflow: hidden; overflow: clip; z-index: 1; }

/* Obere Leiste */
.panel {
  position: relative; z-index: 50000; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 6px; font-size: 12.5px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-0) 78%, transparent), color-mix(in srgb, var(--bg-1) 50%, transparent)); backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.panel-left, .panel-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.panel-right { justify-content: flex-end; }
.panel-btn { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 9px; border: 0; border-radius: 7px; background: none; color: var(--text); cursor: default; font-size: 12.5px; transition: background 0.12s; }
.panel-btn:hover, .panel-btn.open { background: rgba(255, 255, 255, 0.12); }
.panel-btn svg { width: 15px; height: 15px; }
.start-btn { width: 34px; padding: 0; justify-content: center; }
.start-btn .logo-phoenix { width: 22px; }
.panel-clock { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.panel-user { color: var(--text-2); max-width: 220px; } .panel-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulse.off { background: var(--warn); animation: none; box-shadow: 0 0 8px var(--warn); }
.panel-btn .bell-badge { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px; background: var(--warn); color: #1a1200; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.panel-btn { position: relative; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

/* Desktop-Symbole (optional) */
.desktop-icons { position: absolute; inset: 0; padding: 12px 10px; display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 98px); grid-auto-columns: 96px; align-content: start; gap: 4px; }
.desk-icon {
  position: relative; width: 92px; height: 94px; padding: 8px 4px; border: 1px solid transparent; border-radius: 10px; background: none; cursor: default;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
.desk-icon:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.1); }
.desk-icon.sel { background: var(--accent-soft); border-color: var(--accent-line); }
.di-img, .dock-img, .si-img {
  position: relative; display: grid; place-items: center; color: #fff; border-radius: 13px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, white 6%), color-mix(in srgb, var(--accent2) 55%, var(--accent-lo)));
  box-shadow: 0 8px 18px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.di-img { width: 46px; height: 46px; } .di-img svg { width: 24px; height: 24px; }
.di-label { font-size: 12px; line-height: 1.2; text-align: center; max-width: 88px; word-break: break-word; }
.badge-dot { position: absolute; top: -5px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; font-size: 11px; font-weight: 700; display: grid; place-items: center; background: var(--warn); color: #1a1200; box-shadow: 0 0 0 2px rgba(10, 6, 30, 0.9); text-shadow: none; }

/* Uhr-Widget auf dem Desktop (unten rechts) */
.desk-widget { position: absolute; z-index: 1; right: 56px; bottom: calc(var(--dock-h) + 10px); text-align: right; pointer-events: none; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55); }
.dw-time { font-size: clamp(56px, 8vw, 104px); font-weight: 200; line-height: 1; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.dw-date { margin-top: 6px; font-size: clamp(18px, 2.4vw, 30px); font-weight: 300; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.92); }
.dw-name { margin-top: -2px; font-size: clamp(26px, 3.6vw, 52px); font-weight: 800; letter-spacing: -0.02em; line-height: 1; }

/* Dock (unten, mittig, schwebend) */
.dock-row { position: relative; z-index: 50000; display: flex; justify-content: center; align-items: center; padding-bottom: 6px; pointer-events: none; }
.dock {
  pointer-events: auto; display: flex; align-items: flex-end; gap: 8px; padding: 9px 12px; max-width: calc(100vw - 16px); overflow-x: auto; overflow-y: visible;
  border-radius: 20px; background: color-mix(in srgb, var(--bg-1) 55%, transparent); backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.13); box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  scrollbar-width: none;
}
.dock::-webkit-scrollbar { display: none; }
.dock-item { position: relative; flex: none; width: var(--dock-size); height: var(--dock-size); padding: 0; border: 0; background: none; cursor: default; transition: transform 0.18s var(--ease); transform-origin: 50% 100%; }
.dock-item:hover { transform: translateY(-7px) scale(1.18); }
.dock-item:active { transform: translateY(-3px) scale(1.08); }
.dock-img { width: var(--dock-size); height: var(--dock-size); border-radius: calc(var(--r-md) + 3px); } .dock-img svg { width: calc(var(--dock-size) * 0.5); height: calc(var(--dock-size) * 0.5); }
.dock-item .badge-dot { top: -7px; right: -7px; }
.dock-item::before { /* Laufzeit-Marker */
  content: ''; position: absolute; left: 50%; bottom: -7px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: transparent; transition: background 0.2s, width 0.2s, margin 0.2s;
}
.dock-item.running::before { background: rgba(255, 255, 255, 0.75); }
.dock-item.active::before { background: #fff; width: 16px; margin-left: -8px; border-radius: 3px; box-shadow: 0 0 10px var(--accent-glow); }
.dock-item.minimized .dock-img { opacity: 0.6; }
.dock-item::after { /* Tooltip */
  content: attr(data-label); position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(4px); white-space: nowrap; padding: 4px 10px; border-radius: 8px; font-size: 12px; color: #fff;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent); border: 1px solid rgba(255, 255, 255, 0.12); opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.dock-item:hover::after { opacity: 1; transform: translateX(-50%); }

/* ── Fenster ──────────────────────────────────────────── */
.win {
  position: absolute; display: flex; flex-direction: column; min-width: 0; max-width: 100%; max-height: 100%;
  border-radius: var(--r-lg); overflow: hidden; overflow: clip; background: var(--bg-1);
  border: 1px solid var(--line-strong); box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.75);
  animation: win-in 0.2s var(--ease);
}
.win.active { border-color: var(--accent-line); box-shadow: 0 24px 70px -16px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--accent-soft), 0 0 50px -28px var(--accent-glow); }
.win.min { display: none; }
.win.max { inset: 0 !important; width: auto !important; height: auto !important; border-radius: 0; border-width: 0; }
.win.closing { animation: win-out 0.15s forwards; }
@keyframes win-in { from { opacity: 0; transform: scale(0.97) translateY(8px); } }
@keyframes win-out { to { opacity: 0; transform: scale(0.97); } }

.win-title {
  display: flex; align-items: center; gap: 10px; height: 38px; padding-left: 12px; flex: none; user-select: none; touch-action: none;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2)); border-bottom: 1px solid var(--line);
}
.win:not(.active) .win-title { background: var(--bg-2); color: var(--text-3); }
.win-title > svg { width: 16px; height: 16px; color: var(--accent-hi); flex: none; }
.win-title .wt { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-btns { display: flex; align-self: stretch; position: relative; z-index: 4; }
.win-btn { width: 46px; border: 0; background: none; color: var(--text-2); display: grid; place-items: center; cursor: default; transition: background 0.12s; }
.win-btn svg { width: 15px; height: 15px; }
.win-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.win-btn.close:hover { background: #e5484d; }
.win-bar { display: flex; align-items: center; gap: 12px; padding: 8px 18px; min-height: 48px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-0) 55%, transparent); flex: none; }
.win-bar .subtitle { flex: 1; min-width: 0; color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.win-content { container-type: inline-size; flex: 1; min-height: 0; overflow: auto; padding: 22px; background: radial-gradient(700px 300px at 90% -10%, var(--accent-soft), transparent 70%), var(--bg-1); }
.view { animation: view-in 0.28s var(--ease); max-width: 1280px; margin: 0 auto; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.win-resize { position: absolute; z-index: 3; touch-action: none; }
.win-resize.n { top: 0; left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.win-resize.s { bottom: 0; left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.win-resize.e { right: 0; top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.win-resize.w { left: 0; top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.win-resize.ne { top: 0; right: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.win-resize.nw { top: 0; left: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.win-resize.se { bottom: 0; right: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.win-resize.sw { bottom: 0; left: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.win.max .win-resize { display: none; }

/* ── App-Menü (aus dem Logo-Knopf oben links) ───────────── */
.start-menu {
  position: absolute; z-index: 50001; left: 6px; top: calc(var(--panel-h) + 6px); width: min(380px, calc(100vw - 12px));
  max-height: calc(100vh - var(--panel-h) - var(--dock-h) - 16px); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--bg-2) 90%, transparent); backdrop-filter: blur(26px) saturate(1.4); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: var(--shadow-2), 0 0 60px -34px var(--accent-glow);
  animation: menu-in 0.18s var(--ease);
}
.start-menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-10px); } }
.start-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px; }
.start-list { overflow-y: auto; padding: 4px 10px 10px; min-height: 0; }
.start-section { margin: 10px 8px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.start-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--text); text-align: left; cursor: default; }
.start-item:hover { background: rgba(255, 255, 255, 0.09); }
.start-item .si-img { width: 34px; height: 34px; border-radius: 10px; flex: none; } .start-item .si-img svg { width: 18px; height: 18px; }
.start-item .si-sub { color: var(--text-3); font-size: 11.5px; }
.start-item .nav-badge { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 99px; font-size: 11px; font-weight: 700; text-align: center; background: var(--warn); color: #1a1200; }
.start-foot { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: color-mix(in srgb, var(--bg-0) 50%, transparent); border-top: 1px solid var(--line); }
.start-foot .uc-text { flex: 1; min-width: 0; } .start-foot .uc-name { font-weight: 600; font-size: 13px; } .start-foot .uc-role { font-size: 11px; color: var(--text-3); }

/* ── Marke ────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; padding: 7px 6px; border-radius: 12px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent2) 55%, var(--accent-lo))); box-shadow: 0 6px 20px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-text { min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Anmeldebildschirm ────────────────────────────────── */
.lock { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.lock-clock { position: absolute; z-index: 2; left: 36px; bottom: 30px; pointer-events: none; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
.lock-clock .lc-time { font-size: 64px; font-weight: 200; line-height: 1; letter-spacing: -0.01em; }
.lock-clock .lc-date { margin-top: 6px; font-size: 16px; color: var(--text-2); }
.lock-card {
  width: min(440px, 100%); padding: 32px; border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--bg-1) 74%, transparent); backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: var(--shadow-2), 0 0 90px -40px var(--accent-glow); animation: view-in 0.4s var(--ease);
}
.lock-card .brand { padding: 0 0 22px; justify-content: center; flex-direction: column; text-align: center; gap: 12px; }
.lock-card .brand-mark { width: 150px; height: auto; padding: 0; background: none; box-shadow: none; border-radius: 0; }
.lock-card .brand-mark .logo-phoenix { aspect-ratio: 1380 / 1130; background-size: 100% auto; filter: drop-shadow(0 6px 24px var(--accent-glow)); }
.custom-logo .lock-card .brand-mark .logo-phoenix { aspect-ratio: 3 / 2; background-size: contain; background-position: center; }
.lock-card .brand-name { font-size: 22px; }
.lock-card h2 { font-size: 17px; margin-bottom: 4px; }
.lock-card .lead { color: var(--text-2); margin-bottom: 20px; }
.lock-links { display: flex; justify-content: center; gap: 6px; margin-top: 18px; color: var(--text-3); font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-hi); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
@keyframes fade { from { opacity: 0; } }

/* Sperrbildschirm */
.lock-overlay { position: absolute; inset: 0; z-index: 200000; animation: fade 0.2s; }
.is-locked .desktop, .is-locked .desk-widget, .is-locked .modal-root, .is-locked .notif-panel, .is-locked .start-menu, .is-locked .toasts { visibility: hidden; }

/* Modals/Toasts immer über Fenstern, Leiste und Dock */
.modal-root { z-index: 100000 !important; }
.toasts { z-index: 100001 !important; top: calc(var(--panel-h) + 10px) !important; bottom: auto !important; right: 12px !important; }

/* ── Schmale Bildschirme: Fenster immer maximiert ─────── */
@media (max-width: 700px) {
  .screen { --dock-h: calc(var(--dock-size) + 22px); }
  .win { inset: 0 !important; width: auto !important; height: auto !important; border-radius: 0; border-width: 0; }
  .win-resize, .win-btn.max { display: none; }
  .win-content { padding: 16px 14px; }
  .panel-user, .desk-widget { display: none; }
  .dock-item:hover { transform: none; } .dock-item::after { display: none; }
  .lock-clock { display: none; }
}
.panel-btn .bell-badge[hidden] { display: none; }
.lock-card .lead svg { width: 16px; height: 16px; }

/* ── Sperrbildschirm (minimal, dunkel, Logo mit Glühen) ── */
.lock-overlay.ls { display: grid; place-items: center; background:
  radial-gradient(520px 340px at 50% 24%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
  radial-gradient(900px 600px at 50% 110%, color-mix(in srgb, var(--accent2) 10%, transparent), transparent 70%),
  var(--bg-0); }
.ls-inner { display: flex; flex-direction: column; align-items: center; width: min(520px, 100%); padding: 24px; text-align: center; animation: view-in 0.5s var(--ease); }
.ls-logo { width: 96px; margin-bottom: 26px; filter: drop-shadow(0 0 26px var(--accent-glow)) drop-shadow(0 0 60px var(--accent-glow)); }
.ls-time { font-size: clamp(64px, 12vw, 104px); font-weight: 200; line-height: 1; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.ls-date { margin-top: 10px; color: var(--text-2); font-size: 16px; letter-spacing: 0.02em; }
.ls-id { margin: 30px 0 14px; display: inline-flex; align-items: center; gap: 8px; color: var(--accent-hi); font-weight: 600; letter-spacing: 0.06em; }
.ls-id svg { width: 15px; height: 15px; }
.ls-form { display: flex; gap: 8px; width: 100%; max-width: 420px; }
.ls-input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--bg-3); color: var(--text); font: inherit; letter-spacing: 0.08em; text-align: center; }
.ls-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ls-btn { height: 44px; padding: 0 22px; border: 0; border-radius: var(--r-md); cursor: pointer; font-weight: 700; color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-lo)); box-shadow: 0 8px 22px -10px var(--accent-glow); }
.ls-btn:hover { filter: brightness(1.1); } .ls-btn:disabled { opacity: 0.6; }
.ls-error { min-height: 20px; margin-top: 10px; color: var(--err); font-size: 13px; }
.ls-out { margin-top: 18px; color: var(--text-3); font-size: 12.5px; } .ls-out b { color: var(--text-2); font-weight: 600; }
.ls-link { background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; } .ls-link:hover { color: var(--text); }
.ls-input.shake { animation: shake 0.35s; } @keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@media (max-width: 480px) { .ls-form { flex-direction: column; } .ls-btn { width: 100%; } }

/* Live-Uhr: Sekunden dezent hinter den Minuten */
.dw-time .dw-sec { font-size: 0.34em; font-weight: 300; opacity: 0.6; margin-left: 4px; }
.lock-clock .lc-time, .ls-time, .panel-clock { font-variant-numeric: tabular-nums; }
