:root {
  --bg: #f7f1e8;
  --ink: #1f1a16;
  --muted: #746b61;
  --soft: #fffaf3;
  --white: #ffffff;
  --dark: #181513;
  --dark-2: #2a221d;
  --gold: #f1d6ad;
  --terra: #b8794c;
  --terra-dark: #8d4f2f;
  --line: #eadfce;
  --shadow: 0 22px 70px rgba(52, 39, 27, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(184, 121, 76, 0.18), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(241, 214, 173, 0.36), transparent 28rem),
    var(--bg);
  color: var(--ink);
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #181513 0%, #2d2119 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 28px;
  align-items: end;
  padding: clamp(24px, 5vw, 48px);
}

.hero-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.32;
}

.hero-glow-one {
  right: -70px;
  top: -70px;
  width: 230px;
  height: 230px;
  background: var(--terra);
}

.hero-glow-two {
  left: 45%;
  bottom: -90px;
  width: 220px;
  height: 220px;
  background: var(--gold);
  opacity: 0.18;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 10px 14px;
  color: rgba(255,255,255,0.76);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  font-size: 14px;
  font-weight: 700;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(241, 214, 173, 0.7);
}

.brand-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 28px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--gold), var(--terra));
  color: #181513;
  font-size: 30px;
  font-weight: 1000;
  letter-spacing: -0.08em;
  box-shadow: 0 18px 45px rgba(0,0,0,0.25);
}

h1, h2, p { margin: 0; }

h1 {
  font-size: clamp(36px, 7vw, 70px);
  line-height: 0.92;
  letter-spacing: -0.065em;
  font-weight: 1000;
}

h1 span { color: var(--gold); }

.hero-title-block p {
  max-width: 720px;
  margin-top: 16px;
  color: rgba(255,255,255,0.68);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.6;
}

.hero-total-card {
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 28px;
  padding: 24px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
}

.hero-total-card p,
.hero-total-card small {
  color: rgba(255,255,255,0.62);
  font-weight: 800;
}

.hero-total-card p {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
}

.hero-total-card strong {
  display: block;
  margin-top: 10px;
  color: var(--gold);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero-total-card small {
  display: block;
  margin-top: 12px;
  font-size: 14px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.scenario-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 8px 30px rgba(52, 39, 27, 0.06);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.scenario-card:hover { transform: translateY(-2px); box-shadow: 0 18px 45px rgba(52, 39, 27, 0.11); }
.scenario-card.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.scenario-card strong { display: block; font-size: 21px; font-weight: 1000; }
.scenario-card small { display: block; margin-top: 4px; color: var(--muted); font-weight: 700; }
.scenario-card.active small { color: rgba(255,255,255,0.62); }
.scenario-card em { font-style: normal; color: var(--terra); font-size: 24px; font-weight: 1000; }
.scenario-card.active em { color: var(--gold); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card, .panel {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: 0 10px 38px rgba(52, 39, 27, 0.07);
}

.kpi-card {
  border-radius: 28px;
  padding: 22px;
}

.kpi-card p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1;
  letter-spacing: -0.055em;
  font-weight: 1000;
}

.progress-track {
  height: 9px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe7dc;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--terra), var(--dark));
  transition: width .25s ease;
}

.panel {
  border-radius: var(--radius-xl);
  padding: clamp(18px, 3vw, 28px);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.panel h2 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.045em;
  font-weight: 1000;
}

.panel-heading p,
.panel-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
}

.objective-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.objective-zone label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.money-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 12px;
  background: var(--soft);
}

.money-input span {
  color: var(--muted);
  font-weight: 1000;
}

.money-input input {
  width: 130px;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: right;
  color: var(--ink);
  font-size: 18px;
  font-weight: 1000;
}

.reset-button, .copy-button {
  border: 0;
  border-radius: 18px;
  padding: 12px 16px;
  color: #fff;
  background: var(--dark);
  font-weight: 1000;
  transition: transform .2s ease, background .2s ease;
}

.reset-button:hover, .copy-button:hover { transform: translateY(-1px); background: var(--terra-dark); }

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
}

.table-header,
.row-line {
  display: grid;
  grid-template-columns: 1.45fr .58fr .58fr .68fr .54fr .66fr 1.05fr .9fr .9fr;
  gap: 0;
  align-items: center;
}

