/* Les Clés de la Conscience · Design System */
:root {
  --bg: #e9e1d7;
  --paper: #f8f4ec;
  --paper2: #fffaf2;
  --ink: #1f1d1b;
  --muted: #746b65;
  --line: #8c8177;
  --gold: #b79b42;
  --gold2: #d7c47a;
  --soft: #d8cfc3;
  --dark: #181716;
  --green: #4a7c59;
  --red: #8b3a3a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3 { font-family: Georgia, 'Times New Roman', serif; font-weight: 500; line-height: 1.1; }
h1 { font-size: clamp(28px, 5vw, 52px); letter-spacing: -.04em; margin: 0 0 16px; }
h2 { font-size: clamp(22px, 3vw, 36px); letter-spacing: -.03em; margin: 0 0 14px; }
h3 { font-size: clamp(18px, 2.5vw, 24px); margin: 0 0 10px; }
p { margin: 0 0 14px; font-size: 16px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: var(--paper);
  border-bottom: 1px solid rgba(140, 129, 119, .2);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  font-family: Georgia, serif;
  font-size: 16px;
  color: var(--ink);
  font-weight: 500;
  flex: 1;
}
.topbar-brand span { color: var(--gold); }
.topbar nav { display: flex; gap: 8px; }
.topbar nav a {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 20px;
  transition: all .15s;
}
.topbar nav a:hover, .topbar nav a.active {
  background: rgba(183, 155, 66, .12);
  color: var(--gold);
  text-decoration: none;
}
.topbar-user {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.main { flex: 1; padding: 32px 24px; max-width: 900px; margin: 0 auto; width: 100%; }
.main.wide { max-width: 1100px; }
.main.narrow { max-width: 640px; }

/* Cards & Blocks */
.card {
  background: var(--paper);
  border: 1px solid rgba(140, 129, 119, .22);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
}
.card.gold {
  background: linear-gradient(180deg, rgba(255,250,242,.95), rgba(243,236,223,.8));
  border-color: rgba(183, 155, 66, .36);
}
.card.dark {
  background: #1c1b19;
  color: #f5efe5;
  border: none;
}
.card.dark p, .card.dark .muted { color: #d8d0c5; }

/* Dividers */
.gold-line {
  width: 80px;
  height: 1px;
  background: var(--gold);
  margin: 24px 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--gold);
  color: white;
}
.btn-primary:hover { background: #9e8535; color: white; text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(140, 129, 119, .35);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); text-decoration: none; }
.btn-danger {
  background: var(--red);
  color: white;
}
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 20px; }
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  background: white;
  border: 1px solid rgba(140, 129, 119, .35);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color .2s;
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(183, 155, 66, .12);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

/* Checkbox */
.checkbox-group { display: flex; flex-direction: column; gap: 12px; }
.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: var(--gold);
  cursor: pointer;
}
.checkbox-item span {
  font-size: 15px;
  line-height: 1.5;
}

/* Sliders */
.slider-group { margin-bottom: 24px; }
.slider-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.slider-label { font-size: 15px; color: var(--ink); }
.slider-value {
  font-family: Georgia, serif;
  font-size: 20px;
  color: var(--gold);
  min-width: 28px;
  text-align: right;
}
input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: linear-gradient(to right, var(--gold) 0%, var(--gold) var(--val, 50%), rgba(140,129,119,.25) var(--val, 50%));
  border-radius: 4px;
  outline: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* Progress steps */
.steps {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}
.step {
  flex: 1;
  height: 4px;
  background: rgba(140, 129, 119, .2);
  border-radius: 4px;
  transition: background .3s;
}
.step.done { background: var(--gold); }
.step.current { background: var(--gold2); }

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
}
.badge-pending { background: rgba(183,155,66,.15); color: var(--gold); }
.badge-approved { background: rgba(74,124,89,.15); color: var(--green); }
.badge-rejected { background: rgba(139,58,58,.15); color: var(--red); }
.badge-active { background: rgba(74,124,89,.2); color: var(--green); }
.badge-dormante { background: rgba(140,129,119,.15); color: var(--muted); }
.badge-fragile { background: rgba(183,155,66,.15); color: var(--gold); }
.badge-integree { background: rgba(74,124,89,.2); color: var(--green); }

