/* ==========================================================
   Coolblue App Hub — Redesigned Stylesheet
   Dual theme: light (default) + dark
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

/* ── Light Theme Tokens ─────────────────────────────────── */
:root,
[data-theme="light"] {
    --accent: #0090e3;
    --accent-dim: #0077c2;
    --accent-deep: #005a94;
    --accent-glow: rgba(0, 144, 227, 0.15);
    --accent-subtle: rgba(0, 144, 227, 0.06);

    --bg-body: #f5f7fa;
    --bg-sidebar: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f0f4f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f5f7fa;
    --bg-topbar: rgba(255, 255, 255, 0.75);
    --bg-hero: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 50%, #e1f0fc 100%);
    --bg-modal: rgba(0, 0, 0, 0.25);

    --text-primary: #1a2332;
    --text-secondary: #5a6778;
    --text-muted: #8e99a8;
    --text-inverse: #ffffff;

    --border: #e4e9f0;
    --border-light: #f0f2f5;
    --border-accent: rgba(0, 144, 227, 0.2);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.08);

    --glass: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.8);

    --error: #e53e3e;
    --error-bg: #fef2f2;
    --success: #38a169;
    --success-bg: #f0fff4;

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ── Dark Theme Tokens ──────────────────────────────────── */
[data-theme="dark"] {
    --accent: #5db8f5;
    --accent-dim: #4aa8e8;
    --accent-deep: #3a98d8;
    --accent-glow: rgba(93, 184, 245, 0.12);
    --accent-subtle: rgba(93, 184, 245, 0.05);

    --bg-body: #0a1628;
    --bg-sidebar: #0e1b33;
    --bg-surface: #0e1b33;
    --bg-surface-hover: #152543;
    --bg-card: rgba(21, 37, 67, 0.6);
    --bg-card-hover: rgba(30, 50, 85, 0.7);
    --bg-input: #0a1628;
    --bg-topbar: rgba(10, 22, 40, 0.7);
    --bg-hero: linear-gradient(135deg, #0e1b33 0%, #0a1628 50%, #101f3a 100%);
    --bg-modal: rgba(0, 0, 0, 0.5);

    --text-primary: #e2eaff;
    --text-secondary: #8da0c4;
    --text-muted: #5a6e8f;
    --text-inverse: #0a1628;

    --border: #1e2f50;
    --border-light: #162340;
    --border-accent: rgba(93, 184, 245, 0.15);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.35);

    --glass: rgba(14, 27, 51, 0.6);
    --glass-border: rgba(30, 47, 80, 0.5);

    --error: #fc8181;
    --error-bg: #2d1515;
    --success: #68d391;
    --success-bg: #152d15;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==========================================================
   AUTH PAGES (Login / Register / Change Password)
   ========================================================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg-body);
}

.auth-container {
    max-width: 420px;
    width: 100%;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-md);
    position: relative;
    animation: fadeUp 0.4s ease-out;
    border: 1px solid var(--border-light);
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 0 0 4px 4px;
}

.auth-container h1 {
    color: var(--accent);
    font-family: 'Manrope', sans-serif;
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-container .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
    line-height: 1.5;
}

.auth-container form { margin-top: 28px; }

.auth-container label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.auth-container input[type="email"],
.auth-container input[type="password"],
.auth-container input[type="text"] {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-input);
    margin-bottom: 18px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.auth-container input:focus {
    border-color: var(--accent);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-container input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-container button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.auth-container button[type="submit"]:hover {
    background: var(--accent-dim);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.auth-container button[type="submit"]:active {
    transform: scale(0.985);
}

.auth-link {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    color: var(--accent-dim);
    text-decoration: underline;
}

.alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

/* ==========================================================
   HUB LAYOUT
   ========================================================== */
.hub-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg-body);
}

/* ── Sidebar Navigation (left) ─────────────────────────── */
.sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 16px 20px;
    z-index: 40;
    transition: background 0.3s, border-color 0.3s;
}

.sidebar-nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.sidebar-nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.nav-link .material-symbols-outlined {
    font-size: 20px;
}

/* ── Sidebar Catalog ───────────────────────────────────── */
.sidebar-catalog {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
    min-height: 0;
}

