/* =========================================================================
   check-site — feuille de styles unique.

   Conception mobile d abord : le technicien travaille debout, sur telephone,
   parfois avec des gants. Les cibles tactiles font au moins 44 px, les
   couleurs restent lisibles en plein soleil comme dans un local technique.
   ========================================================================= */

:root {
  color-scheme: light dark;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #d8dde4;
  --text: #16191d;
  --text-soft: #5b636d;
  --text-faint: #868e99;

  --accent: #1f6feb;
  --accent-soft: #e7effd;
  --accent-text: #ffffff;

  --ok: #1c7a42;
  --ok-soft: #e2f4e9;
  --warn: #8a5a00;
  --warn-soft: #fdf0d9;
  --bad: #b02a26;
  --bad-soft: #fbe4e3;
  --info: #1b4a91;
  --info-soft: #e6eefb;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 20 26 / 6%), 0 4px 16px rgb(16 20 26 / 6%);
  --gap: 16px;
  --tap: 44px;

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1d232c;
    --border: #2b323c;
    --text: #e6eaf0;
    --text-soft: #a2acba;
    --text-faint: #78838f;

    --accent: #4e9dff;
    --accent-soft: #16263d;
    --accent-text: #06101d;

    --ok: #56d68a;
    --ok-soft: #10281a;
    --warn: #e2a53a;
    --warn-soft: #2c2211;
    --bad: #f2837d;
    --bad-soft: #331716;
    --info: #7fb2ff;
    --info-soft: #14223a;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 32%);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .6em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }

.muted { color: var(--text-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-text); padding: 10px 16px;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------- coquille */

.boot, .login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text-soft);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--gap);
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.01em;
}
.topbar__brand span { color: var(--accent); }
.topbar__brand:hover { text-decoration: none; }

.topbar__nav { display: none; gap: 4px; margin-left: 12px; }
.topbar__nav a {
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 550; font-size: .92rem;
}
.topbar__nav a:hover { background: var(--surface-2); text-decoration: none; }
.topbar__nav a.is-active { background: var(--accent-soft); color: var(--accent); }

.topbar__user { margin-left: auto; }

.user-chip {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px; padding: 6px 10px; min-height: var(--tap);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; cursor: pointer;
}
.user-chip__name { font-size: .85rem; font-weight: 600; }
.user-chip__role { font-size: .7rem; color: var(--text-faint); }

.outlet {
  padding: var(--gap);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  max-width: 1180px;
  margin: 0 auto;
}
.outlet[aria-busy="true"] { opacity: .55; }

.bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottombar a {
  flex: 1; min-height: 56px;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 600; color: var(--text-soft);
  padding: 6px 4px; text-align: center;
}
.bottombar a:hover { text-decoration: none; }
.bottombar a.is-active { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

@media (min-width: 860px) {
  .topbar__nav { display: flex; }
  .bottombar { display: none; }
  .outlet { padding: 24px; padding-bottom: 48px; }
}

/* ------------------------------------------------------------ connexion */

.login__box {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}
.login__title { font-size: 1.6rem; margin-bottom: 4px; }
.login__title::after { content: ""; }
.login__sub { color: var(--text-soft); font-size: .9rem; margin-bottom: 20px; }
.login__box .btn + .btn { margin-top: 10px; }

/* --------------------------------------------------------------- entetes */

.page-head {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px;
}
.page-head__eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin: 0 0 2px; }
.page-head__sub { color: var(--text-soft); font-size: .9rem; margin: 4px 0 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.breadcrumb { font-size: .88rem; margin-bottom: 8px; }

.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  margin: 0 calc(var(--gap) * -1) 16px;
  padding: 0 var(--gap) 2px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs__item {
  flex: 0 0 auto; padding: 10px 14px; min-height: var(--tap);
  display: flex; align-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-soft); font-weight: 600; font-size: .88rem; white-space: nowrap;
}
.tabs__item:hover { text-decoration: none; color: var(--text); }
.tabs__item.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* --------------------------------------------------------------- panneaux */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.panel__hint { font-size: .82rem; color: var(--text-soft); }
.panel--error { border-color: var(--bad); }
.panel > summary { cursor: pointer; }

.split { display: grid; gap: 16px; }
@media (min-width: 860px) { .split { grid-template-columns: 1fr 1fr; } }

