/* ================================================================
   SUP.CSS — Supervision AuditMS
   Variables héritées de https://auditms.fr/css/theme.css
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }

/* ── Login overlay ───────────────────────────────────────── */
#overlay {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--bg2); border: 1px solid var(--bd);
  border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 340px;
}
.login-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; }
.login-inp {
  width: 100%; padding: .65rem .85rem;
  background: var(--bg3); border: 1px solid var(--bd);
  border-radius: 8px; color: var(--text); font-size: .85rem;
  font-family: var(--sans); margin-bottom: .75rem;
}
.login-inp:focus { outline: none; border-color: var(--accent); }
.login-err { color: var(--red); font-size: .8rem; margin-top: .5rem; min-height: 1.2em; }

/* ── Layout ──────────────────────────────────────────────── */
#layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--bd);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sb-top {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--bd);
}
.sb-brand { font-size: .95rem; font-weight: 700; }
.sb-sub   { font-size: .65rem; color: var(--text2); font-weight: 400; margin-top: .1rem; }
.sb-lbl   {
  font-size: .6rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text2); margin: .85rem 0 .3rem;
}
.tenant-sel {
  width: 100%; padding: .4rem .6rem;
  background: var(--bg3); border: 1px solid var(--bd);
  border-radius: 6px; color: var(--text); font-size: .78rem;
  font-family: var(--sans); cursor: pointer;
}
.tenant-sel:focus { outline: none; border-color: var(--accent); }

.sb-nav { flex: 1; padding: .6rem 0; }
.sb-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1rem; font-size: .82rem;
  color: var(--text2); text-decoration: none;
  transition: color .12s, background .12s;
  border-right: 2px solid transparent;
}
.sb-link:hover { color: var(--text); background: var(--bg3); }
.sb-link.active { color: var(--accent); background: var(--bg3); border-right-color: var(--accent); font-weight: 500; }
.sb-ico { font-size: .82rem; width: 1.1rem; text-align: center; flex-shrink: 0; }

.sb-logout {
  margin: .75rem 1rem; padding: .4rem .75rem;
  background: none; border: 1px solid var(--bd);
  border-radius: 6px; color: var(--text2); font-size: .74rem;
  cursor: pointer; font-family: var(--sans); text-align: left;
  transition: all .12s;
}
.sb-logout:hover { color: var(--red); border-color: rgba(239,68,68,.3); }

/* ── Main ────────────────────────────────────────────────── */
main { padding: 2rem; overflow-y: auto; }
.pg-header { margin-bottom: 1.75rem; }
.pg-title { font-size: 1.1rem; font-weight: 600; }
.pg-meta  { font-size: .74rem; color: var(--text2); margin-top: .25rem; }

/* ── Score cards ─────────────────────────────────────────── */
.scores-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 1rem; margin-bottom: 1.75rem;
}
.score-card {
  background: var(--bg2); border: 1px solid var(--bd);
  border-radius: 10px; padding: 1.25rem;
}
.score-val {
  font-size: 2.4rem; font-weight: 700;
  font-family: var(--mono); line-height: 1; margin-bottom: .5rem;
}
.score-bar {
  height: 4px; background: var(--bg4);
  border-radius: 2px; margin-bottom: .6rem; overflow: hidden;
}
.score-fill { height: 100%; border-radius: 2px; transition: width .35s; }
.score-lbl  { font-size: .72rem; color: var(--text2); font-weight: 500; }

/* ── Stat mini cards ─────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill,minmax(140px,1fr));
  gap: .75rem; margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--bd);
  border-radius: 8px; padding: 1rem;
}
.stat-val { font-size: 1.6rem; font-weight: 700; font-family: var(--mono); }
.stat-lbl { font-size: .68rem; color: var(--text2); margin-top: .25rem; }
.s-red    { border-left: 3px solid var(--red); }
.s-orange { border-left: 3px solid var(--orange); }
.s-green  { border-left: 3px solid var(--green); }

/* ── Sections ────────────────────────────────────────────── */
.section { margin-bottom: 1.75rem; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .6rem; padding-bottom: .25rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  cursor: pointer; user-select: none;
}
.section-head:hover .section-title { color: var(--text); }
.section-arrow {
  font-size: .65rem; color: var(--text2);
  transition: transform .18s ease;
  line-height: 1;
}
.section-title {
  font-size: .65rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text2);
}
.s-badge {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 4px; font-size: .65rem; font-weight: 600;
  font-family: var(--mono);
}
.s-badge-red    { background: rgba(239,68,68,.12);   color: var(--red);    border: 1px solid rgba(239,68,68,.25); }
.s-badge-orange { background: rgba(245,158,11,.12);  color: var(--orange); border: 1px solid rgba(245,158,11,.25); }
.s-badge-green  { background: rgba(34,197,94,.12);   color: var(--green);  border: 1px solid rgba(34,197,94,.25); }

/* ── Table ───────────────────────────────────────────────── */
.sup-tbl { width: 100%; border-collapse: collapse; font-size: .78rem; }
.sup-tbl th {
  text-align: left; padding: .5rem .75rem;
  border-bottom: 1px solid var(--bd);
  color: var(--text2); font-weight: 500;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .03em;
  white-space: nowrap;
}
.sup-tbl td { padding: .5rem .75rem; border-bottom: 1px solid var(--bd); }
.sup-tbl tr:last-child td { border: none; }
.sup-tbl tbody tr:hover td { background: var(--bg3); }
.cell-mono { font-family: var(--mono); font-size: .71rem; color: var(--text2); }
.cell-wrap { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tbl-empty { color: var(--green); font-size: .78rem; padding: .6rem 0; }
.tag { display: inline-block; padding: .1rem .4rem; border-radius: 3px; font-size: .65rem; font-family: var(--mono); }
.tag-red    { background: rgba(239,68,68,.12); color: var(--red); }
.tag-orange { background: rgba(245,158,11,.12); color: var(--orange); }

/* ── History block ───────────────────────────────────────── */
.history-block {
  background: var(--bg2); border: 1px solid var(--bd);
  border-radius: 10px; padding: 1.25rem; margin-bottom: 1.75rem;
}
.history-title { font-size: .72rem; font-weight: 600; color: var(--text2); margin-bottom: .85rem; }

.loading { color: var(--text2); font-size: .82rem; padding: 2rem 0; }
.err-msg { color: var(--red); font-size: .82rem; padding: 1rem 0; }