.catalog-title {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.catalog-search {
    padding: 0 12px;
    margin-bottom: 8px;
}

.catalog-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    color: var(--text-primary);
    background: var(--bg-input);
    outline: none;
    transition: border-color 0.2s;
}

.catalog-search input:focus {
    border-color: var(--accent);
}

.catalog-search input::placeholder {
    color: var(--text-muted);
}

.catalog-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.catalog-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: grab;
    transition: background 0.15s, opacity 0.15s;
    user-select: none;
}

.catalog-item:hover {
    background: var(--bg-surface-hover);
}

.catalog-item.placed {
    opacity: 0.4;
    cursor: default;
}

.catalog-item.dragging {
    opacity: 0.3;
}

.catalog-item-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.catalog-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.catalog-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-item-desc {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-item-status {
    flex-shrink: 0;
    color: var(--text-muted);
    display: flex;
}

.catalog-item.placed .catalog-item-status {
    color: var(--success);
}

.sidebar-nav-footer {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* sidebar-edit-btn removed — catalog is always visible */

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-logout {
    color: var(--text-muted);
    transition: color 0.15s;
}

.user-logout:hover {
    color: var(--error);
}

.user-logout .material-symbols-outlined {
    font-size: 18px;
}

/* ── Main Content ──────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* ── Top Bar ───────────────────────────────────────────── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    transition: background 0.3s, border-color 0.3s;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.top-bar-tabs {
    display: flex;
    gap: 4px;
}

.tab-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    letter-spacing: -0.2px;
}

.tab-link:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.tab-link.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-muted);
}

.search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 8px 16px 8px 40px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    width: 220px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, width 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    width: 280px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ── Theme Toggle ──────────────────────────────────────── */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    position: relative;
}

.theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--accent);
    border-color: var(--border-accent);
}

.theme-toggle .material-symbols-outlined { font-size: 20px; }

[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }

/* ── Content Area ──────────────────────────────────────── */
.content-area {
    padding: 32px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    animation: fadeUp 0.5s ease-out;
}

/* ── Hero Section ──────────────────────────────────────── */
.hero-section {
    position: relative;
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    margin-bottom: 40px;
    background: var(--bg-hero);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-family: 'Manrope', sans-serif;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    max-width: 440px;
    line-height: 1.6;
}

.hero-subtitle strong {
    color: var(--accent);
    font-weight: 600;
}

.hero-glow {
    position: absolute;
    top: -40%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Apps Section ──────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
}

.section-title {
    font-family: 'Manrope', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Category Sections ─────────────────────────────────── */
.cat-section {
    margin-bottom: 32px;
}

.cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.cat-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.cat-color-dot:hover {
    transform: scale(1.4);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.cat-title {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.cat-title-input {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--accent);
    border-radius: 4px;
    padding: 4px 8px;
    outline: none;
    width: 200px;
}

.cat-edit-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.cat-section:hover .cat-edit-actions {
    opacity: 1;
}

.cat-action-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.cat-action-btn .material-symbols-outlined { font-size: 16px; }

.cat-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.cat-delete-btn:hover {
    border-color: var(--error) !important;
    color: var(--error) !important;
}

/* ── Cards Grid ────────────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    min-height: 40px;
}

.drop-zone.drag-over {
    background: var(--accent-subtle);
    border-radius: var(--radius);
    outline: 2px dashed var(--border-accent);
    outline-offset: 4px;
    min-height: 80px;
}

/* ── Card Ghost Placeholder ─────────────────────────────── */
.card-ghost {
    border-radius: var(--radius-lg);
    min-height: 140px;
}

.card-ghost-inner {
    height: 100%;
    min-height: 140px;
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    background: var(--accent-subtle);
    opacity: 0.6;
    animation: ghostPulse 1.5s ease-in-out infinite;
}

@keyframes ghostPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* ── New Category Preview ──────────────────────────────── */
.new-cat-preview {
    position: relative;
    height: 0;
    margin: 0;
    overflow: visible;
    transition: height 0.2s ease, margin 0.2s ease;
    pointer-events: none;
}

.new-cat-preview.visible {
    height: 48px;
    margin: 12px 0;
}

.new-cat-preview-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.15s;
}

.new-cat-preview.visible .new-cat-preview-line {
    opacity: 1;
}

.new-cat-preview-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent);
    color: var(--text-inverse);
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 16px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.new-cat-preview.visible .new-cat-preview-label {
    opacity: 1;
}

