/* SIGRA® prototype — design tokens (cf. skill dataviz / references/palette.md) */
.viz-root, body {
  color-scheme: light;
  --surface-0:      #f5f5f3;
  --surface-1:      #fcfcfb;
  --surface-2:      #ffffff;
  --border:         #e3e2dd;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #86847c;
  --series-1:       #2a78d6; /* blue   */
  --series-2:       #eb6834; /* orange */
  --series-3:       #1baf7a; /* aqua   */
  --series-7:       #4a3aa7; /* violet */
  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--surface-0); color: var(--text-primary);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}
a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  padding: 12px 24px; position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--series-1); }
.topbar nav { display: flex; gap: 6px; align-items: center; }
.topbar nav a { color: var(--text-secondary); font-size: 13px; font-weight: 600; padding: 6px 2px; border-bottom: 2px solid transparent; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text-primary); border-bottom-color: var(--series-1); text-decoration: none; }
.topbar nav a .nav-badge { display: inline-block; margin-left: 5px; min-width: 16px; padding: 1px 5px;
  border-radius: 9px; background: var(--status-critical); color: white; font-size: 10.5px; font-weight: 700;
  text-align: center; vertical-align: 2px; }
/* LOT 61 (Priorité 7 — simplifier l'expérience utilisateur) : les écrans
   sont regroupés par domaine dans des menus déroulants natifs
   <details>/<summary> plutôt qu'affichés à plat (cf. app.js::renderTopbar
   pour le regroupement) — un seul menu ouvert à la fois, jamais plus. */
.topbar nav > a, .topbar nav > details.nav-group { flex-shrink: 0; }
.topbar nav > details.nav-group { position: relative; }
.topbar nav > details.nav-group > summary {
  list-style: none; cursor: pointer; user-select: none; white-space: nowrap;
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  padding: 6px 8px; border-radius: 6px; border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 5px;
}
.topbar nav > details.nav-group > summary::-webkit-details-marker,
.topbar nav > details.nav-group > summary::marker { display: none; content: ""; }
.topbar nav > details.nav-group > summary::after { content: "▾"; font-size: 9px; color: var(--text-muted); }
.topbar nav > details.nav-group[open] > summary,
.topbar nav > details.nav-group > summary:hover { color: var(--text-primary); background: var(--surface-0); }
.topbar nav > details.nav-group.has-active > summary { color: var(--text-primary); border-bottom-color: var(--series-1); }
.topbar .nav-group-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(11, 11, 11, .14); padding: 6px; z-index: 20;
  display: flex; flex-direction: column; gap: 1px;
}
.topbar .nav-group-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 6px; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); border-bottom: none;
}
.topbar .nav-group-menu a.active, .topbar .nav-group-menu a:hover {
  background: var(--surface-0); color: var(--text-primary); text-decoration: none; border-bottom: none;
}
/* LOT 44 : identité courante (remplace le sélecteur de tenant — le tenant
   découle désormais de la session authentifiée, cf. app.js::renderTopbar). */
.topbar .identity-box { margin-left: auto; text-align: right; line-height: 1.35; }
.topbar .identity-nom { font-size: 12.5px; font-weight: 700; color: var(--text-primary); }
.topbar .identity-detail { font-size: 11px; color: var(--text-muted); }
#logout-btn { padding: 6px 12px; font-size: 12px; }
/* LOT 53.1 — sélecteur de langue (SIGRA® INTERNATIONAL), groupé avec
   l'identité/déconnexion à droite (cf. app.js::renderTopbar pour l'ordre
   des enfants qui produit ce regroupement via le margin-left:auto ci-dessus). */
#langue-select { padding: 6px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-0); color: var(--text-primary); }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 28px 0 12px; color: var(--text-primary); }
.subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px;
}
.stat-tile .stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.stat-tile .stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-tile .stat-value.good { color: var(--status-good); }
.stat-tile .stat-value.critical { color: var(--status-critical); }
.stat-tile .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
tr:hover td { background: var(--surface-0); }
tbody tr { cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.badge.good { color: #0a4d0a; background: #e4f6e4; } .badge.good::before { background: var(--status-good); }
.badge.warning { color: #6b4600; background: #fff3dc; } .badge.warning::before { background: var(--status-warning); }
.badge.serious { color: #7a2f16; background: #fde6dc; } .badge.serious::before { background: var(--status-serious); }
.badge.critical { color: #5c1414; background: #fbdcdc; } .badge.critical::before { background: var(--status-critical); }
.badge.neutral { color: var(--text-secondary); background: var(--surface-0); } .badge.neutral::before { background: var(--text-muted); }

.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
  font-size: 13px; color: var(--text-primary);
}
button {
  padding: 7px 14px; border-radius: 6px; border: 1px solid var(--series-1); background: var(--series-1);
  color: white; font-size: 13px; font-weight: 600; cursor: pointer;
}
button.secondary { background: var(--surface-2); color: var(--series-1); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Matrice de risque 5x5 */
.matrix-wrap { display: flex; gap: 12px; }
.matrix { display: grid; grid-template-columns: repeat(5, 64px); grid-template-rows: repeat(5, 64px); gap: 3px; }
.matrix .cell {
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white; cursor: pointer; position: relative;
  transition: transform .1s;
}
.matrix .cell:hover { transform: scale(1.05); outline: 2px solid var(--text-primary); }
.matrix .cell.empty { color: var(--text-muted); font-weight: 400; font-size: 12px; }
.axis-y { display: flex; flex-direction: column-reverse; justify-content: space-between; }
.axis-y span, .axis-x span { font-size: 11px; color: var(--text-secondary); }
.axis-x { display: flex; justify-content: space-between; width: 100%; padding-left: 34px; }
.matrix-col { display: flex; flex-direction: column; gap: 6px; }
.matrix-labels { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; }

.legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.legend .item { display: flex; align-items: center; gap: 5px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.drilldown-panel {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
  min-width: 320px; max-width: 380px;
}
.chip { display: inline-block; padding: 3px 9px; border-radius: 20px; background: var(--surface-0); font-size: 12px; margin: 2px; cursor: pointer; }
.chip:hover { background: var(--series-1); color: white; }

.timeline { border-left: 2px solid var(--border); padding-left: 18px; margin-left: 6px; }
.timeline .step { position: relative; padding-bottom: 20px; }
.timeline .step::before { content: ""; position: absolute; left: -23px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--series-1); }
.timeline .step .step-title { font-weight: 700; font-size: 13px; }
.timeline .step .step-body { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-secondary); }
.kv dd { margin: 0; }

.section-note { font-size: 12px; color: var(--text-muted); background: var(--surface-0); border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.empty-state { color: var(--text-muted); font-size: 13px; padding: 24px; text-align: center; }