.cards { display: grid; gap: 12px; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.card {
  display: block; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  color: var(--text); font: inherit;
  box-shadow: var(--shadow);
}
.card--link:hover, .card--button:hover { border-color: var(--accent); text-decoration: none; }
.card--button { cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.card__eyebrow { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.card__title { font-size: 1.02rem; font-weight: 650; margin: 0 0 6px; display: block; }
.card__meta { font-size: .85rem; color: var(--text-soft); margin: 0; }

/* ------------------------------------------------------------ indicateurs */

.tiles {
  display: grid; gap: 10px;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 16px;
}
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 980px) { .tiles { grid-template-columns: repeat(5, 1fr); } }

.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.tile__value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile__label { font-size: .78rem; color: var(--text-soft); }
.tile--ok { border-left-color: var(--ok); }
.tile--warn { border-left-color: var(--warn); }
.tile--bad { border-left-color: var(--bad); }
.tile--info { border-left-color: var(--info); }
.tile--neutral { border-left-color: var(--accent); }

.progress {
  position: relative; height: 26px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
  border: 1px solid var(--border);
}
.progress__fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); opacity: .85; transition: width .3s ease; }
.progress__label {
  position: relative; display: grid; place-items: center; height: 100%;
  font-size: .78rem; font-weight: 700; color: var(--text);
  mix-blend-mode: normal;
}

.status-list { list-style: none; margin: 0; padding: 0; }
.status-row a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; min-height: var(--tap);
  border-bottom: 1px solid var(--border); color: var(--text);
}
.status-row a:hover { text-decoration: none; background: var(--surface-2); }
.status-row__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-faint); flex: none; }
.status-row__dot--ok { background: var(--ok); }
.status-row__dot--warn { background: var(--warn); }
.status-row__dot--bad { background: var(--bad); }
.status-row__dot--info { background: var(--info); }
.status-row__label { flex: 1; font-size: .9rem; }
.status-row__count { font-weight: 700; font-variant-numeric: tabular-nums; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 1.1fr) 2fr auto; gap: 10px; align-items: center; font-size: .86rem; }
.bar__track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--accent); }
.bar__value { color: var(--text-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

.tally { list-style: none; margin: 0; padding: 0; }
.tally li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem;
}
.tally li:last-child { border-bottom: 0; }
.tally li.bad strong { color: var(--bad); }
.tally strong { font-variant-numeric: tabular-nums; }

.checks { list-style: none; margin: 0; padding: 0; }
.check {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 9px 10px; border-radius: var(--radius-sm); margin-bottom: 4px; font-size: .88rem;
}
.check--ok { background: var(--ok-soft); }
.check--bad { background: var(--bad-soft); }
.check__value { font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* --------------------------------------------------------------- boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 10px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .92rem;
  cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; }
.btn--danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn--danger:hover { background: var(--bad-soft); }
.btn--block { width: 100%; }
.btn--tiny { min-height: 34px; padding: 5px 10px; font-size: .8rem; }

.icon-btn {
  min-height: 36px; min-width: 36px; border: 0; background: transparent;
  color: var(--text-soft); font-size: 1.5rem; line-height: 1; cursor: pointer; border-radius: var(--radius-sm);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row--wrap { flex-wrap: wrap; }
.btn-row--sticky {
  position: sticky; bottom: calc(64px + env(safe-area-inset-bottom));
  padding-top: 8px; background: linear-gradient(transparent, var(--surface) 40%);
}
@media (min-width: 860px) { .btn-row--sticky { bottom: 12px; } }

.action-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.action-bar--footer { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); }
@media (min-width: 860px) { .action-bar--footer { bottom: 16px; } }

/* --------------------------------------------------------------- champs */

.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--text-soft); margin-bottom: 5px;
}
.field__hint { font-size: .78rem; color: var(--text-faint); margin: 4px 0 0; }
.field__justified { font-size: .78rem; color: var(--warn); margin: 4px 0 0; }
.field--missing > .field__label { color: var(--warn); }

.req {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; background: var(--warn-soft); color: var(--warn);
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}

.input {
  width: 100%; min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* evite le zoom automatique sur iOS */
}
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 76px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: none; padding-right: 12px; }
.input--large { font-size: 18px; min-height: 52px; }

