/* Cockpit (module Dashboard). Toutes les règles sont préfixées .dash- : ce fichier est chargé sur toutes les pages. */

/* ---------- Bandeau d'accueil ---------- */
.dash-hero {
  position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-bottom: 22px; padding: 30px 32px; border-radius: var(--r-xl); border: 1px solid var(--line);
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(184,132,58,.16) 0%, rgba(184,132,58,0) 60%),
    radial-gradient(40% 80% at 0% 100%, rgba(184,132,58,.08) 0%, rgba(184,132,58,0) 70%),
    linear-gradient(135deg, #FFFDF8 0%, #F8F0E1 100%);
  box-shadow: var(--shadow);
}
.dash-hero::after {
  content: ""; position: absolute; left: 32px; bottom: 0; width: 64px; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--gold), #D9AE68);
}
.dash-hero-text { min-width: 0; }
.dash-date { display: block; font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); font-weight: 600; margin-bottom: 8px; }
.dash-hero h1 { font-size: 2.45rem; font-weight: 400; margin: 0; letter-spacing: -.02em; }
.dash-lead { margin: 8px 0 0; color: var(--ink-2); font-size: 1.02rem; }
.dash-lead strong { color: var(--danger); font-weight: 600; }
.dash-hero-period {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; min-width: 200px;
  background: rgba(255,253,248,.75); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(4px);
}
.dash-hero-k { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.dash-hero-v { font-family: var(--font-display); font-size: 1.3rem; color: var(--espresso); }
.dash-hero-link { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; font-weight: 500; margin-top: 2px; }
.dash-hero-link .icon { width: 14px; height: 14px; }

/* ---------- Tuiles ---------- */
.dash-tiles { margin-bottom: 22px; }
.dash-tiles > .card + .card, .dash-body > .card + .stack { margin-top: 0; }
.dash-tile { color: inherit; transition: transform .15s var(--ease), box-shadow .15s, border-color .15s; }
.dash-tile:hover { color: inherit; transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(43,33,23,.05), 0 14px 30px -14px rgba(43,33,23,.28); }
.dash-tile .stat-value { font-variant-numeric: tabular-nums; }
.dash-of { font-size: 1.15rem; color: var(--muted); }
.dash-mini { height: 5px; margin: 6px 0 2px; }
.dash-tile-calm .stat-value { color: var(--success); }

/* ---------- À faire ---------- */
.dash-body { align-items: start; }
.dash-todo { overflow: visible; }
.dash-group-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.dash-group-head .icon { width: 15px; height: 15px; }
.dash-group-critical .dash-group-head { color: var(--danger); }
.dash-group-soon .dash-group-head { color: var(--warning); }
.dash-group-info .dash-group-head { color: var(--info); }
.dash-group-count { margin-left: auto; font-size: .72rem; padding: 0 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); letter-spacing: 0; }
.dash-group:not(:has(.dash-alert)) { display: none; }
.dash-group + .dash-group .dash-group-head { border-top: 1px solid var(--line); }
.dash-group:last-child .dash-alert:last-child { border-bottom: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.dash-alert { position: relative; transition: background .12s, opacity .2s, transform .2s; }
.dash-alert:hover { background: #FCF8F0; }
.dash-alert.alert-critical { box-shadow: inset 3px 0 0 var(--danger); }
.dash-alert.htmx-swapping { opacity: 0; transform: translateX(12px); }
.dash-alert.is-resolved .alert-title { color: var(--ink-2); }
.dash-alert-who { font-weight: 600; color: var(--ink); }
.dash-alert-who:hover { color: var(--gold-2); }
.dash-due { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--ink-2); white-space: nowrap; flex: none; }
.dash-due .icon { width: 14px; height: 14px; color: var(--muted); }
.dash-due.is-near { color: var(--warning); font-weight: 600; }
.dash-due.is-late { color: var(--danger); font-weight: 600; }
.dash-due.is-late .icon, .dash-due.is-near .icon { color: currentColor; }

/* Menu Reporter / Ignorer (details natif, sans script) */
.dash-menu { position: relative; }
.dash-menu > summary { list-style: none; }
.dash-menu > summary::-webkit-details-marker { display: none; }
.dash-menu[open] > summary { background: var(--bg-2); color: var(--ink); }
.dash-menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  animation: dash-pop .16s var(--ease);
}
.dash-menu-pop form { margin: 0; }
.dash-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none;
  font: 500 .88rem/1.2 var(--font); color: var(--ink); cursor: pointer; text-align: left;
}
.dash-menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.dash-menu-item:hover, .dash-menu-item:focus-visible { background: var(--bg-2); }
.dash-menu-item.is-danger { color: var(--danger); }
.dash-menu-item.is-danger .icon { color: var(--danger); }
@keyframes dash-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* État « Tout est en ordre » */
.dash-clear { text-align: center; padding: 52px 28px 56px; }
.dash-clear-mark {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 30% 30%, #5FA374, var(--success));
  box-shadow: 0 0 0 8px var(--success-soft), 0 0 0 9px #CFE3D4, 0 18px 30px -16px rgba(63,125,82,.7);
}
.dash-clear-mark .icon { width: 34px; height: 34px; stroke-width: 2.4; }
.dash-clear h3 { font-size: 1.45rem; font-weight: 400; margin-bottom: 6px; }
.dash-clear p { color: var(--ink-2); max-width: 420px; margin: 0 auto; }

