:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dfe7ef;
  --text: #172033;
  --muted: #6b7a90;
  --primary: #2457d6;
  --primary-dark: #1b43a7;
  --danger-bg: #fff2f2;
  --danger-border: #efb7b7;
  --danger-text: #8f2020;
  --shadow: 0 10px 30px rgba(31, 48, 79, .07);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  min-height: 120px;
  padding: 28px 36px;
  background: radial-gradient(circle at top right, rgba(255,255,255,.20), transparent 28%), linear-gradient(135deg, #102a6b 0%, #2457d6 55%, #4f7cff 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 30px rgba(30, 70, 160, .22);
}

.app-header h1 {
  margin: 4px 0 6px;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -.4px;
}

.app-header p {
  margin: 0;
  opacity: .84;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
  opacity: .8;
}

.diagnostic-link {
  color: white;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.page {
  width: min(1780px, calc(100% - 40px));
  margin: 24px auto 50px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.filters-panel {
  padding: 20px;
}

.section-heading h2,
.table-header h2 {
  margin: 0;
  font-size: 20px;
}

.section-heading p,
.table-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 14px;
}

.filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-grid label span {
  color: #526177;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #ccd8e5;
  border-radius: 10px;
  padding: 0 12px;
  background: white;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus,
select:focus {
  border-color: #5d83e6;
  box-shadow: 0 0 0 4px rgba(69, 111, 223, .12);
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 0 17px;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-light {
  background: #edf2f8;
  color: #2c3a4e;
}

.alert {
  margin-top: 16px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  padding: 15px 18px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -.35px;
}

.kpi-card small {
  color: #7c8a9c;
  font-size: 12px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  min-height: 390px;
  padding: 10px;
  overflow: hidden;
}

.table-panel {
  margin-top: 18px;
  overflow: hidden;
}

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

.table-header > span {
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 7px 10px;
  border-radius: 999px;
}

.table-wrap {
  max-height: 670px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  white-space: nowrap;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8edf2;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eef3f8;
  color: #4c5c71;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .025em;
}

tbody tr:nth-child(even) {
  background: #fbfcfe;
}

tbody tr:hover {
  background: #eef4ff;
}

.empty {
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

@media (max-width: 1350px) {
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .app-header { padding: 22px; }
  .page { width: min(100% - 22px, 1780px); }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .app-header { align-items: flex-start; gap: 18px; flex-direction: column; }
  .filter-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .filter-actions { flex-direction: column; }
}



.client-filter {
  grid-column: span 2;
}

.search-field {
  position: relative;
}

.suggestions {
  display: none;
  position: absolute;
  z-index: 100;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d7e0eb;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(28, 45, 77, .18);
  padding: 7px;
}

.suggestions.is-open {
  display: block;
}

.suggestion-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
  color: #1d2939;
  background: transparent;
}

.suggestion-row + .suggestion-row {
  margin-top: 2px;
}

.suggestion-row:hover,
.suggestion-row.is-active {
  background: #edf4ff;
  color: #1849a9;
}

.suggestion-main {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 650;
  white-space: normal;
}

.suggestion-message {
  padding: 12px;
  color: #758399;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 1350px) {
  .client-filter {
    grid-column: span 1;
  }
}


.eyebrow.dark {
  color: #5e6d84;
  opacity: 1;
}

.monthly-panel {
  margin: 18px 0;
  padding: 0;
  overflow: hidden;
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  padding: 18px 20px 22px;
  background:
    linear-gradient(180deg, rgba(247,250,255,.95), rgba(255,255,255,1));
}

.month-card {
  position: relative;
  overflow: hidden;
  min-height: 130px;
  padding: 17px;
  border-radius: 16px;
  border: 1px solid #dfe7f2;
  background: linear-gradient(145deg, #ffffff 0%, #f7f9ff 100%);
  box-shadow: 0 10px 24px rgba(36, 87, 214, .07);
}

.month-card::after {
  content: "";
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  right: -24px;
  top: -24px;
  background: rgba(36, 87, 214, .08);
}

.month-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf0ff;
  color: #204bb5;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}

.month-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.month-metrics span {
  display: block;
  color: #7a8799;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.month-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  color: #172033;
}

.monthly-empty {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px dashed #cfd9e6;
  border-radius: 12px;
}

.chart-card {
  border-top: 4px solid #2457d6;
}

.table-panel {
  border-top: 4px solid #102a6b;
}

.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  right: -22px;
  bottom: -22px;
  background: rgba(36, 87, 214, .08);
}

@media (max-width: 1350px) {
  .monthly-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .monthly-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .monthly-grid { grid-template-columns: 1fr; }
}


/* Identite 1.0.6 - volontairement tres differente */
body {
  background:
    radial-gradient(circle at 10% 0%, rgba(50, 102, 255, .10), transparent 28%),
    radial-gradient(circle at 90% 18%, rgba(0, 205, 170, .08), transparent 24%),
    #f3f6fb;
}

.app-header {
  min-height: 170px;
  background:
    radial-gradient(circle at 88% 20%, rgba(44, 255, 201, .28), transparent 20%),
    radial-gradient(circle at 65% 90%, rgba(112, 75, 255, .32), transparent 27%),
    linear-gradient(120deg, #07162f 0%, #102f71 48%, #174fd0 100%);
  border-bottom: 1px solid rgba(255,255,255,.14);
}

.app-header h1 {
  font-size: 44px;
  letter-spacing: -1.4px;
  margin-top: 10px;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #39e6bd;
  color: #062338;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .08em;
}

.filters-panel {
  margin-top: -48px;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 24px 65px rgba(14, 34, 75, .16);
}

.kpi-grid {
  gap: 16px;
}

.kpi-card {
  min-height: 142px;
  padding: 20px;
  border: 0;
  background: linear-gradient(145deg, #ffffff, #f8faff);
  box-shadow: 0 14px 35px rgba(21, 46, 94, .09);
}

.kpi-card:first-child {
  background: linear-gradient(135deg, #102f71 0%, #2457d6 100%);
  color: white;
}

.kpi-card:first-child span,
.kpi-card:first-child small {
  color: rgba(255,255,255,.72);
}

.kpi-card:first-child strong {
  color: white;
  font-size: 31px;
}

.monthly-panel {
  border: 0;
  box-shadow: 0 18px 45px rgba(18, 42, 90, .10);
}

.monthly-grid {
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  background: #0b1730;
  gap: 1px;
  padding: 1px;
}

.month-card {
  min-height: 155px;
  border-radius: 0;
  border: 0;
  background: linear-gradient(145deg, #111f3e, #0b1730);
  box-shadow: none;
  color: white;
  padding: 22px;
}

.month-card::after {
  width: 110px;
  height: 110px;
  right: -35px;
  top: -42px;
  background: rgba(57, 230, 189, .12);
}

.month-label {
  background: rgba(57, 230, 189, .14);
  color: #52f0c8;
}

.month-metrics span {
  color: #8ea0bf;
}

.month-metrics strong {
  color: white;
  font-size: 20px;
}

.chart-card {
  border-top: 0;
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(18, 42, 90, .10);
}

.article-chart {
  border-left: 5px solid #39e6bd;
}

.table-panel {
  border-top: 0;
  box-shadow: 0 18px 45px rgba(18, 42, 90, .10);
}

.btn-primary {
  background: linear-gradient(135deg, #163f9b, #2d6bff);
  box-shadow: 0 8px 18px rgba(36, 87, 214, .28);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

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

@media (max-width: 650px) {
  .app-header h1 { font-size: 34px; }
  .monthly-grid { grid-template-columns: 1fr; }
}


/* Tableau mensuel N / N-1 - version 1.0.7 */
.monthly-panel {
  overflow: hidden;
  background: #ffffff;
}

.monthly-heading {
  background:
    linear-gradient(90deg, rgba(36, 87, 214, .07), transparent 48%),
    #ffffff;
}

.compact-table-wrap {
  overflow-x: auto;
  border-top: 1px solid #e3e9f1;
}

.monthly-table {
  min-width: 860px;
  font-size: 13px;
}

.monthly-table thead tr:first-child th {
  background: #0b1730;
  color: #ffffff;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.monthly-table thead tr:nth-child(2) th {
  background: #132447;
  color: #b9c8e3;
}

.monthly-table th,
.monthly-table td {
  padding: 12px 14px;
}

.monthly-table .group-title {
  text-align: center;
  letter-spacing: .08em;
}

.month-cell {
  font-weight: 900;
  color: #173c91;
  background: #f4f7ff;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: #172033;
}

.muted-number {
  color: #7b8799;
  font-weight: 650;
}

.delta-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.delta-cell.positive {
  color: #087a60;
  background: rgba(16, 185, 129, .08);
}

.delta-cell.negative {
  color: #c43d4d;
  background: rgba(244, 63, 94, .07);
}

.monthly-table tbody tr:hover td {
  background-color: #edf3ff;
}

.monthly-table tbody tr:hover .delta-cell.positive {
  background: rgba(16, 185, 129, .13);
}

.monthly-table tbody tr:hover .delta-cell.negative {
  background: rgba(244, 63, 94, .12);
}


/* Business Pulse 2.0 - tableaux type Excel */
.excel-panel {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid #d8e0ec;
  box-shadow: 0 16px 42px rgba(12, 35, 76, .09);
}

.excel-wrap {
  overflow: auto;
  max-height: 590px;
  border-top: 1px solid #d8e0ec;
  background: white;
}

.excel-table {
  min-width: 1320px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.excel-table th,
.excel-table td {
  padding: 9px 11px;
  border-right: 1px solid #dfe5ee;
  border-bottom: 1px solid #dfe5ee;
  white-space: nowrap;
  text-align: right;
}

.excel-table th:first-child,
.excel-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 2;
}

.excel-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: white;
  background: #173c91;
  font-weight: 900;
  letter-spacing: .02em;
}

.excel-table thead th:first-child {
  z-index: 5;
  background: #102d70;
}

.excel-table tbody td:first-child {
  background: #f2f6ff;
  color: #173c91;
  font-weight: 900;
}

.excel-table tbody tr:nth-child(even) td:not(:first-child) {
  background: #f8fafc;
}

.excel-table tbody tr:hover td {
  background: #eaf1ff !important;
}

.excel-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: #0b1730;
  color: white;
  border-color: #243656;
}

.positive-cell {
  color: #07644f;
  background: #dcf7ec !important;
  font-weight: 900;
}

.negative-cell {
  color: #a51d35;
  background: #ffe4e9 !important;
  font-weight: 900;
}

.positive-text { color: #087a60; font-weight: 850; }
.negative-text { color: #c12b43; font-weight: 850; }

.purchase-panel {
  border-top: 5px solid #26c7a0;
}

.purchase-table thead th {
  background: #0e6d63;
}

.purchase-table thead th:first-child {
  background: #09534c;
}

.purchase-warning {
  margin: 0;
  padding: 12px 18px;
  color: #7a4b00;
  background: #fff4cf;
  border-top: 1px solid #f0d681;
  font-size: 13px;
}
