:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --sidebar: #061236;
  --sidebar-2: #0b1a49;
  --text: #111b45;
  --muted: #697293;
  --line: #e8ebf3;
  --pink: #f41472;
  --pink-rgb: 244, 20, 114; /* triplet de --pink, pour les rgba() ; surcharge dynamique via header.php */
  --pink-2: #ffedf5;
  --purple: #7c3cff;
  --violet: #a64dff;
  --orange: #ff7a1a;
  --green: #21ad69;
  --blue: #2e73e8;
  --red: #ff3b5f;
  --shadow: 0 14px 40px rgba(11, 26, 73, .08);
  --shadow-soft: 0 8px 24px rgba(11, 26, 73, .06);
  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

button,
input,
select { font: inherit; }

button { cursor: pointer; }

svg { display: block; }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 10%, rgba(var(--pink-rgb), .22), transparent 30%),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  overflow-y: auto;
}

.brand,
.brand-mini {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
}

.brand__icon,
.brand-mini svg {
  width: 28px;
  height: 28px;
  color: var(--pink);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
}

.brand__icon--emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  stroke: none;
}

.brand__text {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.8px;
}

.brand__tag {
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
  background: var(--pink);
}

.sidebar__nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 0 14px;
  border-radius: 12px;
  color: rgba(255, 255, 255, .9);
  text-decoration: none;
  font-weight: 650;
  transition: .18s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, .08); }

.nav-item--active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--pink), #fff 6%), color-mix(in srgb, var(--pink), #000 8%));
  box-shadow: 0 12px 24px rgba(var(--pink-rgb), .32);
}