/* ── Empty Hub State ───────────────────────────────────── */
.empty-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    transition: border-color 0.2s, background 0.2s;
}

.empty-hub.drag-over {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.empty-hub-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.empty-hub-icon .material-symbols-outlined {
    font-size: 28px;
    color: var(--accent);
}

.empty-hub h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.empty-hub p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 300px;
}

/* ── App Card ──────────────────────────────────────────── */
.app-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
    box-shadow: var(--shadow-card);
}

.app-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-accent);
}

.app-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

body.is-editing .app-card {
    cursor: grab;
}

body.is-editing .app-card:active {
    cursor: grabbing;
}

body.is-editing .app-card:hover {
    transform: none;
}

.card-link {
    display: flex;
    flex-direction: column;
    padding: 24px 20px 20px;
    text-decoration: none;
    color: inherit;
}

.card-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: transform 0.2s;
}

.app-card:hover .card-icon-wrap {
    transform: scale(1.08);
}

.card-emoji {
    font-size: 24px;
    line-height: 1;
}

.card-name {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-status {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    opacity: 0.6;
}

.card-arrow {
    font-size: 16px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.app-card:hover .card-arrow {
    opacity: 1;
    transform: translate(2px, -2px);
}

/* ── Card Remove ───────────────────────────────────────── */
.card-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: var(--error-bg);
    color: var(--error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s, background 0.2s, transform 0.1s;
}

.app-card:hover .card-remove {
    opacity: 1;
}

.card-remove .material-symbols-outlined { font-size: 14px; }

.card-remove:hover {
    background: var(--error);
    color: #fff;
    transform: scale(1.1);
}

/* ==========================================================
   EDIT PANEL (right sidebar)
   ========================================================== */
.edit-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease, background 0.3s;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
}

.edit-panel.open {
    transform: translateX(0);
}

.edit-panel-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-panel-header h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 700;
}

.edit-panel-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.edit-panel-header button:hover {
    color: var(--text-primary);
}

.edit-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.edit-section {
    margin-bottom: 24px;
}

.edit-section h4 {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.hidden-apps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.empty-msg {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
}

.hidden-app-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    transition: background 0.15s;
}

.hidden-app-item:hover {
    background: var(--bg-surface-hover);
}

.hidden-app-icon { font-size: 20px; line-height: 1; }

.hidden-app-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.hidden-app-add {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.15s;
}

.hidden-app-add:hover {
    transform: scale(1.15);
}

.hidden-app-add .material-symbols-outlined { font-size: 22px; }

.edit-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.edit-action-btn:hover {
    background: var(--accent-dim);
}

.edit-action-btn .material-symbols-outlined { font-size: 18px; }

.edit-action-btn.danger {
    background: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.edit-action-btn.danger:hover {
    color: var(--error);
    border-color: var(--error);
}

/* ==========================================================
   COLOR PICKER MODAL
   ========================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeUp 0.2s ease-out;
}

.modal-card h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
}

.color-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.color-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.color-dot:hover {
    transform: scale(1.2);
    border-color: var(--text-primary);
}

.modal-cancel {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 24px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s;
}

.modal-cancel:hover {
    color: var(--text-primary);
}

/* ==========================================================
   MOBILE NAV (bottom)
   ========================================================== */
.mobile-nav {
    display: none;
}

/* ==========================================================
   APPS LIST PAGE
   ========================================================== */
.apps-page-header {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.apps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apps-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    position: relative;
}

.apps-list-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0;
}

.apps-list-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-accent);
}

.apps-list-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.apps-list-info {
    flex: 1;
    min-width: 0;
}

.apps-list-name {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.apps-list-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.apps-list-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.apps-list-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 4px 10px;
    border-radius: 12px;
}

.apps-list-badge.in-hub {
    background: var(--accent-subtle);
    color: var(--accent);
}

