/* Vue admin : statistiques d'usage (js/admin-stats.js) — Accueil = centre de pilotage */
.adm-page { --adm-a: var(--primary); --adm-b: #2a9d8f; --adm-c: #8a94a6; --adm-soft: #c9d3df; }
body.dark-mode .adm-page { --adm-a: #6ea8fe; --adm-b: #4fd1c5; --adm-c: #9aa4b2; --adm-soft: #3d4654; }
.adm-page .hl-header h2 { margin: 0; }
.adm-page.adm-hub { max-width: 1320px; }
.adm-page.is-loading { opacity: .55; pointer-events: none; }
.adm-header__tools { display: flex; gap: 8px; align-items: center; }
.adm-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.adm-icon-btn .fp-ic { width: 18px; height: 18px; }
.adm-icon-btn:hover, .adm-icon-btn:focus-visible { border-color: var(--adm-a); }
.adm-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 22px; }
.adm-card__head .adm-card__title { margin: 0; }
.adm-card__title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.adm-head-actions { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.adm-link { border: 0; background: none; padding: 4px 0; font-family: inherit; font-weight: 700; font-size: 13px; line-height: 1.2; color: var(--adm-a); cursor: pointer; white-space: nowrap; }
.adm-link:hover, .adm-link:focus-visible { text-decoration: underline; }
.adm-pill { border: 0; border-radius: 999px; padding: 4px 10px; font-family: inherit; font-weight: 700; font-size: 12px; line-height: 1.2; cursor: pointer; }
.adm-pill--bad { background: var(--bad-bg); color: var(--bad); }
.adm-sub { font-size: 12px; font-weight: 700; color: var(--text); margin: 4px 0 8px; }
.adm-seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--surface-soft); }
.adm-seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1; color: var(--muted); cursor: pointer; }
.adm-seg button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.adm-seg--sm { margin-bottom: 12px; }
.adm-seg--sm button { padding: 6px 10px; font-size: 12px; }
.adm-note { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--text); font-size: 13px; }

/* Sections et grille (1 à 3 colonnes) */
.adm-sec { margin: 0 0 22px; }
.adm-sec__hd { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.adm-sec__hd h3 { margin: 0; font-size: 16px; color: var(--text); }
.adm-sec__hd p { margin: 0; font-size: 12px; color: var(--muted); }
.adm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.adm-grid > .hl-card { min-width: 0; box-sizing: border-box; display: block; }
.adm-span-2 { grid-column: span 2; }
.adm-span-3 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .adm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .adm-span-2 { grid-column: 1 / -1; } }
@media (max-width: 760px) { .adm-grid { grid-template-columns: minmax(0, 1fr); } }

/* À traiter */
.adm-inbox { display: flex; flex-wrap: wrap; gap: 12px; }
.adm-inbox > .adm-todo { flex: 1 1 190px; }
.adm-inbox > .adm-todo--wide { flex: 2 1 340px; }
.adm-todo { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); border-left: 4px solid var(--adm-a); min-width: 0; }
.adm-todo--bad { border-left-color: var(--bad); }
.adm-todo--warn { border-left-color: var(--warn); }
.adm-todo__top { display: flex; align-items: center; justify-content: space-between; }
.adm-todo__ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-soft); color: var(--adm-a); }
.adm-todo--bad .adm-todo__ic { background: var(--bad-bg); color: var(--bad); }
.adm-todo--warn .adm-todo__ic { background: var(--warn-bg); color: var(--warn); }
.adm-todo__ic .fp-ic { width: 17px; height: 17px; }
.adm-todo__n { font-size: 26px; font-weight: 800; color: var(--text); }
.adm-todo__l { font-size: 14px; font-weight: 700; color: var(--text); }
.adm-todo__s { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.adm-todo__btn { align-self: flex-start; margin-top: auto; border: 0; border-radius: 10px; padding: 8px 12px; background: var(--primary); color: #fff; font-family: inherit; font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer; }
body.dark-mode .adm-todo__btn { background: var(--adm-a); color: #0b1320; }
.adm-todo__btn:focus-visible, .adm-link:focus-visible, .adm-seg button:focus-visible { outline: 2px solid var(--adm-a); outline-offset: 2px; }
.adm-inbox--ok { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--ok-bg); color: var(--ok); }
.adm-inbox--ok .fp-ic { width: 22px; height: 22px; flex: none; }
.adm-inbox--ok div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text); }
.adm-reqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; margin: 2px 0 10px; }
.adm-req { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-soft); font-size: 13px; color: var(--text); }
.adm-req span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.adm-req small { margin-left: 6px; color: var(--muted); font-size: 11px; }
.adm-req__x { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.adm-req__x:hover { background: var(--bad-bg); color: var(--bad); }
.adm-req__x .fp-ic { width: 15px; height: 15px; }

/* Chiffres clés */
.adm-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 6px; }
.adm-hero__t { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.adm-hero__v { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; }
.adm-hero__l { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 4px; }
.adm-hero__h { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adm-hero__note { margin: 0 0 22px; }
.adm-delta { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); white-space: nowrap; }
.adm-delta.is-good { background: var(--ok-bg); color: var(--ok); }
.adm-delta.is-bad { background: var(--bad-bg); color: var(--bad); }
.is-good { color: var(--ok); } .is-bad { color: var(--bad); } .is-warn { color: var(--warn); font-weight: 700; }

/* Indicateurs */
.adm-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.adm-kpi { padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); }
.adm-kpi__v { font-size: 22px; font-weight: 800; color: var(--text); }
.adm-kpi__l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adm-kpi__h { font-size: 10px; color: var(--muted); opacity: .8; }
.adm-facts { display: grid; margin: 4px 0; }
.adm-fact { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text); }
.adm-fact:last-child { border-bottom: 0; }
.adm-fact span small { display: block; font-size: 11px; color: var(--muted); }
.adm-fact strong { text-align: right; white-space: nowrap; }
.adm-fact strong small { font-weight: 500; color: var(--muted); margin-left: 4px; }

