@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Theme colors */
  --bg-body: #080C14;
  --bg-card: rgba(16, 24, 40, 0.75);
  --bg-card-hover: rgba(22, 34, 56, 0.85);
  --bg-input: #0F172A;
  --bg-input-border: rgba(255, 255, 255, 0.12);
  --bg-input-focus: #1E293B;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(124, 58, 237, 0.4);
  --border-cyan: rgba(6, 182, 212, 0.4);

  /* Accents */
  --primary: #8B5CF6;
  --primary-glow: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
  --cyan: #06B6D4;
  --emerald: #10B981;
  --amber: #F59E0B;
  --rose: #F43F5E;
  --blue: #3B82F6;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(6, 182, 212, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
  padding-bottom: 4rem;
}

/* --- Container & Layout --- */
.container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--text-main);
  border-color: var(--border-accent);
  transform: translateX(-3px);
  background: rgba(139, 92, 246, 0.1);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow);
}

.brand-titles h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #FFFFFF, #E2E8F0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-glow);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-accent);
  color: #FFFFFF;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
}

.btn-danger-outline {
  background: transparent;
  color: var(--rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--rose);
}

/* Main Grid Layout */
.simulator-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 980px) {
  .simulator-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
  .results-column {
    width: 100%;
  }
  .results-panel {
    position: static !important;
    width: 100%;
  }
}

/* Section Cards */
.form-section-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease;
}

.form-section-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary);
  border: 1px solid rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.section-title-left h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: normal;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-dim);
  pointer-events: none;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  min-height: 46px;
  background-color: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}

input[type="date"] {
  min-width: 0;
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.8);
  opacity: 0.8;
  padding: 2px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.has-icon input,
.has-icon select {
  padding-left: 2.5rem;
}

input:focus,
select:focus {
  border-color: var(--primary);
  background-color: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Select natif fallback & options lisibles */
select,
select option,
select optgroup {
  font-family: var(--font-main);
  font-size: 1rem;
  background-color: #0F172A;
  color: #F8FAFC;
}

select option {
  padding: 10px 14px;
}

/* --- Custom Dropdowns (Haute Lisibilité & Résolution des Bugs Navigateur) --- */
.custom-dropdown-container {
  position: relative;
  width: 100%;
}

.visually-hidden-select {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.custom-dropdown-trigger {
  width: 100%;
  min-height: 48px;
  background-color: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  outline: none;
}

.custom-dropdown-trigger:hover,
.custom-dropdown-container.open .custom-dropdown-trigger {
  border-color: var(--primary);
  background-color: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.custom-dropdown-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-dropdown-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.custom-dropdown-container.open .custom-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.custom-dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #0F172A;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-dropdown-container.open .custom-dropdown-panel {
  display: flex;
}

.custom-dropdown-search-wrapper {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.98);
}

.custom-dropdown-search-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.custom-dropdown-search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.25);
}

.custom-dropdown-list {
  max-height: 290px;
  overflow-y: auto;
  padding: 0.35rem;
}

.custom-dropdown-list::-webkit-scrollbar {
  width: 6px;
}
.custom-dropdown-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.custom-dropdown-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}
.custom-dropdown-list::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.6);
}

.custom-dropdown-group-header {
  padding: 0.6rem 0.85rem 0.3rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.08);
  border-radius: var(--radius-sm);
  margin: 0.35rem 0 0.2rem 0;
}

.custom-dropdown-item {
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  font-weight: 500;
  color: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  user-select: none;
  min-height: 40px;
}

.custom-dropdown-item:hover {
  background-color: rgba(139, 92, 246, 0.22);
  color: #FFFFFF;
}

.custom-dropdown-item.selected {
  background-color: rgba(139, 92, 246, 0.35);
  color: #FFFFFF;
  font-weight: 700;
  border-left: 3px solid var(--primary);
}

.custom-dropdown-item .item-check {
  color: var(--cyan);
  font-weight: 800;
  font-size: 1.05rem;
  margin-left: 0.5rem;
}

.info-pill-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.info-pill-note strong {
  color: var(--cyan);
}

/* Custom Toggle Switch Card */
.checkbox-toggle-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-top: 0.25rem;
  transition: all 0.2s ease;
}

.checkbox-toggle-card:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.05);
}

