/* ── Logo dot ── */
.logo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  animation: blink 2.4s ease-in-out infinite;
}

/* ── Control group ── */
.ctl-group {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); min-height: 38px;
}
.ctl-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--muted-2); text-transform: uppercase; white-space: nowrap;
}

/* ── Inputs & selects ── */
input[type="date"],
input[type="search"],
select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text); outline: none;
  min-height: 34px; padding: 6px 10px;
  border-radius: 7px; font-family: var(--mono); font-size: 11px;
  transition: border-color .14s, background .14s;
}
input[type="date"]:focus,
input[type="search"]:focus,
select:focus {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
input[type="search"] { width: 200px; }
input[type="date"]   { width: 140px; }
select               { width: 160px; }
input::placeholder   { color: var(--muted-2); }

/* ── Buttons ── */
.btn {
  min-height: 38px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-family: var(--mono); font-size: 10px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  transition: border-color .14s, background .14s, color .14s, transform .08s;
}
.btn:hover   { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.btn:active  { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--accent-dark); border-color: transparent; color: #fff; }
.btn-ghost   { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
#bar-info { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  white-space: nowrap; letter-spacing: .04em;
}
.badge-red    { color: var(--red);    background: var(--red-bg);    border-color: var(--red-border); }
.badge-orange { color: var(--orange); background: var(--orange-bg); border-color: var(--orange-border); }
.badge-green  { color: var(--green);  background: var(--green-bg);  border-color: var(--green-border); }
.badge-gray   { color: var(--gray);   background: var(--gray-bg);   border-color: var(--gray-border); }
.badge-blue   { color: var(--accent); background: var(--accent-light); border-color: var(--accent-mid); }
.badge-outline { background: transparent; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-title { font-family: var(--mono); font-size: 11px; color: var(--text); letter-spacing: .04em; }
.card-sub   { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* ── Empty state ── */
.empty {
  padding: 36px 18px; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--muted-2); font-family: var(--mono); font-size: 11px;
  border: 1px dashed var(--border-2); border-radius: 10px; background: var(--surface-2);
}

/* ── Spinner ── */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  display: inline-block;
  animation: spin .75s linear infinite; vertical-align: middle;
}

/* ── Tables ── */

.tbl-wrap {
  overflow: auto; 
  max-height: calc(100vh - 240px); /* Forcer le scroll interne (s'adapte à l'écran) */
  border: 1px solid var(--border);
  border-radius: 12px; 
  background: var(--surface);
  will-change: scroll-position;
}
.tbl-wrap::-webkit-scrollbar { height: 6px; width: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }

table { 
  width: 100%; 
  min-width: 860px; 
  border-collapse: separate; /* Indispensable pour un sticky propre sans bug de bordure */
  border-spacing: 0; 
}

/* On applique le sticky directement sur les cellules th (et non thead tr) */
thead th {
  position: sticky; 
  top: 0; 
  z-index: 10;
  background: var(--surface-2); /* Doit être opaque pour cacher les lignes défilantes */
  border-bottom: 1px solid var(--border);
  background-clip: padding-box;
  
  padding: 11px 14px; text-align: left;
  font-family: var(--mono); font-size: 9px; font-weight: 400;
  color: var(--muted-2); text-transform: uppercase; letter-spacing: .1em; white-space: nowrap;
}

th.r, td.r { text-align: right; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── ROI trend ── */
.ov-roi-value { font-weight: 700; line-height: 1.2; }
.ov-roi-trend {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 4px; margin-top: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.roi-trend-up      { background: var(--green-bg);   color: var(--green); }
.roi-trend-down    { background: var(--red-bg);      color: var(--red); }
.roi-trend-warning { background: var(--orange-bg);   color: var(--orange); }
.roi-trend-muted   { background: var(--gray-bg);     color: var(--gray); }

/* ── Formula tooltip ── */
.formula-th { cursor: help; }
.formula-tooltip {
  position: fixed; display: none; max-width: 420px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  line-height: 1.45; white-space: normal; z-index: 99999;
  pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}