@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&family=Syne:wght@600;700;800&display=swap");

:root {
  --ink: #101828;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --bg: #eef2f6;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fff7ed;
  --ok: #027a48;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --header-h: 68px;
  --font: "Figtree", sans-serif;
  --display: "Syne", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgba(194, 65, 12, 0.12), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(15, 23, 42, 0.08), transparent 50%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 40%, #e8eef5 100%);
  line-height: 1.5;
}

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

img { max-width: 100%; display: block; }

/* ===== Shell pleine largeur ===== */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  width: 100%;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(228, 231, 236, 0.9);
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #ea580c, #9a3412);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}
.nav > a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}
.nav > a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.site-main {
  flex: 1;
  width: 100%;
  padding: clamp(1.25rem, 2.5vw, 2rem) clamp(1rem, 3vw, 2.5rem) 2.5rem;
}

.site-footer {
  width: 100%;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  background: rgba(255,255,255,.55);
}
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--accent); }

/* ===== Typo ===== */
h1, h2, h3 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}
h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 2vw, 1.75rem); font-weight: 700; }
.lead {
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 42rem;
}
.muted { color: var(--muted); }

/* ===== Panels / surfaces ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.1rem, 2vw, 1.75rem);
  margin-bottom: 1.25rem;
  width: 100%;
  animation: rise .45s ease both;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.panel-head h1, .panel-head h2 { margin-bottom: 0.25rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ===== Hero landing pleine largeur ===== */
.hero {
  position: relative;
  width: 100%;
  min-height: calc(100vh - var(--header-h) - 6rem);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
  animation: rise .5s ease both;
}
.hero-copy h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  max-width: 14ch;
  margin-bottom: 1rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.hero-visual {
  position: relative;
  min-height: 320px;
  border-radius: 28px;
  background:
    linear-gradient(155deg, #1f2937 0%, #111827 55%, #7c2d12 120%);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: #fff;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero-visual::before {
  content: "";
  position: absolute;
  inset: -20% auto auto 40%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249,115,22,.45), transparent 70%);
  animation: float 7s ease-in-out infinite;
}
.hero-visual::after {
  content: "";
  position: absolute;
  inset: auto -10% -30% auto;
  width: 260px;
  height: 260px;
  border-radius: 40% 60% 50% 50%;
  background: rgba(255,255,255,.06);
  animation: float 9s ease-in-out infinite reverse;
}
.hero-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  padding: 1.1rem 1.25rem;
  backdrop-filter: blur(8px);
}
.hero-card strong { display: block; font-family: var(--display); font-size: 1.15rem; margin-bottom: .35rem; }
.hero-card span { color: rgba(255,255,255,.78); font-size: .95rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 2rem;
  max-width: 36rem;
}
.stat {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
}
.stat b {
  display: block;
  font-family: var(--display);
  font-size: 1.25rem;
}
.stat span { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

/* ===== Forms ===== */
label {
  display: block;
  margin: 0.9rem 0 0.35rem;
  font-weight: 650;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
input, select, textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #fb923c;
  box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.12);
}

