:root,
body.palette-pined {
  --bg: #f4efe6;
  --paper: #fffcf7;
  --ink: #1a1614;
  --muted: #4a433c;
  --brand: #1c3d32;
  --brand-ink: #f7f1e8;
  --accent: #b45309;
  --line: #d7cfc3;
  --ok: #14532d;
  --err: #7f1d1d;
  --focus: #0f766e;
  --danger: #7f1d1d;
  --shadow: 0 8px 24px rgb(28 22 20 / 8%);
}

body.palette-sable {
  --bg: #f6edd9;
  --paper: #fffaf1;
  --ink: #2a1d12;
  --muted: #6b5340;
  --brand: #7c4a1a;
  --brand-ink: #fff7ea;
  --accent: #b45309;
  --line: #e2d0b4;
  --focus: #9a3412;
}

body.palette-ardoise {
  --bg: #e8eef2;
  --paper: #f7fafc;
  --ink: #15202b;
  --muted: #44505c;
  --brand: #1e3a4c;
  --brand-ink: #eef6fb;
  --accent: #0f766e;
  --line: #c5d0d8;
  --focus: #155e75;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

img,
svg,
table {
  max-width: 100%;
}

a {
  color: var(--brand);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

.skip-link:focus {
  top: 0.75rem;
}

.site-header,
.site-main,
.site-footer {
  width: min(72rem, calc(100% - 1.5rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0.5rem;
}

.brand a {
  color: var(--brand);
  font-weight: 700;
  font-size: 1.35rem;
  text-decoration: none;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.site-main {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.site-footer {
  color: var(--muted);
  font-size: 0.9rem;
  padding-bottom: 2rem;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.hero h1,
.site-main h1 {
  line-height: 1.2;
  margin-top: 0;
}

.lead,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

.benefits,
.limits ul,
.timeline {
  padding-left: 1.2rem;
}

.kpis {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
}

.kpis li {
  background: #eef4f0;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.85rem;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.kpis strong {
  font-size: 1.35rem;
}

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

.btn-primary,
.btn-secondary,
.btn-danger,
button[type="submit"] {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary,
form[action="/demarrer"] .btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
}

.btn-secondary,
.search button {
  background: #ece4d6;
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff7f7;
}

label,
legend {
  display: block;
  font-weight: 600;
  margin-top: 0.85rem;
}

input,
select,
textarea {
  width: 100%;
  max-width: 28rem;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid #b7aea2;
  background: #fff;
  color: var(--ink);
}

.search {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.search button {
  width: fit-content;
}

.table-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.line-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.line-row label {
  margin: 0;
  font-weight: 500;
}

.line-row input[type="checkbox"] {
  width: auto;
  margin-right: 0.4rem;
}

.line-row .qty input {
  width: 5rem;
}

.price {
  color: var(--muted);
  white-space: nowrap;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.meta dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.meta dd {
  margin: 0;
  font-weight: 600;
}

.banner {
  padding: 0.75rem 0.9rem;
  border-radius: 0.7rem;
  margin-bottom: 1rem;
}

.banner-ok {
  background: #dcfce7;
  color: var(--ok);
}

.banner-error {
  background: #fee2e2;
  color: var(--err);
}

.disclaimer {
  font-weight: 600;
}

.fineprint {
  color: var(--muted);
  font-size: 0.9rem;
}

.limits {
  margin-top: 2rem;
  padding: 1rem;
  background: #f7f1e8;
  border-radius: 0.75rem;
}

.document {
  max-width: 48rem;
}

.status-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.session-banner {
  width: min(72rem, calc(100% - 1.5rem));
  margin: 0 auto 0.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: #eef4f0;
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.context-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.65rem;
  align-items: start;
  margin: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fff;
}

.context-card input {
  width: auto;
  grid-row: 1 / 3;
  margin-top: 0.25rem;
}

.context-card span,
.task-row span,
.document-row span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.8rem;
  margin-bottom: 1rem;
}

.filter-form label {
  margin: 0;
}

.check-label {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.check-label input {
  width: auto;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #ece4d6;
  color: var(--ink);
}

.progress {
  display: block;
  width: 100%;
  height: 0.75rem;
  appearance: none;
  margin: 0.75rem 0 1.5rem;
  border-radius: 999px;
  border: 0;
  background-color: #e5e7eb;
}

.progress::-webkit-progress-bar {
  border-radius: 999px;
  background-color: #e5e7eb;
}

.progress::-webkit-progress-value,
.progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--brand);
}

.task-list,
.document-list {
  list-style: none;
  padding: 0;
}

.task-row,
.document-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.task-row form,
.document-row form {
  flex: 0 0 auto;
}

details {
  margin-top: 0.4rem;
}

@media (max-width: 640px) {
  .site-main {
    padding: 1rem;
  }

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

  .task-row,
  .document-row {
    display: block;
  }

  .task-row form,
  .document-row form {
    margin-top: 0.6rem;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data-table tr {
    display: block;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
  }

  .data-table tfoot th,
  .data-table tfoot td {
    display: flex;
    justify-content: space-between;
  }
}

.path-grid,
.split-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.85rem;
}

.path-card {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: #fff;
}

.bulk-actions {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

@media print {
  .nav,
  .skip-link,
  .session-banner,
  .site-footer,
  .no-print,
  form {
    display: none !important;
  }

  body,
  .site-main {
    background: #fff;
    box-shadow: none;
    border: 0;
  }
}
