/* ---------------------------------------------------------
   Page interne "Suivi ZAN". Réutilise le système de design du
   site (tokens, polices, .tool-panel/.result-panel/.search-box…)
   depuis ../styles.css. Ce fichier ne contient que l'habillage
   propre à cette page : bandeau ZAN, tableaux, comparatifs.
--------------------------------------------------------- */

.intro-zan .lede { margin-top: 2px; margin-bottom: 0; }

.intro-zan .tool-panel { max-width: none; margin: 22px 0 0; }
.intro-zan .zan-result { max-width: none; margin: 24px 0 0; }

.zan-info { position: relative; display: inline-block; margin: 10px 0 0; }

.zan-info-btn {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--blue);
  background: var(--blue-soft);
  border: 0;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: .82rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.zan-info-btn:hover,
.zan-info-btn:focus-visible { background: var(--blue); color: #fff; }
.zan-info-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.zan-info-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 20;
  width: min(360px, 82vw);
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}

.zan-info-panel[hidden] { display: none; }
.zan-info:hover .zan-info-panel[hidden],
.zan-info:focus-within .zan-info-panel[hidden] { display: block; }

.zan-info-panel p { margin: 0 0 8px; color: var(--ink); font-size: .9rem; line-height: 1.5; }
.zan-info-panel p:last-child { margin-bottom: 0; }
.zan-info-panel strong { color: var(--blue-deep); }

.zan-law-note-sub { color: var(--muted) !important; font-size: .8rem !important; }

.zan-national { padding-top: clamp(28px, 5vw, 48px); padding-bottom: clamp(28px, 5vw, 48px); }

