/* --- DESIGN (Apple macOS Sequoia / visionOS Theme) --- */
:root {
    --bg-gradient-start: #0f172a; 
    --bg-gradient-end: #020617;
    --glass-bg: rgba(15, 23, 42, 0.68); 
    --glass-window: #0f172a;
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
    --accent-color: #38bdf8; 
    --accent-glow: rgba(56, 189, 248, 0.45);
    --private-color: #f43f5e; 
    --private-glow: rgba(244, 63, 94, 0.45);
    --text-main: #f8fafc; 
    --text-muted: #94a3b8;
    --apple-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

body { 
    margin: 0; padding: 0; height: 100vh; width: 100vw; overflow: hidden; 
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    background: 
        radial-gradient(circle at 18% 18%, rgba(56, 189, 248, 0.14) 0%, transparent 45%),
        radial-gradient(circle at 82% 80%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 0%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-main); 
    -webkit-user-select: none; user-select: none; 
    -webkit-tap-highlight-color: transparent; 
    -webkit-font-smoothing: antialiased;
}

* { scrollbar-width: none; box-sizing: border-box; } 
*::-webkit-scrollbar { display: none; }

/* --- SVG ICON SYSTEM --- */
.svg-icon {
    width: 22px; height: 22px;
    display: block; flex-shrink: 0;
    pointer-events: none;
}
.svg-icon-sm {
    width: 16px; height: 16px;
    display: block; flex-shrink: 0;
    pointer-events: none;
}
.btn-with-icon {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.modal-header-icon {
    width: 54px; height: 54px; border-radius: 16px;
    background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.28);
    color: var(--accent-color);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* --- TOP BAR (Uhrzeit, Datum, Schnellsuche & Handbuch-Button) --- */
.top-bar {
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px; padding: 6px 14px 6px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--glass-border); border-radius: 999px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), var(--glass-highlight);
    z-index: 9999; font-size: 0.85rem; color: var(--text-main);
    transition: transform 0.3s var(--apple-spring), box-shadow 0.3s ease;
}
.top-bar:hover {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5), var(--glass-highlight);
}
.top-bar-date { color: var(--text-muted); font-weight: 500; }
.top-bar-clock { font-weight: 600; color: var(--text-main); letter-spacing: 0.4px; }
.top-bar-sep { color: rgba(255,255,255,0.18); }

.top-bar-actions {
    display: flex; align-items: center; gap: 6px;
}
.top-bar-icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-main);
    width: 26px; height: 26px;
    border-radius: 50%;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--apple-spring);
}
.top-bar-icon-btn .svg-icon {
    width: 14px; height: 14px;
}
.top-bar-icon-btn:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: var(--accent-color);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 14px var(--accent-glow);
}
.top-bar-icon-btn:active {
    transform: scale(0.95);
}

