/* =========================================================================
   Scout' — design system « Le tirage » (v 20260623-tirage)
   Refonte ton clair inspirée du langage blueprint d'inventapp, transposée
   en feuille de plan claire (lisibilité chantier). Audacieux mais cohérent :
   Scout Outdoor : couture orange BTP (ambre #FBA63C → orange #E8590C), signature,
   typo Archivo (titres) + IBM Plex Mono (labels/cotes) + Inter (corps).
   ========================================================================= */
:root {
  --ink: #14201d;
  --ink-2: #2c3a36;
  --muted: #5d6b66;
  --faint: #8a9893;
  --line: #d3ddd8;
  --line-soft: #e6ede9;
  --surface: #ffffff;
  --paper: #f3f6f3;
  --soft: #e9f1ec;
  --accent: #e8590c;
  --accent-strong: #c2410c;
  --lime: #fba63c;
  --warn: #b86713;
  --danger: #a63d3d;
  --blue: #2f6f9f;
  /* type roles */
  --font-display: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* shape + depth */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20,32,29,.05), 0 1px 0 rgba(20,32,29,.02);
  --shadow-md: 0 12px 30px -20px rgba(15,42,34,.45);
  /* the brand seam (lime → teal) reused everywhere */
  --seam: linear-gradient(90deg, var(--lime), var(--lime) 14%, var(--accent) 72%, var(--accent-strong));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  /* Discrete blueprint grid — the "drawing sheet" read, kept faint for sunlight legibility. */
  background-image:
    linear-gradient(rgba(232,89,12,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,89,12,.045) 1px, transparent 1px);
  background-size: 30px 30px, 30px 30px;
  background-position: -1px -1px, -1px -1px;
  background-attachment: fixed;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, canvas { max-width: 100%; }
a { color: inherit; }

/* ---- topbar : la réglette / cartouche de plan -------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px clamp(16px, 4vw, 36px);
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  backdrop-filter: saturate(140%) blur(12px);
}
/* the brand seam runs along the very top edge of the bar */
.topbar::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--seam);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand img {
  width: 148px;
  height: 54px;
  object-fit: contain;
}
.topbar-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar-login {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
}

/* Project section nav — compact blueprint labels; the active one wears the
   lime→teal seam, the same signature as the card tops. Always present as a
   sitemap; disabled (faint) until a project is opened. */
.section-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; flex-wrap: wrap; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--soft); color: var(--ink); }
.nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 9px; right: 9px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--seam);
}
.nav-link.is-disabled { color: var(--muted); opacity: .5; pointer-events: none; }

/* User chip → dropdown (Profil / Abonnement / Déconnexion). */
.nav-user { position: relative; flex: 0 0 auto; }
.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.nav-user-trigger:hover { background: #dde7e1; }
.nav-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-caret { font-size: 10px; color: var(--muted); transition: transform .15s ease; }
.nav-user.is-open .nav-user-caret { transform: rotate(180deg); }
.nav-user-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 184px;
  display: none;
  flex-direction: column;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(0,0,0,.16);
}
.nav-user.is-open .nav-user-panel { display: flex; }
.nav-user-panel a,
.nav-user-panel .link-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
}
.nav-user-panel a:hover,
.nav-user-panel .link-button:hover { background: var(--soft); color: var(--ink); }
.nav-user-panel .nav-form { width: 100%; margin: 0; }
.nav-user-panel .nav-form .link-button { color: var(--danger); }
.nav-form { margin: 0; }
.link-button {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
}
.link-button:hover { background: var(--soft); color: var(--ink); }
.menu-toggle {
  display: none;
  width: 44px;
  min-height: 44px;
  padding: 0;
  background: var(--ink);
  border-radius: var(--r-sm);
  font-size: 22px;
}
.shell { width: min(1240px, calc(100% - 32px)); margin: 28px auto 56px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head.compact { align-items: center; }
h1, h2, h3, p { margin-top: 0; }
h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.02;
  margin-bottom: 10px;
}
h2 { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -.01em; }
h3 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin-bottom: 10px; }
.muted { color: var(--muted); }
/* Eyebrow / cote : a technical dimension-line label set in mono. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1.5px;
  background: var(--accent);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }
.messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message {
  margin: 0;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  font-size: 14px;
  font-weight: 500;
}
.message.error { border-color: #e1a7a7; border-left-color: var(--danger); background: #fff1f1; }
.message.success { border-color: #a7d9c6; border-left-color: var(--accent); background: #effaf5; }
/* Limite atteinte / fonction Pro : un bandeau « cool » non-agressif, identique
   partout (jamais une page d'upgrade plein écran). */
