/* =====================================================================
   INFOSOLUTION — Feuille de style
   Palette : encre navy / orange signal / teal / vert / rouge / ambre
   Typo    : Poppins (titres, chiffres) + Inter (texte courant)
   Principe : tout au texte et à la couleur — aucune icône, aucun emoji
   ===================================================================== */

:root {
  --navy:        #161A3A;
  --navy-light:  #232a5c;
  --orange:      #FF5A36;
  --orange-dark: #E14522;
  --teal:        #00BFA6;
  --green:       #1FA97A;
  --green-bg:    #E4F7EF;
  --red:         #E53950;
  --red-bg:      #FDE8EB;
  --amber:       #FFB238;
  --amber-bg:    #FFF4E0;
  --paper:       #F5F6FA;
  --card:        #FFFFFF;
  --ink:         #1D2140;
  --muted:       #6B7090;
  --line:        #E4E6F2;

  --radius:      16px;
  --radius-sm:   10px;
  --tap:         56px; /* hauteur minimale des zones tactiles */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 48px;
}

h1, h2, h3, .display {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  margin: 0;
}

a { color: inherit; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* évite le zoom automatique iOS */
}

/* ---------------------------------------------------------------------
   En-tête sticky : logo + nom d'appli + badge J-x (élément signature)
   --------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--navy);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(22, 26, 58, 0.25);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-brand img {
  height: 34px;
  width: auto;
  border-radius: 6px;
  background: #fff;
  padding: 3px;
  flex-shrink: 0;
}

.app-brand .name {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge "J-x" façon tampon d'accès / billet de foire */
.jday-badge {
  background: var(--orange);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 999px;
  transform: rotate(-3deg);
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--orange-dark);
  flex-shrink: 0;
}

.jday-badge.late {
  background: var(--red);
  box-shadow: 0 3px 0 #b91f36;
}

.jday-badge.today {
  background: var(--green);
  box-shadow: 0 3px 0 #157a56;
}

/* ---------------------------------------------------------------------
   Écran de connexion (PIN)
   --------------------------------------------------------------------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px 40px;
  background:
    radial-gradient(circle at 15% 0%, rgba(255,90,54,0.18), transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(0,191,166,0.16), transparent 40%),
    var(--navy);
  text-align: center;
}

.login-logo {
  max-width: 190px;
  max-height: 110px;
  width: auto;
  height: auto;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.login-app-name {
  color: #fff;
  font-size: 22px;
  letter-spacing: 1px;
  margin-bottom: 18px;
}

.login-jday {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 34px;
  padding: 14px 30px;
  border-radius: var(--radius);
  transform: rotate(-2deg);
  box-shadow: 0 5px 0 var(--orange-dark);
  margin-bottom: 6px;
}

.login-jday.today { background: var(--green); box-shadow: 0 5px 0 #157a56; }
.login-jday.late  { background: var(--red);   box-shadow: 0 5px 0 #b91f36; }

.login-event-name {
  color: #cfd2ef;
  font-size: 14px;
  margin-bottom: 30px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pin-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

.pin-card label {
  display: block;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 14px;
  font-size: 15px;
}

.pin-dots-input {
  width: 100%;
  text-align: center;
  letter-spacing: 14px;
  font-size: 30px;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 10px 14px 22px;
  color: var(--navy);
  background: var(--paper);
}

.pin-dots-input:focus {
  outline: none;
  border-color: var(--orange);
}

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  min-height: var(--tap);
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 0 var(--orange-dark);
}
.btn-primary:active { transform: translateY(3px); box-shadow: none; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--line);
  color: var(--navy);
}

.btn-full-mt { margin-top: 16px; }

.error-msg {
  background: var(--red-bg);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-msg {
  background: var(--green-bg);
  color: var(--green);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------------
   Barre utilisateur (sous l'en-tête, dans le tableau de bord)
   --------------------------------------------------------------------- */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.user-bar .greeting {
  font-size: 14px;
  color: var(--muted);
}

.user-bar .greeting strong {
  color: var(--ink);
}

.user-bar a.logout, .user-bar a.admin-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--orange-dark);
  text-decoration: none;
  padding: 8px 10px;
}

/* ---------------------------------------------------------------------
   Filtres / compteurs (état des tâches)
   --------------------------------------------------------------------- */
.stats-row {
  display: flex;
  gap: 10px;
  padding: 14px 16px 4px;
  overflow-x: auto;
}

