/* =====================================================================
   RAPPORT DU SOIR — feuille de style
   Palette : vert coco / ambre canette — sobre, fonctionnelle, lisible
   ===================================================================== */

:root {
  --coco-green: #2f6b4f;
  --coco-green-dark: #1f4d38;
  --coco-cream: #f7f4ec;
  --coco-amber: #c98a2c;
  --coco-ink: #23291f;
  --coco-line: #dcd5c3;
  --coco-red: #b23b3b;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--coco-cream);
  color: var(--coco-ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  padding-bottom: 4rem;
}

/* ---------- En-tete applicatif ---------- */
.app-header {
  background: linear-gradient(120deg, var(--coco-green-dark), var(--coco-green));
  color: #fff;
  padding: 1.6rem 0;
  margin-bottom: 2rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.2px;
}

.app-header p {
  margin: 0.15rem 0 0;
  opacity: 0.85;
  font-size: 0.92rem;
}

/* ---------- Cartes de section ---------- */
.section-card {
  background: #fff;
  border: 1px solid var(--coco-line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.section-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--coco-green-dark);
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--coco-amber);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-card h2 .badge-letter {
  background: var(--coco-green-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-label {
  font-weight: 600;
  font-size: 0.86rem;
  color: #4a4536;
}

.form-control,
.form-select {
  border-radius: 7px;
  border: 1px solid #cfc8b3;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--coco-green);
  box-shadow: 0 0 0 0.2rem rgba(47, 107, 79, 0.15);
}

.calc-field {
  background: #eef3ee !important;
  font-weight: 700;
  color: var(--coco-green-dark);
}

/* ---------- Lignes dynamiques ---------- */
.dynamic-row {
  border: 1px dashed var(--coco-line);
  border-radius: 8px;
  padding: 0.8rem;
  margin-bottom: 0.7rem;
  background: #fcfbf7;
  position: relative;
}

.btn-remove-row {
  color: var(--coco-red);
  border: none;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

.btn-remove-row:hover {
  color: #7c1f1f;
}

.btn-add-row {
  border: 1px dashed var(--coco-green);
  color: var(--coco-green-dark);
  background: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-add-row:hover {
  background: var(--coco-green);
  color: #fff;
}

/* ---------- Totaux mis en valeur ---------- */
.total-highlight {
  background: linear-gradient(120deg, #fff7e8, #fdeecb);
  border: 1px solid #e8cd8f;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-weight: 700;
  color: #7a5216;
}

/* ---------- Barre d'actions ---------- */
.action-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--coco-line);
  padding: 0.9rem 1rem;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 20;
}

.action-bar .btn {
  font-weight: 600;
  border-radius: 8px;
}

/* ---------- Apercu du rapport (style "message WhatsApp") ---------- */
#report-preview-wrapper {
  display: none;
}

#report-preview-wrapper.visible {
  display: block;
}

.report-sheet {
  background: #fff;
  border: 1px solid var(--coco-line);
  border-radius: var(--radius);
  padding: 2rem 2.2rem;
  max-width: 720px;
  margin: 0 auto 1.5rem;
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #1c1c1c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.report-sheet strong {
  color: var(--coco-green-dark);
}

#toast-zone {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
}

/* =====================================================================
   IMPRESSION — n'affiche que la fiche de rapport, format A4
   ===================================================================== */
@media print {
  @page {
    size: A4;
    margin: 14mm 16mm;
  }

  body {
    background: #fff !important;
    padding: 0;
  }

  .app-header,
  .action-bar,
  #report-form,
  .no-print,
  #toast-zone {
    display: none !important;
  }

  #report-preview-wrapper {
    display: block !important;
  }

  .report-sheet {
    border: none;
    box-shadow: none;
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-size: 12pt;
    color: #000;
  }
}