.message.upgrade {
  border-color: #f0cfa0; background: #fff7ec; color: #6b4415; font-weight: 600;
}
.message.upgrade::before { content: "🔒 "; }
.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--danger);
  border: 1px solid #e1a7a7;
  background: #fff1f1;
  font-weight: 600;
}
.storage-meter { margin: 4px 0 16px; }
.storage-meter__track {
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.storage-meter__fill { height: 100%; background: linear-gradient(90deg, var(--lime), var(--accent)); border-radius: 999px; }
.storage-meter__fill.is-warning { background: var(--warn); }
.storage-meter__fill.is-full { background: var(--danger); }
.storage-meter__label {
  margin: 7px 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .01em;
}
.compact-head {
  align-items: center;
  margin-bottom: 10px;
}
.deadline-panel { margin-bottom: 18px; }
.deadline-list {
  display: grid;
  gap: 8px;
}
.deadline-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  text-decoration: none;
}
.deadline-item strong,
.deadline-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deadline-item small { color: var(--muted); }
.color-swatch {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(29,37,40,.18);
  flex: 0 0 auto;
}
.zone-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.deadline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.deadline-badge.soon { background: #fff2e0; color: #7a3f00; }
.deadline-badge.today,
.deadline-badge.overdue { background: #fff1f1; color: var(--danger); }
.net-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  margin-left: auto;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}
.net-status__icon {
  flex: none;
  width: 21px;
  height: 21px;
}
.net-status__icon path,
.net-status__icon line {
  fill: none;
  stroke: #9aa7a3;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.net-status__icon circle { fill: #9aa7a3; }
.net-status__slash { visibility: hidden; }
.net-status[data-state="online"] .net-status__icon path { stroke: #1fa468; }
.net-status[data-state="online"] .net-status__icon circle { fill: #1fa468; }
.net-status[data-state="offline"] .net-status__icon path,
.net-status[data-state="offline"] .net-status__slash { stroke: #d64545; }
.net-status[data-state="offline"] .net-status__icon circle { fill: #d64545; }
.net-status[data-state="offline"] .net-status__slash { visibility: visible; }
.net-status[data-state="offline"] .net-status__icon {
  animation: net-pulse 1.4s ease-in-out infinite;
}
/* Brighter strokes on the dark floating chip of the fullscreen viewer. */
.net-status--floating[data-state="online"] .net-status__icon path { stroke: #38d68f; }
.net-status--floating[data-state="online"] .net-status__icon circle { fill: #38d68f; }
.net-status--floating[data-state="offline"] .net-status__icon path,
.net-status--floating[data-state="offline"] .net-status__slash { stroke: #ff6b6b; }
.net-status--floating[data-state="offline"] .net-status__icon circle { fill: #ff6b6b; }
@keyframes net-pulse {
  50% { opacity: .4; }
}
.net-status__count {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}
.net-status__count[hidden] { display: none; }
.net-status--floating {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 850;
  margin: 0;
  border: 0;
  background: rgba(29,37,40,.88);
  color: #fff;
  box-shadow: 0 8px 22px rgba(15,23,26,.28);
}
/* Manual online/offline switch (pin offline on a flaky link). */
.net-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 5px 11px 5px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.net-toggle:hover { background: var(--soft); }
.net-toggle__sw {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #c2cace;
  transition: background .15s ease;
}
.net-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform .15s ease;
}
.net-toggle__label { white-space: nowrap; }
.net-toggle[data-state="forced"] {
  background: #fff2e0;
  color: #7a3f00;
  border-color: #f0cfa0;
}
.net-toggle[data-state="forced"] .net-toggle__sw { background: var(--warn); }
.net-toggle[data-state="forced"] .net-toggle__thumb { transform: translateX(14px); }
.net-toggle[data-state="offline"] .net-toggle__label { color: var(--danger); }
.invite-link-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #a7d9c6;
  border-radius: 8px;
  background: #effaf5;
}
.invite-link-box input { width: 100%; }
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .005em;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
}
.button:hover, button:hover { background: var(--accent-strong); }
.button:active, button:active { transform: translateY(1px); }
/* Secondary = an outlined "drawing" button rather than a heavy dark slab. */
.button.secondary {
  background: var(--surface);
  color: var(--accent-strong);
  border-color: var(--line);
}
.button.secondary:hover { background: var(--soft); border-color: var(--accent); }
button:disabled,
.button[aria-disabled="true"] {
  opacity: .55;
  cursor: progress;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-panel {
  max-width: 460px;
  margin: 8vh auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.auth-logo {
  width: 180px;
  height: 66px;
  margin-bottom: 14px;
  object-fit: contain;
}
.auth-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-weight: 800;
}
.form { display: grid; gap: 14px; }
.form.wide { max-width: 680px; }
label, legend {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; }
/* Visible, on-brand focus everywhere (accessibility floor). */
:where(input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22,115,95,.16);
}
:where(a, button, .button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sync-toast {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 950;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 750;
  font-size: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.sync-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.password-field {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-top: 6px;
}
.password-field input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
.password-toggle {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}
.form-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #b8d8ce;
  border-radius: 8px;
  background: #effaf5;
  color: var(--accent-strong);
  font-weight: 850;
}
.spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 3px solid rgba(22,115,95,.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.check { display: block; margin: 8px 0; font-weight: 600; }
.check input { width: auto; margin-right: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
/* Project / item cards behave like drawing plates: a hover lift + a seam that
   appears on hover, echoing the brand signature without shouting. */
.grid .card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.grid .card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--seam);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.grid .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #c3d2cb;
}
.grid .card:hover::before { transform: scaleX(1); }
.grid .card h2 { margin-bottom: 4px; }
.grid .card .button { margin-top: auto; }
.profile-panel { max-width: 560px; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.stats span, .status-strip span {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
}
.status-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.status-strip span {
  display: grid;
  gap: 3px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
}
.status-strip strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.inline-form, .filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}
.inline-mini-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 6px;
  align-items: end;
}
.inline-mini-form input,
.inline-mini-form select {
  margin-top: 0;
}
.inline-mini-form button {
  min-height: 42px;
}
.list { display: grid; gap: 14px; }
.invite-row {
  display: grid;
  grid-template-columns: minmax(180px, .6fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}
.floor-row { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.plans { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.plan-upload-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}
.add-plan-panel {
  margin-bottom: 16px;
}
.add-plan-panel summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.add-plan-panel summary::-webkit-details-marker { display: none; }
.add-plan-panel[open] summary { margin-bottom: 14px; }
.wide-field { grid-column: span 2; }
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.plan-card {
  position: relative;
  display: grid;
  grid-template-rows: 190px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.plan-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  z-index: 1;
  background: var(--seam);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #c3d2cb;
}
.plan-card:hover::before { transform: scaleX(1); }
.plan-thumb {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #c8d0ce;
}
.plan-thumb img,
.plan-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.plan-thumb-placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #eef4f1, #ffffff);
  color: var(--accent-strong);
  text-align: center;
}
.plan-thumb-placeholder strong {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 22px;
  letter-spacing: 0;
}
.plan-thumb-placeholder small {
  color: var(--muted);
  font-weight: 850;
}
.plan-card-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.plan-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.plan-card-head h2 { margin-bottom: 4px; }
.plan-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.plan-card-meta span {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
}
.plan-settings-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 0;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}
.plan-settings-btn:hover { background: var(--ink); color: #fff; }
/* Plan edit popup (replaces the inline <details> that stretched neighbour cards). */
.plan-dialog {
  width: min(460px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.32);
}
.plan-dialog::backdrop { background: rgba(15,23,26,.45); }
.plan-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 0;
}
.plan-dialog-head h2 { margin: 0; font-size: 18px; }
.plan-dialog .form { margin: 0; padding: 16px; }
.plan-dialog .plan-dialog-delete { padding-top: 0; }
.plan-dialog .danger-button { width: 100%; }
.plan-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.plan-stack { display: grid; gap: 10px; margin-top: 12px; }
.doc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-edit[open] { flex-basis: 100%; }
.doc-edit > summary {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}
.doc-edit > summary::-webkit-details-marker { display: none; }
.doc-edit[open] > summary { background: var(--ink); color: #fff; border-color: var(--ink); }
.doc-edit-form { margin-top: 10px; max-width: 420px; }
.upload-progress {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.upload-progress__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.plan-manager { margin-top: 14px; }
.floor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.floor-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}
.floor-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.compact-form {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.plan-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--soft);
  text-decoration: none;
  font-weight: 800;
}
.plan-edit {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 72px minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.plan-edit input { margin-top: 0; }
.danger-button {
  background: var(--danger);
}
.danger-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.tool-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  background: var(--ink);
}
.tool-button:disabled {
  cursor: not-allowed;
  opacity: .35;
}
.page-indicator {
  min-width: 56px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* --- fullscreen plan viewer ------------------------------------------------ */
body.viewer-fullscreen { background: #c8d0ce; }
body.viewer-fullscreen .topbar { display: none; }
body.viewer-fullscreen .shell { width: 100%; margin: 0; }
body.viewer-fullscreen .messages {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  width: min(92vw, 420px);
  margin: 0;
  pointer-events: none;
  animation: toast-out .4s ease 3.6s forwards;
}
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }
.plan-stage {
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
  background: #c8d0ce;
  z-index: 20;
}
.viewer-fab {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  z-index: 720;
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 12px;
  background: rgba(29,37,40,.88);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  backdrop-filter: blur(6px);
}
.viewer-context {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(70px + env(safe-area-inset-left));
  z-index: 715;
  display: grid;
  gap: 2px;
  max-width: min(38vw, 300px);
  padding: 4px 0;
  text-shadow: 0 1px 3px rgba(255,255,255,.9);
}
.viewer-context strong,
.viewer-context small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-menu {
  position: absolute;
  top: calc(68px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  z-index: 710;
  width: min(86vw, 320px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
  backdrop-filter: blur(8px);
}
.viewer-menu-head { display: grid; gap: 2px; margin-bottom: 12px; }
.viewer-menu-nav { display: grid; gap: 6px; }
.viewer-menu-nav a {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}
/* Interaction tools (zones) — labelled buttons, centred at the top. */
.viewer-tools {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 716;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: calc(100vw - 148px);
}
.tool-button--label {
  width: auto;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  background: rgba(29,37,40,.88);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.tool-button--label[hidden] { display: none; }
.tool-button--label .tool-ic { font-size: 16px; line-height: 1; }
.tool-button--label.is-active {
  background: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 8px 22px rgba(0,0,0,.28);
}
.tool-button--confirm,
.tool-button--confirm.is-active { background: var(--accent-strong); }

/* Navigation tools — zoom / rotate / reset, bottom-right. */
.viewer-controls {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 700;
  display: grid;
  gap: 8px;
}
.viewer-controls .tool-button,
.viewer-pages .tool-button {
  width: 48px;
  min-height: 48px;
  border-radius: 12px;
  background: rgba(29,37,40,.88);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.viewer-controls .tool-button.is-active {
  background: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 8px 22px rgba(0,0,0,.28);
}
.viewer-pages {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(29,37,40,.88);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
.viewer-pages .tool-button {
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}
.viewer-pages .page-indicator { color: #fff; min-width: 44px; }
.emprise-toolbar {
  position: absolute;
  top: calc(72px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 690;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(92vw, 680px);
  padding: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(29,37,40,.12);
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  backdrop-filter: blur(8px);
}
.emprise-toolbar[hidden] { display: none; }
.emprise-toolbar input,
.emprise-toolbar select {
  min-height: 38px;
  max-width: 170px;
  border-radius: 8px;
  font-size: 13px;
}
.emprise-conflicts-only {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--soft);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}
@media (max-width: 720px) {
  .emprise-toolbar {
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    top: auto;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    overflow-x: auto;
  }
  .emprise-toolbar input,
  .emprise-toolbar select {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
  }
  /* Compact, icon-only zone tools tucked beside the network icon, clear of
     the title (left) and the dropdown menu (below). At most two show at once
     (Ajouter / Terminer swap), so the row stays tight. */
  .viewer-tools {
    left: auto;
    right: calc(68px + env(safe-area-inset-right, 0px));
    transform: none;
    flex-wrap: nowrap;
    gap: 6px;
    max-width: none;
  }
  .tool-button--label {
    width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  .tool-button--label .tool-label { display: none; }
  .tool-button--label .tool-ic { font-size: 18px; }
  .viewer-context { max-width: calc(100vw - 240px); }
}
@media (hover: none), (pointer: coarse) {
  .viewer-controls #zoomIn,
  .viewer-controls #zoomOut,
  .viewer-controls #rotatePlan {
    display: none;
  }
}
/* Side list, Google-Maps style — tablet/desktop only. */
.viewer-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 640;
  width: 332px;
  display: none;
  flex-direction: column;
  padding-top: calc(72px + env(safe-area-inset-top, 0px));
  background: rgba(255,255,255,.96);
  border-right: 1px solid var(--line);
  box-shadow: 6px 0 24px rgba(0,0,0,.12);
  backdrop-filter: blur(8px);
  transition: transform .2s ease;
}
.viewer-panel.is-collapsed { transform: translateX(-105%); }
.panel-reopen {
  position: absolute;
  display: none;
  top: 50%;
  left: calc(-8px + env(safe-area-inset-left, 0px));
  z-index: 660;
  width: 44px;
  min-width: 44px;
  height: 132px;
  min-height: 132px;
  padding: 0;
  border-radius: 0 12px 12px 0;
  background: rgba(29,37,40,.9);
  color: #fff;
  transform: translateY(-50%);
  box-shadow: 8px 0 22px rgba(0,0,0,.24);
  backdrop-filter: blur(6px);
  overflow: hidden;
  transition: left .2s ease;
}
.viewer-panel:not(.is-collapsed) + .panel-reopen { left: calc(324px + env(safe-area-inset-left, 0px)); }
/* Keep the tab vertically centred while pressed: the global `button:active`
   nudge (translateY(1px)) would otherwise clobber the -50% centring and make
   the tab jump down — on touch it then slips out from under the finger so the
   tap never fires and the drawer fails to toggle. */
.panel-reopen:active { transform: translateY(-50%); }
.panel-reopen span {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
}
@media (min-width: 900px) {
  .viewer-panel { display: flex; }
  .panel-reopen:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; }
}
.viewer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 10px;
}
.panel-collapse {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
}
.panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 14px;
}
.panel-item {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 8px;
}
.panel-locate {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 8px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  text-align: left;
}
.panel-thumb {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8edeb;
}
.panel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.panel-thumb-more {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(15,23,26,.78);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.panel-dot {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: var(--danger);
}
.panel-dot.status-Ouvert { background: var(--danger); }
.panel-dot.status-A-traiter { background: var(--warn); }
.panel-dot.status-En-cours { background: var(--blue); }
.panel-dot.status-A-verifier { background: #7a52c7; }
.panel-dot.status-Leve { background: var(--accent); }
.panel-dot.status-Refuse { background: #5b6770; }
.panel-dot.status-Annule { background: #939fa3; }
.panel-dot.type-Constat { border-radius: 8px; }
.panel-dot.type-Remarque { border-style: dashed; }
.panel-dot.type-Non-conformite { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.panel-dot.priority-Haute { box-shadow: 0 0 0 3px var(--ink); }
.panel-dot.priority-Critique { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--danger); }
.panel-text { display: grid; min-width: 0; gap: 2px; }
.panel-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.panel-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-open {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.pin-marker .pin.pin--flash { animation: pin-flash 1.2s ease; }
@keyframes pin-flash {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,.35); }
  40% { box-shadow: 0 0 0 12px rgba(47,111,159,.45), 0 4px 12px rgba(0,0,0,.35); }
}

.point-sheet {
  --sheet-system-bottom: max(env(safe-area-inset-bottom, 0px), 44px);
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--visual-viewport-bottom, 0px);
  z-index: 800;
  max-height: min(calc(var(--visual-viewport-height, 100dvh) - 16px), 600px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Generous floor: Android's virtual nav bar overlaps the viewport bottom
     and env(safe-area-inset-bottom) is 0 on some Chrome versions. */
  padding: 14px 16px calc(18px + var(--sheet-system-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -14px 40px rgba(0,0,0,.3);
  transform: translateY(105%);
  transition: transform .22s ease;
}
.point-sheet.is-open { transform: translateY(0); }
/* The submit button stays pinned to the visible bottom of the sheet even
   when the form scrolls, so it can never sit under the system buttons. */
.point-sheet > form.form > button[type="submit"] {
  position: sticky;
  bottom: var(--sheet-system-bottom);
  box-shadow: 0 0 0 6px var(--surface);
}
.point-sheet-head {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -14px -16px 8px;
  padding: 14px 16px 8px;
  background: var(--surface);
}
.point-sheet-head h2 { margin: 0; min-width: 0; font-size: 18px; }
.sheet-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.sheet-head-actions form { margin: 0; }
.sheet-photo-button,
.sheet-danger-button {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
}
.sheet-photo-button { background: var(--ink); }
.sheet-danger-button { background: var(--danger); }
.sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  text-decoration: none;
}
.sheet-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.point-sheet-head + .sheet-section-photos {
  margin-top: 0;
  padding-top: 8px;
  border-top: 0;
}
.sheet-section h3 { margin-bottom: 8px; }
.emprise-sheet .form-warning {
  margin: 4px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff2e0;
  color: #7a3f00;
  font-weight: 800;
}
.emprise-readonly {
  display: grid;
  gap: 8px;
}
.emprise-readonly h3 {
  margin: 0;
}

/* --- zone sheet: tabbed Zone / Occupations ------------------------------- */
.sheet-tabs {
  display: flex;
  gap: 3px;
  margin: 0 0 12px;
  padding: 3px;
  background: var(--soft);
  border-radius: 10px;
}
.sheet-tab {
  flex: 1;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
}
.sheet-tab.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.sheet-tab[disabled] { opacity: .45; cursor: not-allowed; }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.sheet-tabpanel[hidden] { display: none; }
.sheet-hint { color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }

.occupations-list { display: grid; gap: 8px; }
.occupations-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.occupation-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  /* The left rail carries the company colour — the at-a-glance "who". */
  border-left: 5px solid var(--occ-color, var(--blue));
  border-radius: 12px;
  background: var(--surface);
}
.occupation-card.has-conflict {
  border-color: #e3b5b5;
  box-shadow: inset 0 0 0 1px #e3b5b5;
}
.occupation-card__main { min-width: 0; display: grid; gap: 3px; }
.occupation-card__title { font-weight: 800; font-size: 14px; }
.occupation-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}
.occupation-card__actions { display: flex; gap: 4px; flex: 0 0 auto; }
.occ-icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}
.occ-icon-btn.danger { background: #fff1f1; color: var(--danger); }

.occupations-add {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
}
.occupation-form {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.occupation-form .field-row { display: flex; gap: 10px; }
.occupation-form .field-row > label { flex: 1; min-width: 0; }
.occupation-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

/* --- report: switchable "Comptes rendus par …" panel (CSS-only tabs) ------ */
.report-breakdown .breakdown-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.report-breakdown .breakdown-switch__label {
  font-weight: 800;
  color: var(--muted);
  margin-right: 4px;
}
.report-breakdown .bk-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.report-breakdown .bk-pane { display: none; }
.report-breakdown .bk-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
/* The checked radio reveals its pane and lights its tab (radios precede both). */
#bk-company:checked ~ .bk-pane--company,
#bk-trade:checked ~ .bk-pane--trade,
#bk-type:checked ~ .bk-pane--type,
#bk-status:checked ~ .bk-pane--status {
  display: block;
}
#bk-company:checked ~ .breakdown-switch label[for="bk-company"],
#bk-trade:checked ~ .breakdown-switch label[for="bk-trade"],
#bk-type:checked ~ .breakdown-switch label[for="bk-type"],
#bk-status:checked ~ .breakdown-switch label[for="bk-status"] {
  background: var(--accent);
  color: #fff;
}
.report-selection {
  display: grid;
  gap: 16px;
}
.report-selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.report-selection-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
}
.report-keyword-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 220px));
  gap: 12px;
}
.report-check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.report-check-grid fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.report-check-grid legend {
  padding: 0 4px;
  color: var(--accent);
  font-weight: 900;
}
.report-check-list {
  display: grid;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
}
.report-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--soft);
  font-weight: 800;
}
.report-check span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-check small {
  color: var(--muted);
  font-weight: 900;
}

.emprise-handle-icon,
.emprise-label-icon {
  background: none;
  border: 0;
}
.emprise-handle {
  position: relative;
  /* Generous, invisible hit area for comfortable touch dragging... */
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  cursor: move;
  user-select: none;
  touch-action: none;
}
/* ...with a small, semi-transparent visible square. */
.emprise-handle::before {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
  border: 1.5px solid var(--ink);
  box-sizing: border-box;
}
/* Center target dot marks the exact vertex position. */
.emprise-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85);
}
.emprise-handle:hover::before,
.emprise-handle:focus-visible::before {
  background: rgba(255, 255, 255, 0.85);
  border-width: 2px;
}
.emprise-handle--move::before {
  border-radius: 50%;
  background: rgba(238, 244, 241, 0.6);
}
.emprise-surface,
.emprise-edit-surface {
  cursor: move;
}
.emprise-label {
  display: inline-grid;
  gap: 1px;
  max-width: 180px;
  padding: 4px 7px;
  border-radius: 2px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  border: 1px solid rgba(29,37,40,.35);
  box-shadow: none;
  line-height: 1.12;
  text-align: left;
  pointer-events: none;
}
.emprise-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.emprise-label small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
@media (min-width: 821px) {
  .point-sheet {
    --sheet-system-bottom: env(safe-area-inset-bottom, 0px);
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 380px;
    border-radius: 14px;
    padding-bottom: 16px;
    transform: translateY(calc(100% + 24px));
  }
  .point-sheet > form.form > button[type="submit"] { bottom: 0; }
}
.plan-map {
  position: absolute;
  inset: 0;
  background: #c8d0ce;
}
.plan-map.leaflet-container {
  font: inherit;
  outline: none;
}
.plan-stage.is-drawing-zone .plan-map,
.plan-stage.is-drawing-zone .plan-map.leaflet-container {
  cursor: crosshair;
}
.viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 600;
  max-width: min(92%, 420px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(29, 37, 40, .92);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  pointer-events: none;
}
/* Pins inside Leaflet div-icons sit statically; the marker handles placement. */
.pin-marker { background: none; border: 0; }
.pin-marker .pin {
  position: static;
  transform: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.pin-marker .pin.preview { cursor: grab; }
.pin-marker .pin.pin--moving {
  box-shadow: 0 0 0 4px rgba(47,111,159,.55), 0 6px 16px rgba(0,0,0,.35);
}
.viewer-error {
  padding: 24px;
  color: var(--danger);
  font-weight: 800;
}
.pin {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%) scale(var(--pin-scale));
  transform-origin: center;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: 3px solid #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0,0,0,.24);
}
.pin.status-Ouvert { background: var(--danger); }
.pin.status-A-traiter { background: var(--warn); }
.pin.status-En-cours { background: var(--blue); }
.pin.status-A-verifier { background: #7a52c7; }
.pin.status-Leve { background: var(--accent); }
.pin.status-Refuse { background: #5b6770; }
.pin.status-Annule { background: #939fa3; }
.pin.type-Constat { border-radius: 8px; }
.pin.type-Remarque { border-style: dashed; }
.pin.type-Non-conformite { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.pin.priority-Basse { opacity: .82; }
.pin.priority-Haute { box-shadow: 0 0 0 3px var(--ink), 0 8px 20px rgba(0,0,0,.24); }
.pin.priority-Critique { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--danger), 0 8px 20px rgba(0,0,0,.24); }
.pin.preview { background: var(--blue); pointer-events: none; }
.pin.offline-pin {
  background: var(--warn);
  border-style: dashed;
}
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th {
  background: var(--soft);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--line);
}
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f7faf8; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.photos img,
.photo-preview-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-preview-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.photo-preview-strip[hidden] { display: none; }
.camera-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.photo-add-button {
  width: 100%;
  background: var(--ink);
}
.photo-item {
  position: relative;
  display: grid;
  gap: 6px;
  margin: 0;
}
.photo-item figcaption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mini-button {
  min-height: 34px;
  padding: 4px;
  background: var(--ink);
}
.photo-delete-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 999px;
  background: rgba(166,61,61,.95);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
.comment { padding: 10px 0; border-top: 1px solid var(--line); }
.report-plan {
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.report-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.report-plan-preview {
  position: relative;
  width: min(100%, 980px);
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.report-plan-preview img,
.report-plan-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}
.report-pin-layer {
  position: absolute;
  inset: 0;
}
.report-emprise-layer,
.report-emprise-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.report-emprise-label {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-grid;
  gap: 1px;
  max-width: 180px;
  padding: 4px 7px;
  border: 1px solid rgba(29,37,40,.35);
  border-radius: 2px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  box-shadow: none;
  line-height: 1.1;
}
.report-emprise-label strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.report-emprise-label small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.report-pin {
  --pin-scale: .74;
  pointer-events: none;
}
.report-sheet-preview {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
  margin: 14px 0 22px;
  align-items: stretch;
}
.report-sheet-plan {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.report-sheet-plan img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: contain;
}
.report-sheet-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.report-sheet-list h3 {
  margin-bottom: 2px;
}
.report-point-item {
  display: grid;
  gap: 5px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.report-point-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.report-point-item p {
  margin: 0;
}
.report-photos {
  display: grid;
  grid-template-columns: repeat(2, 88px);
  gap: 6px;
}

/* --- plan crop editor -------------------------------------------------------- */
.crop-area {
  position: relative;
  margin: 10px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
.crop-area img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.crop-box {
  position: absolute;
  border: 2px solid var(--accent-strong);
  /* Dim everything outside the kept area. */
  box-shadow: 0 0 0 9999px rgba(20, 28, 26, .45);
  cursor: move;
}
.crop-handle {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--accent-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.crop-handle.nw { top: -13px; left: -13px; cursor: nwse-resize; }
.crop-handle.ne { top: -13px; right: -13px; cursor: nesw-resize; }
.crop-handle.sw { bottom: -13px; left: -13px; cursor: nesw-resize; }
.crop-handle.se { bottom: -13px; right: -13px; cursor: nwse-resize; }
.crop-page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.crop-form > .actions { margin: 14px 0; }
.report-photos img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 820px) {
  .topbar {
    align-items: center;
    padding: 8px 10px;
  }
  .brand img { width: 140px; height: 50px; }
  .menu-toggle { display: inline-flex; }
  .topbar-main {
    position: absolute;
    top: calc(100% + 6px);
    left: 10px;
    right: 10px;
    z-index: 30;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.99);
    box-shadow: 0 16px 34px rgba(0,0,0,.16);
    transform-origin: top right;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(.98);
    transition: opacity .16s ease, transform .16s ease;
  }
  .topbar-main.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }
  .section-nav { flex-direction: column; align-items: stretch; gap: 4px; }
  .nav-link {
    min-height: 46px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--ink);
    justify-content: flex-start;
  }
  .nav-link.is-active::after { left: 0; right: auto; top: 9px; bottom: 9px; width: 3px; height: auto; }
  .nav-link.is-disabled { background: transparent; }
  /* The user dropdown becomes a flat list inside the drawer. */
  .nav-user { width: 100%; }
  .nav-user-trigger { width: 100%; justify-content: space-between; min-height: 44px; }
  .nav-user-caret { display: none; }
  .nav-user-panel {
    position: static;
    display: flex;
    min-width: 0;
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .nav-user-panel a,
  .nav-user-panel .link-button { min-height: 46px; background: var(--soft); }
  .nav-form { margin: 0; }
  .shell { width: min(100% - 18px, 1180px); margin-top: 14px; }
  .page-head, .detail-grid { grid-template-columns: 1fr; display: grid; }
  .page-head { gap: 10px; }
  .page-head .actions,
  .page-head > .button,
  .page-head > a.button { width: 100%; }
  .actions .button { flex: 1 1 150px; }
  .button, button { min-height: 46px; }
  .inline-form, .filters { grid-template-columns: 1fr; }
  .invite-row { grid-template-columns: 1fr; }
  .plan-upload-form { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .plan-card { grid-template-rows: 170px auto; }
  .plan-edit { grid-template-columns: 1fr; }
  .report-selection-head,
  .report-keyword-row,
  .report-check-grid,
  .report-sheet-preview {
    grid-template-columns: 1fr;
    display: grid;
  }
  .auth-panel { margin: 18px auto; padding: 18px; }
  h1 { font-size: 30px; line-height: 1.05; }
  .card, .panel { padding: 14px; }
  .photos { grid-template-columns: 1fr 1fr; }
}

@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .topbar,
  .report-actions .actions,
  .report-filters,
  .report-filter-note,
  .report-companies,
  .report-breakdown,
  .net-status,
  .messages {
    display: none !important;
  }
  .shell {
    width: 100%;
    margin: 0;
  }
  /* Keep the plan image whole and repeat table headers, but never force the
     whole (often page-tall) plan block onto one page — that only pushed point
     rows to overflow and split. Protect the rows themselves instead. */
  .report-plan-preview {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-table-wrap thead {
    display: table-header-group;
  }
  .report-table-wrap tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-table-wrap table {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .status-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-strip span { min-height: 64px; }
  .table-wrap {
    overflow: visible;
    background: transparent;
    border: 0;
  }
  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  thead { display: none; }
  tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
  }
  td {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }
  td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }
  td[colspan] {
    display: block;
  }
  td[colspan]::before { content: ""; }
}

/* --- Abonnement (billing) --- */
.billing-usage { width: 100%; border-collapse: collapse; }
.billing-usage th, .billing-usage td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e3e6ea);
}
.billing-usage th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.billing-usage td:nth-child(2), .billing-usage td:nth-child(3),
.billing-usage th:nth-child(2), .billing-usage th:nth-child(3) { text-align: right; }
.plan-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.plan-cta form { margin: 0; }

/* ===== Pages d'accès — le sas inventapp → Scout (v 20260622-auth-sas) =====
   Fond "feuille de plan" sombre d'inventapp d'où émerge le panneau Scout clair ;
   la couture verte (lime → teal) en haut du panneau est la signature. */
body.auth {
  --bp-bg: #06070F; --bp-soft: #8492AC; --lime: #93CF3E;
  --grid: rgba(120,180,235,.05); --grid-strong: rgba(130,190,240,.09);
  margin: 0; min-height: 100vh; color: #EAF0FB;
  background-color: var(--bp-bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px),
    radial-gradient(120% 80% at 50% 6%, rgba(147,207,62,.06), transparent 60%);
  background-size: 30px 30px, 30px 30px, 150px 150px, 150px 150px, 100% 100%;
  background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px, 0 0;
  background-attachment: fixed;
}
.auth-origin {
  position: fixed; left: clamp(16px,3vw,28px); top: 18px; z-index: 5;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--bp-soft); text-decoration: none;
}
.auth-origin span { margin-right: 7px; opacity: .7; }
.auth-origin:hover { color: var(--lime); }
.auth-reg { position: fixed; width: 14px; height: 14px; opacity: .5; pointer-events: none; z-index: 4; }
.auth-reg::before, .auth-reg::after { content: ""; position: absolute; background: var(--lime); box-shadow: 0 0 6px var(--lime); }
.auth-reg::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-.5px); }
.auth-reg::after { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-.5px); }
.auth-reg--tl { left: 22px; top: 22px; }
.auth-reg--br { right: 22px; bottom: 22px; }

