/* SuniSight — design system Sunitech (spec section 8).
   Charte sombre premium "mettre l'IT en pleine lumiere".
   Separation par surfaces, espace et typographie. Pas de bordures, pas d'ombres.
   Chiffres dominants en mono. Un seul accent dominant par ecran. */

:root {
  --bg-app: #0a0e14;
  --bg-surface: #10161f;
  --bg-surface-2: #151d28;
  --bg-surface-strong: #1a2330;
  --bg-rail: #0c1119;

  --text-primary: #f3f6fa;
  --text-secondary: #97a3b4;
  --text-muted: #5d6a7b;

  /* Accent lumiere = bleu de marque Sunitech (UNITECH). L'ambre du placeholder
     d'origine est abandonne (cf. charte). C'est l'unique accent dominant. */
  --light: #60a5fa;
  --light-soft: #93c5fd;
  --light-deep: #3b82f6;

  --cool: #5b93f0;
  --success: #46c08a;
  --warning: #e2a83f;
  --danger: #e35d4c;

  --sev-critical: #e35d4c;
  --sev-high: #e2873f;
  --sev-medium: #e2a83f;
  --sev-low: #5b93f0;
  --sev-info: #6b7787;

  --radius-card: 16px;
  --radius-chip: 999px;
  --radius-input: 12px;

  --font-display: "Schibsted Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 3vw, 32px); margin: 0; }
h2 { font-size: clamp(17px, 2vw, 21px); margin: 0; }
h3 { font-size: 15px; margin: 0; }

a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }

/* --- Shell: rail silencieux + contenu dominant --- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--bg-rail);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 22px;
}
.brand .hex {
  width: 30px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--bg-app);
  background: var(--light);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.brand .name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.brand .name b { color: var(--light); font-weight: 600; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--bg-surface); color: var(--text-primary); }
.nav-item.active { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-item.active .ico { color: var(--light); }
.nav-item .ico { width: 18px; height: 18px; color: var(--text-muted); }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 16px 12px 6px; }
.rail .spacer { flex: 1; }
.rail .foot { font-size: 11px; color: var(--text-muted); padding: 10px 12px; }

.main { padding: 30px clamp(20px, 4vw, 44px) 64px; max-width: 1280px; }

/* --- Topbar de page --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-secondary); font-size: 14px; margin-top: 6px; }
.crumb { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.crumb a:hover { color: var(--text-secondary); }

/* --- Cartes / surfaces --- */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 22px 24px;
}
.card.tight { padding: 18px 20px; }
.card-2 { background: var(--bg-surface-2); }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 18px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* --- KPI --- */
.kpi .label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.kpi .value { font-family: var(--font-mono); font-size: clamp(28px, 4vw, 40px); font-weight: 600; line-height: 1.1; margin-top: 8px; }
.kpi .hint { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* --- Hero score de risque: seul element avec halo lumineux contenu --- */
.hero {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  padding: 30px 32px;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute; z-index: -1;
  width: 360px; height: 360px;
  right: -90px; top: -140px;
  background: radial-gradient(circle, color-mix(in srgb, var(--light) 32%, transparent), transparent 68%);
  filter: blur(8px);
  pointer-events: none;
}
.hero .label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.hero .score { font-family: var(--font-mono); font-size: clamp(48px, 8vw, 68px); font-weight: 600; line-height: 1; color: var(--light); margin: 10px 0 2px; }
.hero .score small { font-size: 22px; color: var(--text-muted); font-weight: 500; }
.hero .caption { color: var(--text-secondary); font-size: 14px; max-width: 46ch; }

/* --- Chips de severite / statut --- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: var(--radius-chip);
  background: var(--bg-surface-2);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.chip .n { font-family: var(--font-mono); color: var(--text-primary); }
.chip.critical .dot { background: var(--sev-critical); }
.chip.high .dot { background: var(--sev-high); }
.chip.medium .dot { background: var(--sev-medium); }
.chip.low .dot { background: var(--sev-low); }
.chip.info .dot { background: var(--sev-info); }
.chip.on { background: color-mix(in srgb, var(--light) 14%, var(--bg-surface-2)); color: var(--text-primary); }

.sev-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.sev-critical { background: var(--sev-critical); }
.sev-high { background: var(--sev-high); }
.sev-medium { background: var(--sev-medium); }
.sev-low { background: var(--sev-low); }
.sev-info { background: var(--sev-info); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: var(--radius-chip); background: var(--bg-surface-2); color: var(--text-secondary); }
.badge.en_cours { color: var(--light); background: color-mix(in srgb, var(--light) 12%, var(--bg-surface-2)); }
.badge.termine { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--bg-surface-2)); }
.badge.actif { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--bg-surface-2)); }
.badge.revoque { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--bg-surface-2)); }
.badge.expire { color: var(--text-muted); }

/* --- Tables: pas de bordures, separation par espace et zebra discrete --- */
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 10px 14px;
}
table.data td { padding: 13px 14px; font-size: 14px; vertical-align: middle; }
table.data tbody tr { background: var(--bg-surface); transition: background .12s ease; }
table.data tbody tr:nth-child(even) { background: var(--bg-surface-2); }
table.data tbody tr:hover { background: var(--bg-surface-strong); }
table.data td:first-child, table.data th:first-child { border-radius: 10px 0 0 10px; }
table.data td:last-child, table.data th:last-child { border-radius: 0 10px 10px 0; }
table.data tbody tr td { border: 0; }
.t-wrap { border-spacing: 0 6px; }
table.data.spaced { border-collapse: separate; border-spacing: 0 7px; }

