:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe4ef;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eaf1ff;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-strong);
}

.app-shell {
  min-height: 100vh;
  width: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 18px 34px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #0f172a);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.25);
}

.brand-title {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-subtitle,
.muted {
  color: var(--muted);
}

.nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex: 1 1 auto;
}

.nav-link {
  display: block;
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.nav-link.active,
.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.header-note {
  max-width: 260px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.45;
}

.main {
  width: 100%;
  min-width: 0;
  padding: 34px;
}

.page-header,
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(34px, 3.8vw, 58px);
  line-height: 0.95;
}

h2 {
  font-size: 22px;
}

.lead {
  max-width: 850px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.stats {
  display: flex;
  gap: 12px;
}

.stats div {
  min-width: 112px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats span {
  display: block;
  font-size: 28px;
  font-weight: 900;
}

.stats small {
  color: var(--muted);
  font-weight: 700;
}

.panel,
.table-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(260px, 1.2fr) repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.22);
  border-color: var(--primary);
}

.filter-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
}

.button-primary {
  color: white;
  background: var(--primary);
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  color: var(--text);
  background: var(--panel-soft);
  border-color: var(--line);
}

.table-card {
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar span,
.hint {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  max-height: calc(100vh - 330px);
  overflow: auto;
}

table {
  width: 100%;
  min-width: 2100px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0;
  text-align: left;
  color: #334155;
  background: #eef4ff;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.column-filter-row th {
  top: 45px;
  z-index: 2;
  padding: 8px 10px 10px;
  background: #f8fbff;
}

.sort-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 45px;
  padding: 13px 14px;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 900;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.sort-button:hover,
.sort-button.sorted-asc,
.sort-button.sorted-desc {
  color: var(--primary-strong);
  background: rgba(37, 99, 235, 0.08);
}

.sort-indicator {
  color: var(--muted);
  font-size: 13px;
}

.column-filter {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 12px;
}

td {
  max-width: 280px;
  padding: 14px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: top;
  line-height: 1.4;
}

.wide-cell {
  min-width: 320px;
}

.table-cell-categorie,
.table-cell-organisme {
  min-width: 190px;
}

.service-cell,
.table-cell-equipe-a-contacter {
  min-width: 380px;
  max-width: 480px;
}

.value-chip {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  padding: 7px 10px;
  overflow: hidden;
  color: var(--chip-text, var(--primary-strong));
  background: var(--chip-bg, var(--primary-soft));
  border: 1px solid var(--chip-border, rgba(37, 99, 235, 0.16));
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organism-chip {
  border-radius: 12px;
}

.service-highlight {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-left: 4px solid var(--primary);
  border-radius: 16px;
}

.service-highlight span {
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.service-highlight strong {
  color: #0f172a;
  font-size: 15px;
  line-height: 1.25;
}

.service-highlight small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.cell-link {
  display: inline-flex;
  max-width: 240px;
  margin: 0 6px 6px 0;
  padding: 6px 9px;
  overflow: hidden;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.cell-link:hover {
  color: white;
  background: var(--primary);
}

tbody tr {
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

tbody tr:hover {
  background: #f8fbff;
}

.empty-row,
.empty-state {
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  font-weight: 800;
}

.detail-header {
  display: block;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.badge {
  padding: 10px 14px;
  color: var(--chip-text, var(--primary-strong));
  background: var(--chip-bg, var(--primary-soft));
  border: 1px solid var(--chip-border, rgba(37, 99, 235, 0.15));
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  gap: 22px;
  margin-bottom: 22px;
}

.professional-card,
.contact-card,
.all-fields {
  padding: 24px;
}

dl {
  display: grid;
  gap: 18px;
  margin: 22px 0 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dd {
  margin: 6px 0 0;
  line-height: 1.55;
}

.link-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-stack a {
  padding: 8px 10px;
  background: var(--primary-soft);
  border-radius: 999px;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.field-read {
  min-height: 118px;
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.field-read span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-read p {
  margin: 0;
  line-height: 1.5;
}

.markdown-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
}

.doc-list {
  position: sticky;
  top: 34px;
  align-self: start;
  max-height: calc(100vh - 68px);
  padding: 18px;
  overflow: auto;
}

.doc-list h2 {
  margin-bottom: 16px;
}

.doc-link {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  font-weight: 700;
}

.doc-link.active,
.doc-link:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.markdown-reader {
  min-height: calc(100vh - 130px);
  padding: 26px;
}

.reader-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.reader-header span {
  color: var(--muted);
  font-weight: 800;
}

.markdown-body {
  max-width: 1100px;
  color: #243044;
  font-size: 16px;
  line-height: 1.72;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.4em 0 0.55em;
  line-height: 1.1;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child {
  margin-top: 0;
}

.markdown-body p,
.markdown-body ul {
  margin: 0 0 1em;
}

.markdown-body li {
  margin-bottom: 0.45em;
}

.todo-panel {
  margin-bottom: 22px;
  padding: 22px;
}

.todo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.todo-grid label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  color: #334155;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.45;
}

.todo-grid input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.source-card {
  display: grid;
  gap: 8px;
  min-width: 300px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.source-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.source-card a {
  font-weight: 800;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.info-panel {
  padding: 26px;
}

.info-panel h3 {
  margin: 24px 0 10px;
  font-size: 17px;
}

.info-panel p,
.info-panel li {
  color: #334155;
  line-height: 1.65;
}

.info-panel ul,
.info-panel ol {
  padding-left: 22px;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.callout {
  padding: 16px 18px;
  background: var(--primary-soft);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 18px;
  font-weight: 700;
}

.compact-dl {
  gap: 12px;
}

.deadline-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.deadline-row div {
  padding: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.deadline-row span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.deadline-row strong {
  display: block;
  font-size: 18px;
}

.step-list {
  display: grid;
  gap: 10px;
  counter-reset: steps;
  list-style: none;
  padding-left: 0 !important;
}

.step-list li {
  position: relative;
  min-height: 52px;
  padding: 14px 16px 14px 58px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.step-list li::before {
  counter-increment: steps;
  content: counter(steps);
  position: absolute;
  left: 16px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: white;
  background: var(--primary);
  border-radius: 10px;
  font-weight: 900;
}

.warning-grid,
.bureau-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.warning-grid div,
.bureau-grid div {
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.warning-grid strong,
.bureau-grid strong {
  display: block;
  margin-bottom: 6px;
}

.warning-grid span,
.bureau-grid span {
  color: var(--muted);
  line-height: 1.45;
}

.bureau-section {
  margin-top: 24px;
}

.bureau-highlight {
  padding: 18px;
  background: var(--primary-soft);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 20px;
}

@media (max-width: 1180px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .filters,
  .detail-grid,
  .field-grid,
  .markdown-layout,
  .info-grid,
  .two-columns,
  .deadline-row,
  .todo-grid,
  .warning-grid,
  .bureau-grid {
    grid-template-columns: 1fr;
  }
}