.form-narrow { max-width: 480px; }
.form-wide { max-width: 720px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 12px;
  padding: 0.72rem 1.15rem;
  background: var(--accent);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset;
}
.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn.secondary { background: #1f2937; }
.btn.secondary:hover { background: #111827; }
.btn.warn { background: #c2410c; }
.btn.danger { background: var(--danger); }
.btn.ghost {
  background: transparent;
  color: var(--ink-soft) !important;
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink) !important; }
.btn.sm { padding: 0.45rem 0.75rem; font-size: 0.85rem; border-radius: 10px; }

/* ===== Table ===== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th, .table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.95rem;
}
.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fcfcfd; }
.table .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: .01em;
}
.badge.suspendu, .badge.resilie { background: var(--danger-bg); color: var(--danger); }
.badge.essai, .badge.en_retard { background: var(--warn-bg); color: var(--warn); }
.badge.actif { background: var(--ok-bg); color: var(--ok); }

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdca;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.impersonate-banner {
  width: 100%;
  background: linear-gradient(90deg, #fff7ed, #ffedd5);
  border-bottom: 1px solid #fdba74;
  padding: 0.75rem clamp(1rem, 3vw, 2.5rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 600;
  color: #9a3412;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}
.price-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform .2s ease, border-color .2s ease;
}
.price-card:hover {
  transform: translateY(-3px);
  border-color: #fdba74;
}
.price-card .amount {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.price-card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-soft);
}
.price-card li { margin: 0.25rem 0; }

.auth-shell {
  min-height: calc(100vh - var(--header-h) - 8rem);
  display: grid;
  place-items: center;
}
.auth-panel {
  width: min(100%, 440px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-copy h1 { max-width: none; }
  .hero-visual { min-height: 240px; }
  .price-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; max-width: none; }
}

@media (max-width: 640px) {
  .site-header {
    height: auto;
    min-height: var(--header-h);
    flex-direction: column;
    align-items: stretch;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .nav { justify-content: flex-start; }
  .btn { width: auto; }
}
.stats{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))!important}

.badge.ouvert { background: var(--warn-bg); color: var(--warn); }
.badge.en_cours { background: #eff8ff; color: #175cd3; }
.badge.resolu { background: var(--ok-bg); color: var(--ok); }

/* ===== Modale photo ===== */
body.photo-modal-open { overflow: hidden; }

.photo-thumb {
  cursor: zoom-in;
  border: 0;
  padding: 0;
  background: transparent;
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 12px;
  overflow: hidden;
}
.photo-thumb img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  transition: transform .2s ease, box-shadow .2s ease;
}
.photo-thumb:hover img,
.photo-thumb:focus-visible img {
  transform: scale(1.02);
  box-shadow: var(--shadow);
  outline: 2px solid #fdba74;
  outline-offset: 2px;
}

.photo-modal[hidden] { display: none !important; }
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.photo-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.62);
  backdrop-filter: blur(4px);
}
.photo-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: min(92vh, 900px);
  background: var(--surface);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.28);
  overflow: hidden;
  animation: rise .2s ease;
}
.photo-modal__close {
  position: absolute;
  top: .55rem;
  right: .7rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.photo-modal__close:hover { background: var(--line); }
.photo-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.9fr);
  max-height: min(92vh, 900px);
}
.photo-modal__media {
  background: #0f172a;
  display: grid;
  place-items: center;
  min-height: 280px;
  max-height: min(92vh, 900px);
  overflow: auto;
}
.photo-modal__img {
  max-width: 100%;
  max-height: min(92vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.photo-modal__side {
  padding: 1.25rem 1.25rem 1.5rem;
  overflow: auto;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.photo-modal__title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
}
.photo-modal__legende { margin: 0; }
.photo-modal__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.photo-modal__list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin: .25rem 0;
  max-height: 220px;
  overflow: auto;
}
.photo-modal__ann {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .65rem .75rem;
}
.photo-modal__ann header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  margin-bottom: .25rem;
  font-size: .9rem;
}
.photo-modal__ann p { margin: 0; }
.photo-modal__form label {
  display: block;
  margin-top: .5rem;
  font-weight: 600;
  font-size: .9rem;
}
.photo-modal__form textarea,
.photo-modal__form input[name="auteur_nom"] {
  width: 100%;
  margin-top: .3rem;
}

/* ===== Flux échanges ===== */
.flux {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.flux-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem 1rem;
  background: var(--surface);
}
.flux-item.artisan { border-left: 4px solid #175cd3; }
.flux-item.client { border-left: 4px solid var(--accent); }
.flux-item.signalement { border-left: 4px solid var(--warn); background: var(--warn-bg); }
.flux-item header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}
.flux-item .flux-msg { margin: 0; white-space: pre-wrap; }
.flux-thumb {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: .45rem;
  font-size: .9rem;
}
.flux-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

@media (max-width: 800px) {
  .photo-modal__body { grid-template-columns: 1fr; }
  .photo-modal__side { border-left: 0; border-top: 1px solid var(--line); max-height: 45vh; }
  .photo-modal__media { max-height: 40vh; }
  .photo-modal__img { max-height: 40vh; }
}
