/* Opération Petit Pois — feuille de style
   Palette « conserverie » : encre vert profond, fer-blanc, papier, pois, tomate */
:root {
  --ink: #1d2a22; --ink-2: #3f4c43; --muted: #6d776f;
  --paper: #f5f2ea; --paper-2: #ece7da; --card: #fffdf8; --line: #d9d3c4;
  --tin: #aeb4ad; --tin-2: #d5d9d3;
  --pea: #5d8a2e; --pea-d: #2f5d1e; --pea-l: #c9e08f;
  --tomato: #c4552d; --amber: #d99a2b; --blue: #3d5a8a;
  --r: 10px; --shadow: 0 1px 0 rgba(29,42,34,.06), 0 6px 18px -10px rgba(29,42,34,.25);
  --f-head: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--f-head); letter-spacing: -.01em; margin: 0 0 .4em; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--pea-d); }
.muted { color: var(--muted); } .tiny { font-size: 12px; color: var(--muted); }
.pos { color: var(--pea-d); } .neg { color: var(--tomato); } .mid { color: var(--amber); }

/* boutons */
.btn { border: 1.5px solid var(--ink); background: var(--card); border-radius: 8px; padding: .62em 1.1em; font-weight: 600; transition: transform .08s, background .15s; }
.btn:hover:not(:disabled) { background: var(--paper-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--pea-d); border-color: var(--pea-d); }
.btn.sm { padding: .38em .9em; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--pea-d); text-decoration: underline; font-size: 13px; }