.field-row { display: grid; gap: 12px; }
@media (min-width: 560px) { .field-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

.zone-groups { display: flex; flex-wrap: wrap; gap: 10px; }
.zone-groups__item { display: flex; align-items: center; gap: 6px; }
.zone-groups__item .input { width: 180px; }

.checkline {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--tap); font-size: .9rem; cursor: pointer;
}
.checkline input { width: 20px; height: 20px; accent-color: var(--accent); }

.form-section {
  border: 0; border-top: 1px solid var(--border);
  margin: 0 0 18px; padding: 14px 0 0;
}
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section legend {
  padding: 0; font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
}
.form-grid { display: grid; gap: 4px; margin-top: 10px; }
@media (min-width: 700px) {
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 16px; }
  .field--textarea, .field--multiselect { grid-column: 1 / -1; }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: .86rem; cursor: pointer; user-select: none;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.tri { display: flex; gap: 6px; }
.tri__btn {
  flex: 1; min-height: var(--tap); padding: 8px 4px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-soft);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.tri__btn:first-child.is-on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.tri__btn:nth-child(2).is-on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.tri__btn:nth-child(3).is-on { background: var(--surface-2); border-color: var(--text-faint); color: var(--text); }
.tri__btn:disabled { opacity: .6; cursor: default; }

.secret__state { font-size: .85rem; color: var(--text-soft); margin: 0 0 6px; }
.secret__actions { display: flex; flex-wrap: wrap; gap: 6px; }

.picker { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 14px; }
.picker .field-row { margin-bottom: 10px; }
.picker select { margin-bottom: 8px; }
.picker-free { margin-bottom: 14px; }
.picker-free summary { cursor: pointer; font-size: .86rem; color: var(--text-soft); padding: 8px 0; }

.code-editor {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px; line-height: 1.5; white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
.code-line {
  font-family: ui-monospace, Consolas, monospace; font-size: .78rem;
  background: var(--surface-2); padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-soft); word-break: break-word;
}

/* ---------------------------------------------------------------- listes */

.list-count { font-size: .82rem; color: var(--text-soft); margin: 0 0 10px; }

.site-list { list-style: none; margin: 0; padding: 0; }
.site-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "check main status" "check progress progress";
  gap: 4px 12px; align-items: center;
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.site-row input[type=checkbox] { grid-area: check; width: 22px; height: 22px; accent-color: var(--accent); }
.site-row__main { grid-area: main; display: flex; flex-direction: column; color: var(--text); min-height: 40px; justify-content: center; }
.site-row__main:hover { text-decoration: none; }
.site-row__name { font-weight: 600; font-size: .95rem; }
.site-row__meta { font-size: .8rem; color: var(--text-soft); }
.site-row__status { grid-area: status; }
.site-row__progress { grid-area: progress; }
.site-row__progress .progress { height: 8px; }
.site-row__progress .progress__label { display: none; }

.visit-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .visit-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }

.visit-card {
  display: block; padding: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.visit-card:hover { border-color: var(--accent); text-decoration: none; }
.visit-card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.visit-card__name { font-weight: 650; font-size: 1rem; }
.visit-card__meta { font-size: .84rem; color: var(--text-soft); margin: 0 0 2px; }
.visit-card__hours { color: var(--text); }
.visit-card__warn {
  font-size: .82rem; margin: 8px 0 0; padding: 8px 10px;
  background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm);
}
.visit-card .progress { margin-top: 10px; height: 8px; }
.visit-card .progress__label { display: none; }

