/* ── tableau-de-bord-v860 (ajouté en V8.6.0) ──
   Nouveau tableau de bord (js/modules/tableau-de-bord-v860.js). L’ancien contenu de #dashboardView est masqué,
   la citation du jour reste visible, en haut sous le titre. */
#dashboardView.tdb-on > :not(#tdbHead):not(#tdbRoot):not(.daily-quote) { display: none !important; }
/* Citation du jour : entre l’en-tête et les PC (V8.6.1). */
#dashboardView.tdb-on > .daily-quote { margin: 0 0 18px; }

.tdb { --tdb-accent: #9f1239; --tdb-accent-dark: #6b0d24; --tdb-soft: #fff1f3; --tdb-ink: #2f1d22; --tdb-muted: #6b5a5f; --tdb-line: #ead9de; --tdb-card: #fff;
  --tdb-ok: #13703f; --tdb-ok-bg: #eefaf2; --tdb-warn: #9a5b00; --tdb-warn-bg: #fff6e5; --tdb-danger: #b91c1c; --tdb-danger-bg: #fff0f0; --tdb-info: #1d4ed8; --tdb-info-bg: #eef4ff;
  color: var(--tdb-ink); font-size: 15px; line-height: 1.45; }
.tdb * { box-sizing: border-box; }

