/* ═══════════════════════════════════════════════════════════════════════════
   LIVRE DES LOIS — Styles immersifs
   Palette : Bleu République · Or · Blanc parchemin
═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --primary:        #002395;   /* Bleu france */
  --primary-dark:   #001570;
  --primary-light:  #1a4ab5;
  --gold:           #b8972a;
  --gold-light:     #d4af37;
  --red:            #c0392b;
  --green:          #1a6b3a;
  --bg:             #f7f5f0;   /* Parchemin clair */
  --bg-dark:        #0a0e1a;   /* Fond sombre header */
  --surface:        #ffffff;
  --surface-alt:    #f0ede6;
  --border:         #d4c9b0;
  --border-dark:    #8b7355;
  --text:           #1a1a2e;
  --text-muted:     #6b6b7a;
  --text-light:     #f5f5f0;
  --shadow:         0 2px 12px rgba(0,0,0,.12);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.18);
  --radius:         4px;
  --radius-lg:      8px;
  --font-title:     'Cinzel', 'Georgia', serif;
  --font-body:      'Libre Baskerville', 'Georgia', serif;
  --font-ui:        'Source Sans 3', system-ui, sans-serif;
  --transition:     .2s ease;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Conteneur ────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════════════════════ */
.site-header { background: var(--bg-dark); color: var(--text-light); }

.header-top { border-bottom: 1px solid rgba(255,255,255,.1); padding: .75rem 0; }
.header-top .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-brand { display: flex; align-items: center; gap: 1rem; }
.republic-seal { color: var(--gold-light); opacity: .9; flex-shrink: 0; }
.site-name {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .03em;
}
.site-name:hover { text-decoration: none; color: var(--gold-light); }
.site-subtitle { display: block; font-size: .75rem; color: rgba(255,255,255,.55); letter-spacing: .08em; text-transform: uppercase; }
.header-title { display: flex; flex-direction: column; gap: .1rem; }

