/* ===================================================================
   IAMSHIBA – Dashlet KPI Temps & Marge
   =================================================================== */

.iamshiba-kpi-time {
  padding: 22px 26px 20px;
  font-size: 13px;
}

/* ---------- HEADER GLOBAL ---------- */

.iamshiba-kpi-time__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

/* Titre principal Apple-style */

.shiba-stat-title-main {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  /* Dégradé Apple ultra léger */
  background: linear-gradient(90deg, #1e3a8a, #0f172a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-left: 2px;
}

.iamshiba-kpi-time__header-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

/* ---------- NAVIGATION PERIODE ( <  •  > ) ---------- */

.iamshiba-kpi-time__period-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.iamshiba-kpi-time__period-btn {
  border: none;
  outline: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  transition: all 0.16s ease-out;
}

.iamshiba-kpi-time__period-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

/* ---------- Onglets Mois / Trim / Sem / Année ---------- */

.iamshiba-kpi-time__range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 999px;
  background: #f3f4f6;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  white-space: nowrap;
}

.iamshiba-kpi-time__range-btn {
  border-radius: 999px;
  border: none;
  padding: 3px 12px;
  font-size: 11px;
  cursor: pointer;
  background: transparent;
  color: #4b5563;
  min-width: 48px;
  text-align: center;
  transition: all 0.16s ease-out;
}

.iamshiba-kpi-time__range-btn.is-active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.iamshiba-kpi-time__range-btn:not(.is-active):hover {
  color: #111827;
}

/* ---------- Scope Moi / Équipe / Cabinet ---------- */

.iamshiba-kpi-time__segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: #f3f4f6;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
  white-space: nowrap;
}

.iamshiba-kpi-time__scope {
  border-radius: 999px;
  border: none;
  padding: 3px 12px;
  font-size: 11px;
  cursor: pointer;
  background: transparent;
  color: #4b5563;
  min-width: 60px;
  text-align: center;
  transition: all 0.16s ease-out;
}

.iamshiba-kpi-time__scope.is-active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.iamshiba-kpi-time__scope:not(.is-active):hover {
  color: #111827;
}

/* ---------- Libellé utilisateur ---------- */

.iamshiba-kpi-time__user-label {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  text-align: right;
}

/* ---------- États de chargement / vide ---------- */

.iamshiba-kpi-time__loading,
.iamshiba-kpi-time__empty {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 10px;
}

/* ===================================================================
   Cartes statistiques – shiba-stat-*
   =================================================================== */

/* --- Grille --- */

.shiba-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}


@media (max-width: 1100px) {
  .shiba-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .shiba-stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- Carte statistique (glassmorphism) --- */

.shiba-stat-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.05),
    0 3px 8px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shiba-stat-card--main {
  grid-row: span 2;
}

@media (max-width: 1100px) {
  .shiba-stat-card--main {
    grid-row: span 1;
  }
}

/* --- Header de carte --- */

.shiba-stat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.shiba-stat-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.shiba-stat-caption {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.shiba-stat-meta {
  font-size: 11px;
  font-weight: 500;
  color: #1d4ed8;
  white-space: nowrap;
}

/* --- Valeurs principales --- */

.shiba-stat-value-lg {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #0f172a;
  margin-top: 6px;
}

.shiba-stat-sub {
  font-size: 12px;
  color: #475569;
}

.shiba-stat-sub strong {
  font-weight: 600;
  color: #111827;
}

/* --- Barre d’occupation --- */

.shiba-stat-bar {
  position: relative;
  width: 100%;
  height: 8px;
  margin-top: 10px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.9);
  overflow: hidden;
}

.shiba-stat-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
  max-width: 100%;
}

/* --- Lignes stats --- */

.shiba-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-top: 2px;
}

.shiba-stat-row--space {
  margin-top: 4px;
}

.shiba-stat-key {
  color: #6b7280;
}

.shiba-stat-val {
  color: #0f172a;
  font-weight: 600;
}

.shiba-stat-val--green {
  color: #16a34a;
}

.shiba-stat-val--neutral {
  color: #111827;
}

/* --- Hint --- */

.shiba-stat-hint {
  margin-top: 6px;
  font-size: 10px;
  color: #9ca3af;
}

/* ---------- Masquer le titre natif du dashlet ---------- */

.dashboard-panel[data-name="cTimeKpi"] .panel-heading h4 {
  display: none !important;
}

/* ---------- Graphique capacité empilée ---------- */

.shiba-capacity-bar {
  position: relative;
  width: 100%;
  height: 10px;
  margin-top: 12px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.9);  /* capacité libre */
  overflow: hidden;
}

.shiba-capacity-bar__segment {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}

