:root { 
    --bg-color: #66FFCC;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-main: #000080;
    --text-muted: #334155; 
    --border-color: #86efac; 
    --input-bg: #ffffff; 
    --btn-bg: #000080; 
    --btn-hover: #1e1b4b; 
    --error-bg: #fef2f2; 
    --error-color: #dc2626; 
    --success-bg: #f0fdf4; 
    --success-color: #16a34a; 
    --btn-danger: #dc2626; 
    --btn-danger-hover: #b91c1c; 
}

html, body {
    background-color: #66FFCC !important;
    background: #66FFCC !important;
    color: var(--text-main);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container { 
    width: 100%; 
    max-width: 980px; 
    padding: 10px; 
    box-sizing: border-box; 
    flex-grow: 1; 
    margin: 0 auto; 
}

@media (max-width: 600px) { 
    html, body { padding: 10px 0 !important; } 
    .container { padding: 8px; } 
}

/* En-tête */
.header-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 20px; 
}

.header-titles h1 { 
    font-size: 1.35rem; 
    font-weight: 700; 
    margin: 0 0 4px 0; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    color: #FA0000; 
    font-family: 'Cooper Black', 'Montserrat', sans-serif; 
}

.header-titles p { 
    color: var(--text-muted); 
    font-size: 0.85rem; 
    margin: 0; 
    font-weight: 600; 
}

.version-tag { 
    font-size: 0.7rem; 
    background: #ffffff; 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-weight: 600; 
    color: #000080; 
    border: 1px solid #cbd5e1; 
    font-family: sans-serif; 
}

/* Menu popover */
.menu-container { position: relative; }
.hamburger-btn { 
    background: #ffffff; 
    border: 1px solid #000080; 
    border-radius: 6px; 
    padding: 8px 10px; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}
.hamburger-bar { 
    width: 20px; 
    height: 2px; 
    background-color: var(--text-main); 
    border-radius: 1px; 
}
.menu-popover { 
    display: none; 
    position: absolute; 
    right: 0; 
    top: calc(100% + 8px); 
    background: #fff; 
    border: 1px solid #cbd5e1; 
    border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); 
    width: 230px; 
    z-index: 1000; 
    padding: 6px 0; 
}
.menu-popover.active { display: block; animation: fadeUp 0.15s ease-out; }
.menu-popover a { 
    display: block; 
    padding: 9px 14px; 
    color: var(--text-main); 
    text-decoration: none; 
    font-size: 0.85rem; 
    font-weight: 600; 
}
.menu-popover a:hover { background: #e0f2fe; }
.menu-popover hr { margin: 4px 0; border: none; border-top: 1px solid #e2e8f0; }

/* Navigation pilules */
.admin-nav { 
    display: flex; 
    flex-wrap: wrap; 
    align-items: center; 
    gap: 8px; 
    margin-bottom: 10px; 
}
.admin-nav a { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none; 
    color: var(--text-main); 
    font-family: inherit;
    font-size: 0.82rem; 
    line-height: 1.2;
    padding: 7px 14px; 
    font-weight: 600; 
    border-radius: 50px; 
    background: rgba(255,255,255,0.9); 
    border: 1px solid #000080; 
    box-sizing: border-box;
    transition: all 0.15s ease; 
}
.admin-nav a:hover { 
    background: #ffffff; 
    transform: translateY(-1px); 
}
.admin-nav a.active { 
    color: #fff; 
    background: var(--btn-bg); 
    border-color: var(--btn-bg); 
    box-shadow: 0 2px 6px rgba(0,0,128,0.25); 
}

/* Cartes et Grilles */
.card { 
    background: var(--card-bg); 
    border: 1px solid rgba(0,0,128,0.15); 
    border-radius: 10px; 
    padding: 14px 18px 18px 18px; 
    margin-bottom: 18px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.06); 
}

/* Gestion dynamique du zoom */
body.zoom-small { --grid-min: 120px; --grid-gap: 10px; --logo-size: 35px; --title-size: 0.75rem; --card-pad: 8px; --clamp-title: 1; }
body.zoom-medium { --grid-min: 160px; --grid-gap: 15px; --logo-size: 50px; --title-size: 0.9rem; --card-pad: 12px; --clamp-title: 2; }
body.zoom-large { --grid-min: 220px; --grid-gap: 25px; --logo-size: 65px; --title-size: 1.1rem; --card-pad: 16px; --clamp-title: 2; }

.grid-bookmarks { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr)) !important; 
    gap: var(--grid-gap) !important; 
    align-items: stretch !important; 
}

