/* Tableau de bord : la mise en page de la maquette (ml/doc/budget/maquette_espace_client.html),
   charte Predixis, polices hébergées ici (Montserrat, licence OFL dans polices/). */
@font-face {
  font-family: 'Montserrat'; font-weight: 400; font-display: swap;
  src: url(polices/montserrat-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-weight: 600; font-display: swap;
  src: url(polices/montserrat-latin-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-weight: 700; font-display: swap;
  src: url(polices/montserrat-latin-700-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Montserrat'; font-weight: 800; font-display: swap;
  src: url(polices/montserrat-latin-800-normal.woff2) format('woff2');
}
:root {
  --bg: #f7f9fc;          /* Gris halo */
  --surface: #ffffff;
  --ink: #333333;         /* Encre */
  --ink-2: #666666;       /* Ardoise */
  --line: #e0e6ed;        /* Gris bordure */
  --track: #edf1f6;
  --nuit: #2c3e50;        /* Bleu nuit : titres */
  --accent: #3498db;      /* Bleu Predixis : actions */
  --accent-2: #2980b9;
  --s-reel: #b7791f;      /* Réalisé */
  --s-prev: #2b8fd6;      /* Prévu par l'IA */
  --s-obj: #2c3e50;       /* Objectif */
  --ok: #1e8e4e; --ok-bg: #e6f5ec;
  --warn: #b35a0b; --warn-bg: #fdf0e3;
  --bad: #c0392b; --bad-bg: #fbe9e7;
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11171e;
    --surface: #18212b;
    --ink: #e4e9ef;
    --ink-2: #9fb0c2;
    --line: #2b3846;
    --track: #22303d;
    --nuit: #e4ecf4; --accent: #4aa8e8; --accent-2: #6bb9ee;
    --s-reel: #e9a04a; --s-prev: #4aa8e8; --s-obj: #d3dee9;
    --ok: #5fd08e; --ok-bg: #173325; --warn: #f0a560; --warn-bg: #3a2814;
    --bad: #f08a7e; --bad-bg: #3d1d1a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11171e;
  --surface: #18212b;
  --ink: #e4e9ef;
  --ink-2: #9fb0c2;
  --line: #2b3846;
  --track: #22303d;
  --nuit: #e4ecf4; --accent: #4aa8e8; --accent-2: #6bb9ee;
  --s-reel: #e9a04a; --s-prev: #4aa8e8; --s-obj: #d3dee9;
  --ok: #5fd08e; --ok-bg: #173325; --warn: #f0a560; --warn-bg: #3a2814;
  --bad: #f08a7e; --bad-bg: #3d1d1a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--surface); }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1080px; margin: 0 auto; }
.num { font-variant-numeric: tabular-nums; }

/* Barre du haut */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.top .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding-block: 12px;
}
.logo { font-weight: 700; letter-spacing: 2px; color: var(--nuit); font-size: 17px; }
.logo small {
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-2);
  font-size: 13px;
  margin-left: 8px;
}
.top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
select, input, button { font-family: inherit; font-size: 14px; }
select { border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 6px; padding: 7px 10px; }
.user { color: var(--ink-2); font-size: 13px; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

main .wrap { padding-block: 22px 48px; display: grid; gap: 20px; }
h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--nuit);
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}
h2 { font-size: 18px; font-weight: 700; color: var(--nuit); margin: 0; }
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.lead { color: var(--ink-2); margin: 4px 0 0; max-width: 65ch; }
.muted { color: var(--ink-2); }

/* Tableau de bord : nom du resto et carte du jour en tête, puis un bloc année et un bloc mois */
.tete-tdb { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
  gap: 12px 28px; }
.jour { display: grid; grid-template-columns: auto auto; gap: 12px 40px; align-items: center; }
.bloc {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 20px 28px;
  align-items: start;
}
.resume { display: grid; gap: 12px; align-content: start; }
.quand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.jour .titre-jour { font-size: 26px; font-weight: 800; line-height: 1.1; }
.jour .date { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.chiffres { display: flex; flex-wrap: wrap; gap: 12px 40px; }
.chiffres .lbl { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.chiffres .val {
  font-size: 30px; font-weight: 800; color: var(--nuit); line-height: 1.15; white-space: nowrap;
}
.action { font-size: 14px; margin: 0; }
details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
details .table-wrap { margin-top: 10px; }

/* Trois barres à la même échelle : objectif, prévu par l'IA, réalisé */
.duo {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 96px;
  gap: 8px 10px;
  align-items: center;
}
.duo .lbl { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.duo .piste { height: 14px; background: var(--track); border-radius: 7px; overflow: hidden; }
.duo .b { height: 100%; border-radius: 7px; }
.duo .b.obj { background: var(--s-obj); }
.duo .b.prevu { background: var(--s-prev); }
.duo .b.fait { background: var(--s-reel); }
.duo .val { font-size: 14px; font-weight: 700; color: var(--nuit); text-align: right; }
.duo .val.vide { font-weight: 500; color: var(--ink-2); }
.duo .lbl small { display: block; font-size: 11px; font-weight: 400; }
.pt {
  width: 18px;
  height: 0;
  border-top: 3px solid;
  display: inline-block;
  vertical-align: middle;
}
.pt.fait {
  border-color: var(--s-reel);
  } .pt.prevu { border-color: var(--s-prev);
  border-top-style: dashed;
}
.pt.obj { border-color: var(--s-obj); }
.pt.zone { border: 0; height: 10px; background: var(--s-prev); opacity: .25; border-radius: 2px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}
.panel-head { display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: baseline;
gap: 8px 16px;
  margin-bottom: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; }
.chart text { font-family: var(--font); fill: var(--ink-2); font-size: 11px; }
.tip { position: absolute;
pointer-events: none;
background: var(--surface);
border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.12);
  min-width: 170px; z-index: 3; }
.tip b { color: var(--nuit); display: block; margin-bottom: 4px; }
/* La bulle garde la largeur de son contenu, même contre le bord droit du graphe */
.tip { width: max-content; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.tip .row span { white-space: nowrap; }
.tip .row span:first-child { color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }
td.gauche { text-align: left; }

.a-jour { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }

/* Compte sans aucun resto : le message au milieu de la page */
.sans-resto { min-height: 60vh; place-items: center; }
.sans-resto .panel { max-width: 560px; padding: 32px 28px; text-align: center; }
.sans-resto p {
  margin: 0; font-size: 22px; font-weight: 700; color: var(--nuit); line-height: 1.3;
}
.sans-resto p + p { margin-top: 16px; font-size: 18px; font-weight: 600; }
.sans-resto a { color: var(--accent-2); }

/* Page /demo : dit tout de suite que les chiffres sont inventés */
.bandeau-demo {
  margin: 0; padding: 10px 14px; border-radius: 8px; background: var(--track);
  color: var(--nuit); font-size: 14px; font-weight: 600;
}
th {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
tr.closed td { color: var(--ink-2); }
tr.today td { background: var(--bg); font-weight: 600; }
tfoot td { font-weight: 700; color: var(--nuit); }
.pos { color: var(--ok); } .neg { color: var(--bad); }

.btn { border: 1px solid var(--line);
background: var(--surface);
color: var(--ink);
border-radius: 6px;
  padding: 7px 12px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.month-nav { display: flex; align-items: center; gap: 8px; }

@media (max-width: 860px) {
  .bloc { grid-template-columns: minmax(0, 1fr); }
  .tete-tdb .jour { flex: 1 1 100%; }
  /* Téléphone : « Aujourd'hui » au-dessus de ses deux chiffres */
  .jour { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 21px; }
  .top .who { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
