:root {
  --bleu: #1a3c5e;
  --bleu-clair: #2e5c88;
  --accent: #16a085;
  --fond: #f4f6f9;
  --texte: #1f2937;
  --gris: #6b7280;
  --blanc: #ffffff;
  --rouge: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

header {
  background: var(--bleu);
  color: var(--blanc);
  padding: 22px 20px;
  text-align: center;
  border-radius: 0 0 20px 20px;
  margin: -20px -16px 24px;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

header p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 4px;
}

h2 { font-size: 1.15rem; margin-bottom: 4px; }
.sous-titre { color: var(--gris); font-size: 0.9rem; margin-bottom: 16px; }

.grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grille.une-colonne { grid-template-columns: 1fr; }

.bouton-magasin, .bouton-employe {
  background: var(--blanc);
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--texte);
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: transform 0.05s, border-color 0.1s;
}

.bouton-magasin:active, .bouton-employe:active {
  transform: scale(0.97);
  border-color: var(--accent);
}

.bouton-employe.selectionne {
  border-color: var(--accent);
  background: #e6f7f1;
}

.btn-coupure {
  width: 100%;
  margin-top: 16px;
  background: #eef2f7;
  color: var(--bleu);
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-coupure:active { background: #e2e8f0; }

.btn-repos {
  width: 100%;
  margin-top: 16px;
  background: #fef3c7;
  color: #92400e;
  border: 1.5px dashed #fbbf24;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-repos.actif {
  background: #d1fae5;
  color: #065f46;
  border-color: #34d399;
  border-style: solid;
}

.total-affichage {
  margin-top: 16px;
  padding: 12px;
  background: #e6f7f1;
  border-radius: 12px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f766e;
}

.retour {
  background: none;
  border: none;
  color: var(--bleu-clair);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gris);
  margin: 16px 0 6px;
}

input[type="date"], select {
  width: 100%;
  padding: 14px 12px;
  font-size: 1.05rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: var(--blanc);
  color: var(--texte);
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.principal {
  width: 100%;
  margin-top: 24px;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blanc);
  background: var(--accent);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(22,160,133,0.35);
}

.principal:active { transform: scale(0.98); }
.principal:disabled { background: #9ca3af; box-shadow: none; cursor: not-allowed; }

.message {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  font-size: 0.95rem;
  text-align: center;
  display: none;
}
.message.succes { display: block; background: #e6f7f1; color: #0f766e; border: 1px solid #b7e4d6; }
.message.erreur { display: block; background: #fdecea; color: var(--rouge); border: 1px solid #f5c6c0; }

.badge {
  display: inline-block;
  background: #eef2f7;
  color: var(--bleu);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.total-heures {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.cache { display: none !important; }
.centre { text-align: center; }

/* Admin */
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.btn {
  background: var(--bleu);
  color: var(--blanc);
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn.vert { background: var(--accent); }
.btn.gris { background: #9ca3af; }
.btn.petit { padding: 6px 12px; font-size: 0.8rem; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--blanc);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.85rem;
}
.table th, .table td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid #f0f0f0;
}
.table th:first-child, .table td:first-child { text-align: left; }
.table th { background: var(--bleu); color: var(--blanc); font-weight: 600; }
.table tr.total-ligne td { background: #eef2f7; font-weight: 700; }
.table td.heures { color: var(--accent); font-weight: 600; }

.carte {
  background: var(--blanc);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-semaine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.nav-semaine .periode { font-weight: 700; text-align: center; font-size: 0.95rem; }

.champ {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.champ input, .champ select {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.95rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: var(--blanc);
}

.lien-login {
  max-width: 360px;
  margin: 80px auto;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  z-index: 1000;
  overflow-y: auto;
}
.modal.cache { display: none; }
.modal-contenu {
  background: var(--blanc);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 520px;
  position: relative;
}
.modal-fermer {
  position: absolute;
  top: 12px; right: 12px;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--gris);
  line-height: 1;
}
.lien-nom {
  color: var(--bleu);
  text-decoration: none;
  font-weight: 600;
}
.lien-nom:active, .lien-nom:hover { text-decoration: underline; }