/* Table */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(140,129,119,.22);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,250,242,.64);
  margin: 16px 0;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid rgba(140,129,119,.15);
}
tr:last-child td { border-bottom: none; }
th {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(216,207,195,.3);
  font-weight: 600;
}

/* Alert / Notice */
.notice {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
}
.notice-info { background: rgba(183,155,66,.1); border: 1px solid rgba(183,155,66,.3); color: #5a4a1a; }
.notice-success { background: rgba(74,124,89,.1); border: 1px solid rgba(74,124,89,.3); color: #2a5738; }
.notice-error { background: rgba(139,58,58,.1); border: 1px solid rgba(139,58,58,.3); color: var(--red); }

/* Autosave indicator */
.autosave {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.autosave.saving { color: var(--gold); }
.autosave.saved { color: var(--green); }
.autosave-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Synthesis card */
.synth-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 20px 0;
}
.synth-item {
  background: var(--paper2);
  border: 1px solid rgba(140,129,119,.2);
  border-radius: 16px;
  padding: 20px;
}
.synth-item .label {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.synth-item .value {
  font-family: Georgia, serif;
  font-size: 22px;
  color: var(--gold);
}
.synth-phrase {
  background: #1c1b19;
  color: #f7f1e8;
  border-radius: 20px;
  padding: 28px 32px;
  margin: 20px 0;
}
.synth-phrase p {
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.4;
  font-style: italic;
  margin: 0;
}

/* Week progress */
.week-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.week-chip {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  border: 1px solid rgba(140,129,119,.25);
  background: rgba(255,250,242,.7);
  color: var(--muted);
  cursor: default;
}
.week-chip.done { background: var(--gold); color: white; border-color: var(--gold); }
.week-chip.current { border-color: var(--gold); color: var(--gold); background: rgba(183,155,66,.08); }

/* Transformation buttons */
.transfo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.transfo-item {
  background: rgba(255,250,242,.8);
  border: 1px solid rgba(140,129,119,.2);
  border-radius: 14px;
  padding: 14px 16px;
}
.transfo-label { font-size: 14px; margin-bottom: 8px; font-weight: 500; }
.transfo-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.transfo-btn {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid rgba(140,129,119,.3);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  transition: all .15s;
}
.transfo-btn.selected { border-color: var(--gold); background: var(--gold); color: white; }
.transfo-btn[data-status="dormante"].selected { background: var(--muted); border-color: var(--muted); }
.transfo-btn[data-status="fragile"].selected { background: var(--gold2); border-color: var(--gold2); color: var(--ink); }
.transfo-btn[data-status="active"].selected { background: var(--gold); border-color: var(--gold); }
.transfo-btn[data-status="intégrée"].selected { background: var(--green); border-color: var(--green); }

/* Hero landing */
.hero {
  text-align: center;
  padding: 72px 24px 56px;
  max-width: 640px;
  margin: 0 auto;
}
.hero-emblem {
  width: 56px;
  height: 56px;
  margin: 0 auto 28px;
}
.hero-kicker {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.hero-line {
  width: 80px;
  height: 1px;
  background: var(--gold);
  margin: 28px auto;
}

/* Muted text */
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

/* Utility */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 12px; align-items: center; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(183,155,66,.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Radio hero step (Bloc 5) */
.hero-steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.hero-step-btn {
  padding: 16px 18px;
  border: 1px solid rgba(140,129,119,.25);
  border-radius: 14px;
  background: rgba(255,250,242,.75);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  font-family: inherit;
}
.hero-step-btn:hover { border-color: var(--gold2); background: rgba(255,250,242,.95); }
.hero-step-btn.selected { border-color: var(--gold); background: rgba(183,155,66,.1); }
.hero-step-btn .step-name { font-family: Georgia, serif; font-size: 18px; color: var(--gold); display: block; margin-bottom: 4px; }
.hero-step-btn .step-desc { font-size: 13px; color: var(--muted); display: block; }

/* Responsive */
@media (max-width: 640px) {
  .main { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar nav a { padding: 6px 8px; }
  .synth-grid { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .transfo-grid { grid-template-columns: 1fr; }
  .hero-steps { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}