.toggle-container {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.85rem !important;
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  background-color: #334155;
  border-radius: 9999px;
  flex-shrink: 0;
  transition: background-color 0.25s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.toggle-checkbox:checked + .toggle-switch {
  background: var(--primary-glow);
}

.toggle-checkbox:checked + .toggle-switch::after {
  transform: translateX(20px);
}

.toggle-label-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toggle-label-text strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.toggle-subtext {
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* IEG Quick Info Bar */
.ieg-live-salary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-top: 1.25rem;
}

.salary-preview-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.salary-preview-value {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cyan);
}

/* Other Regimes Dynamic List */
.periods-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.period-item-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.period-item-card:hover {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(20, 30, 50, 0.95);
}

.period-card-top {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
}

.period-card-top .flex-grow {
  flex: 1;
}

.period-card-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.25rem;
}

@media (max-width: 600px) {
  .period-card-fields {
    grid-template-columns: 1fr;
  }
  .period-card-top {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Suffix Euro */
.input-wrapper.suffix-euro {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-wrapper.suffix-euro input {
  padding-right: 2.2rem;
}

.input-suffix {
  position: absolute;
  right: 0.9rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  pointer-events: none;
}

/* Badge de durée calculée & recalcul automatique */
.period-duration-badge {
  font-size: 0.82rem;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.period-duration-badge.empty {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

.period-duration-badge strong {
  color: #FFFFFF;
}

.recalc-link {
  color: #A78BFA;
  font-weight: 700;
  font-size: 0.78rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.recalc-link:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #FFFFFF;
  border-color: var(--primary);
}

@keyframes inputHighlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.8);
    border-color: var(--cyan);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(6, 182, 212, 0.35);
    border-color: var(--cyan);
  }
  100% {
    box-shadow: none;
  }
}

.calc-highlight {
  animation: inputHighlightPulse 0.85s ease-out;
}

.empty-periods-placeholder {
  text-align: center;
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* --- Results Panel (Sticky) --- */
.results-panel {
  position: sticky;
  top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Main Pension KPI Card */
.main-kpi-card {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: 0 15px 35px -10px rgba(124, 58, 237, 0.3);
  position: relative;
  overflow: hidden;
}

.main-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-glow);
}

.status-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.rate-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.rate-status-badge.plein {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.rate-status-badge.decote {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.rate-status-badge.surcote {
  background: rgba(139, 92, 246, 0.2);
  color: #C084FC;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.kpi-title-small {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-main-amount {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.35rem 0 0.5rem 0;
}

.kpi-number {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #FFFFFF;
}

.kpi-unit {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-gross-secondary {
  font-size: 0.92rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kpi-gross-secondary strong {
  color: #E2E8F0;
  font-family: var(--font-mono);
}

/* Quarters progress bar */
.quarters-progress-block {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
}

.progress-fill-ieg {
  background: linear-gradient(90deg, #06B6D4, #3B82F6);
  height: 100%;
  transition: width 0.4s ease;
}

.progress-fill-other {
  background: linear-gradient(90deg, #8B5CF6, #EC4899);
  height: 100%;
  transition: width 0.4s ease;
}

.quarters-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
}

/* Regime Breakdown Cards */
.breakdown-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.4rem;
  box-shadow: var(--shadow-card);
}

.breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.breakdown-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.breakdown-rows {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
}

.breakdown-row .label {
  color: var(--text-muted);
}

.breakdown-row .val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.breakdown-row.total-row {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.95rem;
}

.breakdown-row.total-row .val {
  color: var(--cyan);
  font-size: 1.1rem;
  font-weight: 800;
}

/* Replacement Rate Indicator */
.replacement-rate-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.replacement-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.replacement-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--emerald);
  font-size: 1.15rem;
}

/* Milestone Dates Info Card */
.milestones-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.milestones-card h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.milestone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.milestone-item:last-child {
  border-bottom: none;
}

.milestone-item .m-label {
  color: var(--text-dim);
}

.milestone-item .m-value {
  font-weight: 600;
  color: var(--text-main);
}

/* Action button bar */
.actions-card {
  display: flex;
  gap: 0.75rem;
}

.actions-card button {
  flex: 1;
}

/* Footer & Legal mentions */
.app-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  transition: color 0.2s;
}

.app-footer a:hover {
  color: var(--cyan);
}

/* --- UI Responsive & Mobile Optimizations --- */
.results-mobile-heading {
  display: none;
}

.mobile-floating-bar {
  display: none;
}

@media (max-width: 980px) {
  .results-mobile-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  .results-mobile-heading-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
  }

  .step-num-results {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
    border-color: rgba(16, 185, 129, 0.4);
    font-size: 1.1rem;
  }

  .results-mobile-heading-left h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
  }

  .results-mobile-heading-left p {
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  /* Floating Bottom Bar */
  .mobile-floating-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(139, 92, 246, 0.35);
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  }

  .mobile-floating-bar.mobile-bar-hidden {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
  }

  .mobile-floating-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .mobile-floating-amount {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
  }

  .mobile-floating-amount .m-val {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.02em;
  }

  .mobile-floating-amount .m-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
  }

  .mobile-floating-details {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--cyan);
    font-weight: 600;
  }

  .mobile-floating-details .mobile-dot {
    color: var(--text-dim);
  }

  .mobile-floating-btn {
    padding: 0.6rem 1.1rem !important;
    font-size: 0.88rem !important;
    white-space: nowrap;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
  }

  body {
    padding-bottom: 5.5rem;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0.75rem;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
  }

  .header-brand {
    gap: 0.75rem;
    align-items: flex-start;
  }

  .brand-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .brand-titles h1 {
    font-size: 1.3rem;
    line-height: 1.2;
  }

  .brand-subtitle {
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .header-actions {
    display: flex;
    width: 100%;
    gap: 0.5rem;
  }

  .header-actions .btn {
    flex: 1;
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
    justify-content: center;
  }

  .form-section-card {
    padding: 1.1rem 0.85rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.2rem;
  }

  .section-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
  }

  .section-title-left h2 {
    font-size: 1.05rem;
  }

  .section-title-bar .badge-tag {
    align-self: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  label {
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .label-hint {
    font-size: 0.72rem;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  select,
  .custom-dropdown-trigger {
    font-size: 1rem !important; /* Empeche le zoom auto abusif de Safari iOS */
    min-height: 48px;
    padding: 0.75rem 0.85rem;
  }

  .ieg-live-salary-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
  }

  .ieg-live-salary-bar > div {
    text-align: left !important;
    width: 100%;
  }

  .salary-preview-label {
    font-size: 0.78rem;
  }

  .salary-preview-value {
    font-size: 1.15rem;
  }

  .periods-list {
    gap: 1rem;
  }

  .period-item-card {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
    gap: 0.85rem;
  }

  .period-card-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .period-card-top .delete-period-btn {
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
  }

  .period-card-fields {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .main-kpi-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
  }

  .kpi-number {
    font-size: 2.3rem;
  }

  .kpi-unit {
    font-size: 0.95rem;
  }

  .kpi-gross-secondary {
    font-size: 0.82rem;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .quarters-legend {
    flex-direction: column;
    gap: 0.35rem;
  }

  .replacement-rate-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .replacement-val {
    align-self: flex-start;
    font-size: 1.25rem;
  }

  .breakdown-card {
    padding: 1.1rem 0.85rem;
    border-radius: var(--radius-lg);
  }

  .breakdown-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .breakdown-title {
    font-size: 0.98rem;
  }

  .breakdown-row {
    font-size: 0.84rem;
    gap: 0.4rem;
  }

  .breakdown-row.total-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .breakdown-row.total-row .val {
    font-size: 1.15rem;
  }

  .milestones-card {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .milestone-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .custom-dropdown-panel {
    max-height: 55vh;
  }

  .results-mobile-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  .results-mobile-heading-left {
    justify-content: flex-start;
  }

  .results-mobile-heading button {
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #FFFFFF !important;
    color: #111827 !important;
    padding: 0;
  }

  .back-link,
  .header-actions,
  .btn,
  .actions-card,
  #add-period-btn,
  .btn-danger-outline {
    display: none !important;
  }

  .simulator-layout {
    display: block !important;
  }

  .form-section-card,
  .breakdown-card,
  .main-kpi-card {
    background: #FFFFFF !important;
    color: #111827 !important;
    border: 1px solid #E5E7EB !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 1.5rem !important;
  }

  .kpi-number,
  .breakdown-row.total-row .val {
    color: #4F46E5 !important;
  }

  .text-gradient {
    -webkit-text-fill-color: #111827 !important;
  }
}
