/* ============================================================
   JSNK3D — Suivi de Projets (version web)
   Thème "Sunset Tropical" — fond sombre + dégradé coucher de soleil
   ============================================================ */

:root {
    /* Fond — violet profond inspiré du wallpaper */
    --bg: #0e0b1e;
    --bg-soft: #130f28;
    --panel: #1a1535;
    --panel-light: #241e47;
    --border: #2e2860;

    /* Texte */
    --text: #f0eeff;
    --text-muted: #a09ac8;
    --text-faint: #6860a0;

    /* Palette JSNK3D — violet/rose/teal comme sur le wallpaper */
    --sunset-teal: #3de8d8;
    --sunset-pink: #e040c8;
    --sunset-peach: #c080ff;
    --sunset-orange: #ff5fa0;

    --gradient-sunset: linear-gradient(120deg, var(--sunset-pink) 0%, var(--sunset-peach) 60%, var(--sunset-teal) 100%);
    --gradient-sunset-soft: linear-gradient(120deg, rgba(224, 64, 200, 0.14), rgba(192, 128, 255, 0.14), rgba(61, 232, 216, 0.14));
    --gradient-night: linear-gradient(160deg, #1a1535 0%, #0e0b1e 100%);

    /* Statuts */
    --status-encours: #ffb86b;
    --status-termine: #3de8d8;
    --status-livre: #6ee7a8;
    --status-annule: #f4707e;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 12px 36px rgba(4, 2, 18, 0.55);
    --shadow-sm: 0 4px 16px rgba(4, 2, 18, 0.4);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background:
        linear-gradient(to bottom, rgba(8, 5, 22, 0.58) 0%, rgba(8, 5, 22, 0.78) 100%),
        url('/static/img/bg_jsnk3d.png') center center / cover no-repeat fixed;
    color: var(--text);
    font-family: "Helvetica Neue", -apple-system, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-weight: 800;
    letter-spacing: 0.5px;
    margin: 0 0 6px 0;
}

a {
    color: var(--sunset-teal);
    text-decoration: none;
}

/* ============================================================
   Structure générale
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: rgba(10, 7, 28, 0.78);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(200, 150, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    position: relative;
    overflow: hidden;
}

.brand-logo {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.brand-logo img {
    width: 100%;
    max-width: 160px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(123,47,255,0.3));
    border-radius: 4px;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    transition: background 0.15s, color 0.15s;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--panel);
    color: var(--text);
}

.nav-link.active {
    background: var(--gradient-sunset-soft);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--sunset-pink);
}

.sidebar-palms {
    margin-top: auto;
    opacity: 0.18;
    pointer-events: none;
}

.sidebar-footer {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.5px;
}

/* ---------- Contenu principal ---------- */
.content {
    flex: 1;
    min-width: 0;
    padding: 28px 32px 60px;
}

/* ---------- Cartes / panneaux ---------- */
.panel {
    background: rgba(16, 12, 36, 0.80);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(200, 150, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1px;
}

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

/* ============================================================
   Composants
   ============================================================ */

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, filter 0.15s, background 0.15s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--gradient-sunset);
    color: #14172b;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-secondary {
    background: var(--panel-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--panel);
    border-color: var(--sunset-teal);
}

.btn-danger {
    background: transparent;
    color: var(--status-annule);
    border: 1px solid rgba(244, 112, 126, 0.4);
}

.btn-danger:hover {
    background: rgba(244, 112, 126, 0.12);
    border-color: var(--status-annule);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}


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

.section-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text);
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--gradient-sunset-soft);
    border: 1px solid var(--border);
}

.section-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gradient-sunset);
    flex-shrink: 0;
}

/* ---------- Recherche / filtres ---------- */
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

/* ---------- Formulaires ---------- */
label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="search"],
select,
textarea {
    width: 100%;
    background: rgba(10, 8, 30, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

input::placeholder, textarea::placeholder {
    color: var(--text-faint);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--sunset-teal);
    box-shadow: 0 0 0 3px rgba(79, 214, 230, 0.18);
}

textarea {
    resize: vertical;
    min-height: 70px;
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--sunset-pink);
}

.checkbox-row label {
    margin: 0;
    text-transform: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.prop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
}

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

.btn-icon {
    background: rgba(244, 112, 126, 0.12);
    border: 1px solid rgba(244, 112, 126, 0.25);
    color: var(--status-annule);
    border-radius: 8px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.15s;
}

.btn-icon:hover {
    background: rgba(244, 112, 126, 0.22);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input {
    flex: 1;
}

.hint {
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 6px;
    line-height: 1.4;
}

/* ---------- Tableaux / listes ---------- */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
}

tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
}

.empty-state .emoji {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

/* ---------- Badges de statut ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.badge-encours { background: rgba(255, 184, 107, 0.15); color: var(--status-encours); }
.badge-termine { background: rgba(79, 214, 230, 0.15); color: var(--status-termine); }
.badge-livre   { background: rgba(110, 231, 168, 0.15); color: var(--status-livre); }
.badge-annule  { background: rgba(244, 112, 126, 0.15); color: var(--status-annule); }

/* ---------- Listes simples (documents, etc.) ---------- */
.simple-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.simple-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(10, 8, 30, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
}

.simple-list .doc-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.simple-list .doc-type {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--gradient-sunset-soft);
}

