:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --surface: #fff;
  --ink: #202925;
  --muted: #737e77;
  --line: #e5e9e3;
  --green: #23634b;
  --green-dark: #184a38;
  --green-soft: #e9f2ec;
  --orange: #b85d36;
  --orange-soft: #fbf0e9;
  --shadow: 0 10px 30px rgba(30, 50, 39, .055);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
.shell { max-width: 1440px; margin: 0 auto; padding: 34px 38px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 35px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: var(--green); }
.brand-mark svg { width: 25px; height: 25px; }
.brand-name { font-weight: 750; letter-spacing: -.035em; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 3px; letter-spacing: .08em; text-transform: uppercase; }
.status { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #dfe8df; color: var(--green); background: #f4f8f4; padding: 9px 13px; border-radius: 30px; font-size: 12px; font-weight: 650; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #49a16e; box-shadow: 0 0 0 3px #dceee1; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 27px; }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: .13em; font-weight: 750; font-size: 10px; margin: 0 0 10px; }
h1 { font-size: clamp(29px, 4vw, 42px); letter-spacing: -.055em; line-height: 1.08; margin: 0; font-weight: 720; }
.intro-copy { color: var(--muted); line-height: 1.6; margin: 12px 0 0; font-size: 14px; max-width: 690px; }
.model-tag { color: #64726a; font-size: 11px; white-space: nowrap; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: rgba(255,255,255,.6); margin-bottom: 4px; }
.layout { display: grid; grid-template-columns: minmax(300px, 350px) minmax(0, 1fr); gap: 21px; align-items: start; }
.card { background: var(--surface); border: 1px solid #e9ece7; border-radius: 14px; box-shadow: var(--shadow); }
.controls { padding: 21px 21px 19px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 19px; }
.section-heading h2 { font-size: 14px; letter-spacing: -.01em; margin: 0; }
.section-index { color: #8a958e; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.control-group { padding: 16px 0; border-top: 1px solid #edf0ec; }
.control-group:first-of-type { border-top: 0; padding-top: 0; }
.group-title { color: #78837c; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 15px; }
.control { margin-top: 14px; }
.control:first-of-type { margin-top: 0; }
.control-label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; }
.control-label label { color: #445049; font-weight: 570; }
.unit { color: #909a93; font-size: 10px; }
.input-line { display: grid; grid-template-columns: minmax(0, 1fr) 83px; align-items: center; gap: 12px; }
input[type="range"] { appearance: none; width: 100%; height: 4px; border-radius: 8px; background: #e5ebe5; outline: none; accent-color: var(--green); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--green); border: 3px solid white; box-shadow: 0 0 0 1px #b9cec0, 0 2px 4px #0002; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 3px solid white; box-shadow: 0 0 0 1px #b9cec0, 0 2px 4px #0002; cursor: pointer; }
input[type="number"] { width: 83px; height: 34px; text-align: right; border: 1px solid #e4e9e3; border-radius: 7px; padding: 0 9px; color: var(--ink); background: #fcfdfb; font-size: 12px; font-weight: 650; outline: none; }
input[type="number"]:focus { border-color: #84aa92; box-shadow: 0 0 0 3px #eaf2ec; }
.range-limits { display: flex; justify-content: space-between; color: #a0a9a2; font-size: 9px; margin-top: 6px; padding-right: 95px; }
.hint { color: #87918a; font-size: 10px; line-height: 1.5; margin: 10px 0 0; }
.results { min-width: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { padding: 17px 17px 16px; min-height: 127px; position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 65px; height: 65px; right: -25px; top: -25px; border-radius: 50%; background: #f4f8f4; }
.metric-label { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; color: #738078; font-size: 10px; font-weight: 620; }
.metric-label span:last-child { color: #9ca69f; font-size: 10px; }
.metric-value { margin-top: 20px; font-weight: 750; letter-spacing: -.055em; font-size: clamp(22px, 2.4vw, 30px); white-space: nowrap; }
.metric-unit { color: #7d8981; font-size: 11px; margin-left: 4px; font-weight: 550; letter-spacing: 0; }
.metric-caption { color: #96a099; font-size: 10px; margin-top: 6px; }
.energy-note { padding: 13px 16px; margin: 0 0 16px; display: flex; align-items: center; gap: 11px; background: var(--green-soft); border: 1px solid #dcebe0; border-radius: 10px; color: #41604c; font-size: 11px; line-height: 1.5; }
.energy-note .icon { flex: 0 0 24px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: #d8e9dc; color: var(--green); font-weight: 800; }
.energy-note.warning { background: var(--orange-soft); color: #835337; border-color: #f2dfd0; }
.energy-note.warning .icon { background: #f3dfce; color: var(--orange); }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(245px, .8fr); gap: 16px; }
.chart-card, .melt-card, .method-card { padding: 19px; }
.card-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { margin: 0; font-size: 13px; letter-spacing: -.02em; }
.card-subtitle { font-size: 10px; color: #89938d; margin: 5px 0 0; line-height: 1.5; }
.legend { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: #758078; font-size: 9px; }
.legend-line { width: 14px; height: 2px; background: var(--green); }
.chart-wrap { position: relative; height: 220px; margin-top: 13px; }
canvas { width: 100%; height: 100%; display: block; }
.melt-card { background: #fffdfa; border-color: #eee9df; }
.melt-badge { border-radius: 20px; padding: 5px 8px; color: #956f42; background: #f7f0e4; font-size: 9px; font-weight: 700; white-space: nowrap; }
.melt-rate { font-weight: 750; letter-spacing: -.05em; font-size: 28px; margin-top: 22px; }
.melt-rate small { color: #85877e; font-size: 11px; font-weight: 550; letter-spacing: 0; }
.melt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 15px; margin-top: 14px; border-top: 1px solid #eeeae2; }
.melt-stat-label { color: #92958c; font-size: 9px; }
.melt-stat-value { color: #465047; font-size: 13px; font-weight: 700; margin-top: 5px; }
.melt-explanation { color: #92938a; font-size: 9px; line-height: 1.55; margin: 14px 0 0; }
.phase-summary { margin-top: 16px; padding: 12px; border: 1px solid #eeeae2; border-radius: 8px; background: #fff; }
.phase-summary-label, .phase-progress-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #92958c; font-size: 9px; }
.phase-summary-label strong, .phase-progress-label strong { color: #465047; font-size: 10px; }
.phase-result { color: #465047; font-size: 15px; font-weight: 750; margin-top: 7px; }
.phase-detail { color: #92938a; font-size: 9px; line-height: 1.5; margin: 4px 0 10px; }
.phase-progress { height: 6px; overflow: hidden; border-radius: 6px; background: #edf0ec; }
.phase-progress-fill { width: 0; height: 100%; border-radius: inherit; background: #49a16e; transition: width .2s ease; }
.phase-progress-label { margin-top: 6px; }
.phase-input-status { color: #87918a; font-size: 9px; line-height: 1.45; margin: 5px 0 0; }
.phase-input-status.error { color: #9a5a37; }
.calculation-status { color: #9a5a37; font-size: 10px; font-weight: 600; }
.method-card { margin-top: 16px; background: #f1f5f1; border-color: #e4ebe4; box-shadow: none; }
.method-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.method-card h2 { margin: 0; font-size: 12px; }
.method-card p { color: #77827a; font-size: 10px; line-height: 1.65; margin: 8px 0 0; }
.formula-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.formula { color: #496052; border: 1px solid #dfe8df; border-radius: 6px; background: #f8faf7; padding: 7px 9px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; overflow-wrap: anywhere; }
.method-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.pill { border: 1px solid #dce5dc; background: #f8faf8; color: #5e7163; padding: 5px 8px; font-size: 9px; border-radius: 20px; }
.solver-card { margin-top: 16px; padding: 20px; }
.solver-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.solver-heading h2 { margin: 0; font-size: 14px; }
.solver-description { color: #839087; font-size: 10px; line-height: 1.55; margin: 6px 0 0; max-width: 680px; }
.solver-status { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #e2e8e2; border-radius: 20px; padding: 7px 10px; color: #758078; white-space: nowrap; font-size: 10px; }
.solver-status::before { content: ""; width: 7px; height: 7px; background: #a7b1aa; border-radius: 50%; }
.solver-status.running { color: #246346; border-color: #d6e9dc; background: #f3f8f4; }
.solver-status.running::before { background: #49a16e; box-shadow: 0 0 0 3px #dceee1; }
.solver-status.done { color: #246346; border-color: #d6e9dc; background: #f3f8f4; }
.solver-status.done::before { background: #49a16e; }
.solver-status.warning { color: #956b35; border-color: #efe2c8; background: #fbf7ed; }
.solver-status.warning::before { background: #bf8a40; }
.solver-status.error { color: #9a5a37; border-color: #f0dfd2; background: #fcf5ef; }
.solver-status.error::before { background: #ce8150; }
.solver-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 19px; padding: 13px 14px; background: #f8faf7; border: 1px solid #edf0eb; border-radius: 9px; }
.solver-toolbar > .solver-status { white-space: normal; max-width: 100%; }
.solver-config { display: flex; flex-wrap: wrap; gap: 13px; align-items: flex-end; }
.solver-field label { display: block; color: #7d8880; font-size: 9px; margin-bottom: 5px; }
.solver-field input { width: 84px; height: 31px; font-size: 11px; }
.solver-field select { width: 112px; height: 31px; border: 1px solid #e4e9e3; border-radius: 7px; padding: 0 7px; color: var(--ink); background: #fff; font-size: 11px; }
.solver-field select:focus { outline: 2px solid #eaf2ec; border-color: #84aa92; }
.solver-actions { display: flex; gap: 8px; }
.solver-button { border: 1px solid #dce6dd; border-radius: 7px; height: 33px; padding: 0 12px; background: white; color: #536259; cursor: pointer; font-size: 10px; font-weight: 650; }
.solver-button.primary { background: var(--green); color: white; border-color: var(--green); }
.solver-button.primary:hover { background: var(--green-dark); }
.solver-button.secondary { color: var(--green); border-color: #cbdccf; background: #f6faf6; }
.solver-button:disabled { opacity: .45; cursor: not-allowed; }
.solver-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 13px; margin-top: 14px; }
.solver-panel { min-width: 0; border: 1px solid #edf0eb; border-radius: 9px; padding: 13px; }
.solver-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.solver-panel-head h3 { color: #4a564e; font-size: 10px; margin: 0; }
.solver-panel-head span { color: #929c94; font-size: 9px; }
.solver-canvas { display: block; width: 100%; height: 215px; margin-top: 9px; }
.legend-scale { display: flex; justify-content: space-between; align-items: center; gap: 9px; color: #929c94; font-size: 9px; margin-top: 6px; }
.gradient { height: 7px; flex: 1; border-radius: 5px; background: linear-gradient(90deg, #284ea0, #31a9ba, #66c779, #f4d45c, #d84835); }
.solver-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 13px; }
.solver-stat { background: #f8faf7; border: 1px solid #edf0eb; border-radius: 7px; padding: 9px 10px; }
.solver-stat label { display: block; color: #929c94; font-size: 9px; }
.solver-stat strong { display: block; color: #36483c; font-size: 13px; margin-top: 5px; }
.solver-footnote { color: #8b958e; font-size: 9px; line-height: 1.55; margin: 12px 0 0; }
.footer { display: flex; justify-content: space-between; gap: 16px; color: #98a19a; font-size: 9px; margin-top: 17px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1050px) {
  .shell { padding: 26px 22px 38px; }
  .layout { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); gap: 14px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-grid { grid-template-columns: 1fr; }
  .chart-wrap { height: 205px; }
  .solver-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { padding: 19px 14px 30px; }
  .topbar { margin-bottom: 26px; }
  .intro { display: block; margin-bottom: 20px; }
  .model-tag { display: inline-block; margin-top: 14px; }
  .layout { grid-template-columns: 1fr; }
  .controls { padding: 18px; }
  .metric-grid { gap: 9px; }
  .metric { min-height: 115px; padding: 14px; }
  .metric-value { margin-top: 16px; }
  .method-layout { grid-template-columns: 1fr; gap: 20px; }
  .solver-card { padding: 15px; }
  .solver-heading { display: block; }
  .solver-status { margin-top: 11px; }
  .solver-stats { grid-template-columns: repeat(2, 1fr); }
  .solver-canvas { height: 185px; }
  .footer { flex-direction: column; }
}
@media (prefers-reduced-motion: no-preference) {
  .metric-value, .melt-rate { transition: color .18s ease; }
}

/* --- Barre d'actions, projets, notifications ------------------------------ */
[hidden] { display: none !important; }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
a.app-button { display: inline-flex; align-items: center; text-decoration: none; }
.app-button { border: 1px solid #dce6dd; border-radius: 8px; height: 34px; padding: 0 13px; background: #fff; color: #4a5a50; cursor: pointer; font-size: 12px; font-weight: 650; }
.app-button:hover { border-color: #b9cec0; color: var(--green); }
.app-button:focus-visible { outline: 3px solid #cfe3d5; outline-offset: 1px; }
.app-button.primary { background: var(--green); border-color: var(--green); color: #fff; }
.app-button.primary:hover { background: var(--green-dark); color: #fff; }
.app-button.danger:hover { border-color: #e8c9b6; color: var(--orange); }
.projects-dialog { width: min(560px, calc(100vw - 32px)); border: 1px solid #e3e8e2; border-radius: 14px; padding: 20px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 60px rgba(20, 40, 30, .18); }
.projects-dialog::backdrop { background: rgba(25, 38, 31, .35); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }
.dialog-head h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.dialog-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 8px 0 14px; }
.project-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--line); }
.project-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.project-name { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.project-date { color: #8a958e; font-size: 10px; margin-top: 3px; }
.project-buttons { display: flex; gap: 6px; flex: 0 0 auto; }
.project-empty { color: #8a958e; font-size: 12px; padding: 18px 0; text-align: center; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 10px; background: #1f2d26; color: #fff; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .app-actions { justify-content: flex-start; }
  .project-item { flex-direction: column; align-items: flex-start; }
}