.shiba-capacity-bar__segment--billable {
  left: 0;
  background: #16a34a; /* vert facturable */
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.shiba-capacity-bar__segment--nonbillable {
  left: 0;
  background: #9ca3af; /* gris non facturable */
}

/* Légende */

.shiba-capacity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  margin-top: 4px;
}

.shiba-capacity-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
}

.shiba-capacity-pill::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.shiba-capacity-pill--billable::before {
  background: #16a34a;
}

.shiba-capacity-pill--nonbillable::before {
  background: #9ca3af;
}

.shiba-capacity-pill--free::before {
  background: #e5e7eb;
}

/* ===================================================================
   Histogramme mensuel – utilisé pour Trim / Sem / Année
   =================================================================== */

.shiba-histo {
  margin-top: 18px;
  margin-bottom: 4px;
}

.shiba-histo__title {
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 6px;
}

.shiba-histo__chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 10px 4px;
  border-radius: 14px;
  background: rgba(249, 250, 251, 0.9);
  box-shadow:
    0 12px 25px rgba(15, 23, 42, 0.03),
    0 1px 4px rgba(15, 23, 42, 0.04);
}

.shiba-histo__column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 32px;
}

.shiba-histo__bar {
  position: relative;
  width: 100%;
  max-width: 32px;
  height: 80px;
  border-radius: 10px;
  background: #e5e7eb; /* fond */
  overflow: hidden;
}

.shiba-histo__bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 10px;
  background: #16a34a; /* heures totales (plutôt facturables en cabinet) */
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}

.shiba-histo__value {
  font-size: 10px;
  font-weight: 500;
  color: #0f172a;
}

.shiba-histo__label {
  font-size: 10px;
  color: #6b7280;
  text-transform: uppercase;
}

/* ===================================================================
   KPI Temps – Bouton + Collaboration
   =================================================================== */

/* On s'assure que le header de carte gère bien le bouton à droite */
.iamshiba-kpi-time .shiba-stat-card .shiba-stat-header {
  align-items: center;
}

/* Style du bouton + dans la carte Collaboration */
.iamshiba-kpi-time .iamshiba-kpi-cta {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  padding: 0;
  margin-left: 8px;
  flex-shrink: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 18px;
  line-height: 1;
  font-weight: 600;

  background: #020617;
  color: #ffffff;
  cursor: pointer;

  box-shadow:
    0 14px 28px rgba(15, 23, 42, 0.26),
    0 2px 6px rgba(15, 23, 42, 0.35);

  transition:
    background 0.16s ease-out,
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out;
}

.iamshiba-kpi-time .iamshiba-kpi-cta:hover {
  background: #000000;
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 18px 38px rgba(15, 23, 42, 0.3),
    0 4px 10px rgba(15, 23, 42, 0.4);
}

.iamshiba-kpi-time .iamshiba-kpi-cta:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 8px 16px rgba(15, 23, 42, 0.25),
    0 1px 4px rgba(15, 23, 42, 0.3);
}


/* Sections pour la popup Collaboration */
.iamshiba-modal-section {
  margin-bottom: 10px;
  border-radius: 12px;
  background: rgba(249, 250, 251, 0.98);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.iamshiba-modal-section-toggle {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  cursor: pointer;
}

.iamshiba-modal-section-title {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
}

.iamshiba-modal-section-chevron {
  font-size: 12px;
  color: #6b7280;
}

.iamshiba-modal-section-body {
  padding: 4px 8px 8px;
}

.iamshiba-modal-section-body.is-collapsed {
  display: none;
}

/* Sections pour la popup Collaboration */
.iamshiba-modal-section {
  margin-top: 8px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: rgba(249, 250, 251, 0.98);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.iamshiba-modal-section-toggle {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  cursor: pointer;
}

.iamshiba-modal-section-title {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
}

.iamshiba-modal-section-chevron {
  font-size: 12px;
  color: #6b7280;
}

.iamshiba-modal-section-body {
  padding: 4px 8px 8px;
}

.iamshiba-modal-section-body.is-collapsed {
  display: none;
}



/* ---------- Dashlet header (V2) : conserver le menu (...) ---------- */
.dashboard-panel[data-name="cTimeKpiV2"] .panel-heading h4 .panel-title,
.dashboard-panel[data-name="cTimeKpiV2"] .panel-heading h4 .panel-title-text {
  display: none !important;
}

/* Surtout ne pas masquer le dropdown actions */
.dashboard-panel[data-name="cTimeKpiV2"] .panel-heading .dropdown {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Header visuellement discret mais présent */
.dashboard-panel[data-name="cTimeKpiV2"] > .panel-heading {
  background: transparent;
  border: none;
  padding: 10px 16px 0;
}
