:root {
    --bg-top: #e8d4f0;
    --bg-bottom: #f5d4e8;
    --panel: rgba(255, 252, 255, 0.78);
    --text-main: #5a4a6e;
    --text-soft: #7a6a8e;
    --title: #5a4a6e;
    --shadow-soft: 0 18px 38px rgba(144, 116, 172, 0.14);
    --shadow-pop: 0 16px 30px rgba(255, 183, 212, 0.28);
    --ease-bounce: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
    min-height: 100vh;
    color: var(--text-main);
    line-height: 1.55;
    background: linear-gradient(180deg, #e8d4f0 0%, #f5d4e8 100%);
    overflow-x: hidden;
    position: relative;
    transition: background 320ms ease, color 220ms ease;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    filter: blur(10px);
    opacity: 0.6;
    pointer-events: none;
    z-index: -2;
    animation: drift 18s ease-in-out infinite;
    transition: background 320ms ease, opacity 220ms ease;
}

body::before {
    top: -80px;
    left: -70px;
    background: radial-gradient(circle, rgba(255, 206, 229, 0.82) 0%, rgba(255, 206, 229, 0) 72%);
}

body::after {
    right: -60px;
    bottom: -100px;
    background: radial-gradient(circle, rgba(205, 244, 235, 0.85) 0%, rgba(205, 244, 235, 0) 72%);
    animation-delay: -6s;
}

a,
button,
input,
select,
textarea,
tr,
.card,
.welcome-section,
.page-header,
.table-container,
.modal-content,
.login-card,
.auth-controls {
    transition:
        transform 220ms var(--ease-bounce),
        box-shadow 220ms ease,
        background-color 220ms ease,
        border-color 220ms ease,
        color 220ms ease,
        opacity 220ms ease;
}

.nav-links a {
    transition:
        background-color 180ms ease,
        color 180ms ease;
}

.navbar {
    position: sticky;
    top: 14px;
    z-index: 100;
    overflow: visible;
    margin: 16px 18px 24px;
    padding: 0;
    background: rgba(255, 250, 255, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.navbar .container {
    max-width: 1320px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 0;
    height: 56px;
}

.navbar h1 {
    color: var(--title);
    font-size: 1.2rem;
    letter-spacing: 0.03em;
    font-weight: 800;
    white-space: nowrap;
    display: flex;
    align-items: center;
    padding: 0 1.4rem;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 0;
    flex: 1;
    align-items: stretch;
    overflow: visible;
}

/* Sélecteur de base pour les liens cachés dans les dropdowns */
.nav-links a[hidden] {
    display: none;
}

/* Lien direct dans la navbar (ex: Accueil) */
.nav-top-link {
    color: var(--text-main);
    text-decoration: none;
    padding: 0 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    position: relative;
}

.nav-top-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 2px;
    background: linear-gradient(90deg, #f59cc5, #a88ac2);
    border-radius: 2px;
    transition: left 220ms var(--ease-bounce), right 220ms var(--ease-bounce);
}

.nav-top-link:hover {
    color: var(--title);
    background: rgba(255, 221, 237, 0.28);
}

.nav-top-link:hover::after,
.nav-top-link.active::after {
    left: 16px;
    right: 16px;
}

.nav-top-link.active {
    color: #6a527f;
    background: rgba(255, 198, 221, 0.22);
    font-weight: 800;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

/* Masquer le dropdown si tous ses liens sont cachés */
.nav-dropdown:not(:has(a:not([hidden]))) {
    display: none;
}

.nav-dropdown-btn {
    color: var(--text-main);
    background: transparent;
    border: none;
    padding: 0 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-family: inherit;
    position: relative;
}

.nav-dropdown-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 2px;
    background: linear-gradient(90deg, #f59cc5, #a88ac2);
    border-radius: 2px;
    transition: left 220ms var(--ease-bounce), right 220ms var(--ease-bounce);
}

.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn {
    color: var(--title);
    background: rgba(255, 221, 237, 0.28);
}

.nav-dropdown-btn:hover::after,
.nav-dropdown:hover .nav-dropdown-btn::after,
.nav-dropdown-btn.active::after {
    left: 16px;
    right: 16px;
}

.nav-dropdown-btn.active {
    color: #6a527f;
    background: rgba(255, 198, 221, 0.22);
    font-weight: 800;
}

.nav-dropdown-arrow {
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 180ms ease;
}

.nav-dropdown-btn[aria-expanded="true"] .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 140ms ease, transform 140ms ease;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 160px;
    background: rgba(255, 250, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(150, 80, 180, 0.13), 0 2px 8px rgba(0,0,0,0.08);
    backdrop-filter: blur(16px);
    z-index: 200;
    overflow: hidden;
    padding: 6px 0;
}

.nav-dropdown:hover .nav-dropdown-menu {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: background 140ms ease, color 140ms ease;
}

.nav-dropdown-menu a[hidden] {
    display: none;
}

.nav-dropdown-menu a:hover {
    background: rgba(255, 221, 237, 0.45);
    color: var(--title);
}

.nav-dropdown-menu a.active {
    color: #6a527f;
    background: rgba(255, 198, 221, 0.3);
    font-weight: 700;
}

.auth-user-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}

.auth-user-link:hover .auth-user {
    color: var(--primary, #9B59B6);
}

.nav-utility {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-right: 0.8rem;
    flex-shrink: 0;
}

.auth-controls,
.voice-controls {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.6rem 0.45rem 0.9rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.66) 0%, rgba(246, 233, 255, 0.72) 100%);
    border: 1px solid rgba(255, 255, 255, 0.82);
}

.auth-user {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-soft);
}

.theme-selector {
    font-size: 0.82rem;
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.66) 0%, rgba(246, 233, 255, 0.72) 100%);
    color: var(--text-soft);
    cursor: pointer;
    outline: none;
}