/* Graphiques SVG */
.adm-chart { position: relative; }
.adm-chart__max { position: absolute; top: -2px; left: 0; font-size: 10px; color: var(--muted); background: var(--surface); padding-right: 4px; }
.adm-bars { width: 100%; height: 90px; display: block; }
.adm-chart .adm-bars { height: 110px; padding-top: 12px; box-sizing: border-box; }
.adm-line { width: 100%; height: 130px; display: block; padding-top: 12px; box-sizing: border-box; overflow: visible; }
.adm-grid-line { stroke: var(--line); stroke-width: 1; }
.adm-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 4px; }
.adm-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.adm-keys i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.adm-legend { font-size: 12px; color: var(--muted); margin-top: 6px; }
.adm-rank { display: grid; gap: 10px; }
.adm-rank__hd { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text); }
.adm-rank__hd span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-rank__bar { height: 6px; border-radius: 999px; background: var(--surface-soft); margin-top: 4px; overflow: hidden; }
.adm-rank__bar i { display: block; height: 100%; border-radius: 999px; background: var(--adm-a); }
.adm-rank__sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Rétention : colonnes par semaine */
.adm-ret { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; align-items: end; }
.adm-ret__col { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.adm-ret__col.is-off { opacity: .4; }
.adm-ret__pct { font-size: 11px; font-weight: 700; color: var(--text); min-height: 14px; }
.adm-ret__bar { width: 100%; max-width: 44px; height: 110px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 6px; background: var(--surface-soft); overflow: hidden; }
.adm-ret__bar i { display: block; width: 100%; }
.adm-ret__bar i.r { background: var(--adm-a); } .adm-ret__bar i.n { background: var(--adm-b); } .adm-ret__bar i.o { background: var(--adm-soft); }
.adm-ret__n { font-size: 12px; font-weight: 700; color: var(--text); }
.adm-ret__d { font-size: 10px; color: var(--muted); }

/* Tableaux (en cartes sur téléphone) */
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
.adm-table th, .adm-table td { padding: 8px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.adm-table th:first-child { text-align: left; white-space: normal; }
.adm-table thead th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.adm-table tbody th { font-weight: 600; }
.adm-table tbody tr:last-child > * { border-bottom: 0; }
.adm-table td small { color: var(--muted); }
.adm-td-bar { position: relative; min-width: 90px; }
.adm-td-bar span { position: relative; z-index: 1; }
.adm-td-bar i { position: absolute; right: 8px; bottom: 3px; height: 3px; max-width: calc(100% - 16px); border-radius: 999px; background: var(--adm-a); opacity: .55; }
.adm-tag { font-style: normal; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); margin-left: 4px; white-space: nowrap; }
@media (max-width: 600px) {
  .adm-table thead { display: none; }
  .adm-table, .adm-table tbody, .adm-table tr, .adm-table th, .adm-table td { display: block; width: auto; }
  .adm-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .adm-table tbody tr:last-child { border-bottom: 0; }
  .adm-table th, .adm-table td { border: 0; padding: 0; text-align: left; white-space: normal; }
  .adm-table tbody th { grid-column: 1 / -1; }
  .adm-table td::before { content: attr(data-l); display: block; color: var(--muted); font-size: 11px; }
  .adm-td-bar i { display: none; }
}

/* Robot */
.adm-robot { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 900px) { .adm-robot { grid-template-columns: minmax(0, 1fr); } }
.adm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.adm-chip { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--text); }
.adm-chip b { margin-left: 3px; }
.adm-chip.is-good { background: var(--ok-bg); color: var(--ok); }
.adm-chip.is-bad { background: var(--bad-bg); color: var(--bad); }

