@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&display=swap');

/* Tableau de bord — présentation d'après la maquette « Tableau de bord ERP » fournie le 2026-10-23
   (cartes blanches arrondies, bleu marine + orange, graphique à barres avec prévision, panneau de
   suggestions sombre). Tout est rangé sous .dash pour ne rien changer ailleurs dans l'application
   (menu de gauche, barre du haut et autres écrans restent tels quels). */
.dash {
  --d-navy: #16233F;
  --d-navy-2: #1F2F52;
  --d-orange: #E6702E;
  --d-orange-soft: #F2B48E;
  --d-cyan: #1FA7C9;
  --d-card: #FFFFFF;
  --d-ink: #16233F;
  --d-muted: #5A6478;
  --d-line: #E6EAF1;
  --d-line-soft: #F0F2F6;
  --d-bar: #16233F;
  --d-green: #137A52;
  --d-warn: #B4501A;
  --d-shadow: 0 1px 2px rgba(22, 35, 63, 0.06);
  font-family: 'Manrope', system-ui, sans-serif;
  color: var(--d-ink);
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1500px;
}
/* Version sombre de l'application (4e état de l'ampoule) */
html[data-chrome="full"] .dash {
  --d-card: var(--surface);
  --d-ink: var(--ink);
  --d-muted: var(--ink-muted);
  --d-line: var(--border);
  --d-line-soft: var(--border-soft);
  --d-bar: #7C92C8;
  --d-navy: #0F1A33;
  --d-navy-2: #1B2A4D;
  --d-green: #5BD39B;
  --d-warn: #FFA066;
  --d-shadow: none;
}
.dash *, .dash *::before, .dash *::after { box-sizing: border-box; }
.dash button { font-family: inherit; }

/* ---- En-tête ---- */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.dash-date { font-size: 13px; font-weight: 600; color: var(--d-muted); }
.dash-hello { margin: 4px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -0.6px; color: var(--d-ink); }
.dash-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.dash-ask {
  display: flex; align-items: center; gap: 10px; background: var(--d-card); border: 1px solid var(--d-line);
  border-radius: 12px; padding: 0 14px; min-height: 46px; width: 380px; max-width: 100%;
}
.dash-ask svg { flex: none; }
.dash-ask input { border: 0 !important; outline: 0; flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--d-ink); background: transparent !important; padding: 0 !important; box-shadow: none !important; }
.dash-ask:focus-within { border-color: var(--d-orange); box-shadow: 0 0 0 3px rgba(230, 112, 46, 0.18); }
.dash-bell {
  position: relative; width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--d-line);
  background: var(--d-card); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--d-ink);
}
.dash-bell:hover { border-color: var(--d-orange); }
.dash-bell .dot { position: absolute; top: 10px; right: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--d-orange); border: 2px solid var(--d-card); }
.dash-new {
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--d-orange); color: #FFFFFF;
  font-weight: 700; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.dash-new:hover { background: #D2601F; }
.dash button:focus-visible, .dash a:focus-visible { outline: 3px solid rgba(230, 112, 46, 0.45); outline-offset: 2px; }

/* ---- Cartes de chiffres ---- */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.dash-card {
  background: var(--d-card); border-radius: 16px; padding: 20px; box-shadow: var(--d-shadow);
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
html[data-chrome="full"] .dash-card { border: 1px solid var(--d-line); }
.dash-kpi-label { font-size: 13px; font-weight: 600; color: var(--d-muted); }
.dash-kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; color: var(--d-ink); }
.dash-kpi-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 500; color: var(--d-muted); }
.dash-kpi-sub strong { color: var(--d-ink); font-weight: 700; }
.dash-up { color: var(--d-green); font-weight: 700; }
.dash-down { color: #C0392B; font-weight: 700; }
.dash-warn { color: var(--d-warn); font-weight: 700; }
.dash-meter { height: 8px; border-radius: 4px; background: var(--d-line); overflow: hidden; }
.dash-meter > div { height: 100%; background: var(--d-cyan); border-radius: 4px; }

/* ---- Graphique + suggestions ---- */
.dash-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; }
.dash-chart { flex: 2 1 520px; min-width: 0; padding: 22px 24px; gap: 16px; }
.dash-title { margin: 0; font-size: 17px; font-weight: 800; color: var(--d-ink); }
.dash-chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.dash-legend { display: flex; gap: 18px; font-size: 12px; font-weight: 600; color: var(--d-muted); }
.dash-legend span { display: flex; align-items: center; gap: 6px; }
.dash-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--d-bar); }
.dash-legend i.fc { background: var(--d-orange-soft); border: 1.5px dashed var(--d-orange); }
.dash-chart svg { width: 100%; height: auto; display: block; }
.dash-chart .axis { font-family: 'Manrope', sans-serif; font-size: 11px; fill: var(--d-muted); }
.dash-chart .axis-strong { font-weight: 800; fill: var(--d-ink); }
.dash-chart .grid { stroke: var(--d-line); stroke-width: 1; }
.dash-chart .bar { fill: var(--d-bar); }
.dash-chart .bar.cur { fill: var(--d-orange); }
.dash-chart .bar.empty { fill: var(--d-line); }
.dash-chart .bar.fc { fill: var(--d-orange-soft); stroke: var(--d-orange); stroke-width: 1.5; stroke-dasharray: 4 3; }
.dash-chart .bar:hover { opacity: 0.85; }
.dash-chart .note { font-family: 'Manrope', sans-serif; font-size: 12px; fill: var(--d-muted); }
.dash-chart-foot { font-size: 12px; color: var(--d-muted); margin: -6px 0 0; }