/* --- SPOTLIGHT SEARCH MODAL --- */
.spotlight-box {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 20px;
    width: 90%; max-width: 540px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.75), var(--glass-highlight);
    display: flex; flex-direction: column;
    animation: openWindow 0.3s var(--apple-spring);
}
.spotlight-input-wrapper {
    display: flex; align-items: center; padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08); gap: 12px;
}
.spotlight-icon { color: var(--text-muted); display: flex; align-items: center; }
.spotlight-icon .svg-icon { width: 20px; height: 20px; }
#spotlightInput {
    margin: 0; padding: 0; border: none; background: transparent;
    text-align: left; font-size: 1.1rem; color: var(--text-main); width: 100%;
    box-shadow: none;
}
.spotlight-results {
    max-height: 340px; overflow-y: auto; display: flex; flex-direction: column;
    padding: 8px;
}
.spotlight-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-radius: 12px; cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease; gap: 12px;
}
.spotlight-item:hover, .spotlight-item.selected {
    background: rgba(56, 189, 248, 0.2);
}
.spotlight-item-left {
    display: flex; align-items: center; gap: 12px; overflow: hidden;
}
.spotlight-item-left img {
    width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.spotlight-svg-wrap {
    width: 30px; height: 30px; border-radius: 8px;
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    color: var(--accent-color);
}
.spotlight-item-title {
    font-size: 0.95rem; font-weight: 500; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spotlight-item-badge {
    font-size: 0.72rem; color: var(--text-muted); padding: 3px 9px;
    border-radius: 999px; background: rgba(255,255,255,0.08); flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 5px;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 999999;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--glass-border);
    color: var(--text-main); padding: 12px 20px; border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.45), var(--glass-highlight);
    display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 500;
    transform: translateX(120%); transition: transform 0.45s var(--apple-spring);
}
.toast.show { transform: translateX(0); }
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid var(--private-color); }
.toast-icon { display: flex; align-items: center; justify-content: center; }
.toast.success .toast-icon { color: #10b981; }
.toast.error .toast-icon { color: var(--private-color); }

/* --- DOCK (Apple macOS Glass Dock) --- */
.dock-container {
    position: fixed; bottom: 18px; left: 50%; 
    transform: translateX(-50%) translateY(14px) scale(0.86);
    opacity: 0.65;
    display: flex; gap: 14px; padding: 12px 22px;
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border-radius: 26px; border: 1px solid var(--glass-border);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), var(--glass-highlight);
    z-index: 10000; align-items: center;
    transform-origin: bottom center;
    transition: all 0.45s var(--apple-spring);
}

