/* =====================================================================
   Respicare Bilans — styles de base (mobile-first, iPad)
   Chantier 2 (Claude-C) · Module 1 squelette · 06/07/2026
   ===================================================================== */

:root {
  --blue: #185FA5;
  --blue-dark: #0C447C;
  --blue-bg: #E6F1FB;
  --teal: #1D9E75;
  --teal-bg: #E1F5EE;
  --ink: #2C2C2A;
  --muted: #5F5E5A;
  --line: #D3D1C7;
  --surface: #FFFFFF;
  --page: #F1EFE8;
  --radius: 12px;
  --pad: 16px;
  --touch: 52px;                 /* cible tactile confortable */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--pad);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 17px; }
.brand-sub { font-size: 13px; color: var(--muted); }

.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.pill-dev { background: var(--blue-bg); color: var(--blue-dark); }

/* Main */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px var(--pad);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 22px;
  text-align: center;
}
.login-icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--blue-bg);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
}
.login-title { margin: 0; font-size: 22px; font-weight: 600; }
.login-sub { margin: 4px 0 22px; font-size: 15px; color: var(--muted); }
.login-note { margin: 16px 0 0; font-size: 12px; color: var(--muted); }

/* Boutons — grandes cibles tactiles */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--touch);
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 10px;
  -webkit-appearance: none;
  transition: transform .06s ease, background .12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn-ico { font-size: 18px; }

/* Astuce iOS */
.ios-hint {
  max-width: 380px;
  width: 100%;
  background: var(--teal-bg);
  color: #0F6E56;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
}

/* Footer */
.app-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px var(--pad);
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.muted { color: var(--muted); }

/* Champs de saisie */
.fld {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 16px;              /* >=16px : évite le zoom auto iOS */
  margin: 6px 0;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
  -webkit-appearance: none;
}
.fld:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
#pin-form { margin-top: 6px; }

/* Tableau de bord : statistiques */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.stat-label { display: block; font-size: 12px; color: var(--muted); }
.stat-value { display: block; font-size: 24px; font-weight: 600; margin-top: 3px; }

/* Tableau de bord : tuiles d'action */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 92px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.tile:active { transform: scale(0.99); }
.tile-ico { font-size: 22px; color: var(--blue); }
.tile-sub { font-size: 12px; color: var(--muted); font-weight: 400; }

/* Paysage / large : on garde le contenu centré et lisible */
@media (min-width: 768px) {
  .app-header { padding: 14px 28px; }
  .app-main { padding: 32px 28px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