.simple-list .doc-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-list .doc-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================================
   Pages spécifiques
   ============================================================ */

/* ---------- Grille de fiches (dashboard) ---------- */
.fiche-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.fiche-card {
    background: rgba(14, 10, 32, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 150, 255, 0.1);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.12s, border-color 0.18s, box-shadow 0.18s;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text);
}

.fiche-card .fiche-titre {
    color: var(--text);
}

.fiche-card:hover {
    transform: translateY(-3px);
    border-color: rgba(224, 64, 200, 0.5);
    box-shadow: 0 8px 32px rgba(192, 128, 255, 0.22), var(--shadow);
}

.fiche-card .fiche-ref {
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--text-faint);
    text-transform: uppercase;
    font-weight: 700;
}

.fiche-card .fiche-titre {
    font-size: 17px;
    font-weight: 800;
}

.fiche-card .fiche-client {
    font-size: 13px;
    color: var(--text-muted);
}

.fiche-card .fiche-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 6px;
}

.fiche-card .fiche-date {
    font-size: 12px;
    color: var(--text-muted);
}

.fiche-card .fiche-prix {
    font-size: 15px;
    font-weight: 800;
    background: var(--gradient-sunset);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Calendrier ---------- */
.calendar-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

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

.calendar-month {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: capitalize;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar-weekday {
    text-align: center;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    position: relative;
}

.calendar-day:hover {
    border-color: var(--sunset-teal);
}

.calendar-day.outside {
    opacity: 0.25;
    cursor: default;
}

.calendar-day.today {
    border-color: var(--sunset-pink);
    border-width: 2px;
}

.calendar-day.selected {
    background: var(--panel-light);
    border-color: var(--sunset-teal);
}

.calendar-day.has-delivery {
    background: var(--gradient-sunset);
    color: #14172b;
    border-color: transparent;
}

.calendar-day .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    margin-top: 3px;
}

/* ---------- Aperçu 3D ---------- */
.viewer-3d {
    width: 100%;
    height: 340px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: url('/static/img/bg_viewer3d.jpg') center center / cover no-repeat;
    overflow: hidden;
    position: relative;
}

.viewer-3d canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.viewer-3d .viewer-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-align: center;
    padding: 20px;
    background: rgba(20, 10, 40, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ---------- Modale (parcoureur de dossiers) ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 4, 18, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: rgba(14, 10, 32, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(200, 150, 255, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 14px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.folder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}

.folder-list li:hover {
    background: var(--panel-light);
}

.folder-path {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--panel-light);
    border: 1px solid var(--sunset-teal);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow);
    z-index: 200;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none; /* invisible : ne doit jamais intercepter les clics */
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 14px 16px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        overflow-x: auto;
    }

    .brand-sub, .sidebar-palms, .sidebar-footer {
        display: none;
    }

    .brand-logo {
        margin: 0 12px 0 0;
        padding: 0;
        justify-content: flex-start;
    }

    .brand-logo img {
        max-width: 80px;
    }

    .nav-links {
        flex-direction: row;
        gap: 4px;
    }

    .nav-link {
        padding: 9px 12px;
        font-size: 12px;
    }

    .nav-link span {
        display: none;
    }

    .content {
        padding: 18px 16px 80px;
    }

    .page-title {
        font-size: 22px;
    }
}

/* ============================================================
   Page Accueil — Widgets, Stats, Rappels
   ============================================================ */

/* ---------- Grille stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(14, 10, 32, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 150, 255, 0.1);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card .stat-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 900;
    background: var(--gradient-sunset);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
}

.stat-card .stat-value.normal {
    font-size: 24px;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    color: var(--text);
}

.stat-card .stat-sub {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 2px;
}

/* ---------- Rappels / alertes ---------- */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 14px;
    border: 1px solid;
}

.alert-banner.urgent {
    background: rgba(255, 90, 90, 0.1);
    border-color: rgba(244, 112, 126, 0.35);
    color: #ff9090;
}

.alert-banner.warning {
    background: rgba(255, 184, 107, 0.1);
    border-color: rgba(255, 184, 107, 0.35);
    color: var(--status-encours);
}

.alert-banner .alert-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-banner .alert-content strong {
    display: block;
    font-weight: 800;
    margin-bottom: 2px;
}

/* ---------- Liste événements / livraisons ---------- */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(10, 7, 26, 0.55);
    border: 1px solid rgba(200, 150, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    color: var(--text);
}

.event-item:hover {
    border-color: rgba(224, 64, 200, 0.35);
    background: rgba(14, 10, 32, 0.8);
}

.event-item .event-date-box {
    flex-shrink: 0;
    width: 52px;
    text-align: center;
    background: var(--gradient-sunset);
    border-radius: 10px;
    padding: 6px 4px;
    color: #0e0b1e;
}

.event-item .event-date-box .edb-day {
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
}

