/* ==========================================================
   STYLES DASHBOARD - TRADING ET INVESTISSEMENT
   Version nettoyée : mêmes classes, doublons supprimés
   ========================================================== */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --blue: #149b57;
  --green: #12805c;
  --red: #c24132;
  --amber: #b7791f;
  --cyan: #0e7490;
  --violet: #6b4eff;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

select,
button {
  font: inherit;
}

a {
  color: inherit;
}

select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 750;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.nav-link {
  min-height: 42px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 850;
}

.global-topbar {
  min-height: 148px;
}

.global-page {
  --bg: #edf3ef;
  --surface: #ffffff;
  --ink: #073f38;
  --muted: #6d7d79;
  --line: #d6e2dd;
  --blue: #149b57;
  --green: #149b57;
  --red: #d20f12;
  --amber: #ff9f0a;
  --cyan: #3d8b4e;
  --violet: #d7ad32;
  --shadow: 0 16px 40px rgba(7, 63, 56, 0.10);
  background: var(--bg);
  color: var(--ink);
}

.global-page .global-topbar {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(390px, 600px);
  align-items: center;
  column-gap: 20px;
  row-gap: 14px;
  padding: 22px 30px;
  background:
    linear-gradient(135deg, rgba(7, 63, 56, 0.04), rgba(20, 155, 87, 0.08)),
    #f8f9f7;
  border-bottom: 4px solid #ff9f0a;
  box-shadow: 0 14px 34px rgba(11, 59, 54, 0.10);
}

