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

body {
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at 50% 0%, #1a1035 0%, #0b0b12 45%, #050508 100%);
    color: #f2f2f7;
    overflow-x: hidden;
}

.nav-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 1.25rem 0;
    animation: navIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.navbar {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 1rem;
    background: rgba(22, 18, 36, 0.72);
    border: 1px solid rgba(168, 140, 255, 0.22);
    border-radius: 999px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    object-fit: contain;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, #f5f3ff, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}

.nav-sep {
    color: rgba(212, 208, 232, 0.45);
    font-weight: 400;
    user-select: none;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border: none;
    border-radius: 999px;
    background: none;
    color: #d4d0e8;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.nav-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.nav-btn.active {
    color: #fff;
    background: rgba(140, 140, 155, 0.35);
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 200px;
}

.btn-auth {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(168, 140, 255, 0.35);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(99, 102, 241, 0.25));
    color: #fff;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.btn-auth:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(99, 102, 241, 0.4));
}

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

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: #f2f2f7;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-align: left;
}

.user-menu-btn:hover,
.user-menu-btn.open {
    background: rgba(140, 140, 155, 0.28);
    border-color: rgba(168, 140, 255, 0.2);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #4c1d95;
    flex-shrink: 0;
}

.user-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    padding: 0.4rem;
    background: rgba(22, 18, 36, 0.95);
    border: 1px solid rgba(168, 140, 255, 0.25);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    display: none;
    z-index: 200;
}

.user-dropdown.show {
    display: block;
    animation: dropIn 0.18s ease;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    color: #e8e4f5;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.user-dropdown a:hover {
    background: rgba(139, 92, 246, 0.2);
}

.user-dropdown a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.9;
}

.user-dropdown a.danger {
    color: #fca5a5;
}

.user-dropdown a.danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes navIn {
    from {
        opacity: 0;
        transform: translateY(-28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}

.card {
    background: rgba(22, 18, 36, 0.72);
    border: 1px solid rgba(168, 140, 255, 0.22);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    padding: 1.35rem;
}

.card + .card {
    margin-top: 1rem;
}

.card h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.form-grid {
    display: grid;
    gap: 0.85rem;
}

.form-row {
    display: grid;
    gap: 0.35rem;
}

.form-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(212, 208, 232, 0.8);
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(168, 140, 255, 0.22);
    background: rgba(8, 8, 14, 0.55);
    color: #fff;
    font: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: rgba(167, 139, 250, 0.65);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.35rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: 12px;
    border: 1px solid rgba(168, 140, 255, 0.28);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(99, 102, 241, 0.3));
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.12s;
}

.btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.55), rgba(99, 102, 241, 0.42));
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.35);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.92rem;
    font-weight: 600;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #bbf7d0;
}

.alert-info {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #c7d2fe;
}

.tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tab {
    flex: 1;
    padding: 0.65rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: #c4b5fd;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.tab.active {
    background: rgba(140, 140, 155, 0.28);
    color: #fff;
    border-color: rgba(168, 140, 255, 0.2);
}

.auth-wrap {
    max-width: 420px;
    margin: 2.5rem auto;
    padding: 0 1.25rem 3rem;
}

.table-wrap {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.data th,
table.data td {
    text-align: left;
    padding: 0.7rem 0.55rem;
    border-bottom: 1px solid rgba(168, 140, 255, 0.12);
    vertical-align: top;
}

table.data th {
    color: rgba(212, 208, 232, 0.7);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table.data tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(140, 140, 155, 0.3);
}

.badge-admin {
    background: rgba(139, 92, 246, 0.35);
}

.badge-ok {
    background: rgba(34, 197, 94, 0.25);
}

.badge-err {
    background: rgba(239, 68, 68, 0.25);
}

.results {
    margin-top: 1rem;
    display: grid;
    gap: 0.65rem;
}

.result-item {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(8, 8, 14, 0.45);
    border: 1px solid rgba(168, 140, 255, 0.14);
    text-align: left;
    font-size: 0.88rem;
    word-break: break-word;
}

.result-item .meta {
    color: rgba(212, 208, 232, 0.55);
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
}

.loading {
    display: none;
    align-items: center;
    gap: 0.55rem;
    margin-top: 1rem;
    color: #c4b5fd;
    font-weight: 600;
}

.loading.show {
    display: inline-flex;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(196, 181, 253, 0.25);
    border-top-color: #c4b5fd;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.admin-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 900px) {
    .admin-grid.two {
        grid-template-columns: 1fr 1fr;
    }
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

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

    .navbar {
        flex-wrap: wrap;
        border-radius: 22px;
    }

    .nav-right {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

.muted {
    color: rgba(212, 208, 232, 0.55);
    font-size: 0.88rem;
}

.site-footer {
    width: 100%;
    margin-top: 2.5rem;
    padding: 0 1.25rem 1.75rem;
}

.footer-line {
    max-width: 1100px;
    margin: 0 auto 1.15rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168, 140, 255, 0.35), transparent);
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.85rem 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-self: start;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    color: inherit;
}

.footer-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.footer-name {
    font-weight: 800;
    font-size: 0.95rem;
    background: linear-gradient(90deg, #f5f3ff, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.footer-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: rgba(212, 208, 232, 0.55);
    font-size: 0.85rem;
    font-weight: 700;
}

.footer-copy svg {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

.footer-center {
    justify-self: center;
}

.footer-cgu {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(168, 140, 255, 0.28);
    background: rgba(139, 92, 246, 0.16);
    color: #e8e4f5;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.footer-cgu:hover {
    background: rgba(139, 92, 246, 0.28);
    border-color: rgba(168, 140, 255, 0.45);
    color: #fff;
}

.footer-right {
    justify-self: end;
    text-align: right;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(212, 208, 232, 0.55);
    max-width: 260px;
    line-height: 1.35;
}

@media (max-width: 720px) {
    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }

    .footer-left {
        justify-content: center;
        justify-self: center;
    }

    .footer-right {
        justify-self: center;
        text-align: center;
        max-width: none;
    }
}

.ui-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(5, 5, 12, 0.68);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

.ui-modal-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ui-modal {
    width: min(420px, 100%);
    padding: 1.35rem 1.3rem 1.2rem;
    background: rgba(22, 18, 36, 0.78);
    border: 1px solid rgba(168, 140, 255, 0.24);
    border-radius: 22px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(24px) scale(0.94);
    opacity: 0;
    transition:
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.ui-modal-overlay.show .ui-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ui-modal-title {
    font-size: 1.12rem;
    font-weight: 800;
    margin-bottom: 0.55rem;
    background: linear-gradient(100deg, #ffffff 10%, #c4b5fd 55%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ui-modal-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: rgba(212, 208, 232, 0.8);
    line-height: 1.55;
    margin-bottom: 1.2rem;
    white-space: pre-wrap;
}

.ui-modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.05rem;
    border-radius: 14px;
    border: 1px solid rgba(168, 140, 255, 0.28);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    transition: filter 0.15s, transform 0.12s;
}

.ui-btn:hover { filter: brightness(1.06); }
.ui-btn:active { transform: scale(0.98); }

.ui-btn-primary {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.55), rgba(99, 102, 241, 0.4), rgba(34, 211, 238, 0.18));
    border-color: rgba(168, 140, 255, 0.4);
    box-shadow: 0 8px 24px rgba(109, 40, 217, 0.22);
}

.ui-btn-ghost {
    background: rgba(8, 8, 14, 0.45);
}

.ui-btn-danger {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(239, 68, 68, 0.4);
}
