:root {
    --bg: #091419;
    --bg-soft: #102129;
    --surface: rgba(255, 255, 255, 0.08);
    --surface-strong: #ffffff;
    --surface-muted: #f3f8f7;
    --line: rgba(15, 118, 110, 0.18);
    --text: #0f1722;
    --text-soft: #53626b;
    --text-inverse: #f7fbfb;
    --primary: #0f766e;
    --primary-strong: #115e59;
    --secondary: #d6fff6;
    --accent: #14b8a6;
    --accent-soft: rgba(20, 184, 166, 0.16);
    --danger: #dc2626;
    --warning: #f59e0b;
    --shadow-lg: 0 24px 60px rgba(7, 25, 31, 0.16);
    --shadow-md: 0 16px 32px rgba(7, 25, 31, 0.1);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --container: 1180px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 26%),
        radial-gradient(circle at bottom left, rgba(15, 118, 110, 0.12), transparent 26%),
        linear-gradient(180deg, #eef7f5 0%, #f7fbfb 100%);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

textarea,
input,
select {
    width: 100%;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 0.9rem 1rem;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: rgba(20, 184, 166, 0.55);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

textarea {
    resize: vertical;
}

.container {
    width: min(100% - 2rem, var(--container));
    margin: 0 auto;
}

.site-shell {
    min-height: 100vh;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(18px);
    background: rgba(246, 251, 250, 0.72);
    border-bottom: 1px solid rgba(15, 118, 110, 0.08);
}

.site-header-inner,
.site-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.site-footer {
    border-top: 1px solid rgba(15, 118, 110, 0.12);
    margin-top: 4rem;
}

.site-footer-inner {
    color: var(--text-soft);
    font-size: 0.94rem;
    padding: 1.5rem 0 3rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 16px;
    display: inline-grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #22c55e);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-copy {
    display: grid;
    gap: 0.12rem;
}

.brand-copy strong {
    font-size: 1rem;
}

.brand-copy span {
    font-size: 0.84rem;
    color: var(--text-soft);
}

.site-nav,
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
}

.site-nav a,
.admin-nav a {
    color: var(--text-soft);
    padding: 0.65rem 0.95rem;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}

.site-nav a:hover,
.admin-nav a:hover,
.admin-nav a.is-active {
    background: var(--accent-soft);
    color: var(--primary-strong);
}

.hero-section {
    padding: 3rem 0 1.5rem;
}

.hero-card,
.panel,
.ai-result-card,
.article-sheet,
.auth-card,
.empty-state,
.stat-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.hero-card {
    display: grid;
    grid-template-columns: 1.2fr 0.95fr;
    gap: 1.5rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: auto -5rem -5rem auto;
    width: 14rem;
    height: 14rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.18), transparent 70%);
}

.hero-copy h1,
.admin-section-head h1,
.auth-card h1,
.section-heading h2,
.article-header h1,
.ai-result-card h2 {
    margin: 0;
    font-family: "Iowan Old Style", "Palatino Linotype", serif;
    letter-spacing: -0.03em;
    line-height: 1.03;
}

.hero-copy h1 {
    font-size: clamp(2.6rem, 5vw, 4.3rem);
    max-width: 12ch;
}

.hero-copy p,
.section-heading p,
.auth-card p,
.article-lead,
.empty-state p {
    color: var(--text-soft);
    font-size: 1.04rem;
    line-height: 1.7;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}

.hero-panel,
.panel,
.ai-result-card {
    padding: 1.35rem;
}

.field-label,
.field-group label {
    display: inline-block;
    margin-bottom: 0.45rem;
    font-size: 0.93rem;
    font-weight: 700;
}

.ai-form {
    display: grid;
    gap: 1rem;
}

.ai-form-footer,
.filters-actions,
.form-actions,
.article-page-actions,
.action-row,
.table-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.ai-form-footer {
    justify-content: space-between;
}

.ai-form-footer p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--text-soft);
    max-width: 26rem;
}

.button {
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.84rem 1.15rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #16a34a);
    box-shadow: 0 16px 30px rgba(15, 118, 110, 0.22);
}

.button-secondary {
    color: var(--primary-strong);
    background: rgba(20, 184, 166, 0.12);
}

.button-danger {
    color: #fff;
    background: var(--danger);
}

.button-block {
    width: 100%;
}

.filters-section,
.cards-section,
.ai-results-section,
.article-page-section {
    padding: 1rem 0;
}

.filters-bar {
    display: grid;
    grid-template-columns: 1.8fr repeat(4, minmax(0, 1fr)) auto;
    gap: 1rem;
    align-items: end;
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(15, 118, 110, 0.1);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.field-group {
    display: grid;
}

.field-group-wide {
    grid-column: span 1;
}

.section-heading,
.admin-section-head,
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
}

.section-heading {
    margin-bottom: 1.2rem;
}

.cards-grid,
.related-grid,
.recommended-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.article-card,
.related-card {
    display: grid;
    gap: 0.85rem;
    padding: 1.15rem;
    min-height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 249, 247, 0.92));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 118, 110, 0.12);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.article-card:hover,
.related-card:hover {
    transform: translateY(-3px);
    border-color: rgba(15, 118, 110, 0.28);
}

.article-card h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.35;
}

.article-card p,
.related-card span,
.metric-list li span,
.ai-result-topline,
.article-section .rich-text,
.inline-edit-card small {
    color: var(--text-soft);
}

.card-topline,
.card-meta,
.article-header-top,
.article-badges,
.tag-list,
.cta-actions,
.ai-result-topline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.card-code,
.meta-pill,
.tag-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.card-code,
.meta-pill {
    background: rgba(15, 118, 110, 0.08);
    color: var(--primary-strong);
}

