:root {
  --bg-canvas: #f4efe6;
  --bg-app: #fbf8f2;
  --surface: #ffffff;
  --surface-2: #f8f3ea;
  --surface-3: #efe7d6;
  --ink: #1f1b16;
  --ink-2: #4a4239;
  --ink-3: #6f665b;
  --ink-4: #9c9286;
  --line: #ebe1cf;
  --line-soft: #f1ead9;
  --line-strong: #d9cdb4;
  --clay: #b8543a;
  --clay-ink: #8c3d28;
  --clay-soft: #f3dccf;
  --sage: #6e7a52;
  --sage-soft: #e2e5d1;
  --ocre: #c8932f;
  --ocre-soft: #f3e6c2;
  --plum: #74455a;
  --plum-soft: #ead9e0;
  --grey-soft: #e8e2d8;
  --radius: 14px;
  --sidebar: 258px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.2, 0, 0, 1);
  --speed-fast: 140ms;
  --speed: 220ms;
  --speed-slow: 360ms;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-canvas);
  color: var(--ink);
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgb(248 243 234 / 92%), rgb(251 248 242 / 92%)),
    var(--bg-canvas);
}

.auth-card {
  width: min(100%, 470px);
  display: grid;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 24px 60px rgb(31 27 22 / 10%);
  animation: view-enter var(--speed-slow) var(--ease-out);
}

.auth-brand {
  display: flex;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-rise {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  background: var(--bg-app);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  padding: 0 4px 12px;
}

.brand-logo {
  display: block;
  width: 194px;
  max-width: 100%;
  height: auto;
}

.micro {
  color: var(--ink-3);
  font-size: 11px;
}

.project-switcher,
.sidebar-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  transition:
    border-color var(--speed) var(--ease-out),
    box-shadow var(--speed) var(--ease-out),
    transform var(--speed) var(--ease-out);
}

.project-switcher:hover,
.sidebar-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgb(31 27 22 / 6%);
  transform: translateY(-1px);
}

.project-name {
  font-weight: 700;
  margin-top: 2px;
}

.project-switcher-main,
.project-logo-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.project-logo {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface);
  box-shadow: 0 8px 18px rgb(31 27 22 / 6%);
}

.project-logo.small {
  width: 42px;
  height: 42px;
  border-radius: 11px;
}

.project-logo.large {
  width: 82px;
  height: 82px;
  border-radius: 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding-right: 2px;
}

.nav-group {
  display: grid;
  gap: 5px;
}

.nav-label,
.label {
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  text-align: left;
  transition:
    background-color var(--speed-fast) var(--ease-out),
    color var(--speed-fast) var(--ease-out),
    transform var(--speed-fast) var(--ease-out);
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-3);
  color: var(--ink);
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-item:active {
  transform: translateX(2px) scale(0.99);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
h3,
.serif {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  margin: 0 0 12px;
  font-size: 23px;
}

h3 {
  margin: 0;
  font-size: 17px;
}

p {
  margin: 0;
}

em {
  color: var(--clay);
}

.muted {
  color: var(--ink-3);
}

.view {
  display: grid;
  gap: 16px;
  animation: view-enter var(--speed-slow) var(--ease-out);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition:
    border-color var(--speed) var(--ease-out),
    box-shadow var(--speed) var(--ease-out),
    transform var(--speed) var(--ease-out);
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 14px 34px rgb(31 27 22 / 5%);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 208px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
}

.hero::after,
.priority::after {
  content: "";
  position: absolute;
  inset: auto -80px -90px auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgb(243 220 207 / 70%), transparent 70%);
  pointer-events: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.stat {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px;
  background: rgb(255 255 255 / 65%);
}

.stat strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
}

.score-ring {
  display: grid;
  place-items: center;
  gap: 6px;
}

.score-ring svg {
  width: 160px;
  height: 160px;
}

.score-ring .score {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  fill: var(--ink);
}

.score-ring .score-label {
  font-size: 10px;
  fill: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--speed-fast) var(--ease-out),
    border-color var(--speed-fast) var(--ease-out),
    color var(--speed-fast) var(--ease-out),
    box-shadow var(--speed-fast) var(--ease-out),
    transform var(--speed-fast) var(--ease-out),
    opacity var(--speed-fast) var(--ease-out);
}

.btn:hover {
  background: var(--surface-3);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgb(31 27 22 / 8%);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

.btn.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg-app);
}

