/* Hexuvium — Onboarding live & État des lieux (outil terrain agents) */

:root {
  --vert: #084030;
  --vert2: #0a5540;
  --vert3: #0d6b52;
  --or: #BF8E4E;
  --or-light: #e8dfc8;
  --gris: #6B6B6B;
  --bg: #f8f6f1;
  --bg-card: #FFFFFF;
  --bordure: #e5e0d5;
  --rouge: #b0413e;
  --shadow-sm: 0 2px 8px rgba(8, 64, 48, 0.06);
  --shadow-md: 0 6px 24px rgba(8, 64, 48, 0.10);
  --shadow-lg: 0 16px 48px rgba(8, 64, 48, 0.16);
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #1c1c1c;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-font {
  font-family: 'Fraunces', Georgia, serif;
  color: var(--vert);
  font-weight: 600;
}

.hidden { display: none !important; }

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 44px 36px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.login-card img.brand-logo { width: 180px; margin-bottom: 20px; }
.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-card p.tagline { color: var(--gris); font-size: 14px; margin: 0 0 28px; }
.login-card input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bordure);
  font-size: 16px;
  margin-bottom: 14px;
}
.login-card button {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--vert);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .3px;
  transition: background .15s var(--ease);
}
.login-card button:hover { background: var(--vert2); }
.login-card button:disabled { opacity: .6; cursor: default; }
.error-msg { color: var(--rouge); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ===== App shell ===== */
.app-wrap { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  background: var(--vert);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header .header-brand { display: flex; align-items: center; gap: 12px; }
.app-header img { height: 28px; }
.app-header .subtitle { font-size: 13px; opacity: .85; }
.app-header button.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.progress-bar {
  height: 6px;
  background: var(--or-light);
}
.progress-bar-fill {
  height: 100%;
  background: var(--or);
  transition: width .3s var(--ease);
}
.progress-label {
  text-align: center;
  font-size: 12px;
  color: var(--gris);
  padding: 8px 0 0;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.main-content {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 120px;
}

.step-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 20px;
  margin-bottom: 16px;
}
.step-card h2 { font-size: 19px; margin: 0 0 4px; }
.step-card .step-hint { color: var(--gris); font-size: 13px; margin: 0 0 18px; }

/* ===== Champs ===== */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--vert);
  margin-bottom: 6px;
}
.field .field-value {
  font-size: 15px;
  color: #333;
  background: var(--bg);
  border: 1px solid var(--bordure);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bordure);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}
.field textarea { min-height: 70px; resize: vertical; }

/* Toggle 3 états : conforme / à corriger / N/A */
.tri-toggle { display: flex; gap: 8px; }
.tri-toggle button {
  flex: 1;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--bordure);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--gris);
  transition: all .15s var(--ease);
}
.tri-toggle button.active[data-state="conforme"] { background: #e5f2ec; border-color: var(--vert3); color: var(--vert); }
.tri-toggle button.active[data-state="corriger"] { background: #fbeeea; border-color: var(--rouge); color: var(--rouge); }
.tri-toggle button.active[data-state="na"] { background: var(--bg); border-color: var(--gris); color: var(--gris); }
.correction-box { margin-top: 10px; }

/* ===== Pièces ===== */
.room-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
}
.room-tabs button {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--bordure);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--gris);
  white-space: nowrap;
}
.room-tabs button.active { background: var(--vert); border-color: var(--vert); color: #fff; }
.room-tabs button.done::after { content: " ✓"; }

.add-room-btn {
  border: 1.5px dashed var(--or);
  color: var(--or);
  background: transparent;
}

.wall-diagram {
  display: flex;
  justify-content: center;
  margin: 8px 0 20px;
}

.wall-photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wall-photo-slot {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--bordure);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.wall-photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.wall-photo-slot .slot-label {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--vert);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.wall-photo-slot .slot-empty { color: var(--gris); font-size: 28px; }
.wall-photo-slot input[type="file"] { display: none; }

.room-status-row { display: flex; gap: 8px; margin: 16px 0 4px; }
.room-status-row button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--bordure);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}
.room-status-row button.active[data-status="propre"] { background: #e5f2ec; border-color: var(--vert3); color: var(--vert); }
.room-status-row button.active[data-status="nettoyer"] { background: #fdf3da; border-color: var(--or); color: #8a6d2f; }
.room-status-row button.active[data-status="degat"] { background: #fbeeea; border-color: var(--rouge); color: var(--rouge); }

/* ===== Checklist ===== */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bordure);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  accent-color: var(--vert);
  flex-shrink: 0;
}
.checklist-item label { font-size: 14px; line-height: 1.4; }
.checklist-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--or);
  margin: 22px 0 4px;
}
.checklist-section-title:first-child { margin-top: 0; }

/* ===== Nav bas fixe ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--bordure);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  z-index: 15;
}
.bottom-nav button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 700;
}
.bottom-nav .btn-back { background: var(--bg); color: var(--vert); border: 1px solid var(--bordure); }
.bottom-nav .btn-next { background: var(--vert); color: #fff; }
.bottom-nav .btn-next:hover { background: var(--vert2); }
.bottom-nav .btn-next:disabled { opacity: .5; }

/* ===== Confirmation finale ===== */
.confirm-list label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.confirm-list input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--vert); flex-shrink: 0; }

.done-screen {
  text-align: center;
  padding: 60px 20px;
}
.done-screen .done-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--vert); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; margin: 0 auto 20px;
}
.done-screen h2 { font-size: 22px; }
.done-screen p { color: var(--gris); font-size: 14px; max-width: 380px; margin: 8px auto 0; }

.error-banner {
  background: #fbeeea;
  border: 1px solid var(--rouge);
  color: var(--rouge);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .wall-photo-grid { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 16px 12px 120px; }
}