.tag-pill {
    background: rgba(20, 184, 166, 0.12);
    color: var(--primary-strong);
}

.status-pill {
    color: #fff;
}

.status-draft {
    background: var(--warning);
}

.status-published {
    background: var(--primary);
}

.level-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.level-debutant {
    background: rgba(34, 197, 94, 0.14);
    color: #166534;
}

.level-intermediaire {
    background: rgba(20, 184, 166, 0.14);
    color: #0f766e;
}

.level-avance {
    background: rgba(14, 165, 233, 0.14);
    color: #075985;
}

.article-page-container {
    display: grid;
    gap: 1rem;
}

.preview-banner,
.flash {
    width: min(100% - 2rem, var(--container));
    margin: 0 auto 1rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.preview-banner,
.flash-success {
    background: rgba(34, 197, 94, 0.14);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.18);
}

.flash-error {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.18);
}

.article-sheet {
    padding: 1.75rem;
    display: grid;
    gap: 1.5rem;
}

.article-lead {
    max-width: 72ch;
}

.article-sections {
    display: grid;
    gap: 1rem;
}

.article-section {
    padding: 1.2rem 1.3rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(246, 251, 250, 0.95), #ffffff);
    border: 1px solid rgba(15, 118, 110, 0.08);
}

.article-section h2 {
    margin: 0 0 0.7rem;
    font-size: 1.05rem;
}

.rich-text p,
.rich-text ul,
.rich-text ol {
    margin: 0 0 0.9rem;
    line-height: 1.8;
}

.rich-text ul,
.rich-text ol {
    padding-left: 1.3rem;
}

.related-section {
    display: grid;
    gap: 1rem;
}

.cta-panel {
    padding: 1.15rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(34, 197, 94, 0.06));
    border: 1px solid rgba(15, 118, 110, 0.12);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.cta-copy {
    display: grid;
    gap: 0.35rem;
    max-width: 38rem;
}

.cta-copy p {
    margin: 0;
    color: var(--text-soft);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    z-index: 80;
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 18, 22, 0.72);
}

.modal-dialog {
    position: relative;
    width: min(100% - 1.2rem, 980px);
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
    background: transparent;
}

.modal-content {
    position: relative;
    overflow: auto;
    max-height: calc(100vh - 2rem);
    border-radius: var(--radius-xl);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    width: 2.8rem;
    height: 2.8rem;
    border: 0;
    border-radius: 999px;
    font-size: 1.8rem;
    background: rgba(9, 20, 25, 0.88);
    color: #fff;
    cursor: pointer;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    background:
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.12), transparent 22%),
        linear-gradient(180deg, #edf7f5, #f7fbfb);
}

.admin-sidebar {
    padding: 1.4rem;
    border-right: 1px solid rgba(15, 118, 110, 0.08);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-brand {
    margin-bottom: 0.5rem;
}

.admin-nav {
    flex-direction: column;
    align-items: stretch;
}

.admin-main {
    padding: 1.5rem;
}

.admin-main-auth {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.admin-section,
.auth-panel {
    display: grid;
    gap: 1.2rem;
}

.auth-card {
    width: min(100%, 480px);
    padding: 2rem;
}

.stack-form,
.admin-form,
.stack-list {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1.25rem;
    display: grid;
    gap: 0.35rem;
}

.stat-card strong {
    font-size: 2rem;
    line-height: 1;
    color: var(--primary-strong);
}

.stat-card span {
    color: var(--text-soft);
}

.admin-grid,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.field-group-full {
    grid-column: 1 / -1;
}

.table-wrap {
    overflow: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.88);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(15, 118, 110, 0.08);
    vertical-align: top;
}

.admin-table th {
    color: var(--text-soft);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-table small {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-soft);
}

.metric-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.85rem;
}

.metric-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.inline-edit-card {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 118, 110, 0.08);
    background: rgba(255, 255, 255, 0.88);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 700;
}

.checkbox-label input {
    width: auto;
}

.empty-state {
    padding: 2rem;
    text-align: center;
}

.recommended-links {
    margin-top: 1rem;
}

.ai-answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ai-answer-grid section {
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: rgba(15, 118, 110, 0.05);
    border: 1px solid rgba(15, 118, 110, 0.1);
}

.ai-answer-grid h3 {
    margin: 0 0 0.55rem;
}

.ai-answer-grid p,
.ai-answer-grid li,
.ai-answer-grid span {
    color: var(--text-soft);
    line-height: 1.7;
}

.ai-answer-grid ul,
.ai-answer-grid ol {
    margin: 0;
    padding-left: 1.2rem;
}

.loading-card {
    padding: 1rem 1.1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(15, 118, 110, 0.08);
    color: var(--text-soft);
}

@media (max-width: 1100px) {
    .hero-card,
    .filters-bar,
    .cards-grid,
    .related-grid,
    .recommended-links,
    .stats-grid,
    .admin-grid,
    .form-grid,
    .ai-answer-grid {
        grid-template-columns: 1fr;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(15, 118, 110, 0.08);
    }
}

@media (max-width: 720px) {
    .site-header-inner,
    .site-footer-inner,
    .section-heading,
    .admin-section-head,
    .panel-head,
    .cta-panel,
    .ai-form-footer,
    .article-page-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-copy h1 {
        font-size: 2.6rem;
    }

    .article-sheet,
    .hero-card,
    .panel,
    .ai-result-card,
    .auth-card {
        padding: 1.2rem;
    }

    .modal-dialog {
        width: calc(100% - 0.6rem);
        margin: 0.3rem auto;
    }

    .modal-content {
        max-height: calc(100vh - 0.6rem);
    }
}

