/* ============================================================
   ROI Calculator - Light theme cohérent Garage Insight
   Palette : accent #059669 (Rule 44)
   ============================================================ */

.roi-main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 32px 80px;
}

/* ============== HERO ============== */
.roi-hero {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 60%, #eff6ff 100%);
  border: 1px solid #d1fae5;
  border-radius: 20px;
  padding: 32px 40px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.roi-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.roi-hero h1 {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.roi-hero-sub {
  font-size: 15px;
  color: #475569;
  margin: 0 0 20px;
  max-width: 780px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

.roi-hero-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.preset-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-right: 6px;
}

.preset-btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid #d1fae5;
  background: #ffffff;
  color: #047857;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-btn:hover {
  background: #ecfdf5;
  border-color: #059669;
  transform: translateY(-1px);
}

.preset-btn.active {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

/* ============== LAYOUT ============== */
.roi-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

/* ===== INPUTS (col gauche) ===== */
.roi-inputs {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.roi-inputs h2 {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.roi-group {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px dashed #e2e8f0;
}

.roi-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.roi-group h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #047857;
  margin: 0 0 14px;
}

.roi-devis-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: 14px;
}
.roi-devis-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ede9fe;
  border-radius: 12px;
}
.roi-devis-content { flex: 1; min-width: 0; }
.roi-devis-title {
  font-size: 16px;
  font-weight: 700;
  color: #5b21b6;
  margin-bottom: 4px;
}
.roi-devis-sub {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

.roi-field {
  margin-bottom: 16px;
}

.roi-field:last-child {
  margin-bottom: 0;
}

.roi-field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 6px;
}

.roi-field label strong {
  font-size: 15px;
  font-weight: 800;
  color: #047857;
  background: #ecfdf5;
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid #d1fae5;
  font-variant-numeric: tabular-nums;
}

.value-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  border-radius: 6px;
  padding: 2px 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.value-edit:focus-within {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.value-input {
  border: none;
  background: transparent;
  color: #047857;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  width: 90px;
  text-align: right;
  outline: none;
  padding: 0;
  -moz-appearance: textfield;
}

.value-input::-webkit-outer-spin-button,
.value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.value-input:focus {
  color: #064e3b;
}

.value-unit {
  font-size: 13px;
  font-weight: 700;
  color: #047857;
  white-space: nowrap;
}

.roi-canvas-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

.roi-canvas-wrap.pie {
  height: 220px;
}

.roi-canvas-wrap canvas {
  max-height: 100%;
}

.roi-field input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  margin: 4px 0;
}

.roi-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #059669;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.roi-field input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.roi-field input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #059669;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4);
  cursor: pointer;
}

.roi-field small {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  line-height: 1.4;
}

/* ===== OUTPUTS (col droite) ===== */
.roi-outputs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* BIG NUMBER */
.roi-big {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-radius: 20px;
  padding: 32px 36px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(5, 150, 105, 0.25);
}

.roi-big::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
}

.roi-big-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 4px;
  position: relative;
}

.roi-big-number {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  position: relative;
  line-height: 1;
  margin-bottom: 16px;
}

.roi-big-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}

.meta-pill {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  backdrop-filter: blur(6px);
}

.meta-pill strong {
  font-weight: 800;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.meta-pill.positive {
  background: rgba(220, 252, 231, 0.25);
}

.meta-pill.negative {
  background: rgba(254, 226, 226, 0.25);
}

.meta-pill.payback {
  background: rgba(254, 243, 199, 0.3);
}

/* KPI GRID */
.roi-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.roi-kpi {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.roi-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-content .kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 4px;
}

.kpi-content .kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-content .kpi-sub {
  font-size: 12px;
  color: #94a3b8;
}

/* CHART CARDS */
.roi-chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.roi-chart-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PIE LAYOUT */
.roi-pie-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
}

.roi-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-text {
  flex: 1;
  font-size: 13px;
  color: #334155;
  font-weight: 500;
}

.legend-value {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

/* CUMUL SUMMARY */
.roi-cumul-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
}

.cumul-stat {
  text-align: center;
}

.cumul-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 4px;
}

.cumul-stat strong {
  font-size: 20px;
  font-weight: 800;
  color: #047857;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* SUMMARY TABLE */
.roi-summary-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.roi-summary-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 16px;
}

.roi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.roi-table thead th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.roi-table thead th:first-child {
  border-left: 1px solid #e2e8f0;
  border-top-left-radius: 10px;
}

.roi-table thead th:last-child {
  border-right: 1px solid #e2e8f0;
  border-top-right-radius: 10px;
}

.roi-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.roi-table tbody tr:last-child td {
  border-bottom: none;
}

.roi-table tbody td:first-child {
  font-weight: 600;
  color: #0f172a;
}

.roi-table tbody td.delta-positive {
  color: #047857;
  font-weight: 700;
}

.roi-table tbody td.delta-negative {
  color: #b91c1c;
  font-weight: 700;
}

.roi-table tbody tr.total-row td {
  background: #ecfdf5;
  font-weight: 800;
  color: #0f172a;
  border-top: 2px solid #059669;
}

.roi-cta {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed #e2e8f0;
}

/* DISCLAIMER */
.roi-disclaimer {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  padding: 16px 20px;
  margin-top: 28px;
}

.roi-disclaimer p {
  font-size: 13px;
  color: #78350f;
  margin: 0;
  line-height: 1.55;
}

/* ============== RESPONSIVE ============== */
@media (max-width: 1180px) {
  .roi-layout {
    grid-template-columns: 1fr;
  }

  .roi-inputs {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .roi-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .roi-main {
    padding: 16px 16px 60px;
  }

  .roi-hero {
    padding: 22px 20px;
  }

  .roi-hero h1 {
    font-size: 24px;
  }

  .roi-big-number {
    font-size: 40px;
  }

  .roi-kpis {
    grid-template-columns: 1fr;
  }

  .roi-pie-grid {
    grid-template-columns: 1fr;
  }

  .roi-cumul-summary {
    grid-template-columns: 1fr;
  }

  .roi-cta {
    flex-direction: column;
  }
}