.nav-item__icon,
[data-icon] {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-item__icon i,
[data-icon] i {
  font-size: 16px;
  line-height: 1;
}

.nav-item--badge strong {
  margin-left: auto;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 12px;
}

.sidebar__help { margin-top: auto; padding-top: 34px; }

.help-card {
  padding: 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.help-card__icon {
  width: 42px;
  height: 42px;
  color: var(--pink);
}

.help-card__icon svg {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
}

.help-card p {
  margin: 12px 0 4px;
  font-size: 16px;
  font-weight: 800;
}

.help-card span {
  display: block;
  color: rgba(255, 255, 255, .68);
  font-size: 13px;
  line-height: 1.45;
}

.help-card button {
  margin-top: 16px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-weight: 750;
  background: rgba(255, 255, 255, .12);
}

.sidebar__footer {
  padding: 28px 6px 4px;
  font-size: 17px;
  font-weight: 800;
}

.brand-mini svg {
  width: 24px;
  height: 24px;
}

.main {
  min-width: 0;
  padding: 0 34px 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 82px;
  background: rgba(247, 248, 252, .86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(232, 235, 243, .8);
}

.topbar__menu { display: none !important; }

.search {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(560px, 42vw);
  height: 48px;
  padding: 0 14px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search input::placeholder { color: #8a92ad; }

.search kbd {
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 7px;
  color: #6d7593;
  background: #f2f4fa;
  font-size: 12px;
  text-align: center;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.button,
.icon-button,
.user-menu,
.date-filter,
.card__head button,
.chart-card select {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 750;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}

.button--primary {
  min-width: 158px;
  justify-content: center;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pink), #fff 6%), color-mix(in srgb, var(--pink), #000 8%));
  box-shadow: 0 12px 26px rgba(var(--pink-rgb), .26);
}

.button--light em {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--pink);
  background: var(--pink-2);
  font-style: normal;
  font-size: 12px;
  font-weight: 850;
}

/* ----- Etats de survol des boutons ----- */
.button:hover { transform: translateY(-1px); }

.button:not(.button--primary):hover {
  border-color: var(--pink);
  color: var(--pink);
  box-shadow: 0 8px 18px rgba(var(--pink-rgb), .12);
}

.button--primary:hover {
  color: #0d1124;
  box-shadow: 0 16px 30px rgba(var(--pink-rgb), .34);
}

.button:active { transform: translateY(0); }

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: #465071;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.icon-button:hover {
  border-color: var(--pink);
  color: var(--pink);
  background: var(--pink-2);
}

.icon-button.is-danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: #fff0f0;
}

.card__head button:hover {
  border-color: var(--pink);
  color: var(--pink);
  background: var(--pink-2);
  cursor: pointer;
}

.user-menu:hover { border-color: var(--pink); }

.icon-button--notification strong {
  position: absolute;
  top: -6px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--pink);
  font-size: 11px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 4px 8px 4px 6px;
  border: 0;
  background: transparent;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  font-size: 13px;
  font-weight: 850;
}

.user-menu b,
.user-menu small { display: block; text-align: left; }
.user-menu b { font-size: 13px; }
.user-menu small { margin-top: 1px; color: var(--muted); font-size: 11px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: -.8px;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 500;
}

.date-filter {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 106px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.kpi-card__icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

.kpi-card__icon.is-pink { color: var(--pink); background: var(--pink-2); }
.kpi-card__icon.is-purple { color: var(--purple); background: #f1ebff; }
.kpi-card__icon.is-violet { color: var(--violet); background: #f7ebff; }
.kpi-card__icon.is-orange { color: var(--orange); background: #fff0e8; }
.kpi-card__icon.is-green { color: var(--green); background: #eaf8f1; }
.kpi-card__icon.is-blue { color: var(--purple); background: #f3edff; }

.kpi-card p,
.kpi-card strong,
.kpi-card small { display: block; }
.kpi-card p { margin: 0; color: #59627e; font-size: 13px; font-weight: 700; }
.kpi-card strong { margin-top: 8px; font-size: 28px; letter-spacing: -.8px; }
.kpi-card small { margin-top: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.kpi-card small.is-up { color: var(--green); }
.kpi-card small.is-down { color: var(--pink); }
.kpi-card small.is-link { color: var(--purple); }

.dashboard-grid { display: grid; gap: 18px; margin-top: 18px; }
.dashboard-grid--top { grid-template-columns: 33% 1fr; }
.dashboard-grid--middle { grid-template-columns: 1.05fr .95fr; }
.dashboard-grid--bottom { grid-template-columns: 1.05fr .9fr 1.1fr; }

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}

.card__head--left { justify-content: flex-start; }
.card__head h2 { margin: 0; font-size: 18px; letter-spacing: -.3px; }
.card__head span { color: var(--muted); font-size: 13px; font-weight: 600; }
.card__head button {
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--pink);
  background: #fff7fb;
  border-color: #ffd5e8;
  font-size: 12px;
  font-weight: 800;
}

.reminder-list { padding: 0 14px 14px; }
.reminder {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.reminder__body { min-width: 0; }
.reminder__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.reminder__org { font-weight: 700; color: var(--text); }
.reminder__sub > * + *::before {
  content: "·";
  margin-right: 6px;
  color: var(--muted);
}
.reminder:last-child { border-bottom: 0; }
a.reminder { text-decoration: none; color: inherit; }
.reminder--link { cursor: pointer; transition: background .15s ease; }
.reminder--link:hover { background: var(--hover, rgba(124, 60, 255, .06)); }
.reminder__icon,
.activity__icon,
.table-icon,
.pipeline-item__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
}
.reminder__icon i,
.activity__icon i,
.table-icon i,
.pipeline-item__icon i,
.kpi-card__icon i {
  font-size: 15px;
  line-height: 1;
}

.kpi-card__icon i { font-size: 22px; }
.pipeline-item__icon i { font-size: 14px; }
.table-icon i { font-size: 13px; }
.reminder__action { font-size: 13px; font-weight: 800; line-height: 1.35; }
.reminder__person, .reminder__time { color: var(--muted); font-size: 12px; }
.reminder__action.is-pink { color: var(--pink); }
.reminder__action.is-orange { color: var(--orange); }
.reminder__action.is-purple { color: var(--purple); }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.badge--today, .badge--quote { color: var(--pink); background: var(--pink-2); }
.badge--late, .badge--negotiation { color: #e43d17; background: #fff0e8; }
.badge--next, .badge--demo { color: var(--purple); background: #f2eaff; }
.badge--won { color: var(--green); background: #eaf8f1; }
.badge--contacted { color: var(--blue); background: #eaf1ff; }

.pipeline-card { padding-bottom: 14px; }
.pipeline {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 10px 18px 0;
}
.pipeline-stage {
  min-width: 0;
  border-radius: 14px;
  padding: 14px 10px 10px;
  background: linear-gradient(180deg, var(--stage-bg), rgba(255,255,255,.95));
  border: 1px solid rgba(232, 235, 243, .84);
}
.pipeline-stage h3 {
  margin: 0;
  color: var(--stage-color);
  font-size: 13px;
}
.pipeline-stage strong {
  display: block;
  margin-top: 12px;
  font-size: 27px;
}
.pipeline-stage small {
  display: block;
  color: var(--muted);
  font-weight: 650;
}
.pipeline-items { display: grid; gap: 8px; margin-top: 12px; }
.pipeline-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.74);
}
.pipeline-item__icon { width: 30px; height: 30px; border-radius: 9px; }
.pipeline-item b { display: block; overflow: hidden; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.pipeline-item span { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipeline-more { display: block; margin-top: 9px; color: #6b7291; font-size: 11px; font-weight: 750; }
.pipeline-card__footer { margin: 12px 0 0; text-align: center; color: var(--muted); font-weight: 650; }
.pipeline-card__footer strong { color: var(--text); }

.table-card, .activity-card { min-height: 260px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 20px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: #697293; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 13px; font-weight: 650; }
.table-card td:first-child { display: flex; align-items: center; gap: 10px; }
.table-icon { width: 28px; height: 28px; border-radius: 9px; }

.activity-list { padding: 2px 20px 16px; }
.activity {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.activity__icon { width: 30px; height: 30px; border-radius: 10px; }
.activity p { margin: 0; font-size: 13px; font-weight: 650; }
.activity time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.chart-card { padding-bottom: 14px; }
.chart-card select {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  color: #56607d;
  font-size: 12px;
  font-weight: 700;
}
#lineChart { width: 100%; height: 210px; padding: 0 18px; }
.legend { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: -8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.legend__dot, .dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; }
.legend__dot.is-pink, .dot.pink { background: var(--pink); }
.legend__dot.is-blue { background: var(--blue); }
.dot.purple { background: var(--purple); }
.dot.orange { background: var(--orange); }
.dot.blue { background: var(--blue); }
.dot.green { background: #64c889; }

.donut-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 20px;
  padding: 16px 20px 24px;
}
.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    var(--pink) 0 calc(var(--a, 0) * 1%),
    var(--purple) calc(var(--a, 0) * 1%) calc((var(--a, 0) + var(--b, 0)) * 1%),
    var(--orange) calc((var(--a, 0) + var(--b, 0)) * 1%) calc((var(--a, 0) + var(--b, 0) + var(--c, 0)) * 1%),
    var(--blue) calc((var(--a, 0) + var(--b, 0) + var(--c, 0)) * 1%) calc((var(--a, 0) + var(--b, 0) + var(--c, 0) + var(--d, 0)) * 1%),
    #64c889 calc((var(--a, 0) + var(--b, 0) + var(--c, 0) + var(--d, 0)) * 1%) 100%
  );
  position: relative;
}
.donut::after {
  content: '';
  position: absolute;
  inset: 36px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.sector-list, .source-list { list-style: none; margin: 0; padding: 0; }
.sector-list { display: grid; gap: 13px; }
.sector-list li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px; color: #3d4664; font-size: 13px; font-weight: 650; }
.sector-list strong { color: var(--text); }

.source-list { display: grid; gap: 16px; padding: 18px 22px 25px; }
.source-row { display: grid; grid-template-columns: 122px 1fr 40px; gap: 12px; align-items: center; color: #3d4664; font-size: 13px; font-weight: 650; }
.source-bar { height: 13px; border-radius: 999px; background: #f0f2f7; overflow: hidden; }
.source-bar span { display: block; height: 100%; width: var(--value); border-radius: inherit; background: var(--color); }
.source-row strong { text-align: right; }

.bg-pink { color: var(--pink); background: var(--pink-2); }
.bg-purple { color: var(--purple); background: #f1ebff; }
.bg-violet { color: var(--violet); background: #f7ebff; }
.bg-orange { color: var(--orange); background: #fff0e8; }
.bg-green { color: var(--green); background: #eaf8f1; }
.bg-blue { color: var(--blue); background: #eaf1ff; }

@media (max-width: 1480px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid--top, .dashboard-grid--middle, .dashboard-grid--bottom { grid-template-columns: 1fr; }
  .pipeline { overflow-x: auto; grid-template-columns: repeat(7, minmax(150px, 1fr)); }
}

@media (max-width: 1060px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 30;
    left: 0;
    transform: translateX(-100%);
    width: 280px;
    transition: .22s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { padding: 0 18px 28px; }
  .topbar__menu { display: inline-grid !important; }
  .search { width: 100%; }
  .topbar__actions .button--light,
  .user-menu span:not(.avatar),
  .icon-button--notification { display: none; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 14px 0; }
  .topbar__actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .page-head { flex-direction: column; }
  .kpi-grid { grid-template-columns: 1fr; }
  .reminder { grid-template-columns: 36px 1fr; }
  .reminder .badge { grid-column: 2; justify-self: start; margin-top: 4px; }
  .donut-layout { grid-template-columns: 1fr; justify-items: center; }
  .source-row { grid-template-columns: 90px 1fr 36px; }
}