/* Commun (pages des modules aussi) */
.adm-data { display: grid; gap: 2px; }
.adm-data__row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text); }
.adm-data__row:last-child { border-bottom: 0; }
.adm-data__row small { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.adm-errs { display: grid; gap: 8px; margin-top: 12px; }
.adm-err { padding: 8px 10px; border-radius: 10px; background: var(--bad-bg, #fff0ee); }
.adm-err__msg { font-size: 13px; color: var(--text); word-break: break-word; }
.adm-err__meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.adm-ok { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ok); }
.adm-ok .fp-ic { width: 18px; height: 18px; }
.adm-empty { font-size: 13px; color: var(--muted); padding: 8px 0; }
.adm-split { display: flex; height: 34px; border-radius: 10px; overflow: hidden; font: 700 12px/34px inherit; color: #fff; margin-top: 14px; }
.adm-split > div { padding: 0 10px; white-space: nowrap; overflow: hidden; }
.adm-split__app { background: var(--adm-b); }
.adm-split__site { background: var(--adm-c); }
.adm-select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.adm-btn { margin-top: 4px; }
@media (max-width: 520px) {
  .adm-header__tools { width: 100%; justify-content: space-between; }
  .adm-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-hero__v { font-size: 24px; }
  .adm-ret { gap: 4px; }
  .adm-ret__d { font-size: 9px; }
}

/* Admin › Robot (js/admin-robot.js) */
.adm-robot-card { cursor: pointer; }
.adm-robot-badge { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; }
.robot-adm { display: flex; flex-direction: column; gap: 10px; }
.robot-adm .fb-tabs--sub { margin-top: -2px; }
.robot-adm__item { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line, rgba(127,127,127,.25)); background: var(--surface, transparent); color: inherit; font: inherit; cursor: pointer; }
.robot-adm__item:hover { border-color: var(--primary); }
.robot-adm__hd { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.robot-adm__hd span, .robot-adm__phrase small { font-size: 11px; font-weight: 700; white-space: nowrap; }
.robot-adm .is-ok { color: var(--ok, #3cc08a); }
.robot-adm .is-bad { color: var(--bad, #e5776a); }
.robot-adm__detail, .robot-adm__meta { font-size: 12px; color: var(--muted); }
.robot-adm__wanted { font-size: 12px; font-weight: 600; color: var(--primary); }
.robot-adm__note { font-size: 12px; }
.robot-adm__bar { display: flex; gap: 8px; flex-wrap: wrap; }
.robot-adm__bar input { flex: 1; min-width: 160px; }
.robot-adm__phrase { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); font-size: 13px; }
.robot-adm__phrase span { flex: 1; }
.robot-adm__review p { margin: 4px 0 10px; }
.robot-adm__textarea { width: 100%; box-sizing: border-box; min-height: 70px; resize: vertical; }
.robot-adm__actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.robot-adm__back { align-self: flex-start; background: none; border: 0; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
/* À traiter sur téléphone : une ligne compacte par sujet */
@media (max-width: 520px) {
  .adm-todo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; padding: 12px 14px; }
  .adm-todo__top { display: contents; }
  .adm-todo__ic { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .adm-todo__n { grid-column: 3; grid-row: 1 / 3; align-self: center; font-size: 22px; }
  .adm-todo__l { grid-column: 2; grid-row: 1; }
  .adm-todo__s { grid-column: 2; grid-row: 2; margin: 0; }
  .adm-reqs, .adm-todo__btn { grid-column: 1 / -1; }
  .adm-reqs { margin: 8px 0 0; }
  .adm-todo__btn { margin-top: 10px; }
}