.header-user { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.user-info    { display: flex; align-items: center; gap: .5rem; }
.user-avatar  { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--gold); }
.user-name    { font-weight: 600; color: #fff; }

/* Navigation principale */
.main-nav { background: var(--primary); }
.main-nav .container { padding: 0 1.5rem; }
.nav-list { display: flex; list-style: none; gap: 0; }
.nav-link {
  display: block;
  padding: .75rem 1.1rem;
  color: rgba(255,255,255,.85);
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  transition: background var(--transition), color var(--transition);
  border-bottom: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: #fff;
  background: var(--primary-dark);
  border-bottom-color: var(--gold-light);
  text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════════════════════════════ */
.main-content { flex: 1; padding: 2rem 0; }
.main-content .container { padding-top: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,.6);
  border-top: 3px solid var(--gold);
  margin-top: 3rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-name  { display: block; color: #fff; font-family: var(--font-title); font-size: .9rem; }
.footer-sub   { display: block; font-size: .75rem; opacity: .7; }
.footer-nav   { display: flex; gap: 1.5rem; }
.footer-nav a { color: rgba(255,255,255,.7); font-size: .85rem; }
.footer-nav a:hover { color: var(--gold-light); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: .75rem 0;
  text-align: center;
  font-size: .8rem;
  font-family: var(--font-title);
  letter-spacing: .1em;
  color: rgba(255,255,255,.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMPOSANTS
═══════════════════════════════════════════════════════════════════════════ */

/* ── Boutons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.2rem;
  font-family: var(--font-ui);
  font-size: .875rem;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost    { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-ghost:hover { background: var(--primary); color: #fff; }
.btn-danger   { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { opacity: .85; }
.btn-discord  { background: #5865F2; color: #fff; border-color: #5865F2; }
.btn-discord:hover { background: #4752C4; border-color: #4752C4; }
.btn-lg { padding: .75rem 2rem; font-size: 1rem; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .75rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 3px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-admin        { background: #1a1a2e; color: #fff; }
.badge-gouvernement { background: #00469b; color: #fff; }
.badge-senateur     { background: #7b2d8b; color: #fff; }
.badge-public       { background: #6b6b7a; color: #fff; }
.badge-self         { background: var(--gold); color: #fff; }
.badge-loi          { background: var(--primary); color: #fff; }
.badge-decret       { background: #7b1616; color: #fff; }
.badge-arrete       { background: var(--green); color: #fff; }
.badge-crime        { background: #8b0000; color: #fff; }
.badge-delit        { background: #d4580e; color: #fff; }
.badge-contravention{ background: #4a7c59; color: #fff; }
/* Statuts */
.badge-status-brouillon     { background: #7a7a7a; color: #fff; }
.badge-status-en_signature  { background: #d4780e; color: #fff; }
.badge-status-signe         { background: var(--green); color: #fff; }
.badge-status-publie        { background: var(--primary); color: #fff; }
.badge-status-abroge        { background: #999; color: #fff; text-decoration: line-through; }

/* ── Alertes ──────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-success { background: #d4edda; border-left: 4px solid #28a745; color: #155724; }
.alert-error   { background: #f8d7da; border-left: 4px solid #dc3545; color: #721c24; }
.alert-info    { background: #d1ecf1; border-left: 4px solid #17a2b8; color: #0c5460; }
.alert-icon    { font-weight: 900; font-size: 1rem; flex-shrink: 0; }
.alert-close   { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 1.2rem; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}
.page-header-inner { flex: 1; min-width: 0; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.page-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: .25rem;
}
.page-subtitle { color: var(--text-muted); font-size: .95rem; }
.page-actions  { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }

/* ── Section title ────────────────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO
═══════════════════════════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(160deg, var(--bg-dark) 0%, #0f1e4a 100%);
  color: #fff;
  padding: 4rem 0 3rem;
  text-align: center;
  margin: -2rem 0 2.5rem;
  border-bottom: 3px solid var(--gold);
}
.hero-inner { max-width: 700px; margin: 0 auto; padding: 0 1.5rem; }
.hero-seal  { color: var(--gold-light); margin-bottom: 1.5rem; }
.hero-title {
  font-family: var(--font-title);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: .5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.hero-subtitle { font-size: 1.1rem; color: rgba(255,255,255,.7); margin-bottom: 2rem; }
.search-form-hero { display: flex; gap: .5rem; max-width: 600px; margin: 0 auto; }
.search-input-hero {
  flex: 1;
  padding: .75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  background: rgba(255,255,255,.95);
}

/* ── Page d'accueil grille ────────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 2rem;
}
.home-categories { grid-column: 1 / -1; }
.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
  color: #fff;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.cat-card--bleu  { background: linear-gradient(135deg, #1a3a8c, #002395); border-color: #2a5ab5; }
.cat-card--rouge { background: linear-gradient(135deg, #8b1111, #c0392b); border-color: #e0502a; }
.cat-card--or    { background: linear-gradient(135deg, #7a5c00, #b8972a); border-color: #d4af37; }
.cat-card--vert  { background: linear-gradient(135deg, #0d4a27, #1a6b3a); border-color: #2a9b57; }
.cat-card--gris  { background: linear-gradient(135deg, #3a3a4a, #5a5a6a); border-color: #7a7a8a; }
.cat-card--noir  { background: linear-gradient(135deg, #0a0e1a, #1a2030); border-color: #3a4050; }
.cat-icon  { font-size: 2rem; margin-bottom: .5rem; }
.cat-label { font-family: var(--font-title); font-size: .95rem; font-weight: 700; margin-bottom: .3rem; }
.cat-desc  { font-size: .8rem; opacity: .85; }

/* ── Listes de textes ─────────────────────────────────────────────────────── */
.text-list { display: flex; flex-direction: column; gap: .75rem; }
.text-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  padding: .75rem 1rem;
  border-radius: var(--radius);
}
.text-card-type    { margin-bottom: .3rem; }
.text-card-title   { font-family: var(--font-body); font-size: 1rem; font-weight: 700; display: block; }
.text-card-number  { font-size: .8rem; color: var(--text-muted); display: block; }
.text-card-date    { font-size: .8rem; color: var(--text-muted); display: block; margin-top: .2rem; }

/* ── Journal Officiel (accueil) ───────────────────────────────────────────── */
.jo-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}
.jo-number { font-family: var(--font-title); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.jo-title  { font-size: .9rem; }
.jo-date   { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════════════
   CODES JURIDIQUES
═══════════════════════════════════════════════════════════════════════════ */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.code-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.code-card:hover { box-shadow: var(--shadow); border-left-color: var(--gold); text-decoration: none; }
.code-card-icon  { font-size: 1.8rem; flex-shrink: 0; }
.code-card-name  { font-family: var(--font-title); font-size: 1.05rem; color: var(--primary); }
.code-card-desc  { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }
.code-card-arrow { font-size: 1.5rem; color: var(--border-dark); margin-left: auto; }

/* ── Layout code ──────────────────────────────────────────────────────────── */
.code-layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; }
.code-toc {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
}
.toc-title {
  font-family: var(--font-title);
  font-size: .95rem;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  margin-bottom: .75rem;
}
.toc-book { margin-bottom: .75rem; }
.toc-book-link  { font-size: .85rem; font-weight: 700; color: var(--primary); display: block; padding: .2rem 0; }
.toc-title-item { padding-left: .75rem; border-left: 2px solid var(--border); margin: .2rem 0; }
.toc-title-link { font-size: .8rem; font-weight: 600; color: var(--text); display: block; }
.toc-chapter-item { padding-left: .75rem; }
.toc-chapter-link { font-size: .75rem; color: var(--text-muted); display: block; }
.toc-article-link { font-size: .72rem; color: var(--primary); display: inline-block; margin: .1rem .2rem; padding: .1rem .3rem; background: #f0f4ff; border-radius: 2px; }
.toc-article-link:hover { background: var(--primary); color: #fff; }
.toc-article-link.abrogated { opacity: .4; text-decoration: line-through; }

/* ── Hiérarchie ───────────────────────────────────────────────────────────── */
.code-book     { margin-bottom: 2.5rem; }
.book-heading  { font-family: var(--font-title); font-size: 1.4rem; color: var(--primary); border-bottom: 2px solid var(--primary); padding-bottom: .5rem; margin-bottom: 1.25rem; display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.book-title    { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.code-title    { margin-bottom: 1.75rem; padding-left: 1.5rem; border-left: 3px solid var(--border); }
.title-heading { font-family: var(--font-title); font-size: 1.1rem; color: var(--primary-dark); margin-bottom: .75rem; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.code-chapter  { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.chapter-heading { font-size: .95rem; font-weight: 700; color: var(--text); border-bottom: 1px dashed var(--border); padding-bottom: .4rem; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.articles-list { display: flex; flex-direction: column; gap: .5rem; }
.article-stub {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: .5rem .75rem;
  padding: .5rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  transition: border-color var(--transition);
}
.article-stub:hover { border-color: var(--primary); }
.article-stub.abrogated { opacity: .5; background: #f5f5f5; }
.article-number-link { font-family: var(--font-title); font-size: .85rem; font-weight: 700; color: var(--primary); white-space: nowrap; }
.article-title-stub  { font-style: italic; color: var(--text-muted); font-size: .8rem; grid-column: 2; }
.article-preview-stub { font-size: .8rem; color: var(--text-muted); grid-column: 2 / -1; }

/* ── Article page ─────────────────────────────────────────────────────────── */
.article-layout { display: grid; grid-template-columns: 1fr 260px; gap: 2rem; align-items: start; }
.article-page-title .abrogated-badge {
  background: var(--red); color: #fff; font-size: .7rem; padding: .15rem .4rem;
  border-radius: 2px; vertical-align: middle; margin-right: .5rem;
}
.article-location { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.article-text.legifrance-style {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.9;
  background: var(--surface);
  padding: 2rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-lg);
}
.article-notes {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: #fffde7;
  border-left: 3px solid var(--gold);
  font-size: .875rem;
  border-radius: var(--radius);
}
.article-peines { margin-top: 2rem; }
.peines-title { font-family: var(--font-title); font-size: 1rem; margin-bottom: .75rem; color: var(--primary); }
.peines-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.peine-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  border-top: 4px solid var(--border-dark);
}
.peine-card--crime        { border-top-color: #8b0000; }
.peine-card--delit        { border-top-color: #d4580e; }
.peine-card--contravention{ border-top-color: var(--green); }
.peine-card-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.peine-infraction  { font-weight: 700; color: var(--text); font-size: .9rem; }
.peine-card-peine  { font-family: var(--font-body); font-size: .9rem; color: var(--primary); margin-bottom: .4rem; }
.peine-card-details{ font-size: .8rem; color: var(--text-muted); margin-bottom: .5rem; }
.peine-card-footer { display: flex; gap: 1rem; font-size: .8rem; }
.peine-duree, .peine-montant { color: var(--text-muted); }

/* ── Sidebar article ──────────────────────────────────────────────────────── */
.article-sidebar  { display: flex; flex-direction: column; gap: 1rem; }
.sidebar-card     { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; }
.sidebar-title    { font-family: var(--font-title); font-size: .85rem; color: var(--primary); margin-bottom: .75rem; }
.sidebar-nav      { list-style: none; font-size: .85rem; }
.sidebar-nav li   { padding: .15rem 0; }
.sidebar-nav .indent  { padding-left: 1rem; color: var(--text-muted); }
.sidebar-nav .indent2 { padding-left: 2rem; color: var(--text-muted); }
.sidebar-nav .indent3 { padding-left: 3rem; color: var(--text-muted); }
.sidebar-nav .indent4 { padding-left: 4rem; }
.sidebar-nav .current { font-weight: 700; color: var(--primary); }

/* ── Admin inline ──────────────────────────────────────────────────────────── */
.admin-actions-inline { margin-left: auto; display: inline-flex; gap: .25rem; }
.admin-panel { background: #f0f4ff; border: 1px dashed #aac; border-radius: var(--radius); padding: .5rem .75rem; margin: .5rem 0; font-size: .85rem; }
.admin-panel summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.edit-form { background: #fff9e0; border: 1px dashed var(--gold); border-radius: var(--radius); padding: .5rem; margin: .3rem 0; }
.quick-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.quick-form input[type="text"] { flex: 1; min-width: 100px; }
.toc-admin { margin-bottom: .75rem; }
.empty-toc { font-size: .8rem; color: var(--text-muted); font-style: italic; }
.empty-chapter { font-size: .8rem; color: var(--text-muted); font-style: italic; padding: .5rem 0; }

/* ── Code search ──────────────────────────────────────────────────────────── */
.code-search-bar { margin-bottom: 1.5rem; }
.search-form-inline { display: flex; gap: .5rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; }
.search-results { margin-bottom: 2rem; }
.article-result { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.article-result-link { display: flex; gap: 1rem; align-items: baseline; }
.article-number  { font-family: var(--font-title); font-weight: 700; color: var(--primary); white-space: nowrap; }
.article-preview { font-size: .875rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   LIVRE DES PEINES
═══════════════════════════════════════════════════════════════════════════ */
.filters-bar { margin-bottom: 1.5rem; }
.filters-form { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.form-select { padding: .5rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; background: var(--surface); cursor: pointer; }
.form-select--sm { padding: .25rem .5rem; font-size: .8rem; }

.peines-table-wrapper { overflow-x: auto; }
.peines-table { width: 100%; }
.peines-category-row td {
  background: var(--bg-dark);
  color: #fff;
  padding: .4rem .75rem;
  font-family: var(--font-title);
  font-size: .75rem;
  letter-spacing: .05em;
}
.peine-row td { padding: .6rem .75rem; vertical-align: top; }
.peine-infraction a { font-weight: 600; color: var(--primary); }
.peine-actions  { white-space: nowrap; }

/* ── Peine détail ──────────────────────────────────────────────────────────── */
.peine-detail-layout { display: grid; grid-template-columns: 1fr 200px; gap: 2rem; }
.peine-detail-card, .peine-articles-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.peine-detail-card h2 { font-family: var(--font-title); color: var(--primary); margin-bottom: 1rem; }
.peine-detail-peine  { font-family: var(--font-body); font-size: 1.15rem; color: var(--primary-dark); font-weight: 700; margin-bottom: 1rem; }
.peine-detail-details { background: var(--surface-alt); padding: .75rem; border-radius: var(--radius); margin-bottom: 1rem; }
.peine-detail-chiffres { display: flex; gap: 1rem; flex-wrap: wrap; }
.chiffre-card { background: var(--primary); color: #fff; padding: .75rem 1.25rem; border-radius: var(--radius-lg); text-align: center; }
.chiffre-label { font-size: .75rem; opacity: .8; margin-bottom: .2rem; }
.chiffre-value { font-family: var(--font-title); font-size: 1.2rem; font-weight: 700; }
.articles-linked-list { list-style: disc; padding-left: 1.5rem; }
.articles-linked-list li { padding: .2rem 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   TEXTES JURIDIQUES
═══════════════════════════════════════════════════════════════════════════ */
.texts-list { display: flex; flex-direction: column; gap: .75rem; }
.text-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  padding: .75rem 1rem;
  border-radius: var(--radius);
}
.text-list-item.status-brouillon    { border-left-color: #7a7a7a; }
.text-list-item.status-en_signature { border-left-color: #d4780e; }
.text-list-item.status-signe        { border-left-color: var(--green); }
.text-list-item.status-publie       { border-left-color: var(--primary); }
.text-list-item.status-abroge       { border-left-color: #999; opacity: .7; }
.text-list-meta { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.text-list-title  { font-family: var(--font-body); font-weight: 700; color: var(--text); display: block; }
.text-list-number { font-size: .8rem; color: var(--text-muted); }
.text-list-author { font-size: .8rem; color: var(--text-muted); display: block; }
.text-list-date   { font-size: .8rem; color: var(--text-muted); white-space: nowrap; text-align: right; }

/* ── Document officiel ────────────────────────────────────────────────────── */
.text-document {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 2.5rem 3rem;
  box-shadow: var(--shadow);
  max-width: 860px;
  margin: 0 auto;
  font-family: var(--font-body);
}
.text-status-bar { display: flex; gap: .5rem; margin-bottom: .5rem; }

.doc-header {
  text-align: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}
.doc-republique {
  font-family: var(--font-title);
  font-size: .8rem;
  letter-spacing: .2em;
  color: var(--text-muted);
}
.doc-type-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .1em;
  margin: .3rem 0;
}
.doc-number {
  font-size: .9rem;
  color: var(--text-muted);
  font-style: italic;
}

.doc-preamble {
  font-style: italic;
  margin-bottom: 2rem;
  padding: 1rem 1.5rem;
  background: var(--bg);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
}
.preamble-intro { margin-bottom: .5rem; font-style: normal; }
.visa { margin: .3rem 0; font-size: .95rem; }
.visa::before { content: 'Vu '; }
.preamble-close { font-style: normal; font-weight: 700; margin-top: .75rem; }

.doc-body { }
.doc-article { margin-bottom: 1.75rem; }
.doc-article-number {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .3rem;
}
.doc-article-title { font-weight: 400; color: var(--text-muted); margin-left: .5rem; }
.doc-article-content { font-size: .95rem; line-height: 1.9; }

/* Version compacte (JO) */
.doc-article--compact { display: inline; }
.doc-article--compact .doc-article-number { display: inline; border: none; padding: 0; margin: 0; font-size: .9rem; }
.doc-preamble--compact { font-size: .85rem; }

.doc-signature {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: right;
}
.sig-location { font-style: italic; font-size: .9rem; color: var(--text-muted); }
.sig-date     { font-size: .9rem; margin: .2rem 0; }
.sig-name     { font-family: var(--font-title); font-size: 1.1rem; font-weight: 700; margin: .5rem 0; }
.sig-image-wrap { margin-top: .75rem; }
.sig-image    { max-height: 100px; max-width: 200px; border: 1px solid var(--border); border-radius: var(--radius); }

.doc-published-info {
  margin-top: 1.5rem;
  padding: .75rem;
  background: #e8f4fd;
  border-radius: var(--radius);
  text-align: center;
  font-size: .875rem;
}
.doc-abrogated-banner {
  margin-top: 1.5rem;
  padding: .75rem;
  background: #fdecea;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius);
  text-align: center;
  font-size: .875rem;
  font-weight: 700;
  color: var(--red);
}

/* ── Versions ──────────────────────────────────────────────────────────────── */
.text-versions  { margin-top: 2.5rem; }
.version-banner { background: #fff9e0; border: 1px solid var(--gold); padding: .5rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.version-badge  { font-family: var(--font-title); font-size: .85rem; color: var(--gold); font-weight: 700; }

/* ── Workflow (statut) ────────────────────────────────────────────────────── */
.text-main-title { font-family: var(--font-title); font-size: 1.6rem; color: var(--primary); }
.text-number-official { font-size: .9rem; color: var(--text-muted); font-style: italic; }

/* ═══════════════════════════════════════════════════════════════════════════
   JOURNAL OFFICIEL
═══════════════════════════════════════════════════════════════════════════ */
.jo-layout { max-width: 800px; }
.jo-date-section { margin-bottom: 2.5rem; }
.jo-date-heading {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}
.jo-items { display: flex; flex-direction: column; gap: .75rem; }
.jo-item  {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: .75rem 1rem;
  border-radius: var(--radius);
}
.jo-item-meta    { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.jo-issue-number { font-family: var(--font-title); font-weight: 700; font-size: .85rem; }
.jo-item-title   { font-weight: 700; display: block; color: var(--text); }
.jo-publisher    { font-size: .8rem; color: var(--text-muted); }

/* ── Numéro de JO ─────────────────────────────────────────────────────────── */
.jo-issue-document { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; max-width: 900px; margin: 0 auto; }
.jo-issue-header {
  background: var(--bg-dark);
  color: #fff;
  text-align: center;
  padding: 2rem;
  border-bottom: 3px solid var(--gold);
}
.jo-header-republic { font-size: .7rem; letter-spacing: .3em; color: rgba(255,255,255,.5); text-transform: uppercase; }
.jo-header-title    { font-family: var(--font-title); font-size: 1.6rem; letter-spacing: .1em; font-weight: 700; margin: .3rem 0; }
.jo-header-number   { font-family: var(--font-title); font-size: 1rem; color: var(--gold-light); }
.jo-header-date     { font-size: .9rem; margin: .3rem 0; color: rgba(255,255,255,.7); }
.jo-header-motto    { font-size: .7rem; letter-spacing: .15em; color: rgba(255,255,255,.4); margin-top: .75rem; }
.jo-issue-texts     { padding: 2rem; }
.jo-text-entry      { padding: 1.5rem 0; }
.jo-text-type       { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.jo-text-title      { font-family: var(--font-title); font-size: 1.2rem; color: var(--primary); margin-bottom: 1rem; }
.jo-separator       { border: none; border-top: 2px solid var(--border); margin: 0; }
.jo-text-sig        { margin-top: 1.5rem; text-align: right; font-style: italic; font-size: .85rem; }
.jo-sig-img         { max-height: 60px; margin-left: 1rem; vertical-align: middle; }
.jo-text-number     { font-size: .85rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMULAIRES
═══════════════════════════════════════════════════════════════════════════ */
.form-page { max-width: 800px; }
.form-page--wide { max-width: 1000px; }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.form-group  { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
.form-row    { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 0; }
.flex-1      { flex: 1; min-width: 150px; }
.form-label  { font-weight: 600; font-size: .875rem; color: var(--text); }
.required    { color: var(--red); }
.form-input  {
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font-ui);
  background: var(--surface);
  transition: border-color var(--transition);
  width: 100%;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,35,149,.1); }
.form-input.rich-editor { font-family: var(--font-body); line-height: 1.7; }
.form-hint   { font-size: .78rem; color: var(--text-muted); }
.form-check  { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-check input { width: auto; }
.form-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.form-section { margin-bottom: 2rem; }
.form-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.form-section-title { font-family: var(--font-title); font-size: 1rem; color: var(--primary); }

/* Visa rows */
.visa-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.visa-prefix { font-family: var(--font-body); font-style: italic; white-space: nowrap; font-size: .9rem; }
.visa-input  { flex: 1; }

/* Article editor rows */
.article-editor-row { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; }
.article-editor-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.article-editor-label  { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.article-number-input  { width: 60px !important; }
.article-content-input { width: 100%; }

/* Signature upload */
.file-upload-area { position: relative; }
.file-input  { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.file-label  {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-align: center;
}
.file-label:hover { border-color: var(--primary); background: #f0f4ff; }
.file-icon { font-size: 2rem; }
.file-text  { font-size: .9rem; color: var(--text-muted); }

/* ── Auth page ────────────────────────────────────────────────────────────── */
.auth-page { display: flex; justify-content: center; padding: 3rem 1rem; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.auth-seal     { color: var(--primary); margin-bottom: 1.5rem; }
.auth-title    { font-family: var(--font-title); font-size: 1.4rem; color: var(--primary); margin-bottom: .5rem; }
.auth-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 2rem; }
.auth-note     { font-size: .8rem; color: var(--text-muted); margin-top: 1.5rem; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLEAUX
═══════════════════════════════════════════════════════════════════════════ */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table th {
  background: var(--bg-dark);
  color: rgba(255,255,255,.9);
  padding: .65rem 1rem;
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.table td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.table-responsive { overflow-x: auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN
═══════════════════════════════════════════════════════════════════════════ */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.stat-number { font-family: var(--font-title); font-size: 2.5rem; font-weight: 700; color: var(--primary); }
.stat-label  { font-size: .85rem; color: var(--text-muted); margin: .25rem 0 .75rem; }
.stat-link   { font-size: .8rem; color: var(--primary); }
.admin-section { margin-bottom: 2rem; }
.quick-links   { display: flex; gap: .75rem; flex-wrap: wrap; }
.user-cell     { display: flex; align-items: center; gap: .5rem; }
.user-avatar-sm { width: 28px; height: 28px; border-radius: 50%; }
.role-form     { display: flex; gap: .4rem; align-items: center; }

/* ── Signe/publication ────────────────────────────────────────────────────── */
.sign-ceremony { text-align: center; margin-bottom: 2rem; }
.sign-seal     { color: var(--primary); margin-bottom: 1rem; }
.sign-intro    { max-width: 500px; margin: 0 auto; color: var(--text-muted); font-size: .95rem; line-height: 1.7; }

/* ═══════════════════════════════════════════════════════════════════════════
   RECHERCHE
═══════════════════════════════════════════════════════════════════════════ */
.search-page { max-width: 800px; }
.search-form-page { display: flex; gap: .75rem; margin-bottom: 1.5rem; }
.search-input--lg { font-size: 1.05rem; padding: .65rem 1rem; }
.search-summary { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }
.search-section { margin-bottom: 2rem; }
.search-section-title { font-size: 1rem; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: .3rem; margin-bottom: .75rem; }
.search-result { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.search-result-title { font-weight: 700; }
.search-result-excerpt { font-size: .875rem; color: var(--text-muted); margin-top: .2rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   ERREURS
═══════════════════════════════════════════════════════════════════════════ */
.error-page { text-align: center; padding: 5rem 1rem; }
.error-code  { font-family: var(--font-title); font-size: 7rem; font-weight: 900; color: var(--primary); opacity: .15; line-height: 1; }
.error-title { font-family: var(--font-title); font-size: 2rem; color: var(--primary); margin-bottom: .5rem; }
.error-subtitle { color: var(--text-muted); margin-bottom: 2rem; }
.error-detail { background: var(--surface-alt); padding: 1rem; border-radius: var(--radius); font-size: .8rem; text-align: left; max-width: 600px; margin: 0 auto 1.5rem; overflow-x: auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   ÉTATS VIDES
═══════════════════════════════════════════════════════════════════════════ */
.empty-state { color: var(--text-muted); font-size: .9rem; font-style: italic; }
.empty-state-large {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state-large h2 { font-family: var(--font-title); color: var(--text-muted); margin-bottom: .5rem; }
.empty-state-large p  { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   POPOVER (liaisons peines)
═══════════════════════════════════════════════════════════════════════════ */
.peine-popover {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.peine-popover.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.popover-infraction { font-weight: 700; color: var(--primary); font-size: .95rem; margin-bottom: .3rem; }
.popover-peine      { font-size: .9rem; margin-bottom: .3rem; }
.popover-details    { font-size: .8rem; color: var(--text-muted); }
.popover-link       { font-size: .8rem; margin-top: .5rem; display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITAIRES
═══════════════════════════════════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.abrogated    { opacity: .5; text-decoration: line-through; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .header-top .container { flex-direction: column; gap: .75rem; }
  .nav-list { overflow-x: auto; flex-wrap: nowrap; }
  .nav-link { padding: .65rem .85rem; font-size: .78rem; }
  .hero-title { font-size: 1.8rem; }
  .home-grid  { grid-template-columns: 1fr; }
  .code-layout, .article-layout, .peine-detail-layout { grid-template-columns: 1fr; }
  .code-toc  { position: static; max-height: none; }
  .text-document { padding: 1.5rem; }
  .jo-issue-header { padding: 1.5rem; }
  .form-row { flex-direction: column; }
  .table th, .table td { padding: .5rem .6rem; font-size: .8rem; }
}
@media (max-width: 480px) {
  .page-header { flex-direction: column; }
  .search-form-hero { flex-direction: column; }
  .btn-lg { padding: .65rem 1.5rem; }
}