.cell-strong { color: var(--text-primary); font-weight: 500; }
.cell-asset { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  padding: 9px 16px; border-radius: var(--radius-input);
  background: var(--bg-surface-strong); color: var(--text-primary);
  border: 0; cursor: pointer; transition: background .15s ease, opacity .15s ease;
}
.btn:hover { background: #212c3c; }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--light); color: #06101f; font-weight: 600; }
.btn.primary:hover { background: var(--light-soft); }
.btn.ghost { background: transparent; color: var(--text-secondary); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.btn.sm { padding: 6px 11px; font-size: 13px; }

.actions { display: flex; gap: 8px; align-items: center; }

/* --- Formulaires --- */
.form-grid { display: grid; gap: 18px; max-width: 760px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; color: var(--text-secondary); }
.field .req { color: var(--light); }
input[type="text"], input[type="email"], input[type="date"], input[type="number"], select, textarea {
  font-family: var(--font-body); font-size: 14px; color: var(--text-primary);
  background: var(--bg-surface-2); border: 0; border-radius: var(--radius-input);
  padding: 11px 13px; width: 100%; outline: none;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: right 16px center, right 11px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-foot { display: flex; gap: 12px; align-items: center; margin-top: 6px; }

/* --- Filtres --- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; min-width: 150px; padding-top: 8px; padding-bottom: 8px; }

/* --- Etat vide --- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty .big { font-family: var(--font-display); font-size: 17px; color: var(--text-secondary); margin-bottom: 6px; }

.linklike:hover { color: var(--light); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px; }
.spaced-top { margin-top: 26px; }
.prose { color: var(--text-secondary); white-space: pre-wrap; line-height: 1.6; }
.divider { height: 1px; background: var(--bg-surface-2); margin: 0; border: 0; }

/* --- Check-list d'entretien (questionnaire) --- */
/* UX: toggles segmentes etiquetes (couleur + texte, jamais couleur seule),
   progression en direct, descriptions par controle. (uupm: ux/Forms, ux/Feedback) */
.cl-sticky {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg-app) 86%, transparent);
  backdrop-filter: blur(10px);
  padding: 14px 0 14px; margin-bottom: 8px;
}
.cl-sticky-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.cl-overall { flex: 1; min-width: 220px; }
.cl-overall .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.cl-overall .top .t { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.cl-overall .top .n { font-family: var(--font-mono); font-size: 14px; color: var(--text-primary); }

.cl-bar { height: 7px; background: var(--bg-surface-2); border-radius: 999px; overflow: hidden; }
.cl-bar .fill { height: 100%; width: 0; background: var(--light); border-radius: 999px; transition: width .3s ease; }

.cl-saved { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--success) 14%, var(--bg-surface-2)); color: var(--success); font-size: 13px; }