.auth-stage {
  width: 100%; max-width: 444px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column;
  padding: clamp(46px,7vh,80px) clamp(16px,4vw,28px) 40px;
}
.auth-eyebrow {
  margin: auto 0 16px; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--lime);
}
.auth-eyebrow b { font-weight: 600; }
.auth-eyebrow span { color: var(--bp-soft); margin: 0 9px; }
.auth-messages { margin: 0 0 14px; }
.auth-footnote {
  margin: 18px 0 auto; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--bp-soft);
}

body.auth .auth-panel {
  position: relative; overflow: hidden;
  max-width: none; margin: 0; padding: 30px 30px 24px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow:
    0 18px 50px -34px rgba(0,0,0,.6),
    0 0 0 1px rgba(147,207,62,.07),
    0 -2px 60px -22px rgba(147,207,62,.22);
}
body.auth .auth-panel::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--lime), var(--lime) 14%, var(--accent) 72%, var(--accent-strong));
  box-shadow: 0 0 18px rgba(147,207,62,.6), 0 1px 4px rgba(147,207,62,.4);
}
body.auth .auth-logo { display: block; width: 172px; height: auto; margin: 6px auto 6px; }
body.auth .auth-panel h1 { font-size: 21px; line-height: 1.15; text-align: center; margin: 2px 0 6px; }
body.auth .auth-panel > .muted { text-align: center; margin-bottom: 18px; }
body.auth .auth-panel form button[type="submit"] { width: 100%; margin-top: 4px; }
body.auth .auth-links {
  justify-content: center; gap: 8px 18px; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line); font-weight: 600; font-size: 12.5px;
}
body.auth .auth-links a { color: var(--muted); }
body.auth .auth-links a:hover { color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .auth-stage { animation: authRise .5s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes authRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 520px) {
  .auth-origin { top: 14px; }
  .auth-reg { display: none; }
  body.auth .auth-panel { padding: 26px 22px 22px; }
}

/* ===== Profil (hub) ===== */
.section-title {
  margin: 0 0 14px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.field-hint { font-size: 12.5px; margin: -4px 0 2px; }
input:disabled { background: var(--soft); color: var(--muted); cursor: not-allowed; }
button.secondary { background: var(--ink); }

/* la couture verte — signature reprise des pages d'accès */
.panel.seam, .bill-card { position: relative; overflow: hidden; }
.panel.seam::before, .bill-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #93CF3E, #93CF3E 14%, var(--accent) 72%, var(--accent-strong));
  box-shadow: 0 0 14px rgba(147,207,62,.30);
}
.panel.seam { padding-top: 20px; }

.profile-grid { display: grid; gap: 16px; grid-template-columns: 1fr; max-width: 920px; }
@media (min-width: 760px) { .profile-grid { grid-template-columns: 1fr 1fr; } }
.profile-grid .profile-billing { grid-column: 1 / -1; }
.profile-billing .button { margin-top: 6px; }

/* comparaison Free / Pro */
.bill-compare { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 16px; }
@media (min-width: 720px) { .bill-compare { grid-template-columns: 1fr 1fr; align-items: stretch; } }
.bill-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
}
.button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.button.ghost:hover { background: var(--soft); }
.bill-card.pro { border-color: rgba(22,115,95,.5); box-shadow: 0 0 30px rgba(22,115,95,.08); }
.bill-tag {
  align-self: flex-start; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted);
}
.bill-tag.best { background: var(--accent); color: #fff; }
.bill-card h2 { margin: 2px 0 0; font-size: 22px; }
.bill-price { font-size: 30px; font-weight: 800; line-height: 1; }
.bill-price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.bill-lede { font-size: 13px; margin: 0; }
.bill-lede strong { color: var(--accent-strong); }
.bill-vat { font-size: 10px; margin: 3px 0 0; opacity: .6; }
.bill-feats { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.bill-feats li { position: relative; padding-left: 22px; font-size: 14px; color: #33414a; }
.bill-feats li::before { content: "+"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
.bill-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 14px; }
.bill-actions form { margin: 0; }
.bill-actions button, .bill-actions .button { width: 100%; }

/* gestion Pro */
.status-pill {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 99px; background: var(--soft); color: var(--accent-strong);
  vertical-align: middle;
}
.status-pill.past_due, .status-pill.unpaid { background: #fff2e0; color: #7a3f00; }
.status-pill.canceled, .status-pill.incomplete_expired { background: #fff1f1; color: var(--danger); }
.bill-summary {
  display: grid; gap: 10px 24px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px;
}
.bill-summary .k { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.bill-summary .v { font-weight: 700; }
.ghost-danger { background: transparent; color: var(--danger); border: 1px solid #e1a7a7; }
.ghost-danger:hover { background: #fff1f1; }

.bill-invoices { width: 100%; border-collapse: collapse; font-size: 14px; }
.bill-invoices th {
  text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; padding: 0 0 10px; border-bottom: 1px solid var(--line);
}
.bill-invoices td { padding: 11px 0; border-bottom: 1px solid var(--soft); }
.bill-invoices tr:last-child td { border-bottom: 0; }
.bill-invoices td:nth-child(2), .bill-invoices th:nth-child(2) { font-variant-numeric: tabular-nums; }
.inv-link { text-align: right; }
.inv-link a { color: var(--accent); font-weight: 700; text-decoration: none; }
.inv-status { font-weight: 600; }
.inv-status.paid { color: var(--accent); }
.inv-status.open { color: var(--warn); }
.inv-status.void, .inv-status.uncollectible { color: var(--muted); }

/* --- Couche UI par formule (Free / Pro) ------------------------------- */
/* Badge « Free » sur le logo : reprend la couture lime → teal en liseré. */
.brand-wrap { display: inline-flex; align-items: center; gap: 10px; }
.plan-badge {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none; color: var(--accent-strong);
  background: var(--soft); border-radius: 99px; overflow: hidden;
}
.plan-badge::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #93CF3E, var(--accent));
}
.plan-badge:hover { background: #e3ede8; }

/* Bannière lecture-seule (Pro expiré). */
.plan-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
}
.plan-banner .button { white-space: nowrap; }
.plan-banner--readonly { background: #fff2e0; color: #7a3f00; border: 1px solid #f0cfa0; }

/* Action verrouillée par le plafond de la formule. */
.button.is-locked {
  background: var(--soft); color: var(--accent-strong);
  border: 1px dashed var(--accent); opacity: .9;
}
.button.is-locked:hover { background: #e3ede8; }

/* Compteur de sièges (page membres) : valeur au plafond en alerte. */
.seat-usage { font-size: 13px; margin: 0 0 12px; }
.seat-usage strong { font-weight: 700; color: var(--ink); }
.seat-usage strong.is-full { color: var(--warn); }

/* Pastille « Pro » sur une entrée de fonction réservée. */
.pro-pill {
  display: inline-block; margin-left: 4px; padding: 1px 6px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 99px; background: linear-gradient(90deg, #93CF3E, var(--accent));
  color: #fff; vertical-align: middle;
}
/* Encart de remplacement d'une action Pro-only côté Free. */
.pro-lock { border: 1px dashed var(--accent); background: var(--soft); }
.pro-lock p { margin: 0; font-size: 14px; }
.pro-lock a { color: var(--accent-strong); font-weight: 700; }
.mini-button.is-locked {
  display: inline-block; text-decoration: none; background: var(--soft);
  color: var(--accent-strong); border: 1px dashed var(--accent);
}
.report-zip-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px; font-size: 14px;
}
.report-zip-bar .muted { margin-right: 4px; }

/* Bannière non-bloquante sur le plan quand le plafond d'observations (Free)
   est atteint — au lieu de rediriger vers une page d'upgrade plein écran. */
.plan-cap-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1100; max-width: min(92vw, 560px);
  padding: 9px 16px; border-radius: 8px;
  background: #fff2e0; color: #7a3f00; border: 1px solid #f0cfa0;
  font-size: 13px; font-weight: 600; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.plan-cap-banner a { color: var(--accent-strong); font-weight: 700; }

/* --- Espace occupation Gantt (reservation calendar) ---------------------- */
.gantt-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.gantt-head-row h2 { margin: 0; }
.gantt-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.gantt-legend span { display: inline-flex; align-items: center; gap: 5px; }
.gantt-key { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.gantt-key.key-Active { background: var(--accent-strong); }
.gantt-key.key-Prevue { background: var(--accent-strong); opacity: .45; }
.gantt-key.key-Terminee { background: #93a0a6; }
.gantt-key.key-conflict { box-shadow: inset 0 0 0 2px var(--danger); }

.gantt-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
.gantt { display: grid; }
.gantt-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: stretch;
  border-top: 1px solid var(--line);
}
.gantt-row:first-child { border-top: 0; }
.gantt-label {
  position: sticky;
  left: 0;
  z-index: 5;
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: 8px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.gantt-label a {
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gantt-label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-corner { font-weight: 800; color: var(--muted); background: var(--soft); }

.gantt-track {
  position: relative;
  height: calc(var(--lanes, 1) * 30px + 6px);
  overflow: hidden;
}
.gantt-monthbar { height: 32px; background: var(--soft); }
.gantt-month {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding-left: 6px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.gantt-grid {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px solid var(--line);
  opacity: .55;
}
.gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--danger);
  z-index: 2;
  pointer-events: none;
}
.gantt-bar {
  position: absolute;
  z-index: 1;
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--bar-color, var(--accent-strong));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  overflow: hidden;
}
.gantt-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.gantt-bar.status-Prevue { opacity: .6; }
.gantt-bar.status-Terminee { background: #93a0a6; }
.gantt-bar.status-Annulee {
  background: repeating-linear-gradient(45deg, #cdd4d7 0 5px, #dde2e4 5px 10px);
  color: #51606a;
  text-shadow: none;
}
.gantt-bar.status-Annulee .gantt-bar-label { text-decoration: line-through; }
.gantt-bar.is-open { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gantt-bar.is-open::after {
  content: "›";
  margin-left: auto;
  padding-left: 4px;
  font-weight: 900;
}
.gantt-bar.has-conflict { box-shadow: 0 0 0 2px var(--danger), 0 1px 3px rgba(0,0,0,.25); }
.gantt-bar.is-clickable { cursor: pointer; transition: filter .12s ease, box-shadow .12s ease; }
.gantt-bar.is-clickable:hover,
.gantt-bar.is-clickable:focus-visible {
  filter: brightness(1.08);
  box-shadow: 0 3px 10px rgba(0,0,0,.4);
  outline: none;
}
.gantt-bar.is-clickable.has-conflict:hover,
.gantt-bar.is-clickable.has-conflict:focus-visible {
  box-shadow: 0 0 0 2px var(--danger), 0 3px 10px rgba(0,0,0,.4);
}
@media (max-width: 720px) {
  .gantt-row { grid-template-columns: 140px 1fr; }
  .gantt-label { padding: 6px 8px; }
}

/* Occupation edit dialog (opened from a Gantt bar). */
.occ-dialog {
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.32);
}
.occ-dialog::backdrop { background: rgba(15,23,26,.45); backdrop-filter: blur(2px); }
.occ-dialog .form { margin: 0; padding: 16px; }
.occ-dialog .field-row { display: flex; gap: 10px; }
.occ-dialog .field-row > label { flex: 1; min-width: 0; }
.occ-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.occ-dialog-head h2 { margin: 0; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ-dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
