* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    font-family: Inter, system-ui, sans-serif;
    background: #000000;
    color: #e8eefc;
    --bg: #000000;
    --panel: #030304;
    --panel-strong: #071028;
    --text: #e8eefc;
    --muted: #8aa6d6;
    --red: #0a5fd8; /* primary blue accent (kept var name for compatibility) */
    --cyan: #4fc3ff; /* lighter blue accent */
    --border: rgba(255,255,255,0.06);
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(79, 195, 255, 0.06), transparent 24%),
                linear-gradient(180deg, #000000 0%, #02020a 100%);
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #0f1219 0%, #0a0b11 100%);
    border-right: 1px solid var(--border);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    background: var(--red);
    color: #fff;
    font-weight: 900;
    border-radius: 14px;
    letter-spacing: 0.08em;
}

.brand h1,
.brand p {
    margin: 0;
}

.brand h1 {
    font-size: 18px;
    letter-spacing: 0.02em;
}

.brand p {
    font-size: 12px;
    color: var(--muted);
}

.nav-menu {
    display: grid;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    color: var(--text);
    text-decoration: none;
    background: transparent;
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(79, 195, 255, 0.10);
    transform: translateX(2px);
}

.icon {
    font-size: 18px;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 16px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
}

.button.logout {
    display: inline-flex;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--red), var(--cyan));
    font-weight: 600;
}

.content {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
        display: inline-flex;
    background: rgba(255,255,255,0.08);
    color: #f4f7fb;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
}

.mobile-logout {
    display: none;
}

.main-panel {
    display: grid;
    gap: 24px;
}

.panel {
    padding: 24px;
    border-radius: 24px;
    background: rgba(15, 18, 25, 0.9);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.panel h3 {
    margin-top: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.card {
    padding: 20px;
    border-radius: 20px;
    background: rgba(7, 8, 10, 0.9);
    border: 1px solid rgba(255,255,255,0.05);
}

.card strong {
    display: block;
    font-size: 34px;
    margin-bottom: 8px;
    color: #fff;
}

.card span {
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    color: #f4f7fb;
}

thead {
    color: var(--muted);
}

thead th,
tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: left;
    font-size: 14px;
}

tbody tr:hover {
    background: rgba(79, 195, 255, 0.04);
}

td form {
    display: inline-flex;
    vertical-align: middle;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: #f4f7fb;
    padding: 12px 14px;
    outline: none;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(79, 195, 255, 0.12);
    background: rgba(255,255,255,0.05);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2333d7ef' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select option,
option {
    color: #f4f7fb;
    background: rgba(15, 18, 25, 1);
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1 1 250px;
}

.search-form button {
    flex: 0 0 auto;
}

.details-tree details {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.02);
}

.details-tree summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    list-style: none;
}

.details-tree details details {
    margin-top: 12px;
}

.report-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 16px;
}

.report-card {
    display: grid;
    gap: 18px;
    padding: 24px;
    border-radius: 24px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}

.report-card-report {
    width: 100%;
    max-width: 100%;
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.report-magazine {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-top: 16px;
}

.report-card-grid.magazine-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 18px;
    grid-auto-rows: minmax(120px, auto);
}

.magazine-section {
    min-height: 100px;
}

.magazine-section-large {
    grid-column: 1 / -1;
}

.magazine-section-small {
    min-height: 100px;
}

.magazine-section-tags {
    grid-column: 1 / -1;
}

@media (max-width: 850px) {
    .report-card-grid.magazine-grid {
        grid-template-columns: 1fr;
    }
}

.report-card-report:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(0,0,0,0.18);
}

.report-card-report {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-card-title {
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 700;
}

.report-card-subtitle {
    color: var(--muted);
    margin-top: 6px;
}

.report-card-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.report-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(79,195,255,0.14);
    color: #dbe9ff;
    font-size: 13px;
}

.report-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.report-card-body div {
    display: grid;
    gap: 8px;
}

.report-card-body strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.report-card-body span {
    color: #f4f7fb;
    font-size: 14px;
}

.report-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.report-card-actions--meta {
    padding-top: 12px;
}