.tech-grid { display: grid; gap: 10px; }
@media (min-width: 700px) { .tech-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.tech-card {
  display: block; padding: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.tech-card:hover { border-color: var(--accent); text-decoration: none; }
.tech-card__head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.tech-card__name { font-weight: 650; }
.tech-card__summary { font-size: .88rem; margin: 0 0 4px; }
.tech-card__meta { font-size: .8rem; color: var(--text-soft); margin: 0; }

.detail-list { display: grid; gap: 2px; margin: 0; }
@media (min-width: 640px) { .detail-list { grid-template-columns: repeat(2, 1fr); gap: 2px 20px; } }
.detail { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.detail dt { font-size: .82rem; color: var(--text-soft); }
.detail dd { margin: 0; font-size: .9rem; }

/* Grille de vignettes : chaque equipement est une petite carte photo + infos,
   plus agreable a parcourir qu une liste de texte des qu il y a des photos. */
.equipment-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.equipment {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.equipment__photo { display: block; aspect-ratio: 16 / 9; background: var(--surface); }
.equipment__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.equipment__photo--empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: .78rem;
}
.equipment__body { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.equipment__main { display: flex; flex-direction: column; gap: 2px; }
.equipment__thumb { width: 120px; height: 68px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 4px; }
.equipment__role { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.equipment__name { font-weight: 650; }
.equipment__meta { font-size: .82rem; color: var(--text-soft); }
.equipment__badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.equipment__actions { display: flex; flex-wrap: wrap; gap: 6px; }

.criteria { list-style: none; margin: 0; padding: 0; }
.criteria__item {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm); margin-bottom: 4px; font-size: .88rem;
}
.criteria__item--oui { background: var(--ok-soft); }
.criteria__item--non { background: var(--bad-soft); }
.criteria__item--nc { background: var(--surface-2); color: var(--text-soft); }

.anomaly-list { list-style: none; margin: 0; padding: 0; }
.anomaly {
  padding: 14px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border); border-radius: var(--radius-sm);
}
.anomaly--bad { border-left-color: var(--bad); }
.anomaly--warn { border-left-color: var(--warn); }
.anomaly--info { border-left-color: var(--info); }
.anomaly__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.anomaly__where { font-size: .82rem; color: var(--text-soft); }
.anomaly__description { margin: 0 0 6px; }
.anomaly__reco { font-size: .86rem; margin: 0 0 4px; color: var(--text-soft); }
.anomaly__meta { font-size: .76rem; color: var(--text-faint); margin: 8px 0 0; }
.anomaly__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.doc:last-child { border-bottom: 0; }
.doc__main { flex: 1; display: flex; flex-direction: column; color: var(--text); min-height: 40px; justify-content: center; }
.doc__main:hover { text-decoration: none; }
.doc__title { font-weight: 600; font-size: .93rem; }
.doc__meta { font-size: .78rem; color: var(--text-soft); }

.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery__item { position: relative; margin: 0; }
.gallery__item img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2);
}
.gallery__item figcaption { font-size: .78rem; color: var(--text-soft); margin-top: 4px; display: block; }
.gallery__meta { display: block; font-size: .72rem; color: var(--text-faint); }
.gallery__delete {
  position: absolute; top: 6px; right: 6px;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / 62%); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer;
}

.missing-list, .risk-lines, .reco-list, .result-list { margin: 0; padding: 0; list-style: none; }
.reco-list { list-style: decimal; padding-left: 22px; }
.reco-list li, .result-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.result-list li:last-child, .reco-list li:last-child { border-bottom: 0; }

.missing {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 6px;
  background: var(--warn-soft); border-radius: var(--radius-sm);
}
.missing--justified { background: var(--surface-2); }
.missing__label { display: block; font-weight: 600; font-size: .9rem; }
.missing__scope { display: block; font-size: .78rem; color: var(--text-soft); }
.missing__reason { display: block; font-size: .78rem; color: var(--text-soft); font-style: italic; margin-top: 2px; }

.risk-line {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 6px; border-radius: var(--radius-sm); font-size: .89rem;
}
.risk-line--bad { background: var(--bad-soft); }
.risk-line--warn { background: var(--warn-soft); }
.risk-line--info, .risk-line--muted { background: var(--surface-2); }

.ok-line { padding: 10px 12px; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius-sm); font-size: .89rem; }

.risks { display: grid; gap: 8px; }
.risk {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border); border-radius: var(--radius-sm);
}
.risk--bad { border-left-color: var(--bad); }
.risk--warn { border-left-color: var(--warn); }
.risk summary {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 13px 14px; cursor: pointer; min-height: var(--tap);
}
.risk__label { font-weight: 600; }
.risk__count { font-size: .82rem; color: var(--text-soft); white-space: nowrap; }
.risk__sites { margin: 0; padding: 0 14px 12px 32px; font-size: .86rem; }

/* --------------------------------------------------------------- tableaux */

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 700; white-space: nowrap;
  position: sticky; top: 0; background: var(--surface);
}
.table tbody tr:hover { background: var(--surface-2); }
.table--dense { font-size: .8rem; }
.table--dense th, .table--dense td { padding: 6px 8px; }
.is-inactive { opacity: .5; }