.event-item .event-date-box .edb-month {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.event-item.late .event-date-box {
    background: rgba(244, 112, 126, 0.8);
}

.event-item .event-info {
    flex: 1;
    min-width: 0;
}

.event-item .event-title {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item .event-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.event-item .event-countdown {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.event-item .event-countdown.urgent {
    background: rgba(244, 112, 126, 0.15);
    color: var(--status-annule);
}

.event-item .event-countdown.soon {
    background: rgba(255, 184, 107, 0.15);
    color: var(--status-encours);
}

.event-item .event-countdown.ok {
    background: rgba(61, 232, 216, 0.12);
    color: var(--sunset-teal);
}

.event-item .event-countdown.late {
    background: rgba(244, 112, 126, 0.2);
    color: #ff6080;
}

/* ---------- Widgets liens externes ---------- */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.widget-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: rgba(14, 10, 32, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 150, 255, 0.1);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}

.widget-link:hover {
    transform: translateY(-2px);
    border-color: rgba(224, 64, 200, 0.4);
    box-shadow: 0 6px 24px rgba(192, 128, 255, 0.18);
}

.widget-link .wl-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.widget-link .wl-icon.wix     { background: linear-gradient(135deg, #116dff, #0048cc); }
.widget-link .wl-icon.tripo   { background: linear-gradient(135deg, #7b2fff, #3de8d8); }
.widget-link .wl-icon.maker   { background: linear-gradient(135deg, #e040c8, #ff5fa0); }

.widget-link .wl-text {}
.widget-link .wl-title {
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 2px;
}
.widget-link .wl-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.widget-link .wl-arrow {
    margin-left: auto;
    color: var(--text-faint);
    font-size: 16px;
    flex-shrink: 0;
}

/* ---------- Layout accueil 2 colonnes ---------- */
.home-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    align-items: start;
}

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

/* ============================================================
   Page Outils & Productivité
   ============================================================ */

.tools-section-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 24px 0 12px;
}

.tools-section-title:first-child {
    margin-top: 0;
}

/* Grille des outils */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    background: rgba(14, 10, 32, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 150, 255, 0.1);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-2px);
    border-color: rgba(224, 64, 200, 0.4);
    box-shadow: 0 6px 28px rgba(192, 128, 255, 0.18);
}

.tool-card .tc-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.tool-card .tc-body {
    flex: 1;
    min-width: 0;
}

.tool-card .tc-name {
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 3px;
}

.tool-card .tc-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.tool-card .tc-badge {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    margin-top: 6px;
    display: inline-block;
}

.tc-badge.gratuit  { background: rgba(110, 231, 168, 0.15); color: var(--status-livre); }
.tc-badge.payant   { background: rgba(255, 184, 107, 0.15); color: var(--status-encours); }
.tc-badge.freemium { background: rgba(61, 232, 216, 0.12);  color: var(--sunset-teal); }
.tc-badge.desktop  { background: rgba(192, 128, 255, 0.15); color: var(--sunset-peach); }

/* ── Page outils layout ── */
.outils-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1100px) {
    .outils-layout { grid-template-columns: 1fr; }
}

/* ── Widget actualités ── */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.news-item {
    display: flex;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid rgba(200, 150, 255, 0.07);
    text-decoration: none;
    color: var(--text);
    transition: background 0.12s;
    border-radius: 4px;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item:hover .news-title {
    color: var(--sunset-teal);
}

.news-item .news-source-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
}

.news-item .news-source-dot.bambu   { background: #3de8d8; }
.news-item .news-source-dot.natives { background: #e040c8; }
.news-item .news-source-dot.snap    { background: #ffb86b; }
.news-item .news-source-dot.other   { background: var(--text-faint); }

.news-item .news-body {
    flex: 1;
    min-width: 0;
}

.news-item .news-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 3px;
    transition: color 0.12s;
}

.news-item .news-meta {
    font-size: 11px;
    color: var(--text-faint);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.news-item .news-source-label {
    font-weight: 700;
    color: var(--text-muted);
}

.news-badge-hot {
    font-size: 10px;
    font-weight: 800;
    background: rgba(224, 64, 200, 0.2);
    color: var(--sunset-pink);
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: 0.5px;
}

.news-loading {
    text-align: center;
    color: var(--text-faint);
    padding: 30px 10px;
    font-size: 13px;
}

.news-filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.news-filter-btn {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(200, 150, 255, 0.15);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.12s;
}

.news-filter-btn.active,
.news-filter-btn:hover {
    background: var(--gradient-sunset-soft);
    border-color: rgba(224, 64, 200, 0.3);
    color: var(--text);
}

/* ── KENET Converter widget ──────────────────────────────────────────── */
.kenet-card {
    background: rgba(10,7,26,.6);
    border: 1px solid rgba(156,201,59,.25);
    border-radius: 16px;
    padding: 22px 24px 18px;
    margin-bottom: 24px;
    box-shadow: 0 0 0 1px rgba(156,201,59,.08);
}

.kenet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.kenet-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.kenet-title {
    font-size: 17px;
    font-weight: 900;
    color: #9CC93B;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.kenet-actions {
    display: flex;
    gap: 10px;
}

.kenet-features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.kenet-feat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(255,255,255,.03);
    border-radius: 8px;
    padding: 6px 10px;
}

.kf-icon { font-size: 15px; flex-shrink: 0; }

.kenet-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.kenet-preset {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 8px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    color: var(--text-muted);
    line-height: 1.4;
}

.kenet-preset small { font-weight: 400; font-size: 10px; }
.kenet-preset.active {
    border-color: rgba(156,201,59,.4);
    background: rgba(156,201,59,.08);
    color: #9CC93B;
}

.kenet-status {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
}
.kenet-status.loading { background: rgba(61,232,216,.08); color: var(--sunset-teal); border: 1px solid rgba(61,232,216,.2); }
.kenet-status.ok      { background: rgba(110,231,168,.1); color: var(--status-livre); border: 1px solid rgba(110,231,168,.25); }
.kenet-status.error   { background: rgba(244,112,126,.08); color: var(--status-annule); border: 1px solid rgba(244,112,126,.2); }

.kenet-card code {
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    background: rgba(255,255,255,.07);
    padding: 1px 5px;
    border-radius: 4px;
    color: #9CC93B;
}

/* ======================================================================
   Calculateur impression 3D (calc3d.js)
   ====================================================================== */
.calc3d { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.c3-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.c3-title { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1.1; }
.c3-sub { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.c3-reset { background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.c3-reset:hover { border-color: var(--sunset-teal); color: var(--sunset-teal); }

.c3-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; }
.c3-card.c3-accent { border-color: rgba(224, 64, 200, 0.5); box-shadow: 0 0 0 1px rgba(224,64,200,0.12); }
.c3-card-title { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.c3-hint { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.c3-label { display: block; font-size: 13px; font-weight: 600; color: var(--text);
    margin: 14px 0 6px; }
.c3-input { width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 11px 12px; color: var(--text); font-size: 15px;
    box-sizing: border-box; }
.c3-input:focus { outline: none; border-color: var(--sunset-teal); }
select.c3-input { cursor: pointer; }

.c3-row { display: flex; gap: 12px; }
.c3-row > * { flex: 1; }
.c3-suffix, .c3-prefix { position: relative; display: flex; align-items: center; }
.c3-suffix > input { padding-right: 42px; }
.c3-suffix > span { position: absolute; right: 12px; color: var(--text-faint); font-size: 13px; pointer-events: none; }
.c3-prefix > span:first-child { position: absolute; left: 12px; color: var(--text-faint); font-size: 15px; pointer-events: none; }
.c3-prefix > input { padding-left: 28px; }
.c3-prefix > em { position: absolute; right: 12px; color: var(--text-faint); font-size: 13px; font-style: normal; pointer-events: none; }
.c3-prefix > input[data-f="kwh"], .c3-prefix > input[data-f="maint"], .c3-prefix > input[data-f="mo_taux"] { padding-right: 48px; }
.c3-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Segmented Filament / Résine */
.c3-seg { display: flex; background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px; gap: 4px; margin: 4px 0 6px; }
.c3-seg-btn { flex: 1; background: transparent; border: none; color: var(--text-muted);
    padding: 9px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.c3-seg-btn.active { background: var(--panel-light); color: var(--text); }

/* Slider */
.c3-slider-head { display: flex; justify-content: space-between; align-items: center;
    font-size: 14px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.c3-range { width: 100%; accent-color: var(--sunset-teal); }

/* Toggle switch */
.c3-toggle-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.c3-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.c3-switch input { opacity: 0; width: 0; height: 0; }
.c3-switch span { position: absolute; inset: 0; background: var(--border); border-radius: 26px;
    transition: .2s; cursor: pointer; }
.c3-switch span::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: .2s; }
.c3-switch input:checked + span { background: var(--sunset-teal); }
.c3-switch input:checked + span::before { transform: translateX(20px); }

/* Bloc résultats */
.c3-res { background: var(--bg-soft); border-radius: var(--radius-sm); padding: 14px; margin-top: 16px; }
.c3-res-line { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-muted);
    padding: 3px 0; }
.c3-res-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 800;
    color: var(--text); padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--border); }
.c3-res-total span:last-child, .c3-green span:last-child { color: var(--sunset-teal); }
.c3-res-line.c3-green span:last-child { color: var(--status-livre); }

/* Résultat final */
.c3-final { border-color: rgba(61, 232, 216, 0.5); box-shadow: 0 0 0 1px rgba(61,232,216,0.12); }
.c3-final-label { font-size: 11px; letter-spacing: 2px; color: var(--text-muted); text-transform: uppercase; }
.c3-final-price { font-size: 40px; font-weight: 900; color: var(--text); margin: 6px 0 14px;
    background: var(--gradient-sunset); -webkit-background-clip: text; background-clip: text; color: transparent; }
.c3-final-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.c3-btn-primary { background: var(--gradient-sunset); border: none; color: #12101f; font-weight: 800;
    padding: 11px 18px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.c3-btn-primary:hover { opacity: 0.92; }
.c3-final-details { border-top: 1px solid var(--border); padding-top: 14px; }

/* Modale */
.c3-overlay { position: fixed; inset: 0; background: rgba(6, 4, 16, 0.72); backdrop-filter: blur(4px);
    z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px;
    overflow-y: auto; }
.c3-modal { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
    width: 100%; max-width: 700px; margin: auto; }
.c3-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); border-radius: var(--radius) var(--radius) 0 0; z-index: 2; }
.c3-modal-head strong { font-size: 16px; color: var(--text); }
.c3-modal-close { background: var(--panel-light); border: 1px solid var(--border); color: var(--text-muted);
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.c3-modal-close:hover { color: var(--text); border-color: var(--sunset-pink); }
.c3-modal-body { padding: 20px; }
.c3-modal-body .calc3d { max-width: none; }

/* Vrais logos des outils (MY LAB) — image par-dessus l'emoji de secours */
.tool-card .tc-icon { position: relative; overflow: hidden; }
.tc-logo-img { position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; padding: 8px; background: #ffffff; border-radius: 13px;
    box-sizing: border-box; }

/* ======================================================================
   Royaume — mini-jeu médiéval (royaume.js)
   ====================================================================== */
.kdm-statbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.kdm-stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; }
.kdm-stat-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.kdm-stat-val { font-size: 22px; font-weight: 900; color: var(--text); }
.kdm-stat-gold { border-color: rgba(255,209,102,0.5); box-shadow: 0 0 0 1px rgba(255,209,102,0.12); }
.kdm-stat-gold .kdm-stat-val { background: linear-gradient(120deg,#ffd166,#ff9f45); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kdm-coin { -webkit-text-fill-color: initial; }

.kdm-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.kdm-main { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 1000px) { .kdm-layout { grid-template-columns: 1fr; } .kdm-statbar { grid-template-columns: repeat(2,1fr); } }

.kdm-battle-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.kdm-battle-stats b { color: var(--text); }
#kdm-canvas { width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; background: var(--bg); }
.kdm-battle-result { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; display: none; }
.kdm-battle-result.win { display: block; background: rgba(110,231,168,0.10); border: 1px solid rgba(110,231,168,0.3); color: var(--status-livre); }
.kdm-battle-result.lose { display: block; background: rgba(244,112,126,0.10); border: 1px solid rgba(244,112,126,0.3); color: var(--status-annule); }

.kdm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.kdm-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.kdm-card-top { display: flex; align-items: center; justify-content: space-between; }
.kdm-emoji { font-size: 32px; line-height: 1; }
.kdm-lvl { font-size: 12px; font-weight: 800; color: var(--sunset-teal); background: rgba(61,232,216,0.12);
    padding: 3px 8px; border-radius: 20px; }
.kdm-card-name { font-size: 15px; font-weight: 800; color: var(--text); }
.kdm-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; flex: 1; }
.kdm-card-bonus { font-size: 12px; color: var(--sunset-teal); font-weight: 600; }
.kdm-buy { margin-top: 6px; width: 100%; }
.kdm-buy:disabled { opacity: 0.5; cursor: not-allowed; }

/* Colonne sources d'or */
.kdm-source { border-bottom: 1px solid var(--border); padding: 12px 0; }
.kdm-source:last-of-type { border-bottom: none; }
.kdm-source-head { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.kdm-source-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); padding: 2px 0; }
.kdm-source-total { display: flex; justify-content: space-between; font-size: 14px; font-weight: 800; color: var(--text);
    padding-top: 6px; margin-top: 4px; border-top: 1px dashed var(--border); }
.kdm-source-total span:last-child { color: #ffd166; }
.kdm-source-final { background: rgba(255,209,102,0.06); border-radius: var(--radius-sm); padding: 12px; margin-top: 8px; }
.kdm-source-final .kdm-source-total span:last-child { background: linear-gradient(120deg,#ffd166,#ff9f45); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kdm-tip { font-size: 11.5px; color: var(--text-faint); margin-top: 12px; line-height: 1.5; }

/* ======================================================================
   Royaume — jeu isométrique plein écran (royaume/*.js)
   ====================================================================== */
.rg-stage { position: relative; width: 100%; height: calc(100vh - 72px); min-height: 560px;
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #0e0b1e; }
#rg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#rg-canvas:active { cursor: grabbing; }

.rg-hud-top { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; }
.rg-chip { background: rgba(14,11,30,0.72); backdrop-filter: blur(6px); border: 1px solid var(--border);
    border-radius: 10px; padding: 6px 11px; font-size: 14px; color: var(--text); display: flex; gap: 6px; align-items: center; }
.rg-chip-lbl { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.rg-chip-gold { border-color: rgba(255,209,102,0.5); }
.rg-chip-gold b { color: #ffd166; }
.rg-pulse { animation: rgpulse 0.5s ease; }
@keyframes rgpulse { 0%{ transform: scale(1);} 40%{ transform: scale(1.35); color:#fff;} 100%{ transform: scale(1);} }

.rg-hud-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 5; }
.rg-icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
    background: rgba(14,11,30,0.72); backdrop-filter: blur(6px); color: var(--text); font-size: 16px; cursor: pointer; }
.rg-icon-btn:hover { border-color: var(--sunset-teal); }

.rg-assault-wrap { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 5; }
.rg-combat-stats { display: flex; gap: 14px; background: rgba(14,11,30,0.72); backdrop-filter: blur(6px);
    border: 1px solid var(--border); border-radius: 10px; padding: 5px 12px; font-size: 13px; color: var(--text-muted); }
.rg-combat-stats b { color: var(--text); }
.rg-assault { background: linear-gradient(120deg,#b3352b,#e0662b); color: #fff; font-weight: 900; font-size: 16px;
    border: none; border-radius: 12px; padding: 12px 26px; cursor: pointer; box-shadow: 0 6px 20px rgba(224,102,43,0.4);
    letter-spacing: 0.3px; }
.rg-assault:hover { filter: brightness(1.08); }
.rg-assault:disabled { opacity: 0.7; cursor: default; }

.rg-hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
    background: rgba(12,9,26,0.9); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding: 0 16px 14px; max-height: 48%; overflow-y: auto; transition: transform 0.25s ease;
    transform: translateY(calc(100% - 36px)); }
.rg-hud-bottom.open { transform: none; }
.rg-panel-handle { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
    color: var(--text-muted); cursor: pointer; padding: 9px; text-transform: uppercase; }
.rg-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.rg-tab { flex: 1; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-muted);
    border-radius: 9px; padding: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.rg-tab.active { background: var(--panel-light); color: var(--text); border-color: var(--sunset-teal); }
.rg-tab-content { display: none; }
.rg-tab-content.active { display: block; }

.rg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.rg-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
    display: flex; flex-direction: column; gap: 4px; }
.rg-card-h { display: flex; align-items: center; justify-content: space-between; }
.rg-emoji { font-size: 26px; }
.rg-lvl { font-size: 11px; font-weight: 800; color: var(--sunset-teal); background: rgba(61,232,216,0.12); padding: 2px 7px; border-radius: 20px; }
.rg-card-n { font-size: 13px; font-weight: 800; color: var(--text); }
.rg-card-b { font-size: 12px; color: var(--sunset-teal); font-weight: 600; min-height: 15px; }
.rg-btn { margin-top: 4px; width: 100%; border: 1px solid var(--border); background: var(--panel);
    color: var(--text-muted); border-radius: 8px; padding: 7px; font-size: 13px; font-weight: 700; cursor: not-allowed; }
.rg-btn.on { background: linear-gradient(120deg,#ffd166,#ff9f45); color: #201a10; border: none; cursor: pointer; }
.rg-btn.on:hover { filter: brightness(1.06); }

.rg-sources { display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.rg-src-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); padding: 3px 0; }
.rg-src-tot { display: flex; justify-content: space-between; font-size: 15px; font-weight: 800; color: var(--text);
    border-top: 1px dashed var(--border); padding-top: 7px; margin-top: 4px; }
.rg-src-tot span:last-child { color: #ffd166; }
.rg-tip { font-size: 12px; color: var(--text-faint); margin-top: 10px; max-width: 520px; line-height: 1.5; }

@media (max-width: 720px) {
    .rg-assault-wrap { top: auto; bottom: calc(48% + 12px); }
    .rg-hud-top .rg-chip { font-size: 12px; padding: 5px 8px; }
}

/* Royaume — bannière d'annonce d'attaque */
.rg-announce { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -20px);
    z-index: 8; background: rgba(20,8,12,0.82); border: 1px solid rgba(224,102,43,0.6);
    color: #ffcf9e; font-size: 20px; font-weight: 900; letter-spacing: 0.4px;
    padding: 12px 24px; border-radius: 12px; opacity: 0; pointer-events: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5); white-space: nowrap; }
.rg-announce.show { animation: rgAnnounce 3.2s ease forwards; }
@keyframes rgAnnounce {
    0%   { opacity: 0; transform: translate(-50%, -40px) scale(0.9); }
    12%  { opacity: 1; transform: translate(-50%, -20px) scale(1); }
    85%  { opacity: 1; transform: translate(-50%, -20px) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -10px) scale(1); }
}

/* Royaume 3D */
#rg3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rg3d-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800; color: #f0eeff; background: #0e0b1e; z-index: 4; }

/* Royaume 3D — IA : régent actif + encadré conseiller */
.rg-icon-btn.rg-on { border-color: var(--sunset-teal); box-shadow: 0 0 0 2px rgba(61,232,216,0.35); color: var(--sunset-teal); }
.rg-advisor { position: absolute; left: 16px; bottom: 96px; max-width: 380px; z-index: 7;
    background: rgba(12,9,26,0.92); backdrop-filter: blur(8px); border: 1px solid rgba(123,47,255,0.4);
    color: #eae6ff; font-size: 14px; line-height: 1.5; padding: 14px 16px; border-radius: 12px;
    opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; pointer-events: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.rg-advisor.show { opacity: 1; transform: translateY(0); }

/* Royaume 3D — HUD façon jeu mobile (style maison) */
.rg-chip { border-width: 2px; border-radius: 14px; font-weight: 800;
    background: linear-gradient(180deg, rgba(34,26,64,0.92), rgba(14,11,30,0.92));
    box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08); }
.rg-chip-gold { border-color: #d8a832;
    background: linear-gradient(180deg, rgba(66,50,16,0.95), rgba(30,22,8,0.95)); }
.rg-chip-gold b { text-shadow: 0 1px 0 rgba(0,0,0,0.6); }
.rg-icon-btn { border-width: 2px; border-radius: 12px;
    background: linear-gradient(180deg, rgba(34,26,64,0.92), rgba(14,11,30,0.92));
    box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08); }
.rg-icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.45); }
.rg-assault { border-radius: 16px; border: 2px solid #8a2318; font-size: 17px;
    background: linear-gradient(180deg, #ff9d3c 0%, #f06423 45%, #cf3b16 100%);
    text-shadow: 0 2px 0 rgba(0,0,0,0.35);
    box-shadow: 0 5px 0 #7a1f10, 0 10px 24px rgba(224,102,43,0.45), inset 0 2px 0 rgba(255,255,255,0.35); }
.rg-assault:active { transform: translateY(3px); box-shadow: 0 2px 0 #7a1f10, inset 0 2px 0 rgba(255,255,255,0.35); }
.rg-card { border-width: 2px; border-radius: 14px;
    background: linear-gradient(180deg, rgba(38,30,72,0.9), rgba(19,14,40,0.95));
    box-shadow: 0 3px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06); }
.rg-btn.on { border-radius: 11px; border: 2px solid #9c7a1c;
    background: linear-gradient(180deg, #ffe082 0%, #ffb938 55%, #e8940f 100%);
    text-shadow: 0 1px 0 rgba(255,255,255,0.45);
    box-shadow: 0 3px 0 #8a6a12, inset 0 1px 0 rgba(255,255,255,0.5); }
.rg-btn.on:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6a12; }
.rg-hud-bottom { border-top-width: 2px;
    background: linear-gradient(180deg, rgba(24,18,48,0.96), rgba(10,7,22,0.97)); }
.rg-tab.active { box-shadow: inset 0 -3px 0 var(--sunset-teal); }

/* ======================================================================
   REFONTE PRO — couche de raffinement globale (charte inchangée)
   ====================================================================== */

/* --- Structure & rythme vertical --- */
.content { max-width: 1440px; margin: 0 auto; padding: 30px 34px 60px; width: 100%; animation: pageIn 0.35s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.topbar { margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid rgba(200,150,255,0.10);
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 27px; font-weight: 900; letter-spacing: 0.3px; line-height: 1.15; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.panel { margin-bottom: 22px; box-shadow: var(--shadow-sm); transition: border-color 0.2s; }
.panel:hover { border-color: rgba(160,120,240,0.35); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(200,150,255,0.08); flex-wrap: wrap; }
.section-title { font-size: 14.5px; font-weight: 800; letter-spacing: 0.4px; }

/* --- Navigation latérale : indicateur actif net --- */
.nav-link { position: relative; }
.nav-link:hover { color: var(--text); background: rgba(123,47,255,0.10); transform: translateX(2px); }
.nav-link.active::before { content: ""; position: absolute; left: -18px; top: 20%; bottom: 20%;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--gradient-sunset); }
.nav-link svg { width: 18px; height: 18px; flex: none; }

/* --- Boutons : cohérence, focus, presse --- */
.btn { transition: transform 0.12s, box-shadow 0.2s, filter 0.15s, border-color 0.15s; will-change: transform; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible, .rg-icon-btn:focus-visible { outline: 2px solid var(--sunset-teal); outline-offset: 2px; }
.btn-primary { box-shadow: 0 4px 18px rgba(224,64,200,0.35); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(224,64,200,0.5); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

/* --- Formulaires : focus ring doux, cohérence --- */
input[type="text"], input[type="number"], input[type="date"], input[type="email"],
input[type="tel"], input[type="search"], select, textarea {
    transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(61,232,216,0.14); }
label { user-select: none; }
.form-row label { font-size: 12px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.hint { font-size: 12px; color: var(--text-faint); line-height: 1.55; margin-top: 8px; }

/* --- Toolbar de liste --- */
.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 220px; }

/* --- Tableaux : lisibilité pro --- */
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-faint);
    font-weight: 800; padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
td { padding: 12px 14px; border-bottom: 1px solid rgba(46,40,96,0.5); font-size: 14px; }
tbody tr { cursor: pointer; transition: background 0.12s; }
tbody tr:nth-child(even) { background: rgba(123,47,255,0.035); }
tbody tr:hover { background: rgba(123,47,255,0.12); }
tbody tr:hover td:first-child { color: var(--sunset-teal); }
tbody tr:last-child td { border-bottom: none; }
td:first-child { font-weight: 700; color: var(--text); }

/* --- Cartes fiches : hiérarchie + survol --- */
.fiche-card { transition: transform 0.16s, box-shadow 0.2s, border-color 0.16s; position: relative; overflow: hidden; }
.fiche-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
    background: var(--gradient-sunset); opacity: 0; transition: opacity 0.16s; }
.fiche-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(160,120,240,0.5); }
.fiche-card:hover::after { opacity: 1; }
.fiche-ref { font-size: 11px; letter-spacing: 1.4px; }
.fiche-prix { font-weight: 900; }

/* --- Stat cards : liseré dégradé + survol --- */
.stat-card { position: relative; overflow: hidden; transition: transform 0.16s, border-color 0.16s; }
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient-sunset); opacity: 0.65; }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(160,120,240,0.4); }
.stat-card .stat-label { font-size: 10.5px; letter-spacing: 1.6px; }

/* --- Listes d'événements (accueil) --- */
.event-item { transition: background 0.14s, transform 0.14s; border-radius: var(--radius-sm); }
.event-item:hover { background: rgba(123,47,255,0.10); transform: translateX(3px); }
.event-date-box { box-shadow: inset 0 0 0 1px rgba(200,150,255,0.14); }

/* --- Badges --- */
.badge { font-weight: 800; letter-spacing: 0.4px; box-shadow: inset 0 0 0 1px currentColor; opacity: 0.95; }

/* --- Alertes --- */
.alert-banner { border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }

/* --- États vides --- */
.empty-state { padding: 54px 20px; border: 1.5px dashed rgba(160,120,240,0.28); border-radius: var(--radius);
    background: rgba(123,47,255,0.04); }
.empty-state .emoji { display: block; font-size: 38px; margin-bottom: 10px; }

/* --- Modales & toasts --- */
.modal { box-shadow: 0 24px 70px rgba(0,0,0,0.6); animation: pageIn 0.22s ease; }
.modal-overlay { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.toast { box-shadow: var(--shadow); font-weight: 600; }

/* --- Cartes outils (MY LAB) --- */
.tool-card { transition: transform 0.16s, box-shadow 0.2s, border-color 0.16s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(160,120,240,0.5); }
.tool-card:hover .tc-name { color: var(--sunset-teal); }
.tc-name { transition: color 0.15s; }

/* --- Scrollbar & sélection --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(150,110,230,0.28); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(150,110,230,0.45); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(224,64,200,0.4); }

/* --- Responsive ---
   ≤760 px : la couche de base transforme la sidebar en barre horizontale ;
   ce bloc « rail d'icônes » ne doit donc s'appliquer qu'entre 761 et 980 px. */
@media (max-width: 980px) and (min-width: 761px) {
    .sidebar { width: 74px; padding: 18px 10px; }
    .sidebar .nav-link span, .sidebar .sidebar-footer, .sidebar .sidebar-palms { display: none; }
    .sidebar .nav-link { justify-content: center; padding: 12px; }
    .sidebar .brand-logo img { max-width: 44px; }
    .nav-link.active::before { left: -10px; }
}
@media (max-width: 980px) {
    .content { padding: 20px 18px 50px; }
    .home-grid, .outils-layout { grid-template-columns: 1fr !important; }
}
@media (max-width: 760px) {
    .global-search-btn { margin: 0 10px 0 0; flex: 0 0 auto; }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .page-title { font-size: 22px; }
    .topbar { align-items: flex-start; }
}

/* Messagerie — lignes de mail */
.mail-item { display: flex; gap: 14px; align-items: baseline; padding: 12px 14px;
    border-bottom: 1px solid rgba(46,40,96,0.5); text-decoration: none; color: var(--text);
    border-radius: var(--radius-sm); transition: background 0.13s, transform 0.13s; }
.mail-item:last-child { border-bottom: none; }
.mail-item:hover { background: rgba(123,47,255,0.10); transform: translateX(3px); }
.mail-item:hover .mail-subject { color: var(--sunset-teal); }
.mail-from { flex: 0 0 200px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.13s; }
.mail-date { flex: 0 0 auto; font-size: 12px; color: var(--text-faint); }
@media (max-width: 640px) { .mail-from { flex-basis: 110px; } }

/* ============================================================
   Recherche globale — palette Ctrl+K
   ============================================================ */
.global-search-btn {
    display: flex; align-items: center; gap: 10px;
    margin: 0 14px 14px 14px; padding: 9px 12px;
    background: rgba(14, 11, 30, 0.55); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; font-size: 13px; cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.global-search-btn:hover { border-color: var(--sunset-teal); color: var(--text); }
.global-search-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.global-search-btn span { flex: 1; text-align: left; }
.global-search-btn kbd, .search-input-row kbd {
    font-family: inherit; font-size: 10.5px; color: var(--text-faint);
    border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px;
    background: rgba(14, 11, 30, 0.6); white-space: nowrap;
}

.search-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(8, 5, 22, 0.72); backdrop-filter: blur(3px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px;
}
.search-palette {
    width: 100%; max-width: 560px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden;
}
.search-input-row {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.search-input-row svg { width: 18px; height: 18px; color: var(--sunset-teal); flex: 0 0 auto; }
.search-input-row input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font: inherit; font-size: 16px;
}
.search-input-row input::placeholder { color: var(--text-faint); }

.search-results { max-height: 46vh; overflow-y: auto; padding: 8px; }
.search-empty { padding: 18px 14px; color: var(--text-faint); font-size: 13.5px; text-align: center; }
.search-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none;
}
.search-item:hover, .search-item.selected { background: rgba(123, 47, 255, 0.16); }
.search-item.selected { outline: 1px solid rgba(192, 128, 255, 0.4); }
.search-item-icon { font-size: 18px; flex: 0 0 auto; }
.search-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.search-item-title { font-weight: 700; font-size: 14px; }
.search-item-detail {
    font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-item-type {
    flex: 0 0 auto; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-faint);
    border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px;
}
@media (max-width: 900px) {
    .global-search-btn span, .global-search-btn kbd { display: none; }
    .global-search-btn { justify-content: center; }
}

/* FIX : la palette Ctrl+K doit rester cachée tant que hidden est posé
   (le display:flex de .search-overlay écrasait l'attribut hidden) */
.search-overlay[hidden] { display: none !important; }