.stat-pill {
  flex: 1;
  min-width: 92px;
  text-align: center;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  cursor: pointer;
}

.stat-pill.active { border-color: var(--orange); }

.stat-pill .num {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 20px;
  display: block;
}

.stat-pill .lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-pill.pill-late .num { color: var(--red); }
.stat-pill.pill-done .num { color: var(--green); }
.stat-pill.pill-open .num { color: var(--orange-dark); }

/* ---------------------------------------------------------------------
   Section titre de liste
   --------------------------------------------------------------------- */
.section-title {
  padding: 18px 16px 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------------
   Liste de tâches — chaque tâche = un "ticket" compressé sur une ligne
   --------------------------------------------------------------------- */
.task-list {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  border-left: 8px solid var(--green);
  box-shadow: 0 2px 8px rgba(22,26,58,0.06);
  overflow: hidden;
}

.task-card.is-late   { border-left-color: var(--red); }
.task-card.is-done    { border-left-color: var(--green); opacity: 0.75; }
.task-card.is-soon   { border-left-color: var(--amber); }

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  min-height: var(--tap);
  cursor: pointer;
}

.task-check {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: transparent;
}

.task-check.checked {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card.is-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta .dot { opacity: 0.5; }

.deadline-tag {
  font-weight: 700;
}

.deadline-tag.late  { color: var(--red); }
.deadline-tag.soon  { color: var(--amber); }
.deadline-tag.ok    { color: var(--green); }

.comment-count {
  flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.comment-count.zero {
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
}

.status-word {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 9px;
  border-radius: 999px;
}

.status-word.late { background: var(--red-bg); color: var(--red); }
.status-word.ok   { background: var(--green-bg); color: var(--green); }
.status-word.soon { background: var(--amber-bg); color: #a56b00; }

/* ---------------------------------------------------------------------
   Accordéon des commentaires
   --------------------------------------------------------------------- */
.task-accordion {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.task-card.open .task-accordion {
  max-height: 900px;
}

.task-description {
  padding: 12px 16px 4px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.task-assignees {
  padding: 4px 16px 10px;
  font-size: 13px;
  color: var(--muted);
}

.task-assignees strong { color: var(--ink); }

.comments-block {
  padding: 8px 14px 14px;
}

.comment-item {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
}

.comment-author {
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
}

.comment-date {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

.comment-body {
  font-size: 14px;
  margin-top: 4px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.no-comments {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 2px 12px;
  font-style: italic;
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.comment-form textarea {
  flex: 1;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: none;
  min-height: 46px;
  font-size: 14px;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--teal);
}

.comment-form button {
  flex-shrink: 0;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  padding: 0 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}

.empty-state .display {
  color: var(--navy);
  font-size: 18px;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------
   Bouton flottant "Nouvelle tâche" — atteignable au pouce
   --------------------------------------------------------------------- */
.fab-new-task {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 25;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.3px;
  border: none;
  border-radius: 999px;
  padding: 16px 22px;
  box-shadow: 0 6px 18px rgba(255,90,54,0.45);
}

.fab-new-task:active { transform: translateY(2px); }

/* ---------------------------------------------------------------------
   Modale simple (nouvelle tâche)
   --------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22,26,58,0.55);
  display: none;
  align-items: flex-end;
  z-index: 50;
}

.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--card);
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px 28px;
}

.modal-sheet h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--navy);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.field input[type=text],
.field input[type=datetime-local],
.field textarea,
.field select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-chip {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.checkbox-chip input { display: none; }

.checkbox-chip.checked {
  border-color: var(--teal);
  background: #E1F8F4;
  color: #05806e;
}

/* ---------------------------------------------------------------------
   Page Admin
   --------------------------------------------------------------------- */
.admin-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 14px 12px;
  box-shadow: 0 2px 8px rgba(22,26,58,0.06);
}

.admin-section h2 {
  font-size: 16px;
  color: var(--navy);
  margin-bottom: 14px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.admin-list-item:last-child { border-bottom: none; }

.tag-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.role-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  margin-left: 6px;
}

.role-badge.admin { background: var(--navy); color: #fff; }

.link-danger {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}

.current-logo-preview {
  max-height: 70px;
  max-width: 100%;
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------
   Utilitaires
   --------------------------------------------------------------------- */
.container-narrow { max-width: 560px; margin: 0 auto; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