.table-header {
  padding: 14px 16px;
  background: var(--dark);
  color: rgba(255,255,255,0.72);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-header div:not(:first-child) { text-align: right; }

.rows-container { background: #fff; }

.row-line {
  min-height: 92px;
  padding: 16px;
  border-top: 1px solid #f0e8dc;
}
.row-line:first-child { border-top: 0; }

.activity-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-box {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 17px;
  background: #f3e3cf;
  color: var(--terra-dark);
  font-size: 20px;
}

.activity-name strong {
  display: block;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 1000;
}

.activity-name small {
  display: block;
  margin-top: 4px;
  color: #9b9187;
  font-size: 12px;
  font-weight: 800;
}

.cell {
  padding-left: 8px;
  text-align: right;
}

.mobile-label { display: none; }

.input-box {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 112px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px 10px;
  background: #fffdf9;
}

.input-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  text-align: right;
  font-weight: 1000;
}

.input-box span {
  margin-left: 4px;
  color: #a3988d;
  font-size: 12px;
  font-weight: 900;
}

.input-box select {
  width: 100%;
  min-width: 74px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  text-align: right;
  font-weight: 1000;
  appearance: auto;
}

.input-box.select-box {
  padding-right: 8px;
}

.input-box.disabled {
  background: #f7f3ed;
  color: #a89e93;
}
.input-box.disabled input { color: #a89e93; }

.tva-split-box {
  display: inline-grid;
  gap: 5px;
  min-width: 118px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 9px;
  background: #fffdf9;
}

.tva-input-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 1000;
}

.tva-input-line input {
  width: 44px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  text-align: right;
  font-weight: 1000;
}

.tva-auto-line {
  display: block;
  color: #9b9187;
  font-size: 11px;
  font-weight: 1000;
  text-align: right;
  white-space: nowrap;
}

.result-value {
  display: block;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 1000;
  letter-spacing: -0.04em;
}
.result-value.ht { color: var(--terra-dark); }

.bottom-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 20px;
  margin-top: 20px;
}

.repartition-list {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.repartition-line-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: #473f38;
  font-size: 14px;
  font-weight: 900;
}

.repartition-line-top strong { font-size: 15px; }

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1e9dd;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--terra), var(--gold));
  transition: width .25s ease;
}

.summary-panel {
  color: #fff;
  background: linear-gradient(135deg, #181513, #2d2119);
  border-color: rgba(255,255,255,0.08);
}

.summary-list {
  margin-top: 20px;
}

.summary-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 13px 0;
}

.summary-list span {
  color: rgba(255,255,255,0.62);
  font-size: 14px;
  font-weight: 800;
}

.summary-list strong {
  color: #fff;
  text-align: right;
  font-size: 20px;
  font-weight: 1000;
  letter-spacing: -0.04em;
}

.summary-list div:first-child strong,
.summary-list div:last-child strong { color: var(--gold); }

.copy-button {
  width: 100%;
  margin-top: 18px;
  background: rgba(255,255,255,0.12);
}
.copy-button:hover { background: var(--terra); }

.summary-note {
  margin-top: 18px;
  border-radius: 22px;
  padding: 16px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.68);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 650;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  padding: 13px 18px;
  background: var(--dark);
  color: #fff;
  font-weight: 1000;
  box-shadow: 0 18px 45px rgba(0,0,0,0.22);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .hero-content, .bottom-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .table-header { display: none; }
  .row-line {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
  }
  .activity-name {
    grid-column: 1 / -1;
  }
  .cell {
    padding: 0;
    text-align: left;
  }
  .mobile-label {
    display: block;
    margin-bottom: 5px;
    color: #9b9187;
    font-size: 11px;
    font-weight: 1000;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .input-box, .tva-split-box { width: 100%; max-width: none; }
  .result-value { font-size: 20px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .objective-zone { justify-content: flex-start; width: 100%; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1280px); padding-top: 10px; }
  .hero-card, .panel { border-radius: 26px; }
  .hero-content { padding: 22px; }
  .brand-line { grid-template-columns: 1fr; }
  .brand-logo { width: 70px; height: 70px; border-radius: 22px; }
  .hero-total-card { padding: 18px; }
  .scenario-grid { grid-template-columns: 1fr; gap: 10px; }
  .scenario-card { padding: 18px; border-radius: 22px; }
  .kpi-grid { grid-template-columns: 1fr; gap: 10px; }
  .kpi-card { padding: 18px; border-radius: 22px; }
  .row-line { grid-template-columns: 1fr; min-height: auto; }
  .objective-zone { display: grid; grid-template-columns: 1fr; }
  .money-input input { width: 100%; }
  .reset-button { width: 100%; }
}