.btn.clay {
  border-color: var(--clay);
  background: var(--clay);
  color: var(--bg-app);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.help-button {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-3);
  display: inline-grid;
  place-items: center;
  margin-left: 5px;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  transition:
    background-color var(--speed-fast) var(--ease-out),
    color var(--speed-fast) var(--ease-out),
    border-color var(--speed-fast) var(--ease-out),
    transform var(--speed-fast) var(--ease-out);
}

.help-button:hover {
  border-color: var(--clay);
  background: var(--clay-soft);
  color: var(--clay-ink);
  transform: translateY(-1px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions.compact {
  justify-content: flex-end;
}

.project-list {
  display: grid;
  gap: 8px;
}

.projects-panel {
  align-self: start;
}

.onboarding-panel {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.project-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px;
  background: rgb(255 255 255 / 62%);
  animation: soft-rise var(--speed-slow) var(--ease-out);
  transition:
    background-color var(--speed) var(--ease-out),
    border-color var(--speed) var(--ease-out),
    box-shadow var(--speed) var(--ease-out),
    transform var(--speed) var(--ease-out);
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(31 27 22 / 32%);
  backdrop-filter: blur(7px);
  animation: view-enter var(--speed) var(--ease-out);
}

.help-modal {
  width: min(100%, 520px);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 28px 80px rgb(31 27 22 / 18%);
}

.project-row.active {
  border-color: var(--clay);
  background: var(--clay-soft);
}

.project-row:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 22px rgb(31 27 22 / 6%);
  transform: translateY(-1px);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface-3);
  transition:
    background-color var(--speed-fast) var(--ease-out),
    color var(--speed-fast) var(--ease-out);
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ink-4);
}

.chip.declaratif { background: var(--sage-soft); }
.chip.declaratif::before { background: var(--sage); }
.chip.hypothese { background: var(--ocre-soft); }
.chip.hypothese::before { background: var(--ocre); }
.chip.verifie { background: var(--clay-soft); }
.chip.verifie::before { background: var(--clay); }
.chip.infere { background: var(--plum-soft); }
.chip.infere::before { background: var(--plum); }
.chip.invalide { background: var(--grey-soft); }
.chip.invalide::before { background: var(--ink-4); }

.action-card {
  display: grid;
  gap: 9px;
  align-content: start;
}

.action-number {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg-app);
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
}

.module-card {
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.action-card,
.module-card,
.capture-item,
.learning-item,
.deliverable-preview {
  animation: soft-rise var(--speed-slow) var(--ease-out);
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ocre), var(--clay));
  transition: width var(--speed-slow) var(--ease-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  transition:
    border-color var(--speed-fast) var(--ease-out),
    box-shadow var(--speed-fast) var(--ease-out),
    background-color var(--speed-fast) var(--ease-out);
}

textarea {
  min-height: 108px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px var(--clay-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--ink-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
}

.agent-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-tab.active {
  border-color: var(--clay);
  background: var(--clay-soft);
}

.conversation {
  min-height: 480px;
  max-height: 58vh;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.message {
  max-width: 82%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 12px;
  background: var(--surface-2);
  animation: soft-rise var(--speed-slow) var(--ease-out);
}

.message.user {
  justify-self: end;
  background: var(--sage-soft);
}

.message.ai {
  justify-self: start;
  background: var(--surface);
}

.composer {
  display: grid;
  gap: 8px;
}

.capture-item,
.learning-item,
.deliverable-preview {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 11px;
  background: rgb(255 255 255 / 60%);
}

.priority {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--bg-app);
  border-color: var(--ink);
}

.priority .muted,
.priority .label {
  color: #d9cdb4;
}

.dimension-row {
  display: grid;
  grid-template-columns: minmax(160px, 230px) 130px minmax(0, 1fr) 40px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.segments {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.segment {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background-color var(--speed) var(--ease-out);
}

.segment.on.low { background: var(--clay); }
.segment.on.mid { background: var(--ocre); }
.segment.on.high { background: var(--sage); }

.score-formula {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgb(255 255 255 / 65%);
}

.score-formula strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

.score-rules {
  display: grid;
  gap: 8px;
}

.radar-wrap {
  display: grid;
  place-items: center;
}

.radar {
  width: min(100%, 430px);
  aspect-ratio: 1;
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--ink-3);
  background: var(--surface-2);
}

.mobile-menu {
  display: none;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-card {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .hero,
  .chat-layout,
  .onboarding-steps,
  .grid.two,
  .grid.three,
  .grid.four,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .section-head {
    display: grid;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .dimension-row {
    grid-template-columns: 1fr;
  }

  .score-formula {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .project-row {
    grid-template-columns: 1fr;
  }

  .actions.compact {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