/* --------------------------------------------------------------- badges */

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--text-soft);
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--muted { background: var(--surface-2); color: var(--text-soft); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  font-size: .72rem; color: var(--text-soft);
}
.pill--bad { border-color: var(--bad); color: var(--bad); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .89rem; margin-bottom: 14px; }
.alert--error { background: var(--bad-soft); color: var(--bad); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }
.alert--info { background: var(--info-soft); color: var(--info); }

.empty {
  padding: 28px 20px; text-align: center;
  color: var(--text-soft); background: var(--surface-2);
  border-radius: var(--radius-sm); border: 1px dashed var(--border);
}

.skeleton { display: grid; gap: 10px; }
.skeleton__row {
  height: 62px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton__row { animation: none; } }

/* -------------------------------------------------------- menu contextuel */

.context-menu {
  position: fixed; z-index: 80; min-width: 200px; margin: 0; padding: 6px;
  list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgb(0 0 0 / 30%);
}
.context-menu__item { padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.context-menu__item:hover { background: var(--surface-2); }
.context-menu__item--danger { color: var(--bad); }
.context-menu__sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* -------------------------------------------------------------- planning */

.planning-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.planning-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.planning-table th, .planning-table td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.planning-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  padding: 8px; font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.planning-table thead th:first-child { left: 0; z-index: 3; }
.planning-table tbody th {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  padding: 8px 10px; text-align: left; white-space: nowrap; font-weight: 600; font-size: .86rem;
}
.planning-table td { min-width: 132px; max-width: 132px; vertical-align: top; padding: 4px; }
.planning-table td.is-weekend { background: var(--surface-2); }
.planning-table td.is-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.planning-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 4px 6px; font-size: .74rem; line-height: 1.3; margin-bottom: 4px; cursor: grab;
}
.planning-card:active { cursor: grabbing; }
[data-planning-card].is-dragging { opacity: .4; }
.planning-list-row { cursor: grab; }
.planning-list-row:active { cursor: grabbing; }
.planning-filters-row th { text-transform: none; padding: 6px; }
.planning-filters-row .input { min-height: 36px; padding: 6px 8px; font-size: .82rem; }
.planning-card--unplanned { border-left-color: var(--warn); }
.planning-month-cell { min-height: 44px; display: flex; align-items: center; justify-content: center; }
.planning-month-count {
  min-width: 28px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2);
  font-size: .78rem; font-weight: 600; text-align: center; cursor: pointer;
}
.planning-month-count:hover { background: var(--accent-soft, var(--surface-2)); }

/* --------------------------------------------------------------- dialogues */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgb(8 11 15 / 62%);
  padding: 0;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 24px; } }

.dialog {
  width: min(620px, 100%);
  max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -8px 40px rgb(0 0 0 / 34%);
}
@media (min-width: 640px) { .dialog { border-radius: var(--radius); } }

.dialog__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.dialog__head h2 { font-size: 1rem; }
.dialog__body { padding: 16px; overflow-y: auto; flex: 1; }
.dialog__foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.dialog__foot .btn { flex: 1; }
@media (min-width: 640px) { .dialog__foot .btn { flex: 0 0 auto; } }
.dialog__text { font-size: .9rem; color: var(--text-soft); }

.import-report { margin-top: 12px; }
.import-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; padding: 0; margin: 0 0 10px; font-size: .85rem; }
.import-stats strong { font-size: 1.1rem; }
.import-block { border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; font-size: .84rem; }
.import-block ul { margin: 8px 0 0; padding-left: 18px; }
.import-block--error { background: var(--bad-soft); color: var(--bad); }
.import-block--warn { background: var(--warn-soft); color: var(--warn); }
.import-block summary { cursor: pointer; font-weight: 600; }

/* ---------------------------------------------------------------- toasts */

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 90; max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px; border-radius: var(--radius-sm);
  background: var(--text); color: var(--bg);
  font-size: .89rem; font-weight: 550;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--bad); color: #fff; }
.toast--success { background: var(--ok); color: #fff; }
@media (min-width: 860px) { .toast { bottom: 24px; } }

@media print {
  .topbar, .bottombar, .tabs, .action-bar, .btn, .toast { display: none !important; }
  .outlet { padding: 0; }
  .panel { break-inside: avoid; box-shadow: none; }
}