/* ---------- Mois en cours ---------- */
.dash-progress { display: flex; flex-direction: column; gap: 20px; }
.dash-bk + .dash-bk { border-top: 1px solid var(--line); padding-top: 18px; }
.dash-bk-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dash-bk-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--espresso); }
.dash-bk-name .icon { width: 16px; height: 16px; color: var(--gold); }
.dash-bar { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; font-size: .84rem; padding: 3px 0; }
.dash-bar-label { color: var(--ink-2); }
.dash-bar-n { text-align: right; color: var(--ink); font-weight: 600; font-size: .8rem; }

/* ---------- Raccourcis ---------- */
.dash-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); overflow: hidden; }
.dash-shortcut { display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: var(--surface); color: var(--ink); transition: background .12s; }
.dash-shortcut:hover { background: var(--surface-2); color: var(--ink); }
.dash-shortcut strong { display: block; font-size: .9rem; font-weight: 600; }
.dash-shortcut span span { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.dash-sc-ico { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--gold-soft); color: var(--gold-2); transition: background .12s, color .12s; }
.dash-shortcut:hover .dash-sc-ico { background: var(--espresso); color: var(--cream); }

@media (max-width: 900px) {
  .dash-hero { padding: 24px 22px; }
  .dash-hero h1 { font-size: 2rem; }
  .dash-hero::after { left: 22px; }
}
@media (max-width: 560px) {
  .dash-hero-period { min-width: 0; width: 100%; }
  .dash-shortcuts { grid-template-columns: 1fr; }
  .dash-due { padding-left: 50px; width: 100%; }
  .dash-tile .stat-value { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-tile, .dash-alert, .dash-menu-pop { transition: none; animation: none; }
}
.dash-alert-bk { color: var(--gold-2); font-weight: 500; }

/* ---------- Alertes regroupées (plus de 3 du même type et du même niveau) ---------- */
.dash-cluster-head { cursor: pointer; list-style: none; }
.dash-cluster-head::-webkit-details-marker { display: none; }
.dash-cluster-head:hover { background: #FCF8F0; }
.dash-cluster-head .alert-main { flex: 1; min-width: 0; }
.dash-cluster-head .alert-title, .dash-cluster-head .alert-detail { display: block; }
.dash-cluster-chev { margin-left: auto; color: var(--muted); transition: transform .15s var(--ease); }
.dash-cluster[open] > .dash-cluster-head .dash-cluster-chev { transform: rotate(90deg); }
.dash-cluster-body { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dash-cluster-body .dash-alert { padding-left: 36px; }