/* logo boîte */
.can-logo { width: 54px; height: 66px; border-radius: 8px; position: relative; background: linear-gradient(90deg, #9aa199, #e3e6e1 40%, #9aa199); box-shadow: inset 0 -5px 0 rgba(0,0,0,.12), inset 0 5px 0 rgba(255,255,255,.5); }
.can-logo span { position: absolute; left: 0; right: 0; top: 18px; height: 30px; background: var(--pea); }
.can-logo span::before, .can-logo span::after { content: ''; position: absolute; top: 9px; width: 11px; height: 11px; border-radius: 50%; background: var(--pea-l); box-shadow: 13px -3px 0 var(--pea-l); }
.can-logo span::before { left: 9px; } .can-logo span::after { left: 22px; top: 12px; box-shadow: none; }
.can-logo.sm { width: 28px; height: 34px; border-radius: 5px; }
.can-logo.sm span { top: 9px; height: 16px; } .can-logo.sm span::before, .can-logo.sm span::after { display: none; }

/* accueil */
.intro { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 15% 20%, rgba(93,138,46,.12), transparent 40%), radial-gradient(circle at 85% 80%, rgba(196,85,45,.08), transparent 40%), var(--paper); }
.intro-card { max-width: 760px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 40px; box-shadow: var(--shadow); }
.intro h1 { font-size: clamp(36px, 7vw, 64px); font-weight: 800; line-height: .95; margin: 6px 0 14px; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 600; color: var(--pea-d); margin: 18px 0 0; }
.lead { font-size: 17px; color: var(--ink-2); }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0; }
.rules div { background: var(--paper); border-radius: 8px; padding: 12px 14px; font-size: 14px; border-left: 3px solid var(--pea); }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* structure */
.shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 10px; align-items: center; min-width: 210px; }
.brand b { font-family: var(--f-head); font-size: 17px; display: block; line-height: 1.1; }
.brand small { color: #b8c2b9; font-size: 12px; }
.stats { display: flex; gap: 26px; flex: 1; justify-content: center; flex-wrap: wrap; }
.stat small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #a9b4aa; }
.stat b { font-family: var(--f-mono); font-size: 18px; }
.stat b span { font-size: 13px; color: #a9b4aa; }
.stat .tiny { color: #a9b4aa; }
.stat b.neg { color: #ff9b77; } .stat b.mid { color: #f2c46b; } .stat b.pos { color: var(--pea-l); }
.wk, .gauge { height: 4px; background: rgba(255,255,255,.15); border-radius: 2px; margin-top: 3px; width: 90px; overflow: hidden; }
.wk i, .gauge i { display: block; height: 100%; background: var(--pea-l); }
.gauge i.neg { background: #ff9b77; } .gauge i.mid { background: #f2c46b; }
.dots { display: flex; gap: 4px; margin: 5px 0 2px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--pea-l); }
.dots i.on { background: var(--pea-l); }
.top .btn.end { background: var(--pea-l); color: var(--ink); border-color: var(--pea-l); white-space: nowrap; }
.top .btn.end:hover { background: #fff; border-color: #fff; }

.side { background: var(--paper-2); border-right: 1px solid var(--line); padding: 18px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 64px; height: calc(100vh - 64px); }
.side button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.side button:hover { background: rgba(29,42,34,.06); }
.side button.on { background: var(--ink); color: #fff; }
.badge { background: var(--tomato); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-family: var(--f-mono); }
.side-foot { margin-top: auto; padding: 8px 12px; }
.main { padding: 24px 28px 60px; min-width: 0; max-width: 1280px; }
.h { font-size: 15px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); margin: 26px 0 12px; display: flex; gap: 12px; align-items: baseline; }
.h:first-child { margin-top: 0; }

/* conseils et panneaux */
.tip { background: #fdf6dd; border: 1px solid #ecd994; border-radius: var(--r); padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.empty { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 20px; text-align: center; color: var(--muted); margin: 14px 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel h3 { font-size: 15px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-top: 16px; }
.charts .panel { margin: 0; }

/* vue de la ligne */
.line { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 2px 10px; }
.step { flex: 1 0 92px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 3px; min-width: 92px; }
.step .n { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.step .nm { font-weight: 600; font-size: 13px; line-height: 1.2; margin-bottom: 2px; }
.step.known { border-color: var(--pea); }
.step.bad { border-color: var(--tomato); box-shadow: inset 0 3px 0 var(--tomato); }
.tag { font-size: 11px; border-radius: 4px; padding: 1px 5px; font-family: var(--f-mono); }
.tag.unk { color: var(--tin); font-size: 16px; font-family: var(--f-head); }
.tag.bad { background: #f8dfd5; color: #8e3416; } .tag.ok { background: #e5f0d6; color: var(--pea-d); } .tag.info { background: var(--paper-2); color: var(--ink-2); }
.arr { flex: 0 0 14px; align-self: center; height: 2px; background: var(--tin); position: relative; }
.arr::after { content: ''; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--tin); border-right: 0; }

/* indicateurs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; position: relative; min-height: 92px; }
.kpi small { display: block; font-size: 12px; color: var(--muted); }
.kpi b { font-family: var(--f-mono); font-size: 20px; display: block; margin-top: 2px; }
.kpi.big { border-top: 3px solid var(--pea); }
.kpi .spark { width: 90px; height: 26px; position: absolute; right: 10px; bottom: 8px; opacity: .9; }
.kpi.locked { background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 8px, var(--paper-2) 8px, var(--paper-2) 16px); border-style: dashed; }
.kpi .lk { font-family: var(--f-head); font-weight: 700; color: var(--muted); margin: 4px 0; }
.dl { font-size: 12px; margin-left: 4px; color: var(--muted); }
.dl.up { color: var(--pea); } .dl.down { color: var(--tomato); }

/* graphiques */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #e6e1d4; }
.chart .ax { font: 11px var(--f-mono); fill: #7d847e; }
.chart .ax.lbl { font-size: 10.5px; fill: var(--ink-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.hbars { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.hb { display: grid; grid-template-columns: 190px 1fr 92px; gap: 10px; align-items: center; font-size: 13px; }
.hb-t { height: 14px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.hb-b { display: block; height: 100%; background: var(--pea); }
.hb.hl .hb-b { background: var(--tomato); } .hb.hl .hb-l { font-weight: 700; color: var(--tomato); }
.hb-v { font-family: var(--f-mono); font-size: 12px; text-align: right; }

/* décisions */
.dec-head p { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 4px 12px; font-size: 13px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card h4 { font-size: 16px; margin: 6px 0 6px; line-height: 1.25; }
.card p { font-size: 13.5px; color: var(--ink-2); margin: 0 0 10px; flex: 1; }
.card-top { display: flex; gap: 6px; }
.tagc { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--paper-2); border-radius: 4px; padding: 2px 7px; font-weight: 600; color: var(--ink-2); }
.tagc.ghost { background: none; border: 1px solid var(--line); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 8px; margin-bottom: 10px; }
.foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.why { font-size: 12px; color: var(--muted); }
.why.ok, .why .ok { color: var(--pea-d); font-weight: 600; }
.card.active { border-color: var(--amber); }
.card.locked { opacity: .65; box-shadow: none; background: var(--paper); }
.card.done { box-shadow: none; background: #f1f4ea; }
.cards.compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards.compact .card { padding: 10px 12px; } .cards.compact h4 { font-size: 14px; }
.prog { flex: 1 1 100%; height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--amber); }

/* documents */
.docs { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.doclist { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 3px; }
.doclist h5 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 12px 0 2px 4px; }
.doclist button { text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 10px; font-size: 13.5px; }
.doclist button small { display: block; color: var(--muted); font-size: 11px; }
.doclist button:hover { background: var(--paper-2); }
.doclist button.on { background: var(--card); box-shadow: inset 3px 0 0 var(--pea); }
.paper { background: #fffefb; border: 1px solid var(--line); border-radius: 4px; padding: 30px 34px; box-shadow: 0 10px 30px -18px rgba(29,42,34,.45); min-width: 0; }
.paper header { border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 18px; }
.paper header h2 { font-size: 24px; margin: 6px 0 2px; }
.paper header small { color: var(--muted); }
.doc-body { font-size: 14.5px; }
.doc-meta { font-size: 13px; color: var(--muted); }
.steps { padding-left: 22px; } .steps li { margin-bottom: 6px; }
ol.fivewhy li { margin-bottom: 10px; }
.tbl { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); border-bottom: 2px solid var(--ink); padding: 6px 8px; }
.tbl td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; }
.callout { border-left: 4px solid var(--blue); background: #eef2f8; padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 14px 0; font-size: 14px; }
.callout.warn { border-color: var(--amber); background: #fbf2de; }
.callout.ok { border-color: var(--pea); background: #edf4e3; }
.callout.danger { border-color: var(--tomato); background: #fae4dc; }
.scroll-x { overflow-x: auto; }
.vsm { min-width: 760px; }
.vsm .vt { font: 11px var(--f-body); fill: var(--ink); } .vsm .vt.b { font-weight: 600; font-size: 11.5px; } .vsm .vt.s { font-size: 10.5px; fill: var(--ink-2); } .vsm .vt.t { font: 700 9px var(--f-mono); }
.vsm-box { fill: #fff; stroke: var(--ink); stroke-width: 1.5; } .vsm-box.hl { fill: #fae4dc; stroke: var(--tomato); stroke-width: 2.5; }
.vsm-data { fill: var(--paper); stroke: var(--ink); } .vsm-tri { fill: #f2c46b; stroke: var(--ink); }
.vsm-ext { fill: var(--paper-2); stroke: var(--ink); } .vsm-ctrl { fill: #fff; stroke: var(--ink); stroke-dasharray: 4 3; }
.fish { min-width: 900px; }
.fish .ft { font: 12px var(--f-body); fill: var(--ink); } .fish .ft.b { font-weight: 700; font-size: 13px; } .fish .ft.w { fill: #fff; }
.fish .ft.s { font-size: 11px; fill: var(--ink-2); } .fish .ft.root { fill: var(--tomato); font-weight: 600; }
.tree { margin: 12px 0; }
.tree .node { background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: 13.5px; }
.tree .node.root { background: var(--pea-d); text-align: center; margin-bottom: 12px; }
.tree .branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tree .br { display: flex; flex-direction: column; gap: 5px; border-top: 2px solid var(--pea); padding-top: 8px; }
.tree .leaf { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 6px 9px; font-size: 13px; }

/* directeurs */
.dirs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.dir { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.who { display: flex; gap: 10px; align-items: center; }
.who small { display: block; color: var(--muted); font-size: 12.5px; }
.av { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font: 700 14px var(--f-head); flex: 0 0 auto; }
.av.xs { width: 22px; height: 22px; font-size: 9px; vertical-align: middle; margin-right: 6px; }
.dir blockquote { margin: 12px 0 0; padding: 12px 14px; background: var(--paper); border-radius: 0 10px 10px 10px; font-size: 14.5px; position: relative; }
.ophist { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.ophist > div { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.ophist small { font-family: var(--f-mono); color: var(--muted); margin-right: 6px; }
.pill { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; border-radius: 4px; padding: 1px 6px; margin-right: 6px; }
.pill.aide { background: #e5f0d6; color: var(--pea-d); } .pill.piege { background: #f8dfd5; color: #8e3416; } .pill.neutre { background: var(--paper-2); color: var(--ink-2); }

/* journal */
.log { display: flex; flex-direction: column; gap: 4px; }
.le { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 8px 12px; background: var(--card); border-radius: 6px; border-left: 3px solid var(--tin); font-size: 14px; }
.le small { font-family: var(--f-mono); color: var(--muted); }
.le.done { border-color: var(--pea); } .le.event { border-color: var(--amber); } .le.alert { border-color: var(--tomato); background: #fae4dc; } .le.launch { border-color: var(--blue); }

/* modale */
.modal-bg { position: fixed; inset: 0; background: rgba(29,42,34,.55); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s; }
.modal { background: var(--card); border-radius: 14px; max-width: 680px; width: 100%; max-height: 90vh; overflow: auto; padding: 26px 28px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); animation: rise .25s; }
.modal h2 { font-size: 30px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.mini-kpis div { background: var(--paper); border-radius: 8px; padding: 8px 10px; }
.mini-kpis small { display: block; font-size: 11.5px; color: var(--muted); }
.mini-kpis b { font-family: var(--f-mono); font-size: 16px; }
.done-list { padding-left: 18px; font-size: 14px; } .done-list li { margin-bottom: 8px; }
.modal-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; font-size: 14px; box-shadow: var(--shadow); animation: rise .2s; }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translate(var(--tx, 0), 10px); opacity: 0; } }
.toast { --tx: -50%; }

/* bilan */
.endscreen { max-width: 1180px; margin: 0 auto; padding: 32px 24px 70px; }
.end-head { text-align: center; padding: 20px 0 10px; }
.end-head h1 { font-size: clamp(34px, 6vw, 56px); font-weight: 800; margin: 4px 0; }
.score { font-family: var(--f-mono); } .score b { font-size: 46px; } .score span { color: var(--muted); }
.end-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; align-items: start; }
.debrief { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.lesson { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--pea); border-radius: 0 8px 8px 0; padding: 10px 14px; margin-bottom: 8px; }
.lesson.bad { border-left-color: var(--tomato); }
.lesson p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.end-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.tree-svg { display: block; }
.tree-svg .tt { font: 700 13px var(--f-head); fill: var(--ink); text-transform: uppercase; letter-spacing: .06em; }
.tree-svg .nd { fill: #fff; stroke: var(--line); stroke-width: 1.5; }
.tree-svg .nd.g.on { fill: var(--pea); stroke: var(--pea-d); } .tree-svg .nd.b.on { fill: var(--tomato); stroke: #8e3416; }
.tree-svg .nd.b { stroke-dasharray: 4 3; }
.tree-svg .nt { font: 11.5px var(--f-body); fill: var(--ink-2); } .tree-svg .nt.on { fill: #fff; font-weight: 600; }
.tree-svg .edge { fill: none; stroke: #c9c3b3; stroke-width: 1.2; } .tree-svg .edge.on { stroke: var(--pea-d); stroke-width: 2; }

/* responsive */
@media (max-width: 1100px) { .stats { gap: 16px; } .brand { min-width: 0; } .brand small { display: none; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; position: static; }
  .stats { order: 3; flex-basis: 100%; justify-content: space-between; gap: 10px; }
  .top .btn.end { margin-left: auto; }
  .side { position: sticky; top: 0; z-index: 15; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side button { white-space: nowrap; gap: 6px; }
  .side-foot { display: none; }
  .main { padding: 18px 16px 50px; }
  .docs { grid-template-columns: 1fr; }
  .doclist { position: static; flex-direction: row; overflow-x: auto; } .doclist h5 { display: none; } .doclist button { white-space: nowrap; }
  .paper { padding: 20px 16px; }
  .charts, .end-grid, .debrief, .rules { grid-template-columns: 1fr; }
  .hb { grid-template-columns: 120px 1fr 74px; }
  .mini-kpis { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; } .kpi .spark { display: none; } .kpi b { font-size: 17px; }
  .intro-card { padding: 26px 20px; }
}
