/* Mise en page propre à l'application. Tout passe par les jetons Mydral UI. */
html, body { min-height: 100%; }
body.md-app { display: flex; flex-direction: column; min-height: 100vh; }
.page { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: var(--space-5) var(--space-4) 40px; box-sizing: border-box;
  display: grid; gap: var(--space-5); align-content: start; }
.view { display: grid; gap: var(--space-5); }
.view[hidden] { display: none; }
.page > *, .view > * { min-width: 0; }
.md-brand img { height: 42px; }

.hero-kpis { margin-top: 22px; }
.toolbar { display: flex; gap: var(--space-3) var(--space-5); flex-wrap: wrap; align-items: center; }
.toolbar__label, .inline-field { color: var(--muted); font-size: 13px; }
.inline-field { display: inline-flex; gap: 8px; align-items: center; }
.inline-field .md-select { padding: 6px 10px; font-size: 14px; background: var(--surface); }

.grid-2, .grid-3 { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-2 > .md-card, .grid-3 > .md-card { min-width: 0; }

.view-head .page-title { margin: 0; font: 700 30px/1.2 var(--font-sans); color: var(--heading); }
.lead { margin: 8px 0 0; color: var(--muted); }
.sub-title { margin: 18px 0 6px; font: 700 15px/1.3 var(--font-sans); color: var(--heading); }
.muted, .hint { color: var(--muted); font-size: 13px; }
.hint:empty { display: none; }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: 16px; }
.posts-note { margin: 0 0 12px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* enseignements */
.findings { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.finding { background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 22px 18px 16px; position: relative; }
.finding::before { content: ""; position: absolute; top: 12px; left: 18px; width: 34px; height: 4px; border-radius: 2px; background: var(--violet); }
.finding h3 { margin: 6px 0 6px; font: 700 12px/1.4 var(--font-sans); color: var(--orange-ink); text-transform: uppercase; letter-spacing: .12em; }
.finding p { margin: 0; font-size: 14px; }

/* tableaux */
.md-table td.text { white-space: normal; min-width: 260px; max-width: 460px; }
.md-table td.text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.md-table tr.is-young td { color: var(--muted); }
.md-table .rank { color: var(--muted); font-variant-numeric: tabular-nums; }

/* graphiques */
.chart { position: relative; width: 100%; min-height: 200px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--font-sans); font-size: 11.5px; fill: var(--tick); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .bar-label { fill: var(--ink); font-size: 12px; }
.chart .bar-value { fill: var(--heading); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .end-label { fill: var(--heading); font-weight: 700; font-size: 12px; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar:hover, .chart .bar.is-hover { filter: brightness(1.12); }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart-empty { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }

.tooltip { position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; line-height: 1.4; max-width: 280px; }
.tooltip strong { color: var(--heading); font-variant-numeric: tabular-nums; }
.tooltip .tt-head { color: var(--muted); font-size: 12px; }

@media (max-width: 640px) {
  .md-header { padding: 14px 16px 10px; }
  .md-hero__title { font-size: 26px; }
  .view-head .page-title { font-size: 24px; }
}

/* logo officiel : version blanche sur fond sombre */
.logo-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

/* liens stylés en bouton : la couleur de lien de .md-app ne doit pas l'emporter */
.md-app a.md-btn { color: var(--on-dark); text-decoration: none; }
.md-app a.md-btn--outline { color: var(--heading); }
.md-app a.md-btn[aria-disabled] { opacity: .45; pointer-events: none; }

.view-head--action { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.md-kpi__sub .up, .md-kpi__sub .down { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- vue 360 et emailing */
.grid-2-1 { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 960px) { .grid-2-1 { grid-template-columns: minmax(0, 1fr); } }
.card-link { margin-left: auto; font-size: 14px; font-weight: 700; }
.md-card__title .card-link { align-self: center; }

.sources { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.source { display: grid; gap: 14px; align-content: start; }
.source__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.source__head h2 { margin: 0; font: 700 19px/1.3 var(--font-sans); color: var(--heading); }
.source__head .card-link { margin-left: auto; }
.source__metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { background: var(--mist); border-radius: var(--radius-md); padding: 10px 12px; min-width: 0; }
.metric__label { margin: 0; font-size: 12px; color: var(--muted); }
.metric__value { margin: 2px 0 0; font: 700 20px/1.2 var(--font-sans); color: var(--heading); font-variant-numeric: tabular-nums; }
.metric__delta { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.spark__label { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.source--empty { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.source--empty p { margin: 0; color: var(--muted); font-size: 14px; }
.source__chips { display: flex; gap: 8px; flex-wrap: wrap; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity__date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.activity__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity__title .md-chip { margin-right: 6px; }
.activity__nums { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.activity__nums strong { color: var(--heading); }
@media (max-width: 640px) {
  .activity li { grid-template-columns: 1fr; }
  .activity__nums { text-align: left; }
  .source__metrics { grid-template-columns: 1fr 1fr; }
}

.notice { background: var(--surface); }
.notice__list { display: grid; gap: 14px; }
.notice__item h3 { margin: 0 0 4px; font: 700 14px/1.35 var(--font-sans); color: var(--heading); }
.notice__item p { margin: 0; font-size: 14px; }
.notice__item .md-chip { margin-right: 6px; vertical-align: 1px; }
.notice__apple { margin: 16px 0 0; font-size: 13px; }

.multiples { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.multiple__title { margin: 0 0 4px; font: 700 13px/1.3 var(--font-sans); color: var(--muted); }
.chart--short { min-height: 240px; }
.md-table--compact th, .md-table--compact td { padding: 7px 6px; font-size: 13.5px; }
.md-table--compact td.text { min-width: 140px; max-width: 220px; }
.md-table .pill-cell { white-space: nowrap; }
.spark svg { display: block; width: 100%; overflow: visible; }
.spark .hit { fill: transparent; cursor: crosshair; }

.header-collect { margin-left: 4px; }
.md-app a.header-collect { color: var(--ink); }
.md-app a.header-collect[aria-current="page"] { border-color: var(--orange); color: var(--heading); }
.share { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.share .md-bar { width: 90px; min-width: 90px; }
.last-run { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.last-run::first-letter { text-transform: uppercase; }
.last-run .md-pill { margin-left: 4px; }

/* ---------- sous-navigation (LinkedIn, Site web) */
.subnav { margin-bottom: -6px; }
.subnav a { font: 500 14px var(--font-sans); padding: 5px 14px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; }
.md-app .subnav a:hover { text-decoration: none; border-color: var(--heading); }
.md-app .subnav a[aria-current="page"] { background: var(--navy); color: var(--on-dark); border-color: var(--navy); font-weight: 700; }

/* ---------- vitesse */
.speed-pages { display: grid; gap: var(--space-5); align-content: start; }
.speed-page h2 { word-break: break-all; }
.speed-cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.speed-col { background: var(--mist); border-radius: var(--radius-md); padding: 14px 16px; }
.speed-col h3 { margin: 0 0 6px; font: 700 12px/1.4 var(--font-sans); color: var(--orange-ink); text-transform: uppercase; letter-spacing: .12em; }
.speed-score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.speed-score strong { font: 700 28px/1.15 var(--font-sans); color: var(--heading); font-variant-numeric: tabular-nums; }
.speed-metrics { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 10px 0 0; font-size: 13px; }
.speed-metrics dt { color: var(--muted); }
.speed-metrics dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.speed-metrics .group { grid-column: 1 / -1; margin-top: 6px; font-weight: 700; color: var(--heading); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot--good { background: var(--status-good); } .dot--average { background: var(--status-warning); } .dot--poor { background: var(--status-critical); }
.scopes { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- utilisateur connecté, gestion des comptes */
.user-box { display: inline-flex; align-items: center; gap: 10px; margin-left: 6px; font-size: 13px; }
.user-name { font-weight: 700; color: var(--heading); }
.user-form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: end; margin-top: 16px; }
.md-table td.row-actions { white-space: normal; min-width: 260px; }
.row-actions .md-btn--link { font-size: 13px; margin-right: 10px; }
.temp-pwd { font: 700 16px var(--font-mono); background: var(--surface); padding: 2px 8px; border-radius: 6px; user-select: all; }

/* ---------- page de connexion */
.login-main { flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.login-card { width: 100%; max-width: 440px; box-sizing: border-box; }
.login-title { margin: 0; font: 700 26px/1.2 var(--font-sans); color: var(--heading); }
.login-card p { margin: 0; }
.login-card .md-btn--primary { justify-self: start; }

/* ===================== Chronologie */
.tl-nav { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-range { font-weight: 700; color: var(--heading); min-width: 12ch; text-align: center; }
.tl-multiple { margin: 18px 0 2px; font: 700 14px/1.3 var(--font-sans); color: var(--heading); }
.tl-multiple small { font-weight: 400; color: var(--muted); }
.chart.tl-lanes, .chart.tl-small { min-height: 0; }
.chart .lane-label { fill: var(--ink); font-size: 12.5px; font-weight: 700; }
.chart .lane-sep { stroke: var(--grid); }
.chart .lane-week { stroke: var(--grid); stroke-dasharray: 2 3; }
.chart .lane-month { stroke: var(--axis); }
.chart .lane-month-label { fill: var(--muted); font-size: 12px; text-transform: capitalize; }
.chart .lane-today { stroke: var(--heading); stroke-width: 1.5; }
.chart .lane-today-label { fill: var(--heading); font-size: 11px; font-weight: 700; }
.chart .lane-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 1.5; }
.chart .lane-dot.is-free { fill: var(--surface); stroke: var(--series-1); stroke-width: 1.5; }
.chart .lane-event { fill: var(--series-1); stroke: var(--surface); stroke-width: 1.5; }
.chart .lane-event.is-free { fill: var(--surface); stroke: var(--series-1); }
.chart .lane-span { fill: color-mix(in srgb, var(--series-1) 22%, var(--surface)); stroke: var(--series-1); stroke-width: 1; }
.chart .is-link { cursor: pointer; }
.chart .is-link:hover { filter: brightness(1.15); }
.chart .marker { stroke: var(--axis); stroke-dasharray: 3 3; }
.chart .marker--strong { stroke: var(--heading); stroke-dasharray: none; stroke-width: 1.5; }
.chart .marker-label { fill: var(--muted); font-size: 11px; }
.chart .ref-line { fill: none; stroke: var(--heading); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .ref-label { fill: var(--heading); font-size: 11.5px; }
.chart .cmp-other { fill: none; stroke: var(--axis); stroke-width: 1.2; opacity: .8; }
.tooltip .tt-op { color: var(--muted); font-size: 12px; }
.tooltip .tt-cur { color: var(--heading); }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__head { color: var(--muted); font-size: 12px; text-align: center; padding: 2px 0 4px; }
.cal__day { min-height: 92px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 5px; display: flex;
  flex-direction: column; gap: 3px; background: var(--surface); min-width: 0; }
.cal__day.is-out { opacity: .45; }
.cal__day.is-today { border-color: var(--heading); box-shadow: inset 0 0 0 1px var(--heading); }
.cal__num { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--heading); font-size: 13px; }
.cal__num small { font-weight: 400; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cal__item { display: block; font-size: 11.5px; line-height: 1.3; padding: 2px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--ink); background: var(--surface); border: 1px solid var(--series-1); text-decoration: none; }
.cal__item b { color: var(--heading); }
.cal__item.is-free { border-style: dashed; border-color: var(--axis); }
.cal__item--event { background: color-mix(in srgb, var(--series-1) 18%, var(--surface)); font-weight: 700; }
a.cal__item:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .cal { grid-template-columns: 1fr; }
  .cal__head, .cal__day.is-out { display: none; }
  .cal__day { min-height: 0; }
}
.back-link { font-weight: 700; font-size: 14px; }
.nowrap { white-space: nowrap; }
.md-table tr.is-excluded td { color: var(--muted); text-decoration: line-through; }
.md-table tr.is-excluded td:last-child, .md-table tr.is-excluded td:nth-last-child(2) { text-decoration: none; }