.bookmark-card { 
    display: flex !important; 
    flex-direction: column !important; 
    align-items: center !important; 
    justify-content: flex-start !important; 
    text-align: center !important; 
    padding: var(--card-pad) !important; 
    background: #ffffff; 
    border: 1px solid #94a3b8; 
    border-radius: 8px; 
    height: 100% !important; 
    min-height: calc(var(--logo-size) + 55px) !important; 
    box-sizing: border-box !important;
    text-decoration: none; 
    color: inherit; 
    transition: transform 0.15s ease, box-shadow 0.15s ease; 
    overflow: hidden !important;
}

.bookmark-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 10px rgba(0, 0, 128, 0.15); 
    border-color: #000080; 
}

.bookmark-card.empty-tile {
    background: rgba(255, 255, 255, 0.45);
    border: 1px dashed #94a3b8;
    cursor: default;
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.85;
}
.bookmark-card.empty-tile .bookmark-title { color: #475569; }

.bookmark-logo-wrapper { 
    height: var(--logo-size) !important; 
    width: 100% !important; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    margin-bottom: 8px !important; 
    flex-shrink: 0 !important; 
}

.bookmark-logo-wrapper img { 
    max-height: var(--logo-size) !important; 
    max-width: 100% !important; 
    object-fit: contain !important; 
}

.bookmark-logo-wrapper span { 
    font-size: calc(var(--logo-size) * 0.7) !important; 
    line-height: 1 !important; 
}

.bookmark-title { 
    font-weight: 700 !important; 
    font-size: var(--title-size) !important; 
    color: #000080 !important; 
    display: -webkit-box !important; 
    -webkit-line-clamp: var(--clamp-title) !important; 
    -webkit-box-orient: vertical !important; 
    overflow: hidden !important; 
    text-overflow: ellipsis !important; 
    width: 100% !important; 
    line-height: 1.2 !important;
    word-break: break-word !important;
}

.bookmark-info { 
    font-size: calc(var(--title-size) * 0.8) !important; 
    color: #475569 !important; 
    font-family: monospace !important; 
    display: -webkit-box !important; 
    -webkit-line-clamp: 1 !important; 
    -webkit-box-orient: vertical !important; 
    overflow: hidden !important; 
    text-overflow: ellipsis !important; 
    width: 100% !important; 
    margin-top: 4px !important;
}

.data-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.85rem; 
    margin-top: 10px; 
    background: #ffffff; 
    border-radius: 6px; 
    overflow: hidden; 
}
.data-table th, .data-table td { 
    padding: 8px 10px; 
    border: 1px solid #cbd5e1; 
    text-align: left; 
}
.data-table th { 
    background: #f1f5f9; 
    font-weight: 700; 
    color: #000080; 
}

/* Alertes & Formulaires */
.alert { padding: 12px 14px; border-radius: 6px; font-size: 0.85rem; margin-bottom: 15px; }
.alert.error { background-color: var(--error-bg); color: var(--error-color); }
.alert.success { background-color: var(--success-bg); color: var(--success-color); }
.alert.info { background-color: #eff6ff; color: #1d4ed8; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.78rem; font-weight: 600; color: #1e293b; text-transform: uppercase; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], textarea { 
    width: 100%; 
    background: #ffffff; 
    border: 1px solid #000080; 
    border-radius: 6px; 
    padding: 8px 10px; 
    font-size: 0.88rem; 
    box-sizing: border-box; 
    font-family: inherit; 
}