.zan-national-kicker {
  margin: 0 0 18px;
  color: rgba(242, 242, 246, .7);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.zan-stat-label {
  display: block;
  margin-bottom: 10px;
  color: rgba(242, 242, 246, .68);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.zan-national .stats-grid strong { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }

.zan-city-sub { margin-top: 2px; color: var(--muted); font-size: .84rem; }

.zan-gauge-card { min-height: 130px; background: var(--green); }
.zan-gauge-card.tier-ok { background: var(--green); color: #fff; }
.zan-gauge-card.tier-over { background: var(--red); color: #fff; }
.zan-gauge-card.tier-na { background: var(--muted); color: #fff; }

.zan-gauge-figure { display: block; margin-top: 6px; font-size: .78rem; opacity: .9; }

.zan-bars { display: grid; gap: 14px; margin: 20px 0; }
.zan-bar-row .metric-head { margin-bottom: 5px; }
.zan-bar-row .metric-head span { font-size: .9rem; }

.zan-bar-plain {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
}

.zan-bar-plain i {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--blue);
  border-radius: 5px;
}

.zan-bar-with-marker { overflow: visible; }

.zan-bar-marker {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--ink);
}

.zan-bar-marker small {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--ink);
  font-size: .66rem;
  font-weight: 700;
}

.zan-trend { margin: 38px 0 8px; }

.zan-trend-label { margin: 0 0 8px; color: var(--muted); font-size: .84rem; font-weight: 600; }

.zan-chart { display: flex; gap: 10px; }

.zan-chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  width: 54px;
  height: 120px;
  text-align: right;
  color: var(--muted);
  font-size: .66rem;
  line-height: 1;
}

.zan-chart-main { flex: 1; min-width: 0; }

.zan-sparkline {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
}

.zan-spark-col {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.zan-spark-bar {
  width: 100%;
  min-height: 2px;
  background: var(--blue-soft);
  border-radius: 2px 2px 0 0;
}

.zan-spark-col.is-track .zan-spark-bar { background: var(--blue); }

.zan-spark-threshold {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed var(--clay);
  z-index: 2;
}

.zan-spark-threshold span {
  position: absolute;
  left: 0;
  top: -15px;
  padding-right: 4px;
  color: var(--clay);
  background: var(--white);
  font-size: .64rem;
  font-weight: 700;
  white-space: nowrap;
}

.zan-chart-xaxis {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding: 0 2px;
}

.zan-chart-xaxis span {
  flex: 1 1 0;
  text-align: center;
  color: var(--muted);
  font-size: .66rem;
}

.zan-projection {
  margin: 26px 0 0;
  padding: 12px 16px;
  background: var(--paper);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
}

.zan-projection-alert {
  margin-top: 10px;
  color: #7a1015;
  background: #fbe4e4;
}

.zan-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 26px;
}

.zan-compare-block {
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.zan-compare-title { margin: 0 0 12px; color: var(--ink); font-size: .92rem; font-weight: 700; }

.zan-compare-rows { display: grid; gap: 4px; }

.zan-compare-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 4px;
  font-size: .86rem;
}

.zan-compare-row.is-clickable {
  cursor: pointer;
  border: 0;
  background: none;
  width: calc(100% + 12px);
  font-family: inherit;
  font-size: .86rem;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
}

.zan-compare-row.is-clickable:hover,
.zan-compare-row.is-clickable:focus-visible { background: var(--white); }
.zan-compare-row.is-clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.zan-compare-row .zan-compare-tag {
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 600;
}

.zan-compare-row .zan-compare-name { flex: 1; min-width: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zan-compare-row .zan-compare-figure { flex-shrink: 0; font-weight: 700; }
.zan-compare-row .zan-compare-figure.is-best { color: var(--green-deep); }
.zan-compare-row .zan-compare-figure.is-worst { color: var(--red); }

/* ---------------------------------------------------------
   Tableaux (classement régions, top 10, communes en tension)
--------------------------------------------------------- */
.zan-table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.zan-table-wrap--tall { max-height: 560px; overflow-y: auto; }

.zan-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: .88rem;
}

.zan-table caption { text-align: left; }

.zan-table th,
.zan-table td {
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.zan-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.zan-table tbody tr:last-child td { border-bottom: 0; }
.zan-table tbody tr:hover { background: var(--blue-soft); }

.zan-table td.is-name { white-space: normal; font-weight: 600; color: var(--ink); }

.zan-tier {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .82rem;
  white-space: nowrap;
}

.zan-tier::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.zan-tier--ok { color: var(--blue-deep); background: var(--blue-soft); }
.zan-tier--warn { color: #7a5f04; background: var(--gold-soft); }
.zan-tier--high { color: #7a3315; background: var(--clay-soft); }
.zan-tier--over { color: #fff; background: var(--red); }
.zan-tier--na { color: var(--muted); background: var(--paper); }

.zan-watch-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.zan-select-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 600;
}

.zan-select-label select {
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-size: .88rem;
}

.zan-select-label select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.zan-watch-note { flex: 1 1 320px; margin: 0; color: var(--muted); font-size: .8rem; }

.zan-watch-truncate { margin-top: 12px; color: var(--muted); font-size: .84rem; }

.zan-compare-caveat { margin: 14px 0 0; color: var(--muted); font-size: .78rem; }

.zan-table tbody tr.is-clickable { cursor: pointer; }
.zan-table tbody tr.is-clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.zan-table tbody tr.is-clickable td.is-name { color: var(--blue); text-decoration: underline; text-decoration-color: transparent; }
.zan-table tbody tr.is-clickable:hover td.is-name,
.zan-table tbody tr.is-clickable:focus-visible td.is-name { text-decoration-color: currentColor; }

/* ---------------------------------------------------------
   Classement des régions : ligne cliquable + expansion en ligne
--------------------------------------------------------- */
.zan-table thead th:first-child,
.zan-table tbody td:first-child { width: 34px; color: var(--muted); text-align: right; }

.zan-table--regions .zan-region-caret {
  width: 28px;
  padding-right: 0;
  color: var(--muted);
  text-align: center;
  transition: transform .15s ease;
}

.zan-table--regions tr.is-open .zan-region-caret { transform: rotate(90deg); color: var(--blue); }

.zan-region-detail-cell { padding: 0 !important; background: var(--paper); }

.zan-region-detail {
  padding: 12px 14px 16px 42px;
}

.zan-region-detail p { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }

.zan-dept-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.zan-dept-table th,
.zan-dept-table td { padding: 8px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.zan-dept-table thead th { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.zan-dept-table thead th:first-child,
.zan-dept-table tbody td:first-child { width: 30px; color: var(--muted); text-align: right; }
.zan-dept-table tbody tr:last-child td { border-bottom: 0; }
.zan-dept-table tbody tr:hover { background: var(--white); }

@media (max-width: 640px) {
  .zan-table--regions .zan-col-optional,
  .zan-dept-table .zan-col-optional { display: none; }

  .zan-dept-table { table-layout: fixed; }
  .zan-dept-table td.is-name { overflow-wrap: break-word; }

  .zan-table--regions { min-width: 0; table-layout: fixed; }

  .zan-table--regions td.is-name { overflow-wrap: break-word; }

  .zan-region-detail { padding-left: 20px; }
}

@media (max-width: 780px) {
  .zan-compare-grid { grid-template-columns: 1fr; }
}