.global-brand {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.global-logo-stack {
  display: grid;
  justify-items: stretch;
  gap: 6px;
  width: clamp(300px, 20vw, 374px);
  flex: 0 0 clamp(300px, 20vw, 374px);
}

.global-logo {
  width: 100%;
  height: 108px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(214, 226, 221, 0.9);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(11, 59, 54, 0.10);
  text-decoration: none;
}

.global-logo img {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.global-page h1 {
  margin: 0;
  color: #073f38;
  font-size: clamp(1.65rem, 2.4vw, 2.45rem);
  font-weight: 900;
  line-height: 1.06;
}

.global-page .eyebrow,
.global-page .section-label {
  color: #149b57;
}

.global-page select {
  border-color: #c6dfbb;
  color: #073f38;
}

.global-page .topbar-note {
  margin-top: 12px;
  color: #6d7d79;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}

.global-controls {
  width: 100%;
  min-width: 0;
  justify-self: end;
  display: grid;
  grid-template-columns: auto auto;
  align-items: start;
  justify-content: end;
  justify-items: end;
  gap: 8px 10px;
}

.global-page .global-controls .range-control {
  grid-column: 1 / -1;
  width: 100%;
  justify-content: flex-end;
  padding: 12px 18px;
  border: 1px solid rgba(214, 226, 221, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(11, 59, 54, 0.08);
}

.global-page .global-controls .period-control {
  flex: 1 1 0;
  min-width: 0;
  gap: 5px;
}

.global-page .global-controls .period-control select {
  width: 100%;
}

.global-page .period-control label {
  color: #073f38;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.global-page .global-controls select {
  height: 42px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.print-summary-button {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  background: #073f38;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(7, 63, 56, 0.2);
}

.print-summary-button:hover {
  background: #0a544b;
}

.print-summary-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.print-button-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.print-selected-period {
  display: none;
}

.global-logo-stack .auth-user-badge {
  width: 100%;
  min-height: 34px;
  justify-content: center;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.76rem;
  text-align: center;
}

.global-page .trader-actions {
  justify-self: end;
  align-self: start;
  align-items: center;
  justify-content: flex-end;
  flex-direction: row;
  gap: 8px;
  width: auto;
  max-width: none;
}

.global-page .global-control-actions {
  grid-column: 1;
  grid-row: 1;
}

.global-page .last-update {
  grid-column: 2;
  grid-row: 1;
}

.global-page .trader-actions .auth-logout-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  justify-content: center;
  padding: 0;
  line-height: 1.1;
  text-align: center;
}

.auth-logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-logout-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.global-page .trader-actions .auth-button-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.period-control {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.range-control,
.compare-range {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.compare-range {
  margin: -2px 0 14px;
}

.trader-topbar {
  align-items: center;
}

.trader-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

.trader-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
}

.side-menu {
  position: sticky;
  top: 0;
  min-height: calc(100vh - 1px);
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: #101828;
  color: #fff;
}

.side-menu-title {
  padding: 10px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.side-menu-title span,
.side-menu-title strong {
  display: block;
}

.side-menu-title span {
  color: #a4bcfd;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.side-menu-title strong {
  margin-top: 5px;
  font-size: 1.08rem;
}

.side-menu nav {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.side-menu a {
  padding: 11px 12px;
  border-radius: 7px;
  color: #d0d5dd;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 820;
}

.side-menu a:hover,
.side-menu a.active {
  background: #eef2ff;
  color: #101828;
}

.trader-dashboard {
  display: grid;
  gap: 16px;
}

.trader-dashboard > section {
  scroll-margin-top: 18px;
}

.trader-hero {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) repeat(3, minmax(180px, 0.55fr));
  gap: 12px;
}

.job-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.job-card {
  min-height: 190px;
}

.job-card p {
  margin: 10px 0 0;
  color: #344054;
  line-height: 1.55;
}

.job-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #344054;
}

.job-list li {
  margin-bottom: 8px;
  line-height: 1.45;
}

.scope-panel {
  min-height: 220px;
}

.scope-grid,
.pricing-grid,
.digital-grid,
.trader-negotiation-grid {
  display: grid;
  gap: 10px;
}

.scope-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pricing-grid,
.digital-grid,
.trader-negotiation-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.digital-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.scope-grid article,
.pricing-grid article,
.digital-grid article,
.trader-negotiation-grid article {
  min-height: 118px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.scope-grid strong,
.scope-grid span,
.pricing-grid strong,
.pricing-grid span,
.digital-grid strong,
.digital-grid span,
.trader-negotiation-grid strong,
.trader-negotiation-grid span {
  display: block;
}

.scope-grid strong,
.pricing-grid strong,
.digital-grid strong,
.trader-negotiation-grid strong {
  font-size: 0.92rem;
}

.scope-grid span,
.pricing-grid span,
.digital-grid span,
.trader-negotiation-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.45;
}

.trader-brief {
  min-height: 138px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
}

.trader-brief .section-label {
  color: #a4bcfd;
}

.trader-brief p {
  margin: 10px 0 0;
  color: #eef2ff;
  line-height: 1.55;
}

.trader-kpi {
  min-height: 138px;
}

.trader-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, 0.72fr);
  gap: 16px;
}

.trader-side {
  display: grid;
  gap: 16px;
}

.trader-main-panel {
  min-height: 520px;
}

.reporting-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  gap: 16px;
}

.reporting-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-card {
  min-height: 146px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
  display: grid;
  align-content: start;
  gap: 8px;
}

.report-card strong,
.report-card em,
.report-card small {
  display: block;
}

.report-card strong {
  font-size: 0.94rem;
}

.report-card em {
  color: var(--ink);
  font-size: 1.04rem;
  font-style: normal;
  font-weight: 850;
}

.report-card small {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.42;
}

.market-board {
  display: grid;
  gap: 10px;
}

.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.market-row strong,
.market-row small {
  display: block;
}

.market-row small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.4;
}

.market-row span {
  padding: 8px;
  border-radius: 6px;
  background: #eef2ff;
  color: var(--blue);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 850;
}

.session-plan {
  display: grid;
  gap: 10px;
}

.session-item {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.session-item strong,
.session-item small {
  display: block;
}

.session-item strong {
  font-size: 0.92rem;
}

.session-item small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.workflow-panel {
  min-height: 150px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-steps article {
  min-height: 102px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.workflow-steps strong,
.workflow-steps span {
  display: block;
}

.workflow-steps strong {
  font-size: 0.92rem;
}

.workflow-steps span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.45;
}

.comparison-hint {
  min-height: 18px;
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.range-control .period-control,
.compare-range .period-control {
  min-width: 0;
}

.period-control label,
.kpi-label,
.muted {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.dashboard {
  padding: 22px 32px 36px;
}

.overview-band,
.panel,
.metric-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) minmax(210px, 0.55fr);
  gap: 12px;
  padding: 12px;
}

.overview-main {
  min-height: 126px;
  padding: 18px;
  border: 1px dashed #c7cfdd;
  border-radius: 7px;
  background: #fbfcfe;
}

.overview-main p {
  margin: 8px 0 0;
  color: #344054;
  line-height: 1.55;
}

.metric-tile {
  min-height: 126px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  box-shadow: none;
}

.metric-tile strong,
.activity-card strong {
  display: block;
  font-size: 1.28rem;
  letter-spacing: 0;
}

.metric-tile small {
  color: var(--muted);
  font-weight: 750;
}

.activity-filters {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
}

.activity-filter {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.activity-filter.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.global-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(330px, 0.76fr);
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.left-column,
.right-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel {
  padding: 16px;
}

.selected-panel,
.pie-panel,
.trend-panel,
.compare-panel {
  display: flex;
  flex-direction: column;
}

.panel-header {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.chart-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.selected-panel {
  min-height: 0;
  align-self: stretch;
}

.activity-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.activity-card {
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
  border-top: 4px solid var(--blue);
  display: grid;
  align-content: start;
  gap: 10px;
}

.activity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.activity-card h3 {
  margin: 0;
  font-size: 0.96rem;
}

.activity-card span,
.activity-card small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.activity-card-grid div {
  min-width: 0;
}

.activity-card-grid strong {
  margin-top: 3px;
  font-size: 1rem;
  word-break: break-word;
}

.global-page .panel,
.global-page .overview-main,
.global-page .metric-tile {
  border-color: #d6e2dd;
  box-shadow: 0 12px 26px rgba(11, 59, 54, 0.10);
}

.global-page .overview-main {
  border-top: 4px solid #149b57;
}

.global-page .metric-tile {
  border-top: 4px solid #d7ad32;
}

.global-page .activity-card {
  background: #f8f9f7;
  border-color: #d6e2dd;
}

.global-page .activity-dot {
  box-shadow: 0 0 0 4px rgba(20, 155, 87, 0.12);
}

.pie-panel {
  align-self: stretch;
}

.pie-panel canvas {
  aspect-ratio: 13 / 9;
  height: auto !important;
  max-height: none;
}

.activity-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--blue);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segmented button {
  min-width: 86px;
  height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.global-page .segmented {
  border-color: #149b57;
}

.global-page .segmented button {
  color: #073f38;
}

.global-page .segmented button.active {
  background: #149b57;
  color: #fff;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:last-child,
td:last-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
  font-weight: 650;
}

tr.active-row td {
  background: #f3f6ff;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.neutral {
  color: var(--amber) !important;
}

.status {
  display: inline-block;
  min-width: 96px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef2ff;
  color: #344054;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 850;
}

.status.risk {
  background: #fff1f0;
  color: var(--red);
}

.status.good {
  background: #ecfdf3;
  color: var(--green);
}

.status.watch {
  background: #fff7e6;
  color: var(--amber);
}

@media (max-width: 1180px) {
  .global-page .global-topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .global-brand {
    justify-content: center;
  }

  .global-controls {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
    justify-items: stretch;
  }

  .bni-home .home-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .bni-home .trader-actions {
    justify-self: stretch;
    justify-content: flex-start;
  }

  .global-page .global-controls .range-control {
    justify-content: flex-start;
  }

  .overview-band,
  .global-layout,
  .trader-hero,
  .trader-grid,
  .reporting-layout,
  .job-layout,
  .scope-grid,
  .pricing-grid,
  .digital-grid,
  .trader-negotiation-grid,
  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .trader-shell {
    grid-template-columns: 1fr;
  }

  .side-menu {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-menu nav {
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    overflow-x: auto;
  }

  .overview-band {
    grid-template-columns: 1fr;
  }

  .activity-filters {
    grid-template-columns: repeat(4, minmax(112px, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .dashboard {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .trader-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .global-page .trader-actions {
    align-items: center;
    flex-direction: row;
  }

  .global-controls {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .global-page .last-update {
    width: 100%;
    min-height: 38px;
    justify-content: flex-start;
    white-space: normal;
    line-height: 1.25;
  }

  .global-page .global-controls .range-control {
    padding: 12px;
  }

  .side-menu nav {
    grid-template-columns: 1fr;
  }

  .overview-band,
  .activity-cards,
  .activity-filters {
    grid-template-columns: 1fr;
  }

  .range-control,
  .compare-range {
    display: grid;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.55rem;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .session-item {
    grid-template-columns: 1fr;
  }

  .reporting-cards,
  .market-row {
    grid-template-columns: 1fr;
  }
}

.home-body {
  background: #eef2f6;
}

.bni-home {
  --bg: #eef3ef;
  --surface: #ffffff;
  --ink: #073f38;
  --muted: #61766f;
  --line: #d7e3dc;
  --blue: #149b57;
  --green: #149b57;
  --amber: #ff9f0a;
  --red: #c24132;
  --shadow: 0 14px 32px rgba(7, 63, 56, 0.09);
  background:
    linear-gradient(180deg, rgba(20, 155, 87, 0.09), rgba(255, 255, 255, 0) 260px),
    var(--bg);
}

.home-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  min-height: 108px;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.08);
}

.bni-home .home-topbar {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) auto;
  align-items: center;
  gap: 20px;
  position: static;
  min-height: 132px;
  padding: 24px 32px;
  background:
    linear-gradient(135deg, rgba(7, 63, 56, 0.04), rgba(20, 155, 87, 0.08)),
    #f8f9f7;
  border-bottom: 4px solid #ff9f0a;
  box-shadow: 0 14px 34px rgba(7, 63, 56, 0.10);
}

.bni-brand-block {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.bni-logo {
  width: min(380px, 42vw);
  height: auto;
  flex: 0 0 auto;
}

.bni-header-logo-stack {
  display: grid;
  justify-items: stretch;
  gap: 6px;
  width: clamp(260px, 20vw, 374px);
  flex: 0 0 clamp(260px, 20vw, 374px);
}

.bni-header-logo-stack .bni-logo,
.bni-header-logo-stack .bni-module-logo {
  width: 100%;
  height: 108px;
  padding: 18px 22px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(214, 226, 221, 0.9);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(11, 59, 54, 0.10);
}

.bni-header-logo-stack .auth-user-badge {
  width: 100%;
  min-height: 34px;
  justify-content: center;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.76rem;
  text-align: center;
}

.bni-home .trader-actions,
.bni-home .topbar > .trader-actions {
  justify-self: end;
  align-self: start;
  align-items: center;
  justify-content: flex-end;
  flex-direction: row;
  gap: 8px;
}

.bni-home .trader-actions .auth-logout-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  justify-content: center;
  padding: 0;
}

.bni-home .trader-actions .auth-button-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.primary-home-link {
  border-color: #149b57;
  background: #149b57;
  color: #fff;
}

.desk-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff6e8;
  color: #a45d00;
  font-size: 0.78rem;
  font-weight: 850;
}

.home-dashboard {
  display: grid;
  gap: 18px;
  padding: 28px 32px 40px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
}

.home-command,
.home-board,
.home-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.home-command {
  min-height: 310px;
  padding: 24px;
  background: #101828;
  color: #fff;
  display: grid;
  align-content: center;
}

.home-command .section-label {
  color: #a4bcfd;
}

.home-command h2 {
  max-width: 780px;
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.18;
}

.home-command p {
  max-width: 760px;
  margin: 14px 0 0;
  color: #e4e7ec;
  font-weight: 720;
  line-height: 1.55;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.home-actions .nav-link:not(.primary-home-link) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

.home-board,
.home-section {
  padding: 16px;
}

.bni-home .home-section {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px;
  border-color: #d7e3dc;
  border-top: 4px solid #149b57;
}

.home-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-kpis article {
  min-height: 137px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  display: grid;
  align-content: space-between;
}

.home-kpis span,
.home-kpis small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.home-kpis strong {
  display: block;
  margin: 8px 0;
  font-size: 1.25rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
}

.bni-home .workspace-grid {
  grid-template-columns: repeat(3, minmax(230px, 1fr));
}

.workspace-card {
  min-height: 220px;
  padding: 15px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  display: grid;
  align-content: start;
  gap: 12px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.bni-home .workspace-card {
  min-height: 236px;
  background: #fff;
  border-color: #d7e3dc;
  box-shadow: 0 10px 24px rgba(7, 63, 56, 0.06);
}

.workspace-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(23, 32, 51, 0.1);
}

.workspace-card.disabled {
  cursor: default;
  opacity: 0.72;
}

.workspace-card.disabled:hover {
  transform: none;
  box-shadow: none;
}

.workspace-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workspace-card-head span,
.workspace-card-head strong,
.workspace-badges small {
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.workspace-card-head span {
  color: var(--muted);
}

.workspace-card-head strong {
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef8f1;
  color: #149b57;
}

.workspace-card h3 {
  margin: 0;
  font-size: 1.08rem;
}

.workspace-card p {
  margin: 0;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 720;
  line-height: 1.45;
}

.workspace-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.workspace-badges small {
  padding: 5px 7px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
}

.workspace-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.workspace-actions .nav-link {
  min-height: 38px;
  padding: 9px 10px;
  text-align: center;
}

.bni-home .workspace-actions .nav-link:not(.primary-home-link) {
  border-color: #ffbd57;
  color: #073f38;
  background: #fffaf2;
}

.module-shell-page .home-topbar {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.module-overview {
  max-width: 1180px;
}

.module-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-card-grid article {
  min-height: 138px;
  padding: 15px;
  border: 1px solid var(--line);
  border-top: 4px solid #149b57;
  border-radius: 8px;
  background: #fbfcfe;
}

.module-card-grid strong,
.module-card-grid span {
  display: block;
}

.module-card-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.45;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(520px, calc(100% - 32px));
}

.login-panel {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 4px solid #149b57;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-logo {
  width: min(340px, 100%);
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.login-form input {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  font-weight: 760;
}

.auth-user-badge {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #d7e3dc;
  border-radius: 6px;
  background: #eef8f1;
  color: #073f38;
  font-size: 0.78rem;
  font-weight: 850;
}

.auth-logout-button {
  cursor: pointer;
}

.support-admin-panel {
  display: grid;
  gap: 14px;
}

.support-module-list,
.support-users-list,
.support-log-list {
  display: grid;
  gap: 10px;
}

.support-module-row,
.support-user-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.support-module-row,
.support-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.support-module-row strong,
.support-module-row span,
.support-user-head strong,
.support-user-head span {
  display: block;
}

.support-module-row span,
.support-user-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.support-switch {
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.support-switch input,
.support-abilities-grid input {
  accent-color: #149b57;
}

.support-user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
}

.support-user-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.support-user-form input,
.support-user-form select {
  width: 100%;
  min-height: 42px;
}

.support-danger-button {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #fecdca;
  border-radius: 6px;
  background: #fff1f0;
  color: #c24132;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
}

.support-abilities-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.support-abilities-grid section {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.support-abilities-grid section > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.support-abilities-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.support-log-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.support-log-row span,
.support-log-row strong,
.support-log-row small {
  display: block;
}

.support-log-row span,
.support-log-row small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.support-log-row strong {
  margin: 4px 0;
  font-size: 0.92rem;
}

.workspace-soon {
  grid-column: 1 / -1;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.tone-blue {
  border-top-color: var(--blue);
}

.tone-amber {
  border-top-color: var(--amber);
}

.tone-dark {
  border-top-color: #101828;
}

.tone-red {
  border-top-color: var(--red);
}

.tone-green {
  border-top-color: var(--green);
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.governance-list,
.roadmap-list {
  display: grid;
  gap: 10px;
}

.governance-list article,
.roadmap-list article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.governance-list strong,
.governance-list span,
.roadmap-list strong,
.roadmap-list small {
  display: block;
}

.governance-list span,
.roadmap-list small {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 760;
  line-height: 1.42;
}

.roadmap-list article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
}

.roadmap-list article span {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #101828;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 850;
}

/* ===========================
   Dernière modification
   =========================== */

.last-update {
  margin-left: auto;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.global-page .last-update {
  min-height: 34px;
  margin-left: 0;
  padding: 0 12px;
  border-color: rgba(214, 226, 221, 0.95);
  color: #103b37;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  white-space: nowrap;
}

/* ===========================
   Trading et Investissement
   =========================== */

.brand-block h1 {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand-block .eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

/* ===========================
   Graphiques
   =========================== */

.trend-panel canvas,
.compare-panel canvas {
  flex: 1 1 auto;
  min-height: 430px;
}

.compare-panel {
  overflow: hidden;
}

.compare-panel canvas {
  padding-bottom: 20px;
}

/* ===========================
   KPI améliorés
   =========================== */

.metric-tile strong {
  font-size: 1.6rem;
  font-weight: 900;
}

.metric-tile small {
  margin-top: 8px;
  line-height: 1.4;
}

/* ===========================
   Cartes activité
   =========================== */

.activity-card {
  transition: transform 0.15s ease,
              box-shadow 0.15s ease;
}

.activity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(23, 32, 51, 0.08);
}

/* ===========================
   Impression synthese globale
   =========================== */

@media print {
  @page {
    size: A4 landscape;
    margin: 9mm;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body,
  .global-page {
    width: auto;
    min-height: 0;
    background: #fff;
  }

  .global-page {
    --bg: #fff;
    --surface: #fff;
    --line: #cfd8d4;
    --shadow: none;
    padding: 0;
    color: #073f38;
  }

  .global-page .global-topbar {
    min-height: 0;
    grid-template-columns: minmax(0, 1.18fr) minmax(430px, 0.82fr);
    gap: 14px;
    padding: 10px 12px 12px;
    background: linear-gradient(135deg, #ffffff, #f6faf7);
    border: 1px solid #d6e2dd;
    border-bottom: 4px solid #ff9f0a;
    border-radius: 8px;
    box-shadow: none;
    break-inside: avoid;
  }

  .global-brand {
    gap: 14px;
  }

  .global-logo {
    width: 190px;
    height: 64px;
    padding: 10px 14px;
    border-color: #d6e2dd;
    border-radius: 7px;
    box-shadow: none;
  }

  .brand-block h1,
  .global-page h1 {
    font-size: 1.38rem;
    line-height: 1.08;
  }

  .global-page .eyebrow,
  .global-page .section-label {
    color: #12805c;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
  }

  .global-page .topbar-note {
    margin-top: 5px;
    font-size: 0.75rem;
  }

  .global-controls {
    align-self: stretch;
    grid-template-columns: auto auto;
    justify-content: end;
    align-content: start;
    justify-items: end;
    gap: 8px 10px;
  }

  .print-summary-button,
  .trader-actions,
  .auth-logout-button,
  .global-control-actions,
  .print-selected-period,
  .chart-actions,
  .trend-panel,
  .compare-panel {
    display: none !important;
  }

  .global-page .last-update {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    padding: 0 14px;
    border: 1px solid #d6e2dd;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: none;
    color: #103b37;
    font-size: 0.8rem;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
  }

  .print-selected-period {
    display: none;
  }

  .global-page .global-controls .range-control {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #d6e2dd;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: none;
  }

  .global-page .global-controls .period-control {
    display: grid;
    flex: 1 1 0;
    gap: 5px;
    min-width: 0;
  }

  .global-page .period-control label {
    color: #073f38;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .global-page .global-controls select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #c6dfbb;
    border-radius: 6px;
    background: #fff;
    color: #073f38;
    font-size: inherit;
    font-weight: 850;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    appearance: auto;
  }

  .dashboard {
    padding: 9px 0 0;
  }

  .overview-band {
    grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.45fr);
    gap: 9px;
    padding: 9px;
    border-radius: 8px;
    box-shadow: none;
    break-inside: avoid;
  }

  .overview-main,
  .metric-tile,
  .panel,
  .global-page .panel,
  .global-page .overview-main,
  .global-page .metric-tile {
    box-shadow: none;
  }

  .overview-main {
    min-height: 82px;
    padding: 11px 12px;
    border-style: solid;
    border-top: 4px solid #149b57;
    border-radius: 7px;
    background: #fbfcfe;
  }

  .overview-main p {
    margin-top: 4px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .metric-tile {
    min-height: 82px;
    padding: 11px 12px;
    border-radius: 7px;
    background: #fffdf7;
  }

  .metric-tile strong {
    font-size: 1.12rem;
  }

  .global-layout {
    grid-template-columns: minmax(0, 1.24fr) minmax(330px, 0.76fr);
    gap: 9px;
    margin-top: 9px;
    align-items: stretch;
  }

  .selected-panel,
  .pie-panel {
    min-height: 0;
    padding: 11px;
    border-radius: 8px;
    border-top-width: 4px;
    break-inside: avoid;
  }

  .selected-panel {
    display: flex;
    flex-direction: column;
  }

  .panel-header {
    min-height: 22px;
    margin-bottom: 7px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2ebe7;
  }

  .panel-header h2 {
    font-size: 0.86rem;
    color: #073f38;
  }

  .activity-cards {
    flex: 1 1 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .activity-card {
    min-height: 100%;
    padding: 8px;
    border-radius: 6px;
    gap: 6px;
    align-content: stretch;
    background: #ffffff;
    break-inside: avoid;
  }

  .activity-card h3 {
    font-size: 0.76rem;
  }

  .activity-card span,
  .activity-card small {
    font-size: 0.64rem;
  }

  .activity-card-grid {
    gap: 5px;
  }

  .activity-card-grid strong {
    font-size: 0.72rem;
  }

  .pie-panel canvas {
    width: 100% !important;
    height: auto !important;
    max-height: none;
  }

  .activity-card:hover {
    transform: none;
    box-shadow: none;
  }
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 900px) {

  .global-page .global-topbar {
    padding: 20px 18px;
  }

  .global-brand {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .global-logo-stack {
    width: min(360px, 100%);
    flex: 0 0 auto;
  }

  .global-logo {
    width: 100%;
    height: 92px;
    padding: 14px 18px;
  }

  .global-page h1 {
    font-size: 1.7rem;
  }

  .global-page .topbar-note {
    font-size: 0.86rem;
  }

  .range-control {
    display: grid;
    grid-template-columns: 1fr;
  }

  .last-update {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .global-page .global-topbar {
    padding: 16px 12px;
  }

  .global-brand {
    gap: 16px;
  }

  .global-logo-stack {
    width: 100%;
  }

  .global-logo {
    height: 82px;
    padding: 12px 14px;
  }

  .global-logo-stack .auth-user-badge {
    min-height: 32px;
    font-size: 0.72rem;
  }

  .global-page h1 {
    font-size: 1.55rem;
  }

  .global-page .global-controls {
    gap: 8px;
  }

  .global-page .trader-actions .auth-logout-button {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .global-page .last-update {
    font-size: 0.72rem;
    padding: 7px 9px;
  }

  .global-page .global-controls select {
    height: 40px;
    font-size: 0.92rem;
  }
}

@media (max-width: 1180px) {
  .home-hero,
  .home-layout,
  .workspace-grid,
  .module-card-grid,
  .support-user-form,
  .support-abilities-grid {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .home-topbar {
    position: static;
  }

  .bni-brand-block {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .bni-header-logo-stack,
  .bni-logo {
    width: min(360px, 100%);
    flex: 0 0 auto;
  }

  .bni-header-logo-stack .bni-logo,
  .bni-header-logo-stack .bni-module-logo {
    height: 92px;
    padding: 14px 18px;
  }

  .bni-home .trader-actions {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .home-dashboard {
    padding: 18px 16px 28px;
  }

  .home-hero,
  .home-layout,
  .home-kpis,
  .workspace-grid,
  .module-card-grid {
    grid-template-columns: 1fr;
  }

  .workspace-actions {
    grid-template-columns: 1fr;
  }

  .support-module-row,
  .support-user-head {
    align-items: stretch;
    flex-direction: column;
  }

  .support-switch {
    justify-content: flex-start;
  }

  .home-command h2 {
    font-size: 1.25rem;
  }
}