.cl-fn { background: var(--bg-surface); border-radius: var(--radius-card); padding: 20px 22px; margin-bottom: 16px; }
.cl-fn-head { display: flex; align-items: center; gap: 13px; margin-bottom: 6px; }
.cl-fn-badge { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--light);
  background: color-mix(in srgb, var(--light) 15%, var(--bg-surface-2)); }
.cl-fn-head h2 { font-size: 17px; }
.cl-fn-head .mini { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 130px; }
.cl-fn-head .mini .n { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.cl-fn-head .mini .cl-bar { flex: 1; height: 5px; }

.cl-item { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "info controls" "extra extra";
  gap: 9px 18px; padding: 13px 12px; border-radius: 12px; transition: background .12s ease; }
.cl-item:hover { background: var(--bg-surface-2); }
.cl-info { grid-area: info; }
.cl-info .lbl { font-size: 14.5px; color: var(--text-primary); font-weight: 500; }
.cl-info .desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.45; }
.cl-controls { grid-area: controls; }
.cl-extra { grid-area: extra; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-opt span { display: inline-block; padding: 7px 13px; border-radius: 999px; font-size: 12.5px;
  background: var(--bg-surface-2); color: var(--text-secondary); transition: background .12s ease, color .12s ease; white-space: nowrap; }
.cl-item:hover .seg-opt span { background: var(--bg-surface-strong); }
.seg-opt:hover span { color: var(--text-primary); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--light); outline-offset: 2px; }
.seg-opt.s-conforme input:checked + span { background: color-mix(in srgb, var(--success) 24%, var(--bg-surface-2)); color: #c4f0db; }
.seg-opt.s-partiel input:checked + span { background: color-mix(in srgb, var(--warning) 24%, var(--bg-surface-2)); color: #f2dcab; }
.seg-opt.s-non_conforme input:checked + span { background: color-mix(in srgb, var(--danger) 26%, var(--bg-surface-2)); color: #f4c2b9; }
.seg-opt.s-non_applicable input:checked + span { background: var(--bg-surface-strong); color: var(--text-primary); }

.cl-prio { display: inline-flex; align-items: center; gap: 5px; }
.cl-prio .lab { font-size: 11px; color: var(--text-muted); margin-right: 3px; }
.cl-prio-opt { position: relative; cursor: pointer; }
.cl-prio-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.cl-prio-opt span { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; color: var(--text-muted); transition: background .12s, color .12s; }
.cl-prio-opt:hover span { color: var(--text-secondary); }
.cl-prio-opt.p-haute input:checked + span { background: color-mix(in srgb, var(--danger) 20%, var(--bg-surface-2)); color: #f4c2b9; }
.cl-prio-opt.p-moyenne input:checked + span { background: color-mix(in srgb, var(--warning) 20%, var(--bg-surface-2)); color: #f2dcab; }
.cl-prio-opt.p-basse input:checked + span { background: var(--bg-surface-strong); color: var(--text-secondary); }

.cl-note { flex: 1; min-width: 180px; background: transparent; padding: 6px 0; font-size: 13px;
  color: var(--text-secondary); border-radius: 0; }
.cl-note:focus { background: var(--bg-surface-2); border-radius: 8px; padding: 6px 10px; }

@media (max-width: 760px) {
  .cl-item { grid-template-columns: 1fr; grid-template-areas: "info" "controls" "extra"; }
  .cl-fn-head .mini { min-width: 0; }
}

/* --- Polish site-wide (uupm: product/Analytics Dashboard = Dark + Data-Dense ;
   ux/Hover States, ux/Reduced Motion). Depth par les tons et le mouvement, pas
   d'ombres decoratives ; halo reserve au hero. --- */

/* Boutons : retour tactile au clic. */
.btn:active { transform: translateY(1px); }
.btn.primary:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--light) 40%, transparent); }

/* Lignes de table cliquables : liseré d'accent au survol (repere de scan). */
table.data tbody tr[onclick] { position: relative; }
table.data tbody tr[onclick] td:first-child { box-shadow: inset 3px 0 0 transparent; transition: box-shadow .12s ease; }
table.data tbody tr[onclick]:hover td:first-child { box-shadow: inset 3px 0 0 var(--light); }

/* Cartes cliquables. */
.card[onclick], a.card { cursor: pointer; }

/* Etat vide : pastille d'icone. */
.empty .ico-wrap { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  margin: 0 auto 14px; background: var(--bg-surface-2); color: var(--text-muted); }

/* --- Jauge de score (hero) : SVG custom, valeur + texte (uupm: chart/Gauge). --- */
.gauge { position: relative; width: 168px; height: 168px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: var(--bg-surface-2); stroke-width: 10; }
.gauge .prog { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.7,.2,1); }
.gauge .prog.band-danger { stroke: var(--danger); }
.gauge .prog.band-warning { stroke: var(--warning); }
.gauge .prog.band-light { stroke: var(--light); }
.gauge .prog.band-success { stroke: var(--success); }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-center .val { font-family: var(--font-mono); font-size: 46px; font-weight: 600; line-height: 1; color: var(--text-primary); }
.gauge-center .den { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.hero-row { display: flex; align-items: center; gap: 26px; }

/* --- Barre empilee de repartition par severite (uupm: chart/Bullet, Data-Dense). --- */
.sevstack { display: flex; height: 11px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--bg-surface-2); margin-top: 12px; }
.sevstack .seg { min-width: 5px; transition: flex-grow .4s ease; }
.sevstack .seg.s-critical { background: var(--sev-critical); }
.sevstack .seg.s-high { background: var(--sev-high); }
.sevstack .seg.s-medium { background: var(--sev-medium); }
.sevstack .seg.s-low { background: var(--sev-low); }
.sevstack .seg.s-info { background: var(--sev-info); }
.sevstack.clean { background: color-mix(in srgb, var(--success) 30%, var(--bg-surface-2)); }

/* --- Animation d'entree, discrete et une seule passe (gated reduced-motion). --- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes uiRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  .page-head, .hero, .card, .cl-fn { animation: uiRise .42s cubic-bezier(.2,.7,.2,1) both; }
  .grid .card:nth-child(2), .row .card:nth-child(2) { animation-delay: .05s; }
  .grid .card:nth-child(3), .row .card:nth-child(3) { animation-delay: .1s; }
  .grid .card:nth-child(4), .row .card:nth-child(4) { animation-delay: .15s; }
  .gauge .prog { animation: none; }
}

/* --- Analyse IA : edition des recommandations --- */
.rec-head { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 0 0 8px; }
.rec-row { display: grid; grid-template-columns: 1fr 156px; gap: 14px; align-items: start; padding: 12px; border-radius: 12px; transition: background .12s ease; }
.rec-row:hover { background: var(--bg-surface-2); }
.rec-main { display: flex; flex-direction: column; gap: 8px; }
.rec-row textarea { min-height: 56px; }
@media (max-width: 760px) { .rec-row { grid-template-columns: 1fr; } }

/* --- Accessibilite: focus clavier visible --- */
:focus-visible { outline: 2px solid var(--light); outline-offset: 2px; border-radius: 6px; }

/* --- Responsive --- */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; align-items: center;
    flex-wrap: wrap; gap: 4px; padding: 12px 14px;
  }
  .rail .brand { padding: 4px 8px; }
  .rail .spacer, .rail .foot, .nav-section { display: none; }
  .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .field-2, .field-3 { grid-template-columns: 1fr; }
  .main { padding: 22px 16px 48px; }
}

/* --- Motion reduit respecte --- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