button, .btn { 
    display: inline-flex; 
    justify-content: center; 
    align-items: center; 
    background-color: var(--btn-bg); 
    color: #fff; 
    border: 1px solid transparent; 
    border-radius: 6px; 
    padding: 8px 14px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 0.85rem; 
    text-decoration: none; 
}
button:hover, .btn:hover { background-color: var(--btn-hover); }
button.secondary, .btn.secondary { background-color: #fff; color: var(--text-main); border-color: #000080; }
button.secondary:hover, .btn.secondary:hover { background-color: #f8fafc; }
button.danger, .btn.danger { background-color: var(--btn-danger); padding: 4px 8px; font-size: 0.75rem; width: auto; }
.sm-btn { width: auto; padding: 5px 10px; font-size: 0.78rem; }

.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 14px; 
    background: #fff; 
    border: 1px solid #cbd5e1; 
    border-radius: 6px; 
    margin-bottom: 8px; 
    font-size: 0.85rem; 
}

#toast { 
    visibility: hidden; 
    min-width: 180px; 
    background-color: #000080; 
    color: #fff; 
    text-align: center; 
    border-radius: 6px; 
    padding: 10px 16px; 
    position: fixed; 
    z-index: 10000; 
    left: 50%; 
    transform: translateX(-50%); 
    bottom: 25px; 
    font-size: 0.85rem; 
}
#toast.show { visibility: visible; animation: toastFade 2.5s; }
@keyframes toastFade { 0%, 100% { opacity: 0; bottom: 10px; } 15%, 85% { opacity: 1; bottom: 25px; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-up { animation: fadeUp 0.3s ease-out; }

/* Footer */
footer { width: 100%; margin-top: 25px; }
details { border: 1px solid rgba(0,0,128,0.2); border-radius: 6px; background: rgba(255,255,255,0.9); font-size: 0.82rem; }
summary { padding: 10px 14px; cursor: pointer; font-weight: 700; color: #000080; }
.version-list { padding: 10px 14px; border-top: 1px solid #e2e8f0; background: #fff; }
.version-item { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; }
.version-item:last-child { border-bottom: none; }
.v-badge { font-weight: 700; color: #000080; }

/* Styles drag & drop admin */
.drag-handle { cursor: grab; user-select: none; font-size: 1.1rem; color: #94a3b8; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: 0.4; background: #e0f2fe; }
tr.drag-over { border-top: 3px solid #000080; }
.arrow-btn { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 4px; padding: 2px 6px; cursor: pointer; font-size: 0.75rem; color: #000080; }
.arrow-btn:hover { background: #000080; color: #fff; }

/* Module Réseau & QNAP */
.net-block { margin-bottom: 25px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.net-header { background: #f8fafc; padding: 15px; border-bottom: 1px solid #cbd5e1; display: flex; align-items: center; gap: 10px; }
.net-header h3 { margin: 0; font-size: 1.15rem; color: #0f172a; }
.net-body { padding: 15px; }
.net-links { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.net-link { padding: 6px 12px; background: #e2e8f0; color: #334155; text-decoration: none; border-radius: 4px; font-size: 0.85rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.net-link:hover { background: #cbd5e1; }
.net-link.fb { background: #ef4444; color: #fff; }
.net-link.qnap { background: #f97316; color: #fff; }
.net-link.cam { background: #64748b; color: #fff; }
.net-subpanel { border: 1px solid #e2e8f0; border-radius: 6px; margin-bottom: 15px; }
.net-subpanel summary { background: #f1f5f9; padding: 10px 15px; font-weight: 600; cursor: pointer; color: #334155; user-select: none; }
.net-subpanel .content { padding: 15px; overflow-x: auto; }
.net-desc { background: #f1f5f9; padding: 10px 15px; border-radius: 6px; font-size: 0.85rem; margin-bottom: 15px; color: #475569; }