@font-face {
  font-family: "Nexa X Bold";
  src: url("./assets/fonts/NexaXBold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("./assets/fonts/Poppins-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --teal: #2c5051;
  --mint: #5ecd8c;
  --ink: #333333;
  --muted: #868686;
  --paper: #f8f8f8;
  --white: #ffffff;
  --line: #dce5e2;
  --amber: #d58b21;
  --red: #bc4a4a;
  --blue: #477ca8;
  --shadow: 0 16px 40px rgba(44, 80, 81, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Poppins", "Montserrat", sans-serif;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand img {
  width: 190px;
  height: auto;
  flex: 0 0 auto;
}

.eyebrow,
.accent-label {
  margin: 0 0 4px;
  color: var(--mint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: "Nexa X Bold", "Montserrat", sans-serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: var(--teal);
  font-size: clamp(24px, 4vw, 34px);
}

main {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.source-note {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button,
.tab,
.nav-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--teal);
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  padding: 0 12px;
  font-weight: 700;
}

.main-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f7f4;
}

.nav-button {
  min-width: 92px;
  padding: 0 14px;
  border-color: transparent;
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
}

.nav-button.is-active {
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(44, 80, 81, 0.16);
}

.page-view {
  display: none;
}

.page-view.is-active {
  display: block;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: 24px;
  min-height: 190px;
  padding: 34px;
  background: linear-gradient(135deg, var(--teal) 0%, #355f60 72%, #1e1e1e 100%);
  color: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-band h2 {
  max-width: 920px;
  margin: 0;
  font-size: clamp(30px, 4.5vw, 56px);
  line-height: 1.03;
}

.health-meter {
  display: grid;
  place-items: center;
  text-align: center;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.health-meter strong {
  color: var(--mint);
  font-family: "Nexa X Bold", "Montserrat", sans-serif;
  font-size: 56px;
}

.health-meter span {
  max-width: 160px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.kpi {
  min-height: 118px;
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  color: var(--teal);
  font-family: "Nexa X Bold", "Montserrat", sans-serif;
  font-size: 34px;
}

.kpi.warning strong {
  color: var(--amber);
}

.kpi.danger strong {
  color: var(--red);
}

.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
}

.tabs,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  padding: 0 14px;
}

.tab.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}

.filters input,
.filters select {
  height: 38px;
  min-width: 150px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.filters input {
  width: min(360px, 42vw);
}

#slugWorkFilter {
  min-width: 170px;
}

.summary-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.home-summary {
  margin-top: 18px;
}

.details-grid {
  display: block;
}

.panel,
.data-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin: 0;
  color: var(--teal);
  font-size: 18px;
  font-weight: 700;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.bars.compact {
  grid-template-columns: 1fr;
}

.bar-card {
  min-width: 0;
}

.bar-card span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.track {
  height: 8px;
  overflow: hidden;
  background: #edf2f0;
  border-radius: 999px;
}

.fill {
  height: 100%;
  background: var(--mint);
  border-radius: inherit;
}

.data-section {
  margin-top: 16px;
  padding: 18px 18px 0;
}

.details-page .data-section {
  min-width: 0;
  margin-top: 0;
}

.redirects-page .data-section,
.tools-page .data-section {
  margin-top: 0;
}

.count-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ecf7f1;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  max-height: 64vh;
  overflow: auto;
  margin: 0 -18px;
  border-top: 1px solid var(--line);
}

.details-page .table-wrap {
  height: calc(100vh - 235px);
  min-height: 540px;
  max-height: 800px;
}

.redirect-table-wrap {
  height: calc(100vh - 190px);
  min-height: 540px;
  max-height: 820px;
}

.tools-table-wrap {
  height: calc(100vh - 190px);
  min-height: 540px;
  max-height: 820px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f7f4;
  color: var(--teal);
  font-weight: 700;
}

td {
  color: var(--ink);
}

.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: var(--teal);
  color: var(--white);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.small-button:disabled {
  border-color: var(--line);
  background: #edf2f0;
  color: var(--muted);
  cursor: default;
}

.small-button.danger {
  border-color: #f0d5d5;
  background: #faeeee;
  color: var(--red);
}

.small-button.secondary {
  border-color: var(--line);
  background: #f8fbfa;
  color: var(--teal);
}

.small-button.warning {
  border-color: #f4dfb8;
  background: #fff5e5;
  color: var(--amber);
}

.small-button.success {
  border-color: #c8ead5;
  background: #e6f7ed;
  color: #29724a;
}

.action-stack {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.table-input,
.table-select {
  width: 100%;
  min-width: 160px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.table-input {
  min-width: 320px;
}

.table-note {
  width: 100%;
  min-width: 260px;
  height: 70px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  resize: vertical;
}

.tools-page .table-input {
  min-width: 240px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.tool-title-button {
  display: inline;
  max-width: 260px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(94, 205, 140, 0.75);
  text-underline-offset: 3px;
}

.language-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(48px, 1fr));
  gap: 6px;
  min-width: 240px;
}

.language-picker label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.language-picker input {
  width: 13px;
  height: 13px;
  accent-color: var(--teal);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(30, 30, 30, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 28px 80px rgba(30, 30, 30, 0.24);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  color: var(--teal);
  font-family: "Nexa X Bold", "Montserrat", sans-serif;
  font-size: 28px;
}

.field-label {
  display: block;
  margin: 16px 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.modal-input,
.modal-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
}

.modal-input {
  height: 42px;
  padding: 0 12px;
}

.modal-textarea {
  min-height: 420px;
  padding: 14px;
  line-height: 1.55;
  resize: vertical;
}

.muted {
  color: var(--muted);
}

.mono {
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.ok,
.status.complet,
.status.corrige,
.status.fusionne {
  background: #e6f7ed;
  color: #29724a;
}

.status.absent_payload,
.status.absent_live,
.status.slug_different {
  background: #faeeee;
  color: var(--red);
}

.status.incomplet,
.status.a_trier,
.status.slug_autre_langue,
.status.slug_live_autre_langue,
.status.semantique_partiel,
.status.post_migration {
  background: #fff5e5;
  color: var(--amber);
}

.status.semantique_fort {
  background: #e7f1fb;
  color: var(--blue);
}

.status.non_applicable {
  background: #edf2f0;
  color: var(--muted);
}

a {
  color: var(--teal);
}

@media (max-width: 980px) {
  .topbar,
  .control-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-band,
  .summary-layout {
    grid-template-columns: 1fr;
  }

  .main-nav {
    width: 100%;
  }

  .nav-button {
    flex: 1;
  }

  .health-meter {
    width: min(220px, 100%);
    aspect-ratio: auto;
    padding: 24px;
    justify-self: start;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bars {
    grid-template-columns: repeat(2, 1fr);
  }

  .details-page .table-wrap {
    height: auto;
    min-height: 0;
    max-height: 64vh;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 20px, 1540px);
  }

  .brand img {
    width: 150px;
  }

  .hero-band {
    padding: 22px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters select {
    width: 100%;
  }
}

/* ── Produce view ── */
.produce-counters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.produce-groups { display: flex; flex-direction: column; gap: 1.25rem; }
.produce-lang .panel-head { align-items: center; }
.panel-actions { display: flex; gap: .5rem; align-items: center; }
.status.a_integrer { background: #FFEB9C; color: #6b5900; }
.status.a_creer { background: #FCE4D6; color: #8a3b12; }

/* Filtres inline (redirections, contrôle) */
.control-strip-inline { margin-bottom: .75rem; }
.control-strip-inline .filters { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Audit redirections */
.audit-pill { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.audit-pill.sev-high { background: #F8D7DA; color: #842029; }
.audit-pill.sev-med  { background: #FFF3CD; color: #664d03; }
.audit-pill.sev-low  { background: #E2E3E5; color: #41464b; }
.audit-pill.sev-info { background: #E7F1FF; color: #084298; }
.audit-pill.dec-corriger, .audit-pill.dec-redirect { background: #D1E7DD; color: #0f5132; }
.audit-pill.dec-to_create, .audit-pill.dec-a_creer { background: #FCE4D6; color: #8a3b12; }
.audit-pill.dec-out_of_scope, .audit-pill.dec-noise { background: #E2E3E5; color: #41464b; }
.audit-pill.dec-keep { background: #E7F1FF; color: #084298; }
.audit-pill.dec-none { background: transparent; color: #999; }
.audit-row-done { opacity: .45; }
.audit-row-done td a { text-decoration: line-through; }
.audit-table-wrap table { font-size: .82rem; }
.audit-table-wrap td { vertical-align: top; }