.dash-ai {
  flex: 1 1 320px; min-width: 0; background: var(--d-navy); color: #FFFFFF; border-radius: 16px; padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
}
html[data-chrome="full"] .dash-ai { border: 1px solid var(--d-line); }
.dash-ai-head { display: flex; align-items: center; gap: 10px; }
.dash-ai-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--d-orange); display: flex; align-items: center; justify-content: center; }
.dash-ai h2 { margin: 0; font-size: 17px; font-weight: 800; color: #FFFFFF; }
.dash-sug { background: var(--d-navy-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.dash-sug-tag { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #FFB98F; }
.dash-sug p { margin: 0; font-size: 14px; line-height: 1.5; color: #E8ECF4; }
.dash-sug a, .dash-sug button.link {
  align-self: flex-start; background: none; border: 0; padding: 0; cursor: pointer; font-size: 13px; font-weight: 700; color: #7FD8EE; text-decoration: none;
}
.dash-sug a:hover, .dash-sug button.link:hover { text-decoration: underline; }
.dash-ai-foot { margin: auto 0 0; font-size: 11.5px; color: #A9B4CA; }

/* ---- Documents récents + stocks ---- */
.dash-docs { flex: 2 1 520px; padding: 22px 24px; gap: 14px; }
.dash-docs-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dash-link { background: none; border: 0; padding: 0; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--d-ink); text-decoration: underline; }
.dash-link:hover { color: var(--d-orange); }
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
.dash-table th {
  text-align: left; color: var(--d-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700;
  padding: 10px 8px; border-bottom: 1px solid var(--d-line); background: transparent;
}
.dash-table th.num, .dash-table td.num { text-align: right; }
.dash-table td { padding: 12px 8px; border-bottom: 1px solid var(--d-line-soft); color: var(--d-ink); }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table tbody tr { cursor: pointer; }
.dash-table tbody tr:hover td { background: rgba(230, 112, 46, 0.06); }
.dash-table td.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.dash-table td.client { font-weight: 600; }
.dash-table td.date { color: var(--d-muted); white-space: nowrap; }
.dash-table td.amount { text-align: right; font-weight: 700; white-space: nowrap; }
.dash-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.dash-pill.paid { background: #E3F5EC; color: #137A52; }
.dash-pill.info { background: #E2F3F8; color: #0E6A82; }
.dash-pill.sent, .dash-pill.draft { background: #EEF0F5; color: #3D4659; }
.dash-pill.late { background: #FCEBDF; color: #A3460F; }
.dash-empty { color: var(--d-muted); font-size: 14px; padding: 18px 4px; }

.dash-stock { flex: 1 1 320px; padding: 22px 24px; gap: 16px; }
.dash-stock-item { display: flex; flex-direction: column; gap: 6px; }
.dash-stock-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.dash-stock-line .sku { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-stock-line .qty { font-weight: 700; white-space: nowrap; }
.dash-stock-line .qty.low { color: var(--d-warn); }
.dash-stock .dash-meter > div.low { background: var(--d-orange); }
.dash-outline {
  margin-top: auto; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px;
  border: 1.5px solid var(--d-ink); background: transparent; color: var(--d-ink); font-weight: 700; font-size: 14px; cursor: pointer; width: 100%;
}
.dash-outline:hover { border-color: var(--d-orange); color: var(--d-orange); }

.dash-skeleton { color: var(--d-muted); padding: 40px 0; text-align: center; }

@media (max-width: 700px) {
  .dash-hello { font-size: 25px; }
  .dash-ask { width: 100%; }
  .dash-tools { width: 100%; }
  .dash-new { flex: 1; justify-content: center; }
  .dash-chart, .dash-docs, .dash-stock { padding: 18px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .dash-meter > div { transition: width 0.5s ease; }
}
