/* NRP Tracker — CSS mobile-first, vanilla, optimisé pour 3G. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.4; color: #222; background: #f4f5f7;
}
:root {
  --bleu: #1a237e; --bleu-clair: #3949ab;
  --vert: #2e7d32; --rouge: #c62828; --orange: #ef6c00;
  --gris: #616161; --gris-clair: #e0e0e0; --blanc: #fff;
}
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
header.topbar {
  background: var(--bleu); color: var(--blanc);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
header.topbar h1 { font-size: 1.1rem; font-weight: 600; }
header.topbar .user { font-size: .85rem; opacity: .9; }
header.topbar button {
  background: transparent; color: #fff; border: 1px solid #fff;
  padding: 4px 10px; border-radius: 4px; font-size: .8rem; cursor: pointer;
}

main { padding: 12px; max-width: 1200px; margin: 0 auto; }
section { background: #fff; border-radius: 8px; padding: 14px; margin-bottom: 12px;
          box-shadow: 0 1px 3px rgba(0,0,0,.08); }
section h2 { font-size: 1rem; margin-bottom: 10px; color: var(--bleu); }

/* KPIs grid */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi {
  background: #fff; border-left: 4px solid var(--bleu); padding: 10px;
  border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.kpi .label { font-size: .8rem; color: var(--gris); text-transform: uppercase; }
.kpi .value { font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.kpi.ok { border-left-color: var(--vert); }
.kpi.warn { border-left-color: var(--orange); }
.kpi.bad { border-left-color: var(--rouge); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; padding: 8px 6px; background: #f1f2f6; font-weight: 600; }
td { padding: 8px 6px; border-top: 1px solid var(--gris-clair); }
tbody tr:hover { background: #fafafa; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px;
         font-size: .75rem; font-weight: 600; }
.badge.ok { background: #e8f5e9; color: var(--vert); }
.badge.warn { background: #fff3e0; color: var(--orange); }
.badge.bad { background: #ffebee; color: var(--rouge); }
.badge.gray { background: #eee; color: var(--gris); }

/* Forms */
form label { display: block; font-size: .85rem; color: var(--gris); margin: 8px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gris-clair);
  border-radius: 4px; font-size: 14px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
button.primary {
  background: var(--bleu); color: #fff; border: 0; padding: 10px 18px;
  border-radius: 4px; font-size: 15px; cursor: pointer; font-weight: 600;
}
button.primary:hover { background: var(--bleu-clair); }
button.danger { background: var(--rouge); }

/* Alertes */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; font-size: .9rem; }
.alert.danger { background: #ffebee; color: var(--rouge); border: 1px solid #ffcdd2; }
.alert.warn   { background: #fff3e0; color: var(--orange); border: 1px solid #ffe0b2; }
.alert.info   { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* Login */
.login-box {
  max-width: 340px; margin: 80px auto; background: #fff; padding: 28px;
  border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
.login-box h1 { text-align: center; color: var(--bleu); margin-bottom: 18px; }
.login-box button { width: 100%; margin-top: 12px; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: #fff; border-radius: 8px; padding: 20px;
  max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto;
}
.modal h3 { color: var(--bleu); margin-bottom: 12px; }
.hidden { display: none !important; }

/* Utils */
.muted { color: var(--gris); font-size: .85rem; }
.right { text-align: right; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

/* Score de suivi */
.score-card { background: #fff; border-radius: 10px; padding: 16px 18px;
              box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 12px;
              border-left: 6px solid var(--bleu); }
.score-header { display: flex; justify-content: space-between; align-items: baseline;
                margin-bottom: 8px; }
.score-label { font-size: .85rem; color: var(--gris); text-transform: uppercase;
               letter-spacing: .4px; font-weight: 600; }
.score-period { font-size: .75rem; color: var(--gris); }
.score-value { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
               margin: 6px 0 12px; }
.score-big { font-size: 2.4rem; font-weight: 700; color: var(--bleu); line-height: 1; }
.score-tag { display: inline-block; padding: 4px 10px; border-radius: 12px;
             font-size: .8rem; font-weight: 600; }
.score-tag.zero       { background: #fee; color: #c33; }
.score-tag.faible     { background: #fed; color: #c63; }
.score-tag.partiel    { background: #ffd; color: #963; }
.score-tag.bon        { background: #efd; color: #393; }
.score-tag.excellent  { background: #cfc; color: #060; }
.score-detail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
                font-size: .88rem; color: #333; }
.score-detail > div { background: #f7f8fa; padding: 6px 10px; border-radius: 6px; }
.score-stats { margin-top: 10px; font-size: .78rem; color: var(--gris); }
.score-empty { padding: 20px; color: #666; font-style: italic; text-align: center;
               line-height: 1.5; }

/* Score pill (colonne commande) */
.score-pill { display: inline-block; padding: 2px 8px; border-radius: 10px;
              font-size: .75rem; font-weight: 700; min-width: 40px; text-align: center; }
.score-pill.zero      { background: #fee; color: #c33; }
.score-pill.faible    { background: #fed; color: #c63; }
.score-pill.partiel   { background: #ffd; color: #963; }
.score-pill.bon       { background: #efd; color: #393; }
.score-pill.excellent { background: #cfc; color: #060; }
