/* Reporting Easyweb — feuille de style unique, sans dépendance externe. */

:root {
  color-scheme: light;
  --page:            #f9f9f7;
  --surface-1:       #fcfcfb;
  --surface-2:       #f2f1ed;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --muted:           #898781;
  --gridline:        #e1e0d9;
  --baseline:        #c3c2b7;
  --border:          rgba(11, 11, 11, 0.10);
  --series-1:        #0d94a3;
  --brand-deep:      #0E3A44;
  --good:            #0ca30c;
  --warning:         #fab219;
  --critical:        #d03b3b;
  --success-text:    #006300;
  --radius:          10px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --surface-2:      #232322;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --muted:          #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --series-1:       #26a3b0;
    --brand-deep:     #0b2f38;
    --success-text:   #0ca30c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface-1:      #1a1a19;
  --surface-2:      #232322;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --muted:          #898781;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --series-1:       #26a3b0;
  --brand-deep:     #0b2f38;
  --success-text:   #0ca30c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px 64px; }

/* ------------------------------------------------------------------ en-tête */

.topbar {
  background: var(--brand-deep);
  color: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1440px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand__dot { width: 10px; height: 10px; border-radius: 50%; background: #4DBCC6; }
.brand small { font-weight: 400; opacity: 0.72; letter-spacing: 0; }
.topbar nav { margin-left: auto; display: flex; gap: 18px; align-items: center; font-size: 14px; }
.topbar nav a { color: #cfe7ea; text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: #fff; border-bottom-color: #4DBCC6; }

/* ------------------------------------------------------------------- entête page */

.page-head { padding: 32px 0 20px; display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.page-head p { margin: 6px 0 0; color: var(--text-secondary); }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); text-decoration: none; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn--primary:hover { filter: brightness(1.06); background: var(--series-1); }

/* ------------------------------------------------------------------- bandeaux */

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-secondary); font-size: 14px; margin-bottom: 20px;
}
.banner strong { color: var(--text-primary); }
.banner--demo { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, var(--surface-1)); }

/* --------------------------------------------------------------------- cartes */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.card__label { color: var(--text-secondary); font-size: 13px; margin: 0 0 6px; }
.card__value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.card__foot { margin: 8px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card__foot .delta { white-space: nowrap; }
.card--hero .card__value { font-size: 52px; line-height: 1.05; }
.card--hero .card__foot { display: block; }
.card--hero .card__foot .delta { display: block; margin-bottom: 2px; }

.delta { font-size: 13px; font-weight: 600; }
.delta--up { color: var(--success-text); }
.delta--down { color: var(--critical); }
.delta--flat { color: var(--muted); font-weight: 400; }

/* -------------------------------------------------------------------- tableau */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-1); text-align: right; font-weight: 600;
  color: var(--text-secondary); padding: 12px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--baseline); font-size: 12.5px;
}
thead th:first-child, tbody td:first-child { text-align: left; }
tbody td { padding: 11px 12px; white-space: nowrap; text-align: right; border-bottom: 1px solid var(--gridline); font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.cell-client { min-width: 240px; white-space: normal; }
.cell-client a { font-weight: 600; text-decoration: none; }
.cell-client a:hover { text-decoration: underline; }
.cell-client small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
td.na { color: var(--muted); }

.flag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 4px; margin-right: 6px;
  font-size: 11px; font-weight: 700; color: #1a1a19; vertical-align: 1px;
}
.flag--warning  { background: var(--warning); }
.flag--critical { background: var(--critical); color: #fff; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 14px 2px 0; font-size: 13px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.spark { vertical-align: middle; }

/* ---------------------------------------------------------------- fiche client */

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px; }
.panel h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -0.01em; }
.panel .hint { margin: 0 0 16px; color: var(--text-secondary); font-size: 13.5px; }

.metric-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.metric-picker a {
  font-size: 13px; padding: 5px 10px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--border); color: var(--text-secondary);
}
.metric-picker a[aria-current="true"] { background: var(--series-1); border-color: var(--series-1); color: #fff; }

.chart { position: relative; margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text.axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.tooltip {
  position: absolute; pointer-events: none; transform: translate(-50%, -120%);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}
.tooltip b { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 14px; margin: 12px 0; }

.kv { width: 100%; font-size: 14px; }
.kv td { padding: 8px 0; border-bottom: 1px solid var(--gridline); }
.kv td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.meter { display: inline-block; width: 84px; height: 6px; border-radius: 3px; background: var(--gridline); vertical-align: middle; overflow: hidden; }
.meter__fill { display: block; height: 100%; background: var(--series-1); }

.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); }
.stale { color: var(--critical); }

/* ---------------------------------------------------------------------- login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login p { margin: 0 0 20px; color: var(--text-secondary); font-size: 14px; }
.login label { display: block; font-size: 13px; color: var(--text-secondary); margin: 14px 0 5px; }
.login input { width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--baseline); background: var(--page); color: var(--text-primary); font: inherit; }
.login .btn { width: 100%; margin-top: 20px; text-align: center; }
.error { color: var(--critical); font-size: 13.5px; margin-top: 14px; }

footer.foot { margin-top: 34px; color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ formulaires */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; }
.field input[type="text"], .field select {
  width: 100%; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--baseline);
  background: var(--page); color: var(--text-primary); font: inherit;
}
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
fieldset.na { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 18px 0; }
fieldset.na legend { font-size: 13px; color: var(--text-secondary); padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; }
.check input { width: 16px; height: 16px; }
.visually { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