body[data-user-theme="saref"] .theme-selector {
    background: linear-gradient(135deg, rgba(18, 28, 43, 0.92) 0%, rgba(34, 49, 73, 0.88) 100%);
    border-color: rgba(94, 109, 139, 0.3);
    color: #f0d7da;
}

.voice-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ebd2e5;
    box-shadow: 0 0 0 4px rgba(255, 231, 241, 0.9);
}

.voice-indicator.is-speaking {
    background: #79dcb8;
    box-shadow: 0 0 0 6px rgba(168, 242, 215, 0.5);
    animation: bounce-glow 900ms ease-in-out infinite;
}

.voice-label,
.voice-volume-value {
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 700;
}

.voice-slider {
    width: 112px;
    accent-color: #f59cc5;
}

.voice-unlock {
    border: none;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    background: linear-gradient(135deg, #ffc8df 0%, #d8d0ff 100%);
    color: #6f4f78;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-pop);
}

.voice-unlock:hover {
    transform: translateY(-2px) scale(1.01);
}

.voice-unlock.is-hidden {
    display: none;
}

.container {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.welcome-section,
.page-header,
.table-container,
.loading,
.login-card,
.modal-content {
    position: relative;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.welcome-section::before,
.page-header::before,
.table-container::before,
.login-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    transform: translate(-35%, -45%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0) 72%);
    pointer-events: none;
}

/* Home Layout */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.home-main {
    min-width: 0;
}

.home-sidebar {
    min-width: 0;
}

.welcome-section {
    background: rgba(255, 255, 255, 0.5);
    padding: 3rem;
    border-radius: 32px;
    text-align: center;
    animation: rise-in 760ms var(--ease-bounce);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.welcome-section h2 {
    color: var(--title);
    margin-bottom: 0.5rem;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.2;
    font-weight: 700;
}

.welcome-section p {
    max-width: 680px;
    margin: 0 auto 2.5rem;
    color: var(--text-soft);
    font-size: 1rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 2rem 1.5rem;
    border-radius: 24px;
    text-align: center;
    background: rgba(230, 220, 240, 0.6);
    border: 2px solid rgba(200, 180, 220, 0.4);
    animation: rise-in 700ms var(--ease-bounce);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 200px;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(200, 180, 220, 0.6);
}

.card-icon-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(255, 240, 250, 0.8);
    margin-bottom: auto;
}

.card-button-placeholder {
    width: 120px;
    height: 36px;
    border-radius: 18px;
    background: rgba(255, 200, 230, 0.6);
    margin-top: auto;
}

/* Updates Section */
.updates-section {
    background: rgba(255, 255, 255, 0.5);
    padding: 2rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.updates-section h3 {
    color: var(--title);
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.update-card {
    background: rgba(240, 230, 245, 0.5);
    border: 1px solid rgba(220, 210, 235, 0.6);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.update-card:last-child {
    margin-bottom: 0;
}

.update-date {
    font-weight: 700;
    color: var(--title);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.update-item {
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.update-item:last-child {
    margin-bottom: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.6rem 1.8rem;
    margin-bottom: 1.4rem;
    border-radius: 28px;
    animation: rise-in 680ms var(--ease-bounce);
}

.page-header h2 {
    color: var(--title);
    font-size: clamp(1.65rem, 3vw, 2.2rem);
    line-height: 1.1;
}

.page-subtitle {
    margin-top: 0.35rem;
    color: var(--text-soft);
}

.page-header > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-subheader {
    margin-top: 3rem !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.82rem 1.28rem;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(188, 150, 198, 0.18);
}

.btn:hover {
    transform: translateY(-2px) scale(1.01);
}

.btn-primary {
    background: linear-gradient(135deg, #ffc7dc 0%, #d9cbff 100%);
    color: #6b517f;
}

.btn-secondary {
    background: linear-gradient(135deg, #d7ecff 0%, #ebe0ff 100%);
    color: #667291;
}

.btn-success {
    background: linear-gradient(135deg, #cdf5e7 0%, #effee9 100%);
    color: #52866f;
}

.btn-danger {
    background: linear-gradient(135deg, #ffd3de 0%, #ffe4cb 100%);
    color: #9a5d79;
}

.btn-sm {
    padding: 0.58rem 0.95rem;
    font-size: 0.86rem;
}

.table-container {
    padding: 1.2rem;
    border-radius: 28px;
    overflow-x: auto;
    overflow-y: hidden;
    animation: rise-in 760ms var(--ease-bounce);
}

.col-url {
    max-width: 360px;
    word-break: break-word;
}

.col-url a {
    color: #8a63a7;
    font-weight: 700;
}

.col-title {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-title a {
    color: #8a63a7;
    font-weight: 700;
}

.col-launched {
    width: 140px;
    white-space: nowrap;
}

.col-launched input {
    max-width: 110px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    padding: 1rem 0.95rem;
    text-align: left;
    font-weight: 800;
    color: #705985;
    background: linear-gradient(135deg, rgba(255, 216, 232, 0.96) 0%, rgba(214, 233, 255, 0.96) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.86);
}

thead th:first-child {
    border-top-left-radius: 18px;
}

thead th:last-child {
    border-top-right-radius: 18px;
}

tbody td {
    padding: 0.95rem;
    color: #736a8b;
    border-bottom: 1px solid rgba(202, 192, 221, 0.34);
    background: rgba(255, 255, 255, 0.48);
}

tbody tr:nth-child(even) td {
    background: rgba(255, 247, 252, 0.62);
}

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

tbody tr:hover {
    transform: translateY(-2px);
}

.loading,
.error,
.success {
    padding: 1rem 1.15rem;
    border-radius: 22px;
    margin-bottom: 1rem;
}

.loading {
    text-align: center;
    color: var(--title);
    font-size: 1.08rem;
}

.error {
    background: rgba(255, 226, 236, 0.82);
    color: #95617c;
    border: 1px solid rgba(241, 176, 199, 0.55);
}

.success {
    background: rgba(219, 248, 233, 0.9);
    color: #4c806d;
    border: 1px solid rgba(166, 225, 195, 0.64);
}

.admin-note {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.72);
    color: var(--text-soft);
    font-weight: 700;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 1.2rem;
    align-items: start;
    margin-bottom: 2rem;
}

.settings-panel {
    padding: 1.25rem;
}

.panel-title {
    color: var(--title);
    margin-bottom: 0.8rem;
    font-size: 1.25rem;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.form-hint {
    color: var(--text-soft);
    font-size: 0.92rem;
}

.permission-head {
    min-width: 120px;
    text-align: center;
}

.permission-cell {
    text-align: center;
}

.permission-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #f59cc5;
    cursor: pointer;
}

.permission-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.table-note {
    color: var(--text-soft);
    font-weight: 700;
    white-space: nowrap;
}

.account-status-cell {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 2rem 1rem;
    background: rgba(120, 96, 145, 0.22);
    backdrop-filter: blur(10px);
}

.modal-content {
    width: min(100%, 560px);
    margin: 6vh auto 0;
    padding: 2rem;
    border-radius: 28px;
    animation: pop-in 260ms var(--ease-bounce);
}

.modal-content h3 {
    color: var(--title);
    margin-bottom: 1.2rem;
    font-size: 1.45rem;
}

.close {
    float: right;
    color: #af9bc2;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #e88db8;
    transform: scale(1.06);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text-soft);
    font-weight: 700;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(201, 188, 224, 0.72);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-main);
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: rgba(244, 143, 190, 0.88);
    box-shadow: 0 0 0 5px rgba(255, 205, 226, 0.48);
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field .form-control {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-soft);
    font-size: 1.1rem;
    line-height: 1;
    transition: color 150ms ease;
    flex-shrink: 0;
}

.password-toggle:hover {
    color: var(--primary, #9B59B6);
}

.user-info {
    padding: 0.85rem 1rem;
    border-radius: 16px;
    background: rgba(255, 247, 255, 0.86);
    border: 1px solid rgba(213, 198, 233, 0.56);
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 1.4rem;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: linear-gradient(135deg, #f2d9ff 0%, #ffe0ef 100%);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    width: 26px;
    height: 26px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 50%;
    transition: transform 220ms var(--ease-bounce);
}

input:checked + .slider {
    background: linear-gradient(135deg, #cbf6e6 0%, #f1ffd1 100%);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.value-badge {
    display: inline-block;
    padding: 0.42rem 0.85rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
}

.value-vrai {
    background: rgba(207, 245, 231, 0.96);
    color: #4c7e6b;
}

.value-faux {
    background: rgba(255, 221, 231, 0.96);
    color: #946178;
}

.reset-requested-row {
    background: rgba(255, 200, 200, 0.12);
}

.reset-requested-row:hover {
    background: rgba(255, 200, 200, 0.2) !important;
}

.reset-badge {
    font-size: 0.78rem;
    white-space: nowrap;
}

.sortable {
    user-select: none;
    position: relative;
}

.sortable.sort-asc::after {
    content: " ^";
    font-size: 0.8em;
}

.sortable.sort-desc::after {
    content: " v";
    font-size: 0.8em;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-shell {
    width: 100%;
    max-width: 480px;
}

.login-card {
    padding: 2.6rem;
    border-radius: 34px;
    animation: rise-in 720ms var(--ease-bounce);
}

.login-card h1 {
    color: var(--title);
    margin-bottom: 0.65rem;
    font-size: clamp(2rem, 5vw, 2.6rem);
}

.login-subtitle {
    color: var(--text-soft);
    margin-bottom: 1.4rem;
}

.auth-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 1.35rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.login-submit {
    width: 100%;
    margin-top: 0.6rem;
}

.login-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.login-links a {
    color: var(--title);
    font-weight: 800;
    text-decoration: none;
}

.login-links a:hover {
    transform: translateY(-1px);
}

/* Couleur de sélection de texte — thème clair */
::selection {
    background: rgba(245, 156, 197, 0.35);
    color: #5a3f70;
}

/* Dark palette used only for saref. */
body[data-user-theme="saref"] {
    --bg-top: #2d2440;
    --bg-bottom: #3d2d50;
    --panel: rgba(16, 25, 40, 0.92);
    --text-main: #e2d5e8;
    --text-soft: #c5b8d8;
    --title: #f0d8db;
    --shadow-soft: 0 22px 42px rgba(0, 0, 0, 0.52);
    --shadow-pop: 0 18px 32px rgba(248, 219, 84, 0.18);
    color-scheme: dark;
    background: linear-gradient(180deg, #2d2440 0%, #3d2d50 100%);
}

body[data-user-theme="saref"]::before {
    background: radial-gradient(circle, rgba(240, 209, 214, 0.24) 0%, rgba(240, 209, 214, 0) 72%);
}

body[data-user-theme="saref"]::after {
    background: radial-gradient(circle, rgba(248, 219, 84, 0.18) 0%, rgba(248, 219, 84, 0) 72%);
}

/* Sélection de texte en thème sombre */
body[data-user-theme="saref"] ::selection {
    background: rgba(248, 219, 84, 0.32);
    color: #fffbe6;
}

body[data-user-theme="saref"] .navbar {
    background: rgba(8, 14, 22, 0.88);
    border-color: rgba(95, 111, 142, 0.32);
}

body[data-user-theme="saref"] .navbar h1,
body[data-user-theme="saref"] .welcome-section h2,
body[data-user-theme="saref"] .page-header h2,
body[data-user-theme="saref"] .login-card h1 {
    text-shadow: 0 0 18px rgba(248, 219, 84, 0.14);
}

body[data-user-theme="saref"] .nav-top-link,
body[data-user-theme="saref"] .nav-dropdown-btn {
    color: #d8deea;
    background: rgba(34, 48, 70, 0.82);
}

body[data-user-theme="saref"] .nav-top-link:hover,
body[data-user-theme="saref"] .nav-dropdown:hover .nav-dropdown-btn,
body[data-user-theme="saref"] .nav-dropdown-btn:hover {
    background: linear-gradient(135deg, rgba(242, 213, 218, 0.18) 0%, rgba(46, 63, 91, 0.95) 100%);
    color: #f0d7da;
}

body[data-user-theme="saref"] .nav-top-link.active,
body[data-user-theme="saref"] .nav-dropdown-btn.active {
    color: #0c1320;
    background: linear-gradient(135deg, rgba(55, 75, 106, 0.96) 0%, rgba(241, 215, 220, 0.9) 100%);
}

body[data-user-theme="saref"] .nav-dropdown-menu {
    background: rgba(10, 17, 27, 0.96);
    border-color: rgba(95, 111, 142, 0.35);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

body[data-user-theme="saref"] .nav-dropdown-menu a {
    color: #d8deea;
}

body[data-user-theme="saref"] .nav-dropdown-menu a:hover {
    background: linear-gradient(135deg, rgba(242, 213, 218, 0.12) 0%, rgba(46, 63, 91, 0.9) 100%);
    color: #f0d7da;
}

body[data-user-theme="saref"] .nav-dropdown-menu a.active {
    color: #f0d7da;
    background: linear-gradient(135deg, rgba(55, 75, 106, 0.96) 0%, rgba(241, 215, 220, 0.2) 100%);
}

body[data-user-theme="saref"] .auth-controls,
body[data-user-theme="saref"] .voice-controls {
    background: linear-gradient(135deg, rgba(18, 28, 43, 0.92) 0%, rgba(34, 49, 73, 0.88) 100%);
    border-color: rgba(94, 109, 139, 0.3);
}

body[data-user-theme="saref"] .nav-hamburger span {
    background: #d8deea;
}

body[data-user-theme="saref"] .nav-mobile-menu {
    background: transparent;
}

body[data-user-theme="saref"] .nav-mobile-link,
body[data-user-theme="saref"] .nav-mobile-group-btn,
body[data-user-theme="saref"] .nav-mobile-sublink {
    color: #d8deea;
}

body[data-user-theme="saref"] .nav-mobile-link:hover,
body[data-user-theme="saref"] .nav-mobile-link.active,
body[data-user-theme="saref"] .nav-mobile-sublink:hover,
body[data-user-theme="saref"] .nav-mobile-sublink.active {
    background: linear-gradient(135deg, rgba(242, 213, 218, 0.12) 0%, rgba(46, 63, 91, 0.9) 100%);
    color: #f0d7da;
}

body[data-user-theme="saref"] .nav-mobile-utility {
    border-top-color: rgba(95, 111, 142, 0.3);
}

body[data-user-theme="saref"] .auth-user,
body[data-user-theme="saref"] .voice-label,
body[data-user-theme="saref"] .voice-volume-value {
    color: #f0d7da;
}

body[data-user-theme="saref"] .voice-indicator {
    background: #6d7d98;
    box-shadow: 0 0 0 4px rgba(38, 51, 74, 0.75);
}

body[data-user-theme="saref"] .voice-indicator.is-speaking {
    background: #f8db54;
    box-shadow: 0 0 0 6px rgba(248, 219, 84, 0.16);
}

body[data-user-theme="saref"] .voice-slider,
body[data-user-theme="saref"] .permission-checkbox {
    accent-color: #f8db54;
}

body[data-user-theme="saref"] .voice-unlock {
    background: linear-gradient(135deg, #2f4564 0%, #f0d2d6 100%);
    color: #0e1521;
}

body[data-user-theme="saref"] .welcome-section,
body[data-user-theme="saref"] .page-header,
body[data-user-theme="saref"] .table-container,
body[data-user-theme="saref"] .loading,
body[data-user-theme="saref"] .login-card,
body[data-user-theme="saref"] .modal-content {
    border-color: rgba(140, 120, 160, 0.4);
    background: rgba(60, 45, 75, 0.6);
}

body[data-user-theme="saref"] .welcome-section::before,
body[data-user-theme="saref"] .page-header::before,
body[data-user-theme="saref"] .table-container::before,
body[data-user-theme="saref"] .login-card::before {
    background: radial-gradient(circle, rgba(180, 150, 200, 0.1) 0%, rgba(180, 150, 200, 0) 72%);
}

body[data-user-theme="saref"] .card {
    background: rgba(150, 110, 140, 0.5);
    border-color: rgba(120, 90, 130, 0.6);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

body[data-user-theme="saref"] .card:hover {
    border-color: rgba(140, 110, 150, 0.8);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.4);
}

body[data-user-theme="saref"] .card-icon-placeholder {
    background: rgba(50, 40, 70, 0.8);
}

body[data-user-theme="saref"] .card-button-placeholder {
    background: rgba(50, 40, 70, 0.8);
}

body[data-user-theme="saref"] .updates-section {
    background: rgba(60, 45, 75, 0.6);
    border-color: rgba(140, 120, 160, 0.4);
}

body[data-user-theme="saref"] .update-card {
    background: rgba(150, 110, 140, 0.4);
    border-color: rgba(120, 90, 130, 0.5);
}

body[data-user-theme="saref"] .update-date {
    color: #f0d8db;
}

body[data-user-theme="saref"] .update-item {
    color: #e2d5e8;
}

body[data-user-theme="saref"] .btn {
    border-color: rgba(92, 106, 136, 0.38);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

body[data-user-theme="saref"] .btn-primary {
    background: linear-gradient(135deg, #314768 0%, #f0ccd1 100%);
    color: #0a111c;
}

body[data-user-theme="saref"] .btn-secondary {
    background: linear-gradient(135deg, #223246 0%, #8b94a0 100%);
    color: #f3f6fb;
}

body[data-user-theme="saref"] .btn-success {
    background: linear-gradient(135deg, #294150 0%, #a9b1bb 100%);
    color: #f3f6fb;
}

body[data-user-theme="saref"] .btn-danger {
    background: linear-gradient(135deg, #4b2f3d 0%, #d9b6bb 100%);
    color: #fff4f6;
}

body[data-user-theme="saref"] .col-url a,
body[data-user-theme="saref"] .col-title a {
    color: #ffe55a;
}

body[data-user-theme="saref"] thead th {
    color: #f0d8db;
    background: linear-gradient(135deg, rgba(33, 46, 68, 0.98) 0%, rgba(240, 212, 217, 0.2) 100%);
    border-bottom-color: rgba(92, 107, 136, 0.32);
}

body[data-user-theme="saref"] tbody td {
    color: #dce1ef;
    border-bottom-color: rgba(88, 102, 132, 0.32);
    background: rgba(20, 30, 46, 0.88);
}

body[data-user-theme="saref"] tbody tr:nth-child(even) td {
    background: rgba(14, 22, 35, 0.92);
}

body[data-user-theme="saref"] tbody tr:hover td {
    background: rgba(40, 56, 82, 0.95);
}

body[data-user-theme="saref"] .error {
    background: rgba(83, 39, 52, 0.82);
    color: #ffd6df;
    border-color: rgba(194, 128, 147, 0.4);
}

body[data-user-theme="saref"] .success {
    background: rgba(30, 53, 65, 0.84);
    color: #dae9ef;
    border-color: rgba(95, 129, 145, 0.36);
}

body[data-user-theme="saref"] .admin-note,
body[data-user-theme="saref"] .user-info {
    background: rgba(25, 36, 55, 0.82);
    border-color: rgba(89, 104, 134, 0.32);
    color: #bec8dc;
}

body[data-user-theme="saref"] .table-note {
    color: #b8c2d8;
}

body[data-user-theme="saref"] .modal {
    background: rgba(3, 5, 10, 0.68);
}

body[data-user-theme="saref"] .close {
    color: #a9b2c6;
}

body[data-user-theme="saref"] .close:hover {
    color: #ffe55a;
}

body[data-user-theme="saref"] .form-control {
    background: rgba(9, 15, 24, 0.95);
    border-color: rgba(100, 116, 148, 0.6);
    color: #f0f3fc;
}

body[data-user-theme="saref"] .form-control:focus {
    border-color: rgba(248, 219, 84, 0.8);
    box-shadow: 0 0 0 5px rgba(248, 219, 84, 0.2);
}

body[data-user-theme="saref"] .slider {
    background: linear-gradient(135deg, #25354d 0%, #5c6c88 100%);
}

body[data-user-theme="saref"] input:checked + .slider {
    background: linear-gradient(135deg, #f8db54 0%, #f0d2d6 100%);
}

body[data-user-theme="saref"] .value-vrai {
    background: rgba(46, 72, 87, 0.94);
    color: #dcedf3;
}

body[data-user-theme="saref"] .value-faux {
    background: rgba(84, 42, 57, 0.94);
    color: #ffd8e1;
}

/* Hamburger — caché sur desktop */
.nav-hamburger {
    display: none;
}

/* Menu mobile — caché par défaut */
.nav-mobile-menu {
    display: none;
}

@media (max-width: 980px) {
    .navbar {
        margin: 12px 10px 22px;
        border-radius: 20px;
        overflow: visible;
    }

    .navbar .container {
        flex-direction: row;
        height: 52px;
        padding: 0 0.8rem;
        gap: 0;
        justify-content: space-between;
        align-items: center;
    }

    /* Cacher nav desktop sur mobile */
    .nav-links,
    .nav-utility {
        display: none;
    }

    /* Hamburger */
    .nav-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 36px;
        height: 36px;
        padding: 6px;
        background: transparent;
        border: none;
        cursor: pointer;
        border-radius: 10px;
        flex-shrink: 0;
        transition: background 150ms ease;
    }

    .nav-hamburger:hover {
        background: rgba(255, 198, 221, 0.35);
    }

    .nav-hamburger span {
        display: block;
        width: 100%;
        height: 2px;
        background: var(--text-main);
        border-radius: 2px;
        transition: transform 220ms var(--ease-bounce), opacity 150ms ease;
        transform-origin: center;
    }

    /* Animation hamburger → croix */
    .nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* Menu mobile déroulant */
    .nav-mobile-menu {
        display: block;
        max-height: 0;
        overflow: hidden;
        transition: max-height 280ms ease;
    }

    .nav-mobile-menu.open {
        max-height: 600px;
    }

    .nav-mobile-links {
        display: flex;
        flex-direction: column;
        padding: 8px 12px 4px;
        gap: 2px;
    }

    .nav-mobile-link {
        display: block;
        padding: 10px 14px;
        color: var(--text-main);
        text-decoration: none;
        font-weight: 700;
        font-size: 0.92rem;
        border-radius: 12px;
        transition: background 140ms ease;
    }

    .nav-mobile-link:hover,
    .nav-mobile-link.active {
        background: rgba(255, 198, 221, 0.35);
        color: #6a527f;
    }

    /* Groupes dépliables */
    .nav-mobile-group-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 14px;
        background: transparent;
        border: none;
        font-weight: 700;
        font-size: 0.92rem;
        color: var(--text-main);
        font-family: inherit;
        cursor: pointer;
        border-radius: 12px;
        transition: background 140ms ease;
    }

    .nav-mobile-group-btn:hover {
        background: rgba(255, 198, 221, 0.2);
    }

    .nav-mobile-group.active .nav-mobile-group-btn {
        color: #6a527f;
    }

    .nav-mobile-group .nav-dropdown-arrow {
        transition: transform 200ms ease;
    }

    .nav-mobile-group.expanded .nav-dropdown-arrow {
        transform: rotate(180deg);
    }

    .nav-mobile-group-items {
        display: none;
        flex-direction: column;
        padding: 2px 0 2px 12px;
        gap: 2px;
    }

    .nav-mobile-group.expanded .nav-mobile-group-items {
        display: flex;
    }

    .nav-mobile-sublink {
        display: block;
        padding: 8px 14px;
        color: var(--text-main);
        text-decoration: none;
        font-weight: 600;
        font-size: 0.88rem;
        border-radius: 10px;
        transition: background 140ms ease;
    }

    .nav-mobile-sublink:hover,
    .nav-mobile-sublink.active {
        background: rgba(255, 198, 221, 0.35);
        color: #6a527f;
    }

    /* Utilitaires en bas du menu mobile */
    .nav-mobile-utility {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 16px 14px;
        border-top: 1px solid rgba(180, 140, 200, 0.2);
        margin-top: 4px;
        gap: 10px;
    }

    .nav-utility {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header > div {
        width: 100%;
        justify-content: flex-start;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .home-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .home-sidebar {
        order: -1;
    }

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .container {
        padding: 0 1rem;
    }

    .home-layout {
        padding: 1rem;
    }

    .welcome-section {
        padding: 2rem 1.5rem;
        border-radius: 24px;
    }

    .welcome-section h2 {
        font-size: 1.8rem;
    }

    .cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card {
        padding: 1.5rem 1rem;
        min-height: 160px;
    }

    .updates-section {
        padding: 1.5rem;
    }

    .table-container {
        padding: 0.7rem;
        border-radius: 22px;
    }

    thead th,
    tbody td {
        padding: 0.78rem 0.7rem;
    }

    .auth-controls,
    .voice-controls {
        width: 100%;
        justify-content: center;
    }

    .modal-content,
    .login-card {
        padding: 1.6rem;
        border-radius: 24px;
    }

    .auth-inline {
        flex-direction: column;
        align-items: flex-start;
    }
}

@keyframes flash-fade-out {
    0%   { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; }
}

.flash-auto-hide {
    animation: flash-fade-out 5s ease forwards;
}

@keyframes rise-in {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes drift {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(20px, -18px, 0) scale(1.08);
    }
}

@keyframes bounce-glow {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.18);
    }
}