.report-card-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.report-card-grid--small {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-card-section {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 16px;
}

.report-card-section--tags {
    grid-column: span 3;
}

.report-card-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

.report-card-mini {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    margin-top: 8px;
}

.report-card-actions button,
.report-card-actions form button {
    min-width: 110px;
    padding: 10px 16px;
    font-size: 13px;
}

.empty-state {
    color: var(--muted);
    font-size: 13px;
    margin: 10px 0 0;
}

button {
    width: auto;
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--red), var(--cyan));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 4px 12px rgba(10,95,216,0.22);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(10,95,216,0.32);
}

button:active {
    transform: translateY(0);
}

button.delete-btn,
button[type="submit"][value*="Supprimer"] {
    background: linear-gradient(135deg, var(--red), #083a8a);
}

button.delete-btn:hover,
button[type="submit"][value*="Supprimer"]:hover {
    box-shadow: 0 6px 20px rgba(10,95,216,0.42);
}

button.secondary {
    background: rgba(255,255,255,0.08);
    color: #f4f7fb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

button.secondary:hover {
    background: rgba(255,255,255,0.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    width: min(720px, 100%);
    max-height: min(90vh, 100%);
    overflow: auto;
    background: rgba(10, 14, 24, 0.98);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.45);
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.modal-body {
    display: grid;
    gap: 16px;
}

.view-grid {
    display: grid;
    gap: 14px;
}

.view-grid label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
}

.view-value {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
    color: #f4f7fb;
    white-space: pre-wrap;
}

a.button.secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 14px;
    text-decoration: none;
    color: #f4f7fb;
    background: rgba(255,255,255,0.08);
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

a.button.secondary:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.action-btn {
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    color: #f4f7fb;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

.action-btn.delete-btn {
    background: rgba(10,95,216,0.15);
    color: #d6ecff;
}

.action-btn.delete-btn:hover {
    background: rgba(10,95,216,0.25);
}

.form-grid {
    display: grid;
    gap: 16px;
}

.report-fields {
    display: grid;
    gap: 16px;
}

.report-fields[hidden] {
    display: none !important;
}

.report-form-header {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(79, 195, 255, 0.04);
}

.report-form-header h4 {
    margin: 0;
    font-size: 16px;
}

.report-color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    color: var(--muted);
    font-size: 13px;
}

.report-legend-title {
    font-weight: 600;
    color: var(--text);
}

.report-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    gap: 16px;
    margin: 0;
}

.report-section legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--cyan);
}

.auto-field {
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    cursor: not-allowed;
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
}

.color-dot-blue {
    background: #4fc3ff;
}

.color-dot-purple {
    background: #9c27b0;
}

.form-grid label[hidden] {
    display: none !important;
}

.form-grid label {
    display: grid;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.form-actions button {
    padding: 10px 18px;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--cyan);
    cursor: pointer;
}

label {
    cursor: pointer;
}

.permissions-list {
    display: grid;
    gap: 8px;
}

.permissions-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.permissions-list label:hover {
    background: rgba(79, 195, 255, 0.06);
}

.flash {
    padding: 16px;
    border-radius: 18px;
    background: rgba(79, 195, 255, 0.12);
    border: 1px solid rgba(79, 195, 255, 0.18);
    color: #e8f9ff;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

.login-box {
    width: min(520px, 100%);
    padding: 36px;
    border-radius: 26px;
    background: rgba(11, 12, 16, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}

.login-box h1 {
    margin-top: 0;
    color: #fff;
}

.login-box p {
    color: var(--muted);
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(10,95,216,0.12);
    color: #d6ecff;
    border: 1px solid rgba(10,95,216,0.18);
}

inline-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

inline-form button {
    padding: 8px 16px;
    font-size: 13px;
}

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        inset: 0 auto auto 0;
        width: 280px;
        max-width: 80vw;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1000;
        border-right: 1px solid rgba(255,255,255,0.08);
        background: linear-gradient(180deg, #0f1219 0%, #0a0b11 100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.open + .content {
        transform: translateX(280px);
    }
    .content {
        position: relative;
        transition: transform 0.25s ease;
    }
    .topbar {
        position: relative;
        z-index: 1100;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(10px);
    }
    .menu-toggle {
        display: inline-flex;
        position: relative;
        z-index: 1101;
    }
    .mobile-logout {
        display: inline-flex;
        position: relative;
        z-index: 1101;
    }
    .topbar-status {
        display: none;
    }
}
