:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --ink: #1a2e1a;
  --muted: #5c6b5c;
  --accent: #2d6a4f;
  --accent-light: #d8f3dc;
  --border: #d4ddd4;
  --shadow: 0 4px 24px rgba(26, 46, 26, 0.08);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative !important; height: auto !important; }
}

.sidebar {
  background: linear-gradient(165deg, #1b4332 0%, #2d6a4f 100%);
  color: #f0fff4;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  pointer-events: auto;
  flex-shrink: 0;
}
.sidebar .brand { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.02em; margin-bottom: 0.25rem; }
.sidebar .sub { font-size: 0.8rem; opacity: 0.85; margin-bottom: 1.5rem; }
.sidebar nav a {
  display: block;
  color: #d8f3dc;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  position: relative;
  z-index: 2;
  cursor: pointer;
  pointer-events: auto;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(255,255,255,0.15);
  text-decoration: none;
  color: #fff;
}
.sidebar nav .section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.6; margin: 1rem 0 0.4rem 0.5rem; }

.main {
  padding: 2rem 2.5rem 4rem;
  max-width: 1400px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.hero { margin-bottom: 2rem; }
.hero h1 { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.hero .meta { color: var(--muted); font-size: 0.9rem; margin-top: 0.35rem; }
.stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.25rem 0; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  min-width: 120px;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 1.5rem; color: var(--accent); }
.stat span { font-size: 0.8rem; color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
  overflow: hidden;
}
.panel header {
  padding: 0.9rem 1.25rem;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel .body { padding: 1.25rem; }

.diagram-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafcf9;
  overflow: hidden;
  position: relative;
  z-index: 1;
  isolation: isolate;
}
.diagram-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: #eef5ee;
  border-bottom: 1px solid var(--border);
}
.dz-btn {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.dz-btn:hover { background: var(--accent-light); border-color: var(--accent); }
.zoom-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  min-width: 3rem;
  text-align: center;
  font-weight: 600;
  color: var(--accent);
}
.diagram-hint-toolbar {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}
.diagram-viewport {
  height: min(72vh, 720px);
  min-height: 320px;
  overflow: hidden;
  cursor: grab;
  position: relative;
  background: #fafcf9;
}
.diagram-viewport.is-dragging { cursor: grabbing; }
.diagram-stage {
  transform-origin: 0 0;
  display: inline-block;
  padding: 1.5rem;
  min-width: min-content;
}
.diagram-stage .mermaid { margin: 0; font-size: 14px; }
.diagram-stage svg {
  display: block;
  max-width: none !important;
  height: auto !important;
}
/* Style MLD Merise (entités-associations) */
.mermaid .er.entityBox,
.mermaid .er.entityLabel { fill: #f5e6c8 !important; stroke: #8b6914 !important; }
.mermaid .er.attributeBoxEven,
.mermaid .er.attributeBoxOdd { fill: #faf6ef !important; }
.mermaid .entityLabel { font-size: 14px !important; font-weight: 700 !important; }
.mermaid .attributeBoxEven,
.mermaid .attributeBoxOdd { font-size: 11px !important; }
.mermaid .edgeLabel,
.mermaid .edgeLabel .label {
  font-size: 13px !important;
  font-weight: 700 !important;
  fill: #1a2e1a !important;
}
.mermaid .edgeLabel rect { fill: #fff9e6 !important; stroke: #8b6914 !important; }
.mermaid .relationshipLine { stroke: #5c4a32 !important; stroke-width: 2px !important; }
body > svg[id^="mermaid"],
body > div[id^="dmermaid"] {
  display: none !important;
}
.diagram-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.entity-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: #fafcf9;
  transition: box-shadow 0.2s;
}
.entity-card:hover { box-shadow: var(--shadow); }
.entity-card.external { border-style: dashed; opacity: 0.92; }
.entity-card header { margin-bottom: 0.6rem; }
.entity-card h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.entity-card .tech { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }
.tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  vertical-align: middle;
}
.tag.pk { background: #2d6a4f; color: #fff; }
.tag.ext { background: #e9c46a; color: #333; }
.entity-card .attrs { font-size: 0.85rem; padding-left: 1.1rem; color: var(--ink); }
.entity-card .attrs li { margin-bottom: 0.15rem; }
.fk-block { margin-top: 0.6rem; padding-top: 0.5rem; border-top: 1px dashed var(--border); }
.fk-label { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); }
.fk-list { font-size: 0.78rem; list-style: none; margin-top: 0.25rem; }
.fk-list code { background: #e8f0e8; padding: 0.05rem 0.3rem; border-radius: 3px; }

.assoc-list { list-style: none; }
.assoc-list li.assoc {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.assoc-list li:last-child { border-bottom: none; }
.verb { font-weight: 700; color: var(--accent); min-width: 8rem; }
.card {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}
.c-11 { background: #1b4332; color: #fff; }
.c-01 { background: #95d5b2; color: #1a2e1a; }
.c-1n { background: #40916c; color: #fff; }
.c-0n { background: #d8f3dc; color: #1a2e1a; }
.role { font-size: 0.75rem; color: var(--muted); font-style: italic; }
.assoc-arrow { color: var(--muted); margin: 0 0.15rem; }
.assoc-attrs { display: block; width: 100%; font-size: 0.8rem; color: var(--muted);
  margin-top: 0.2rem; padding-left: 8rem; font-style: italic; }

.legend { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.85rem; }
.legend-item { display: flex; align-items: center; gap: 0.35rem; }

.merise-pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: #1a2e1a;
  color: #d8f3dc;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.6;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.domain-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
  transition: transform 0.15s;
}
.domain-card:hover { transform: translateY(-2px); }
.domain-card h2 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.domain-card p { font-size: 0.85rem; color: var(--muted); }
.domain-card .num { font-size: 2rem; font-weight: 800; opacity: 0.15; float: right; line-height: 1; }
.global-card { border-top-color: #1b4332; grid-column: 1 / -1; max-width: 100%; }
.global-card a.btn {
  display: inline-block;
  margin-top: 0.75rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}
.global-card a.btn:hover { background: #1b4332; text-decoration: none; }
.muted { color: var(--muted); }
.panel-primary-schema { border: 2px solid #2d6a4f; }
.schema-plantuml, .schema-scroll {
  overflow: auto;
  max-width: 100%;
  padding: 0.5rem;
  background: #fafcf9;
  border-radius: 8px;
  min-height: 200px;
  max-height: 85vh;
}
.schema-plantuml-img {
  display: block;
  min-width: min(100%, 900px);
  width: auto;
  height: auto;
  margin: 0 auto;
}
.diagram-parts { display: flex; flex-direction: column; gap: 2rem; }
.diagram-part-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.diagram-panel-scrollable .diagram-viewport {
  height: auto;
  min-height: 420px;
  max-height: 80vh;
  overflow: auto;
}
.diagram-panel-scrollable .diagram-stage {
  padding: 2rem;
  min-width: max-content;
}
.diagram-parts-plantuml .diagram-part {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}
.schema-map-unified { display: block; }
.schema-card-grid-unified {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.schema-card header .schema-chip {
  margin-left: 0.5rem;
  font-size: 0.7rem;
  vertical-align: middle;
}
.schema-map { display: flex; flex-direction: column; gap: 1.5rem; }
.schema-zone h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.65rem;
}
.schema-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.schema-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.schema-card-main { border-color: #2d6a4f; }
.schema-card-ref { border-color: #74a4bc; border-style: dashed; }
.schema-card-link { border-color: #b08968; background: #fffbf5; }
.schema-card header {
  padding: 0.55rem 0.75rem;
  background: #eef5ee;
  border-bottom: 1px solid var(--border);
}
.schema-card-link header { background: #faf3eb; }
.schema-card h4 { margin: 0; font-size: 0.95rem; color: var(--accent); }
.schema-card .tech { font-size: 0.72rem; color: var(--muted); }
.schema-attrs {
  list-style: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  max-height: 220px;
  overflow-y: auto;
}
.schema-attrs li { padding: 0.2rem 0; border-bottom: 1px dotted #e8ebe8; }
.schema-attrs li.pk code { font-weight: 700; text-decoration: underline; }
.schema-attrs li.fk { color: #5c4a32; }
.schema-attrs .typ { color: var(--muted); font-size: 0.75rem; margin-left: 0.25rem; }
.schema-attrs .fk-ref { color: #7f5539; font-size: 0.75rem; }
.schema-rel-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.schema-rel-table th, .schema-rel-table td {
  padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left;
}
.schema-rel-table th { background: #eef5ee; font-size: 0.72rem; text-transform: uppercase; }
.schema-rel-arrow { color: #b00020; font-weight: 700; text-align: center; width: 2rem; }
.schema-rel-from { color: var(--accent); font-weight: 600; }
.schema-rel-to { color: #1b4332; font-weight: 600; }
.schema-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.schema-chip.ref { background: #e3f2fd; color: #1565c0; }
.schema-chip.main { background: #d8f3dc; color: #1b4332; }
.schema-chip.link { background: #ffe8d6; color: #7f5539; }
.schema-relations { margin-top: 1rem; }
.schema-relations h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.nav-tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
}
.nav-tabs a:hover { background: var(--accent-light); text-decoration: none; }
.nav-tabs a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.rel-fk-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.rel-fk-table th, .rel-fk-table td { padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--border); text-align: left; }
.rel-fk-table th { background: #eef5ee; font-size: 0.72rem; text-transform: uppercase; color: var(--muted); }
.model-legend { margin-top: 1rem; }
.mermaid-error {
  color: #b00020;
  background: #fff0f0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.pdf-section { margin-bottom: 1.5rem; }

.sidebar nav .section-sources {
  margin-top: 0.5rem;
  opacity: 0.95;
  font-weight: 700;
  color: #b7e4c7;
}
.sidebar nav a.nav-source {
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid #95d5b2;
  padding-left: 0.65rem;
}
.sidebar nav a.nav-source.active {
  background: rgba(255,255,255,0.22);
  border-left-color: #fff;
}
.sidebar nav .section-models {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.2);
}
.markdown-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  max-width: 100%;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.55;
}
.markdown-body h1 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; color: var(--accent); }
.markdown-body h2 { font-size: 1.2rem; margin: 1.25rem 0 0.6rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }
.markdown-body h3, .markdown-body h4 { margin: 1rem 0 0.5rem; }
.markdown-body p { margin: 0.5rem 0; }
.markdown-body ul, .markdown-body ol { margin: 0.5rem 0 0.75rem 1.25rem; }
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.82rem;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.markdown-body th { background: #eef5ee; }
.markdown-body code { font-family: var(--mono); font-size: 0.85em; background: #f0f4f0; padding: 0.1em 0.35em; border-radius: 4px; }
.markdown-body pre { background: #1a2e1a; color: #d8f3dc; padding: 1rem; border-radius: 8px; overflow-x: auto; }
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.doc-meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 1rem; }

.panel-primary-schema { border: 2px solid #2d6a4f; }
.schema-plantuml, .schema-scroll {
  overflow: auto;
  max-width: 100%;
  padding: 0.5rem;
  background: #fafcf9;
  border-radius: 8px;
  min-height: 200px;
  max-height: 85vh;
}
.schema-plantuml-img {
  display: block;
  min-width: min(100%, 900px);
  width: auto;
  height: auto;
  margin: 0 auto;
}
.diagram-parts { display: flex; flex-direction: column; gap: 2rem; }
.diagram-part-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.diagram-panel-scrollable .diagram-viewport {
  height: auto;
  min-height: 420px;
  max-height: 80vh;
  overflow: auto;
}
.diagram-panel-scrollable .diagram-stage {
  padding: 2rem;
  min-width: max-content;
}
.diagram-parts-plantuml .diagram-part {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}
.schema-map-unified { display: block; }
.schema-card-grid-unified {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.schema-card header .schema-chip {
  margin-left: 0.5rem;
  font-size: 0.7rem;
  vertical-align: middle;
}
.schema-map { display: flex; flex-direction: column; gap: 1.5rem; }
.schema-zone h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.65rem;
}
.schema-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.schema-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.schema-card-main { border-color: #2d6a4f; }
.schema-card-ref { border-color: #74a4bc; border-style: dashed; }
.schema-card-link { border-color: #b08968; background: #fffbf5; }
.schema-card header {
  padding: 0.55rem 0.75rem;
  background: #eef5ee;
  border-bottom: 1px solid var(--border);
}
.schema-card-link header { background: #faf3eb; }
.schema-card h4 { margin: 0; font-size: 0.95rem; color: var(--accent); }
.schema-card .tech { font-size: 0.72rem; color: var(--muted); }
.schema-attrs {
  list-style: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  max-height: 220px;
  overflow-y: auto;
}
.schema-attrs li { padding: 0.2rem 0; border-bottom: 1px dotted #e8ebe8; }
.schema-attrs li.pk code { font-weight: 700; text-decoration: underline; }
.schema-attrs li.fk { color: #5c4a32; }
.schema-attrs .typ { color: var(--muted); font-size: 0.75rem; margin-left: 0.25rem; }
.schema-attrs .fk-ref { color: #7f5539; font-size: 0.75rem; }
.schema-rel-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.schema-rel-table th, .schema-rel-table td {
  padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left;
}
.schema-rel-table th { background: #eef5ee; font-size: 0.72rem; text-transform: uppercase; }
.schema-rel-arrow { color: #b00020; font-weight: 700; text-align: center; width: 2rem; }
.schema-rel-from { color: var(--accent); font-weight: 600; }
.schema-rel-to { color: #1b4332; font-weight: 600; }
.schema-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.schema-chip.ref { background: #e3f2fd; color: #1565c0; }
.schema-chip.main { background: #d8f3dc; color: #1b4332; }
.schema-chip.link { background: #ffe8d6; color: #7f5539; }
.schema-relations { margin-top: 1rem; }
.schema-relations h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }

.sql-pre {
  font-family: Consolas, monospace;
  font-size: 0.78rem;
  background: #1a2e1a;
  color: #d8f3dc;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow: auto;
  max-height: none;
  white-space: pre;
  line-height: 1.45;
}
.sql-table-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
  overflow: hidden;
  background: var(--surface);
}
.sql-table-card header {
  padding: 0.75rem 1rem;
  background: #eef5ee;
  border-bottom: 1px solid var(--border);
}
.sql-table-card h3 { font-size: 1rem; margin: 0; }
.col-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.col-table th, .col-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.col-table th { background: #fafcf9; font-size: 0.75rem; text-transform: uppercase; color: var(--muted); }
.rel-keys-card .rel-keys-label { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); margin: 0.5rem 1rem 0.25rem; }
.rel-keys-card .attrs { list-style: none; padding: 0 1rem 0.5rem; font-size: 0.85rem; }
.global-card a.btn { display: inline-block; margin-top: 0.5rem; background: var(--accent); color: #fff; padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; text-decoration: none; }
.dashboard-welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: min(72vh, 780px);
  padding: 3rem 1.5rem 4rem;
  margin: 0 auto;
  max-width: 54rem;
}
.dashboard-welcome__title {
  font-size: clamp(1.85rem, 4.5vw, 3rem);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 2.25rem;
}
.dashboard-welcome__tagline {
  margin: 0;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 600;
  line-height: 1.7;
  color: #1b4332;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.dashboard-welcome__line { display: block; }
.main:has(.dashboard-welcome) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: none;
}
html.auth-pending body {
  visibility: hidden;
}

/* Connexion — fond structuré, palette neutre */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  background: linear-gradient(165deg, #dce3eb 0%, #e8ecf1 38%, #d4dce6 100%);
  overflow: hidden;
}

/* Calque décoratif : halos + grain + cercles filaires */
.auth-page__decor {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 85% 55% at 15% 90%, rgba(100, 116, 139, 0.22), transparent 58%),
    radial-gradient(ellipse 75% 50% at 88% 8%, rgba(148, 163, 184, 0.28), transparent 52%),
    radial-gradient(ellipse 60% 45% at 50% 50%, rgba(241, 245, 249, 0.35), transparent 65%),
    radial-gradient(ellipse 100% 40% at 50% -5%, rgba(255, 255, 255, 0.75), transparent 48%);
}

.auth-page__decor::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image: radial-gradient(rgba(15, 23, 42, 0.055) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, black 10%, transparent 72%);
}

.auth-page__decor::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(140vmin, 920px);
  height: min(140vmin, 920px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35) inset,
    0 0 0 48px rgba(15, 23, 42, 0.02),
    0 0 0 49px rgba(15, 23, 42, 0.035);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(15, 23, 42, 0.08);
  padding: 0;
  overflow: hidden;
}

.auth-card__header {
  padding: 1.75rem 1.75rem 1.25rem;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
}

.auth-card__title {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.auth-card__subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #64748b;
  font-weight: 500;
}

.auth-card__body {
  padding: 1.5rem 1.75rem 1.25rem;
}

.auth-card__footer {
  margin: 0;
  padding: 0 1.75rem 1.35rem;
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.45;
}

.auth-card h1.auth-card__title {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.35rem);
}

.auth-card .auth-sub {
  margin: 0 0 1.5rem;
  font-size: 0.88rem;
  color: #64748b;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #334155;
}

.auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9375rem;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:hover:not(:disabled) {
  border-color: #94a3b8;
}

.auth-field input:focus {
  outline: none;
  border-color: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.2);
}

.auth-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #f8fafc;
}

.auth-lockout {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #854d0e;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.auth-error {
  color: #b91c1c;
  font-size: 0.8125rem;
  margin: 0.65rem 0 0;
  min-height: 1.2em;
}

.auth-submit {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.auth-submit:hover:not(:disabled) {
  background: #1e293b;
}

.auth-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sidebar .nav-logout {
  font-size: 0.85rem;
  color: #ffd6a5;
  border-left: 3px solid transparent;
}

.sidebar .nav-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: #ffd6a5;
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.nav-tabs a {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
}
.nav-tabs a:hover { background: var(--accent-light); text-decoration: none; }
.nav-tabs a.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.rel-fk-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.rel-fk-table th, .rel-fk-table td { padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--border); text-align: left; }
.rel-fk-table th { background: #eef5ee; font-size: 0.72rem; text-transform: uppercase; color: var(--muted); }
.model-legend { margin-top: 1rem; }
.mermaid-error {
  color: #b00020;
  background: #fff0f0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.pdf-section { margin-bottom: 1.5rem; }