/* En-tête */
.tdb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin: 0 0 18px; }
html #dashboardView .tdb .tdb-head h2 { margin: 0; color: var(--tdb-ink) !important; font-size: 30px !important; line-height: 1.1; letter-spacing: -.01em; }
.tdb-head p { margin: 6px 0 0; color: var(--tdb-muted); }
.tdb-clock { color: var(--tdb-accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.tdb-sites { display: flex; flex-wrap: wrap; gap: 6px; }
#dashboardView .tdb-sites button { display: inline-flex; width: auto; height: auto; text-transform: none; letter-spacing: 0; align-items: center; gap: 7px; min-height: 0; padding: 7px 13px; border: 1px solid var(--tdb-line); border-radius: 999px; background: #fff; color: var(--tdb-ink); font: inherit; font-size: 13px; font-weight: 700; line-height: 1; box-shadow: none; cursor: pointer; }
#dashboardView .tdb-sites button i { display: block; width: 9px; height: 9px; border-radius: 50%; }
#dashboardView .tdb-sites button.is-on { border-color: var(--tdb-ink); background: var(--tdb-ink); color: #fff; }
.tdb-sites button:focus-visible, .tdb [role="button"]:focus-visible, .tdb a:focus-visible { outline: 3px solid #9f12394d; outline-offset: 2px; }

/* PC sécurité : l’information principale */
.tdb-pcs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tdb-pc { display: grid; grid-template-columns: 138px 1fr; min-height: 132px; overflow: hidden; border: 1px solid var(--tdb-line); border-radius: 16px; background: var(--tdb-card); cursor: pointer; }
.tdb-pc:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--tdb-line)); }
.tdb-pc-stub { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; background: var(--c); color: #fff; text-align: center; text-shadow: 0 1px 2px #0003; }
.tdb-pc-stub small { font-size: 12px; font-weight: 700; }
.tdb-pc-stub strong { font-size: 18px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.tdb-pc-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; min-width: 0; }
.tdb-pc-state { display: flex; align-items: center; gap: 8px; color: var(--tdb-ok); font-size: 13px; font-weight: 800; }
.tdb-pc-state::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.tdb-pc-state.is-off { color: var(--tdb-danger); }
.tdb-pc-agent { font-size: 19px; font-weight: 800; line-height: 1.2; }
.tdb-pc-meta { color: var(--tdb-muted); font-size: 13px; }
.tdb-pc-meter { display: flex; gap: 4px; margin-top: auto; }
.tdb-pc-meter i { flex: 1; height: 6px; border-radius: 4px; background: #efe3e6; }
.tdb-pc-meter i.on { background: var(--tdb-ok); }
.tdb-pc.is-off { border: 2px dashed #f1a7a7; background: #fffafa; }
.tdb-pc.is-off .tdb-pc-stub { background: color-mix(in srgb, var(--c) 40%, #fff); color: var(--tdb-ink); text-shadow: none; }
.tdb-pc.is-off .tdb-pc-agent { color: var(--tdb-danger); }
.tdb-pc-action { align-self: flex-start; margin-top: 4px; padding: 8px 13px; border-radius: 10px; background: var(--tdb-accent); color: #fff; font-size: 13px; font-weight: 800; }

/* Blocs */
.tdb-grid { display: grid; grid-template-columns: 1.05fr 1.2fr 1fr; gap: 14px; align-items: start; }
.tdb-grid.is-two { grid-template-columns: 1.6fr 1fr; margin-top: 14px; }
.tdb-card { min-width: 0; padding: 16px 18px; border: 1px solid var(--tdb-line); border-radius: 16px; background: var(--tdb-card); box-shadow: none; }
.tdb-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
html #dashboardView .tdb .tdb-card-head h3 { margin: 0; color: var(--tdb-ink) !important; font-size: 18px !important; line-height: 1.25; }
.tdb-sub-head { margin-top: 18px; }
.tdb-count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--tdb-soft); color: var(--tdb-accent); font-size: 13px; font-weight: 800; vertical-align: 2px; }
.tdb-link { color: var(--tdb-accent) !important; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.tdb-link:hover { text-decoration: underline; }
.tdb-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tdb-card-foot { display: flex; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--tdb-line); }
.tdb-button { display: inline-flex; align-items: center; padding: 8px 13px; border: 1px solid #e3c2cb; border-radius: 10px; background: #fff; color: var(--tdb-accent-dark) !important; font-size: 13px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.tdb-button.is-primary { border-color: var(--tdb-accent); background: var(--tdb-accent); color: #fff !important; }
.tdb-list { display: flex; flex-direction: column; gap: 8px; }
.tdb-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--tdb-line); border-left: 4px solid var(--c, var(--tdb-line)); border-radius: 12px; background: var(--tdb-card); cursor: pointer; }
.tdb-row:hover { background: var(--tdb-soft); }
.tdb-when time { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tdb-when time small { display: block; color: var(--tdb-muted); font-size: 12px; font-weight: 600; }
.tdb-what b { display: block; font-size: 14px; line-height: 1.3; }
.tdb-sub { display: block; color: var(--tdb-muted); font-size: 12.5px; }
.tdb-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.tdb-tags:empty { display: none; }
.tdb-tail:empty { display: none; }
.tdb-day { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 56px; border-radius: 10px; background: var(--c); color: #fff; text-shadow: 0 1px 2px #0003; }
.tdb-day small { font-size: 11px; font-weight: 700; }
.tdb-day strong { font-size: 22px; font-weight: 900; line-height: 1; }
.tdb-badge { display: inline-flex; align-items: center; padding: 3px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tdb-ok { border-color: #bfe6cc; background: var(--tdb-ok-bg); color: var(--tdb-ok); }
.tdb-warn { border-color: #f4d79c; background: var(--tdb-warn-bg); color: var(--tdb-warn); }
.tdb-danger { border-color: #f3b4b4; background: var(--tdb-danger-bg); color: var(--tdb-danger); }
.tdb-info { border-color: #c7d7fb; background: var(--tdb-info-bg); color: var(--tdb-info); }
.tdb-neutral { border-color: var(--tdb-line); background: #f7f2f3; color: var(--tdb-muted); }
.tdb-progress { display: flex; height: 12px; margin: 4px 0 8px; overflow: hidden; border-radius: 999px; background: #efe3e6; }
.tdb-progress i { display: block; }
.tdb-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; color: var(--tdb-muted); font-size: 13px; }
.tdb-legend b { margin-right: 3px; color: var(--tdb-ink); font-size: 16px; }
.tdb-legend b.is-danger { color: var(--tdb-danger); }
.tdb-empty { margin: 4px 2px; color: var(--tdb-muted); font-size: 13px; font-style: italic; }
.tdb-more { align-self: flex-start; color: var(--tdb-accent) !important; font-size: 13px; font-weight: 700; text-decoration: none; }

@media (max-width: 1100px) { .tdb-grid { grid-template-columns: 1fr 1fr; } .tdb-grid > :last-child:nth-child(3) { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  html #dashboardView .tdb .tdb-head h2 { font-size: 24px !important; }
  .tdb-grid, .tdb-grid.is-two { grid-template-columns: 1fr; }
  .tdb-grid > :last-child:nth-child(3) { grid-column: auto; }
  .tdb-pc { grid-template-columns: 110px 1fr; min-height: 0; }
  .tdb-row { grid-template-columns: 74px minmax(0, 1fr); }
  .tdb-tail { grid-column: 2; justify-self: start; }
  .tdb-when time { font-size: 13px; white-space: nowrap; }
  .tdb-card-head { flex-wrap: wrap; }
}

/* Thème sombre */
html[data-theme="dark"] .tdb { --tdb-soft: #2a171d; --tdb-ink: #f4e8eb; --tdb-muted: #c9b3ba; --tdb-line: #4a2f37; --tdb-card: #1d1316; --tdb-ok-bg: #12301f; --tdb-ok: #86efac; --tdb-warn-bg: #33250b; --tdb-warn: #fcd38a; --tdb-danger-bg: #3a1414; --tdb-danger: #fca5a5; --tdb-info-bg: #13213f; --tdb-info: #a5c3ff; --tdb-accent: #f0567a; }
html[data-theme="dark"] #dashboardView .tdb-sites button { background: #261a1e; color: var(--tdb-ink); }
html[data-theme="dark"] #dashboardView .tdb-sites button.is-on { background: #f4e8eb; color: #1d1316; }
html[data-theme="dark"] .tdb-pc.is-off { background: #261416; border-color: #7f2d2d; }
html[data-theme="dark"] .tdb-pc-meter i, html[data-theme="dark"] .tdb-progress { background: #3a272d; }
html[data-theme="dark"] .tdb-neutral { background: #261a1e; }
html[data-theme="dark"] .tdb-button { background: #261a1e; border-color: #5a3a43; color: #ffd0da !important; }
html[data-theme="dark"] .tdb-button.is-primary, html[data-theme="dark"] .tdb-pc-action { background: #b51131; border-color: #b51131; color: #fff !important; }

/* Les règles de lisibilité colorent tous les titres des onglets avec une spécificité renforcée (:not(#_t1)…) :
   on reprend la même forme pour garder des titres sombres et lisibles, comme dans les fiches. */
html:not(#_tdb1):not(#_tdb2):not(#_tdb3):not(#_tdb4) #dashboardView .tdb h2,
html:not(#_tdb1):not(#_tdb2):not(#_tdb3):not(#_tdb4) #dashboardView .tdb h3 { color: var(--tdb-ink) !important; }
html[data-theme="dark"] .tdb-pc.is-off .tdb-pc-stub { color: #2f1d22; }
html[data-theme="dark"] .tdb-pc-meter i.on { background: var(--tdb-ok); }

/* V8.6.3 : bouton « Nouveau ticket » de l’onglet Tickets (js/modules/tickets.js), sans soulignement de lien. */
#ticketsNewV863 { display: inline-flex; align-items: center; text-decoration: none !important; white-space: nowrap; }
.tickets-actions-v681:has(#ticketsNewV863) { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