@media (hover: hover) {
    .dock-container:hover {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

.dock-separator { width: 1px; height: 38px; background: rgba(255,255,255,0.14); margin: 0 4px; flex-shrink: 0; }

.dock-item {
    width: 58px; height: 58px; border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 4px 12px rgba(0,0,0,0.25);
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    transition: transform 0.35s var(--apple-spring), background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease; 
    position: relative; border: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
    color: var(--text-main);
}

.dock-item.dragging { opacity: 0.4; border: 1px dashed var(--accent-color); }
.dock-item.drag-over { transform: scale(1.12); border-color: var(--accent-color); background: rgba(56, 189, 248, 0.2); }
.dock-item:hover:not(.dragging) {
    transform: translateY(-10px) scale(1.16);
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 14px 28px rgba(0,0,0,0.45), 0 0 18px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.3);
    z-index: 10;
}
.dock-item:active:not(.dragging) {
    transform: translateY(-4px) scale(1.05);
}
.dock-item.private-app { border-color: rgba(244, 63, 94, 0.35); }
.dock-item.private-app:hover { border-color: var(--private-color); box-shadow: 0 14px 28px rgba(0,0,0,0.45), 0 0 20px var(--private-glow); }
.dock-item img { width: 72%; height: 72%; object-fit: cover; pointer-events: none; border-radius: 11px; }

@media (hover: hover) {
    .dock-item:hover::after {
        content: attr(data-title); position: absolute; top: -42px; left: 50%; transform: translateX(-50%);
        background: rgba(15, 23, 42, 0.92);
        border: 1px solid var(--glass-border); color: var(--text-main);
        padding: 5px 10px; border-radius: 8px; font-size: 11px; font-weight: 600;
        white-space: nowrap; opacity: 0; animation: fadeIn 0.2s var(--apple-spring) forwards;
        pointer-events: none; box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    }
}
@keyframes fadeIn { to { opacity: 1; } }

.dock-indicator { position: absolute; bottom: -7px; width: 5px; height: 5px; background-color: var(--text-main); border-radius: 50%; box-shadow: 0 0 8px var(--accent-glow); opacity: 0; transition: opacity 0.3s; }
.dock-item.running .dock-indicator { opacity: 0.9; }

.lock-btn { background: rgba(0,0,0,0.22); color: var(--text-muted); }
.lock-btn.unlocked { color: var(--private-color); filter: drop-shadow(0 0 8px var(--private-glow)); }
.add-app-btn { color: var(--accent-color); background: rgba(56, 189, 248, 0.08); border: 1px dashed rgba(56, 189, 248, 0.35); }
.note-btn { color: #fde047; background: rgba(253, 224, 71, 0.1); }
.note-btn:hover { border-color: #fef08a !important; box-shadow: 0 0 20px rgba(253, 224, 71, 0.45) !important; }
.trash-btn { color: #fca5a5; background: rgba(239, 68, 68, 0.1); }
.trash-btn:hover { border-color: #fca5a5 !important; box-shadow: 0 0 20px rgba(239, 68, 68, 0.45) !important; }
.backup-btn { color: #6ee7b7; background: rgba(16, 185, 129, 0.12); }
.backup-btn:hover { border-color: #6ee7b7 !important; box-shadow: 0 0 20px rgba(16, 185, 129, 0.45) !important; }

/* --- STICKY NOTES, AUFFÄCHERNDE FARBPUNKTE & PRIVACY-BLUR --- */
.sticky-note {
    position: absolute; width: 225px; height: 225px; min-width: 160px; min-height: 140px;
    background: #fef08a; border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.6);
    display: flex; flex-direction: column; color: #1e293b;
    animation: popIn 0.35s var(--apple-spring);
    overflow: hidden; transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
.sticky-note.note-yellow { background: #fef08a; }
.sticky-note.note-yellow .note-header { background: rgba(250, 204, 21, 0.45); }
.sticky-note.note-blue { background: #bae6fd; }
.sticky-note.note-blue .note-header { background: rgba(56, 189, 248, 0.35); }
.sticky-note.note-green { background: #bbf7d0; }
.sticky-note.note-green .note-header { background: rgba(74, 222, 128, 0.35); }
.sticky-note.note-pink { background: #fbcfe8; }
.sticky-note.note-pink .note-header { background: rgba(244, 114, 182, 0.35); }

.note-header {
    height: 32px; background: rgba(250, 204, 21, 0.45); cursor: grab;
    display: flex; justify-content: space-between; align-items: center; padding: 0 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: background-color 0.25s ease; flex-shrink: 0;
}
.note-header:active { cursor: grabbing; }

/* Auffächernde Farb-Punkte hinter einem unscheinbaren Punkt */
.note-colors {
    display: flex; align-items: center; position: relative;
    height: 22px; padding: 0 4px;
}
.note-color-trigger {
    width: 9px; height: 9px; border-radius: 50%;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.45);
    transition: all 0.25s var(--apple-spring);
    flex-shrink: 0;
}
.note-color-dot {
    width: 12px; height: 12px; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(0,0,0,0.22);
    opacity: 0; transform: scale(0.3);
    margin-left: -12px; pointer-events: none;
    transition: all 0.32s var(--apple-spring);
    flex-shrink: 0;
}
.note-colors:hover .note-color-trigger {
    opacity: 0; transform: scale(0); width: 0; margin: 0; border: none;
}
.note-colors:hover .note-color-dot {
    opacity: 1; transform: scale(1);
    margin-left: 6px; pointer-events: auto;
}
.note-colors:hover .note-color-dot.yellow {
    margin-left: 0;
}
.note-color-dot:hover { transform: scale(1.28) !important; }
.note-color-dot.yellow { background: #fde047; }
.note-color-dot.blue { background: #38bdf8; }
.note-color-dot.green { background: #4ade80; }
.note-color-dot.pink { background: #f472b6; }

.note-header-right { display: flex; align-items: center; gap: 6px; }
.note-todo-btn, .note-close {
    cursor: pointer; color: rgba(15, 23, 42, 0.55);
    background: rgba(255,255,255,0.3); border: 1px solid rgba(0,0,0,0.08);
    border-radius: 6px; width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s var(--apple-spring);
}
.note-todo-btn svg, .note-close svg { width: 13px; height: 13px; pointer-events: none; }
.note-todo-btn:hover { background: rgba(255,255,255,0.7); color: #0f172a; transform: scale(1.08); }
.note-close:hover { background: rgba(239, 68, 68, 0.2); color: #dc2626; border-color: rgba(220, 38, 38, 0.3); transform: scale(1.08); }

/* Privacy-Blur: Nur die 1. Zeile (bis 36px Höhe) ist ohne Mouseover scharf lesbar */
.note-body {
    position: relative; flex-grow: 1; display: flex; flex-direction: column; overflow: hidden;
}
.note-content {
    flex-grow: 1; padding: 12px 16px; outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    font-size: 0.95rem; line-height: 22px; word-wrap: break-word; overflow-y: auto;
    -webkit-user-select: text; user-select: text;
}
.note-body::after {
    content: "";
    position: absolute;
    top: 36px; left: 0; right: 0; bottom: 0;
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    mask-image: linear-gradient(to bottom, transparent 0px, black 8px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 8px);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s var(--apple-spring);
    z-index: 5;
}
.sticky-note:hover .note-body::after,
.sticky-note:focus-within .note-body::after {
    opacity: 0;
}

.note-resize-handle {
    position: absolute; right: 0; bottom: 0; width: 16px; height: 16px;
    cursor: nwse-resize; z-index: 15;
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.22) 50%);
    border-bottom-right-radius: 10px;
}
.note-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.45) 50%);
}
@keyframes popIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- TRASH & CRUMPLED NOTES --- */
.trash-search {
    width: 90%; max-width: 500px; margin: 20px auto; padding: 12px 16px;
    background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
    color: white; border-radius: 12px; font-size: 0.95rem; outline: none;
    transition: border-color 0.3s, background 0.3s;
}
.trash-search:focus { border-color: var(--accent-color); background: rgba(255,255,255,0.1); }

.trash-grid {
    display: flex; flex-wrap: wrap; gap: 15px; padding: 20px 40px;
    overflow-y: auto; align-items: flex-start; justify-content: center;
    flex-grow: 1;
}

.crumpled-note {
    position: relative; width: 140px; height: 140px;
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, transparent 40%, rgba(0,0,0,0.15) 100%), #fef08a;
    box-shadow: 2px 5px 12px rgba(0,0,0,0.4), inset 0 0 15px rgba(0,0,0,0.1);
    border-radius: 6px 14px 8px 16px;
    padding: 15px; color: #333; font-size: 0.85rem; overflow: hidden;
    cursor: pointer; margin: -5px;
    transition: all 0.4s var(--apple-spring);
    transform-origin: center center;
}
.crumpled-note.note-blue {
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, transparent 40%, rgba(0,0,0,0.15) 100%), #bae6fd;
}
.crumpled-note.note-green {
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, transparent 40%, rgba(0,0,0,0.15) 100%), #bbf7d0;
}
.crumpled-note.note-pink {
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, transparent 40%, rgba(0,0,0,0.15) 100%), #fbcfe8;
}
.crumpled-note::after {
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.03) 10px, rgba(0,0,0,0.03) 12px);
    pointer-events: none;
}
.crumpled-note:hover {
    transform: scale(1.12) rotate(0deg) !important;
    box-shadow: 5px 15px 25px rgba(0,0,0,0.6);
    z-index: 999 !important;
}
.crumpled-note.filtered-out {
    opacity: 0 !important;
    transform: scale(0) !important;
    margin: -70px !important;
    pointer-events: none;
}
.crumpled-action-btn {
    position: absolute; top: 6px; width: 22px; height: 22px;
    border-radius: 6px; background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 20; transition: all 0.2s ease;
}
.crumpled-action-btn svg { width: 13px; height: 13px; pointer-events: none; }
.crumpled-action-btn.restore { right: 6px; color: #059669; }
.crumpled-action-btn.restore:hover { background: #10b981; color: #fff; }
.crumpled-action-btn.delete { right: 32px; color: #dc2626; }
.crumpled-action-btn.delete:hover { background: #ef4444; color: #fff; }

/* --- WINDOW (Apple macOS Window + GPU-optimiert) --- */
.window {
    position: absolute; width: 900px; height: 720px; min-width: 360px; min-height: 240px;
    background: var(--glass-window);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 70px rgba(0,0,0,0.65), var(--glass-highlight);
    display: flex; flex-direction: column; overflow: hidden;
    animation: openWindow 0.35s var(--apple-spring);
    transition: width 0.3s var(--apple-spring), height 0.3s var(--apple-spring), top 0.3s var(--apple-spring), left 0.3s var(--apple-spring), border-radius 0.3s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.window.dragging, .window.resizing {
    transition: none !important;
}
.window.active {
    border-color: rgba(255, 255, 255, 0.26);
    box-shadow: 0 35px 95px rgba(0,0,0,0.82), 0 0 0 0.5px rgba(255,255,255,0.15), var(--glass-highlight);
    z-index: 100;
}
.window.private-window.active {
    border-color: rgba(244, 63, 94, 0.5);
    box-shadow: 0 35px 95px rgba(0,0,0,0.85), 0 0 28px rgba(244, 63, 94, 0.18), var(--glass-highlight);
}
.window.attention { animation: shake 0.4s ease-in-out; }
.window.minimized { display: none !important; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes openWindow { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.window-header {
    height: 44px;
    background: linear-gradient(to bottom, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96));
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; cursor: grab;
}
.window-header:active { cursor: grabbing; }
.window-title {
    color: var(--text-main); opacity: 0.85; font-size: 13.5px; font-weight: 600;
    letter-spacing: 0.3px; pointer-events: none;
    display: inline-flex; align-items: center; gap: 6px;
}
.window-title svg { width: 13px; height: 13px; color: var(--private-color); }
.window-controls { display: flex; gap: 8px; width: 68px; align-items: center; }
.window-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; width: 68px; }
.window-external-btn {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted); border-radius: 7px; width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none; transition: all 0.2s var(--apple-spring);
    padding: 0;
}
.window-external-btn svg { width: 13px; height: 13px; pointer-events: none; }
.window-external-btn:hover {
    color: var(--text-main); border-color: rgba(255,255,255,0.3);
    background: rgba(255, 255, 255, 0.14); transform: scale(1.06);
}

/* macOS Traffic Light Dots */
.control-dot {
    width: 13px; height: 13px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    position: relative; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.25);
    transition: transform 0.15s var(--apple-spring), filter 0.15s ease;
}
.control-dot::before {
    font-size: 10px; font-weight: 800; color: rgba(0, 0, 0, 0.65);
    opacity: 0; transition: opacity 0.15s ease; line-height: 1;
}
.window-controls:hover .control-dot::before { opacity: 1; }
.close-dot { background: #ff5f56; }
.close-dot::before { content: "×"; font-size: 11px; }
.min-dot { background: #ffbd2e; }
.min-dot::before { content: "−"; }
.max-dot { background: #27c93f; }
.max-dot::before { content: "+"; }

.window-content { flex-grow: 1; position: relative; background: #0b0f19; overflow: hidden; }
.drag-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; display: none; }
.window.dragging .drag-overlay, .window.resizing .drag-overlay { display: block; } 
iframe { width: calc(100% + 18px); height: 100%; border: none; background: #fff; z-index: 20; position: relative; }

.window-resize-handle {
    position: absolute; right: 0; bottom: 0; width: 18px; height: 18px;
    cursor: nwse-resize; z-index: 30;
    background: linear-gradient(135deg, transparent 50%, rgba(148, 163, 184, 0.35) 50%);
    border-bottom-right-radius: 14px;
}
.window-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, var(--accent-color) 50%);
}

/* --- LOADER --- */
.loader {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 38px; height: 38px;
    border: 3px solid rgba(255,255,255,0.1); border-top: 3px solid var(--accent-color);
    border-radius: 50%; animation: spin 0.85s linear infinite; z-index: 25;
    pointer-events: none; transition: opacity 0.25s ease;
}
@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* --- MODALS & APPLE LOCKSCREEN PIN --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99999; justify-content: center; align-items: center;
    animation: fadeIn 0.25s var(--apple-spring);
}
.modal-box {
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    padding: 30px; border-radius: 22px;
    border: 1px solid var(--glass-border);
    text-align: center; width: 340px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), var(--glass-highlight);
    position: relative; animation: openWindow 0.3s var(--apple-spring);
}
.modal-box h3 { color: var(--text-main); margin-top: 0; font-weight: 600; font-size: 1.05rem; letter-spacing: 0.5px; margin-bottom: 20px; }
input[type="text"], input[type="password"] {
    width: 100%; margin-bottom: 14px; padding: 12px 14px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
    color: white; border-radius: 12px; outline: none; font-size: 1rem;
    text-align: center; transition: all 0.25s var(--apple-spring);
}
input:focus { border-color: var(--accent-color); background: rgba(255,255,255,0.1); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2); }
.checkbox-wrapper { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; color: var(--text-muted); font-size: 0.92rem; }
.btn { padding: 11px 20px; border-radius: 12px; border: none; cursor: pointer; font-weight: 600; margin: 4px; font-size: 0.92rem; transition: all 0.2s var(--apple-spring); -webkit-appearance: none; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent-color); color: #020617; }
.btn-secondary { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: var(--text-muted); }

/* Minimalistisches Apple Lockscreen PIN-Modal */
.pin-modal-box {
    width: 280px; padding: 28px 24px 24px;
}
.pin-lock-icon {
    color: var(--accent-color); margin-bottom: 10px;
    display: flex; justify-content: center;
    filter: drop-shadow(0 4px 12px var(--accent-glow));
}
.pin-subtitle {
    color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
    margin: 0 0 18px 0; letter-spacing: 0.3px;
}
#pinInput {
    letter-spacing: 8px; font-weight: 700; font-size: 1.5rem;
    margin-bottom: 0; padding: 10px 14px; border-radius: 14px;
    background: rgba(0, 0, 0, 0.28);
}
.pin-shake {
    animation: shake 0.4s ease-in-out !important;
    border-color: var(--private-color) !important;
}

/* ========================================= */
/* === MOBILE OPTIMIZATION (iPhone 16 Pro Max) === */
/* ========================================= */
@media (max-width: 768px) {
    .top-bar {
        top: calc(6px + env(safe-area-inset-top));
        padding: 4px 10px 4px 12px; font-size: 0.78rem; gap: 8px;
    }
    .top-bar-icon-btn {
        width: 24px; height: 24px;
    }

    .dock-container {
        width: auto; max-width: 96%; 
        bottom: calc(10px + env(safe-area-inset-bottom));
        justify-content: flex-start; overflow-x: auto;
        padding: 8px 12px; gap: 8px; border-radius: 20px;
        -ms-overflow-style: none; scrollbar-width: none;
        transform: translateX(-50%) scale(1) translateY(0); opacity: 1;
    }
    .dock-container::-webkit-scrollbar { display: none; }
    
    .dock-item { width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0; }
    .dock-item img { width: 68%; height: 68%; }
    .dock-item .svg-icon { width: 19px; height: 19px; }
    
    .dock-separator { height: 25px; margin: 0 2px; }
    .dock-indicator { bottom: -4px; width: 4px; height: 4px; }

    .dock-item[draggable="true"] { touch-action: pan-x; }

    .window { width: 100% !important; height: 100% !important; top: 0 !important; left: 0 !important; border-radius: 0; border: none; min-width: 0; min-height: 0; }
    .window-header { padding-top: calc(10px + env(safe-area-inset-top)); height: calc(50px + env(safe-area-inset-top)); background: rgba(15, 23, 42, 0.95); }
    .min-dot, .max-dot, .window-resize-handle { display: none; }
    .close-dot { width: 28px; height: 28px; background: #ef4444 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E") center/60% no-repeat; }
    .close-dot::before { display: none; }
    .window { resize: none; }
    .modal-box { width: 90%; }
}