:root {
    --vert:     #2D4A32;
    --parchemin:#F5F0E8;
    --bois:     #8B5E3C;
    --texte:    #1a1a1a;
    --gris:     #6b6b6b;
    --bordure:  #d9d2c4;
}

body {
    background: var(--parchemin);
    color: var(--texte);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
}

h1, h2, h3, .scribers-logo {
    font-family: 'Playfair Display', serif;
}

/* ============================================================
   Layout principal — sidebar + contenu
   ============================================================ */

.scribers-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */

.scribers-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 230px;
    height: 100vh;
    background: var(--vert);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

/* Logo */
.sidebar-logo {
    padding: 28px 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-logo-link {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--parchemin);
    text-decoration: none;
    letter-spacing: 0.5px;
    display: block;
}

.sidebar-logo-link:hover {
    color: white;
}

/* Liste de navigation */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav li {
    margin: 0;
}

/* Item de navigation */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(245,240,232,0.82);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    line-height: 1.3;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.08);
    color: var(--parchemin);
}

/* Item actif */
.sidebar-item--active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: white;
    font-weight: 500;
}

.sidebar-item--active:hover {
    background: rgba(255,255,255,0.18);
}

/* Flèche des groupes collapsibles */
.sidebar-chevron {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

/* Sous-items (Documentation) */
.sidebar-item--sub {
    padding: 7px 20px 7px 44px;
    font-size: 0.82rem;
}

/* Icônes SVG */
.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-item--active .sidebar-icon,
.sidebar-item:hover .sidebar-icon {
    opacity: 1;
}

/* Pied de sidebar */
.sidebar-footer {
    padding: 16px 20px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-email {
    color: rgba(245,240,232,0.55);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sidebar-logout {
    display: inline-block;
    color: rgba(245,240,232,0.75);
    font-size: 0.83rem;
    text-decoration: none;
    transition: color 0.15s;
}

.sidebar-logout:hover {
    color: white;
    text-decoration: underline;
}

/* --- Zone de contenu principale --- */

.scribers-main {
    margin-left: 230px;
    flex: 1;
    min-height: 100vh;
    background: var(--parchemin);
    padding: 32px 40px;
    box-sizing: border-box;
}

.scribers-main > div {
    width: 100%;
}

/* Boutons */
.btn-primary {
    background: var(--vert) !important;
    color: var(--parchemin) !important;
    border: none;
    padding: 10px 24px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-bois {
    background: var(--bois) !important;
    color: var(--parchemin) !important;
}

.btn-danger {
    background: #b94040 !important;
    color: white !important;
    border: none;
    padding: 10px 24px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-danger:hover { opacity: 0.85; }

/* Carte dossier */
.dossier-card {
    background: white;
    border: 1px solid var(--bordure);
    border-left: 4px solid var(--vert);
    padding: 20px 24px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s;
}
.dossier-card:hover {
    box-shadow: 0 4px 12px rgba(45,74,50,0.12);
}
.dossier-card h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: var(--vert);
}

/* Statut articles */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}
.badge-brouillon  { background: #f0e9df; color: var(--bois); }
.badge-valide     { background: #dff0e4; color: var(--vert); }
.badge-publie     { background: var(--vert); color: white; }
.badge-vide       { background: #ebebeb; color: #999; }

/* Grille réseaux */
.reseau-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.reseau-card {
    background: white;
    border: 1px solid var(--bordure);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.reseau-card:hover { border-color: var(--vert); }
.reseau-card.has-content { border-color: var(--vert); background: #f7fbf7; }

/* Formulaires */
.scribers-input {
    border: 1px solid var(--bordure) !important;
    background: white !important;
    padding: 10px 14px !important;
    font-family: 'Inter', sans-serif !important;
    width: 100%;
    box-sizing: border-box;
}
.scribers-input:focus {
    outline: none;
    border-color: var(--vert) !important;
}

/* Login */
.login-box {
    max-width: 420px;
    margin: 80px auto;
    background: white;
    border: 1px solid var(--bordure);
    padding: 40px;
}
.login-box h1 {
    color: var(--vert);
    margin-bottom: 4px;
}
.login-box p.subtitle {
    color: var(--gris);
    margin-bottom: 28px;
    font-size: 0.9rem;
}

/* Onglets */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 2px solid var(--bordure);
    margin-bottom: 0;
}
.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 10px 18px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: var(--gris);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}
.tab-btn:hover { color: var(--vert); }
.tab-btn--active {
    color: var(--vert);
    border-bottom-color: var(--vert);
    font-weight: 600;
}
.tab-count {
    display: inline-block;
    font-size: 0.72rem;
    background: #e8e4dc;
    color: var(--gris);
    padding: 1px 6px;
    border-radius: 10px;
}
.tab-panel {
    border-top: none;
    border-radius: 0 0 4px 4px;
}

/* Cartes génériques */
.card {
    background: white;
    border: 1px solid var(--bordure);
    padding: 24px;
    border-radius: 4px;
}
.card-title {
    font-size: 1rem;
    color: var(--vert);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bordure);
}

/* Formulaires */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.88rem;
}

/* Flash messages */
.flash {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 0.88rem;
}
.flash-success { background: #dff0e4; color: #2a6e3f; border: 1px solid #b8ddc5; }
.flash-error   { background: #fde8e8; color: #8b2020; border: 1px solid #f5b8b8; }

/* Few-shots */
.fewshot-item {
    border: 1px solid var(--bordure);
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 4px;
}
.fewshot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.fewshot-content {
    font-size: 0.85rem;
    color: var(--gris);
    line-height: 1.6;
    white-space: pre-wrap;
}
.btn-link-danger {
    background: none;
    border: none;
    color: #b94040;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.btn-sm {
    padding: 5px 12px !important;
    font-size: 0.82rem !important;
    min-width: 90px;
    text-align: center;
}
.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}
.table-row:hover { background: #faf8f4; }
.table-row:last-child { border-bottom: none; }

/* Doc API */
.code-block {
    display: block;
    background: #f4f1eb;
    padding: 10px 14px;
    font-size: 0.82rem;
    border-radius: 4px;
    word-break: break-all;
}
.method-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: monospace;
    flex-shrink: 0;
    margin-top: 2px;
}
.method-get  { background: #d4edda; color: #1a5c2a; }
.method-post { background: #d0e8ff; color: #1a3d6b; }

/* Textarea article */
.article-textarea {
    width: 100%;
    min-height: 400px;
    border: 1px solid var(--bordure);
    padding: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    box-sizing: border-box;
}
.article-textarea:focus {
    outline: none;
    border-color: var(--vert);
}