.apps-list-badge.available {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
}

.apps-list-arrow {
    font-size: 18px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
}

.apps-list-item:hover .apps-list-arrow {
    opacity: 1;
}

@media (max-width: 640px) {
    .apps-list-item {
        padding: 12px 14px;
        gap: 12px;
    }

    .apps-list-icon {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .apps-list-badge {
        display: none;
    }
}

/* ==========================================================
   ANIMATIONS
   ========================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1024px) {
    .search-box input {
        width: 160px;
    }
    .search-box input:focus {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar-nav {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 60;
    }

    .sidebar-nav.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .top-bar-tabs {
        display: none;
    }

    .search-box {
        display: none;
    }

    .content-area {
        padding: 20px 16px 100px;
    }

    .hero-section {
        padding: 32px 24px;
    }

    .hero-title {
        font-size: 26px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .card-link {
        padding: 18px 16px 16px;
    }

    .card-icon-wrap {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }

    .card-emoji {
        font-size: 20px;
    }

    .card-name {
        font-size: 14px;
    }

    .card-desc {
        font-size: 12px;
        margin-bottom: 12px;
    }

    /* Mobile bottom nav */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 72px;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        z-index: 50;
        align-items: center;
        justify-content: space-around;
        padding: 0 8px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 600;
        padding: 8px;
        transition: color 0.15s;
    }

    .mobile-nav-item .material-symbols-outlined {
        font-size: 22px;
    }

    .mobile-nav-item.active {
        color: var(--accent);
    }

    .mobile-nav-fab {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--accent);
        color: var(--text-inverse);
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        transform: translateY(-8px);
        box-shadow: 0 4px 16px var(--accent-glow);
        cursor: pointer;
        transition: transform 0.15s;
    }

    .mobile-nav-fab:active {
        transform: translateY(-8px) scale(0.93);
    }

    .mobile-nav-fab .material-symbols-outlined {
        font-size: 22px;
    }

    .edit-panel {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   ADD APP BUTTON
   ========================================================== */
.btn-add-app {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn-add-app:hover {
    background: var(--accent-dim);
}

.btn-add-app:active {
    transform: scale(0.97);
}

.btn-add-app .material-symbols-outlined {
    font-size: 18px;
}

/* ==========================================================
   APPS LIST DELETE BUTTON
   ========================================================== */
.apps-list-delete {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    z-index: 2;
}

.apps-list-item:hover .apps-list-delete {
    opacity: 1;
}

.apps-list-delete:hover {
    color: var(--error);
    background: var(--error-bg);
}

.apps-list-delete .material-symbols-outlined {
    font-size: 18px;
}

/* ==========================================================
   BADGES: CUSTOM, STORE
   ========================================================== */
.apps-list-badge.custom {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

[data-theme="dark"] .apps-list-badge.custom {
    background: rgba(155, 89, 182, 0.2);
    color: #c39bd3;
}

.apps-list-badge.store {
    background: rgba(46, 204, 113, 0.1);
    color: #27ae60;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .apps-list-badge.store {
    background: rgba(46, 204, 113, 0.15);
    color: #68d391;
}

.apps-list-badge.private {
    background: rgba(155, 89, 182, 0.1);
    color: #8e44ad;
}

[data-theme="dark"] .apps-list-badge.private {
    background: rgba(155, 89, 182, 0.2);
    color: #c39bd3;
}

.card-status-custom {
    color: #9b59b6 !important;
    font-weight: 600;
}

[data-theme="dark"] .card-status-custom {
    color: #c39bd3 !important;
}

.catalog-item-creator {
    font-size: 10px;
    color: #9b59b6;
    font-weight: 600;
}

[data-theme="dark"] .catalog-item-creator {
    color: #c39bd3;
}

/* ==========================================================
   MODAL (ADD APP)
   ========================================================== */
.modal-card-lg {
    width: 520px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

/* ── Form Elements ──────────────────────── */
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-group {
    margin-bottom: 16px;
}

.form-group-emoji {
    flex-shrink: 0;
    width: 80px;
}

.form-group-fill {
    flex: 1;
    min-width: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: 'DM Sans', sans-serif;
}

.form-group input[type="text"],
.form-group input[type="url"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.emoji-input {
    text-align: center;
    font-size: 24px !important;
    padding: 6px !important;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    background: var(--error-bg);
    color: var(--error);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.btn-cancel {
    padding: 10px 20px;
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-cancel:hover {
    background: var(--border);
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-submit:hover {
    background: var(--accent-dim);
}

.btn-submit .material-symbols-outlined {
    font-size: 16px;
}

/* ── Store Checkboxes ──────────────────── */
.store-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.store-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}

.store-checkbox:hover {
    background: var(--bg-surface-hover);
}

.store-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

.store-checkbox input:disabled + span {
    opacity: 0.4;
}

/* ── Select (Winkel) on auth pages ──────── */
select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border, #e4e9f0);
    border-radius: 10px;
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    background: #f5f7fa;
    color: #1a2332;
    margin-bottom: 18px;
    appearance: auto;
}

select:focus {
    outline: none;
    border-color: #0090e3;
}

/* ==========================================================
   EMOJI PICKER
   ========================================================== */
.emoji-trigger {
    width: 100%;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.emoji-trigger:hover {
    border-color: var(--accent);
}

.emoji-trigger:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.emoji-trigger-preview {
    font-size: 26px;
    line-height: 1;
}

.form-group-emoji {
    position: relative;
}

.emoji-picker {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    width: 480px;
    max-width: 95vw;
    max-height: 85vh;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    overflow: hidden;
}

.emoji-picker.open {
    display: flex;
}

.emoji-picker-search {
    padding: 10px 10px 6px;
    flex-shrink: 0;
}

.emoji-picker-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    box-sizing: border-box;
}

.emoji-picker-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.emoji-picker-tabs {
    display: flex;
    padding: 0 6px;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
}

.emoji-tab {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 6px 8px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    border-bottom: 2px solid transparent;
    transition: background 0.1s, border-color 0.1s;
    line-height: 1;
}

.emoji-tab:hover {
    background: var(--bg-surface-hover);
}

.emoji-tab.active {
    border-bottom-color: var(--accent);
    background: var(--accent-subtle);
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.emoji-picker-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal);
    z-index: 199;
}

.emoji-picker-backdrop.open {
    display: block;
}

.emoji-cell {
    background: none;
    border: none;
    font-size: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.1s, transform 0.1s;
    line-height: 1;
    padding: 0;
}

.emoji-cell:hover {
    background: var(--bg-surface-hover);
    transform: scale(1.2);
}

.emoji-cell:active {
    transform: scale(0.95);
}

/* ==========================================================
   SETTINGS PAGE
   ========================================================== */
.settings-section {
    margin-bottom: 32px;
}

.settings-section .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
}

.settings-row + .settings-row {
    border-top: 1px solid var(--border-light);
}

.settings-label {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.settings-value {
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Toggle button */
.toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px;
}

.toggle-track {
    display: inline-block;
    width: 42px;
    height: 24px;
    border-radius: 12px;
    background: var(--border);
    position: relative;
    transition: background 0.2s;
}

.toggle-btn.active .toggle-track {
    background: var(--accent);
}

.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-btn.active .toggle-knob {
    transform: translateX(18px);
}

.toggle-btn.active {
    color: var(--accent);
}

/* Edit icon button */
.btn-icon-edit {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
}

.btn-icon-edit:hover {
    color: var(--accent);
    background: var(--accent-subtle);
    border-color: var(--accent);
}

.btn-icon-edit .material-symbols-outlined {
    font-size: 18px;
}

/* Danger icon button */
.btn-icon-danger {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
}

.btn-icon-danger:hover {
    color: var(--error);
    background: var(--error-bg);
    border-color: var(--error);
}

.btn-icon-danger .material-symbols-outlined {
    font-size: 18px;
}

/* Danger button (solid) */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--error);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-danger:active {
    transform: scale(0.97);
}

.btn-danger .material-symbols-outlined {
    font-size: 16px;
}

/* My app actions (edit/delete buttons on list items) */
.my-app-actions {
    display: flex;
    gap: 2px;
    align-items: center;
    padding-right: 12px;
    flex-shrink: 0;
}

/* On my-apps page, hide the open_in_new arrow and give link room for actions */
.apps-list-item:has(.my-app-actions) .apps-list-arrow {
    display: none;
}

.apps-list-item:has(.my-app-actions) .apps-list-link {
    padding-right: 8px;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-state-icon .material-symbols-outlined {
    font-size: 32px;
    color: var(--accent);
}

.empty-state h3 {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* Alert styling for settings page */
.settings-card .alert {
    margin-bottom: 16px;
}

/* ==========================================================
   TYPE CHOICE (PUBLIC/PRIVATE)
   ========================================================== */
.type-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.type-choice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    text-align: center;
    font-family: 'DM Sans', sans-serif;
    position: relative;
    overflow: hidden;
}

.type-choice-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
    transition: background 0.2s;
}

.type-choice-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-3px);
}

.type-choice-card:active {
    transform: translateY(-1px);
}

.type-choice-card.type-public:hover::before {
    background: var(--accent);
}

.type-choice-card.type-private:hover::before {
    background: #9b59b6;
}

.type-choice-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.type-public .type-choice-icon {
    background: var(--accent-subtle);
}

.type-private .type-choice-icon {
    background: rgba(155, 89, 182, 0.08);
}

[data-theme="dark"] .type-private .type-choice-icon {
    background: rgba(155, 89, 182, 0.15);
}

.type-choice-icon .material-symbols-outlined {
    font-size: 28px;
}

.type-public .type-choice-icon .material-symbols-outlined {
    color: var(--accent);
}

.type-private .type-choice-icon .material-symbols-outlined {
    color: #9b59b6;
}

.type-choice-card strong {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.type-choice-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 140px;
}

/* ==========================================================
   USERS TABLE
   ========================================================== */
.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table th {
    text-align: left;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 2px solid var(--border);
}

.users-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.users-table tr:last-child td {
    border-bottom: none;
}

/* Mobile adjustments for emoji picker */
@media (max-width: 640px) {
    .emoji-picker {
        width: 95vw;
    }

    .emoji-picker-grid {
        grid-template-columns: repeat(7, 1fr);
    }

    .emoji-cell {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* ── Spotlight Search ── */
.spotlight-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
}
.spotlight-backdrop.open { display: flex; }
body:has(.spotlight-backdrop.open) { overflow: hidden; }

.spotlight-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 560px;
    max-width: 90vw;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
    overflow: hidden;
}

.spotlight-input-wrap {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.spotlight-icon { color: var(--text-muted); font-size: 22px; }
.spotlight-input {
    flex: 1; border: none; background: none;
    font-size: 17px; color: var(--text-primary);
    outline: none; font-family: 'DM Sans', sans-serif;
}
.spotlight-input::placeholder { color: var(--text-muted); }
.spotlight-kbd {
    font-size: 11px; padding: 2px 8px;
    border-radius: 4px; border: 1px solid var(--border);
    color: var(--text-muted); background: var(--bg-surface-hover);
    font-family: 'DM Sans', sans-serif;
}

.spotlight-results {
    max-height: 340px; overflow-y: auto;
    padding: 8px;
}
.spotlight-item {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; border-radius: 10px;
    text-decoration: none; color: inherit;
    transition: background 0.1s;
}
.spotlight-item.selected, .spotlight-item:hover {
    background: var(--accent-subtle);
}
.spotlight-item-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--bg-surface-hover);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.spotlight-item.selected .spotlight-item-icon {
    background: var(--accent); color: white;
}
.spotlight-item-info { flex: 1; min-width: 0; }
.spotlight-item-name {
    display: block; font-weight: 600; font-size: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spotlight-item-desc {
    display: block; font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spotlight-item-arrow {
    font-size: 16px; color: var(--text-muted); opacity: 0;
    transition: opacity 0.1s;
}
.spotlight-item.selected .spotlight-item-arrow { opacity: 1; color: var(--accent); }

.spotlight-footer {
    display: flex; gap: 16px; padding: 10px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 11px; color: var(--text-muted);
}
.spotlight-footer kbd {
    font-size: 10px; padding: 1px 5px; border-radius: 3px;
    border: 1px solid var(--border); background: var(--bg-surface-hover);
    font-family: inherit;
}
.spotlight-empty {
    padding: 24px; text-align: center;
    color: var(--text-muted); font-size: 14px;
}

/* ── Search Trigger Button ── */
.search-trigger {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 200px;
}
.search-trigger:hover {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.search-trigger .material-symbols-outlined { font-size: 18px; }
.search-trigger-label { flex: 1; text-align: left; }
.search-trigger kbd {
    font-size: 11px; padding: 1px 6px;
    border-radius: 4px; border: 1px solid var(--border);
    background: var(--bg-surface-hover);
    font-family: 'DM Sans', sans-serif;
}

@media (max-width: 640px) {
    .search-trigger-label, .search-trigger kbd { display: none; }
    .search-trigger { min-width: 0; padding: 8px; }
}

/* ── Favorites Row ── */
.favorites-row, .recent-row {
    margin-bottom: 24px;
    padding: 0 4px;
}
.favorites-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
}
.favorites-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 700; font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.favorites-grid {
    display: flex; gap: 10px;
    overflow-x: auto; padding-bottom: 4px;
}
.fav-card {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none; color: inherit;
    min-width: 90px; position: relative;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.fav-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-accent);
}
.fav-icon { font-size: 28px; }
.fav-name {
    font-size: 12px; font-weight: 600;
    white-space: nowrap; max-width: 80px;
    overflow: hidden; text-overflow: ellipsis;
}
.fav-shortcut {
    position: absolute; top: 4px; left: 4px;
    font-size: 9px; font-weight: 700;
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    opacity: 0; transition: opacity 0.15s;
}
.fav-card:hover .fav-shortcut { opacity: 1; }
.fav-unpin {
    position: absolute; top: 4px; right: 4px;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); opacity: 0;
    transition: opacity 0.15s;
    padding: 2px;
}
.fav-unpin .material-symbols-outlined { font-size: 14px; }
.fav-card:hover .fav-unpin { opacity: 1; }

/* ── Pin button on cards ── */
.card-pin {
    position: absolute; top: 6px; left: 6px;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    padding: 4px; z-index: 2;
}
.card-pin .material-symbols-outlined { font-size: 20px; }
.app-card:hover .card-pin { opacity: 1; }
.card-pin.pinned { opacity: 1; color: var(--accent); }
.card-pin.pinned .material-symbols-outlined { font-variation-settings: 'FILL' 1; }

/* ── Offline status ── */
.app-card.app-offline { opacity: 0.6; }
.card-status-offline {
    position: absolute; bottom: 6px; left: 6px;
    font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 2px 6px; border-radius: 4px;
    background: #e53e3e; color: white;
}

/* ── Popularity badge ── */
.apps-list-badge.popular {
    background: #fff3e0;
    color: #e65100;
}
[data-theme="dark"] .apps-list-badge.popular {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
}

/* ── Onboarding Tour ── */
.onboarding-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.onboarding-modal {
    background: var(--bg-card);
    border-radius: 20px;
    width: 440px; max-width: 90vw;
    padding: 40px 36px 28px;
    text-align: center;
    box-shadow: 0 32px 100px rgba(0,0,0,0.3);
}
.onboarding-illustration {
    font-size: 64px;
    margin-bottom: 20px;
    line-height: 1;
}
.onboarding-modal h2 {
    font-family: 'Manrope', sans-serif;
    font-weight: 800; font-size: 22px;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.onboarding-modal p {
    color: var(--text-secondary);
    font-size: 15px; line-height: 1.6;
    margin-bottom: 0;
}
.onboarding-modal kbd {
    font-size: 12px; padding: 2px 7px;
    border-radius: 4px; border: 1px solid var(--border);
    background: var(--bg-surface-hover);
    font-family: 'DM Sans', sans-serif;
}
.onboarding-nav {
    margin-top: 32px;
    display: flex; align-items: center; justify-content: space-between;
}
.onboarding-dots {
    display: flex; gap: 6px;
}
.onboarding-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, transform 0.2s;
}
.onboarding-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}
.onboarding-buttons {
    display: flex; gap: 8px;
}
