/*
 * Back-office genius@work : palette « Signal » du site (packages/config/tailwind/tokens.css).
 * Aucune dépendance : une police, une feuille, un script facultatif.
 */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('manrope.woff2') format('woff2');
}

:root {
  --ink: #0a0b1e;
  --ink-2: #14162c;
  --ink-line: #2a2d4a;
  --slate: #5b5e70;
  --mist: #a3a6bd;
  --paper: #f6f5f1;
  --sand: #edece6;
  --white: #ffffff;
  --line: #e2e0d9;
  --line-strong: #cbc8be;
  --blue: #1f4bff;
  --blue-deep: #1638d4;
  --blue-soft: #e6ecff;
  --cyan: #00c2ff;
  --lilac: #a98bff;
  --lime: #c8f031;
  --red: #c81e3a;
  --red-soft: #fdecef;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(10 11 30 / 0.04), 0 4px 12px -4px rgb(10 11 30 / 0.08);
  --shadow-md: 0 2px 4px rgb(10 11 30 / 0.04), 0 16px 32px -16px rgb(10 11 30 / 0.18);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
dl,
dd,
fieldset {
  margin: 0;
}

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

a {
  color: var(--blue);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--blue-deep);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--blue);
  color: var(--white);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--lime);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  top: 16px;
}

.muted {
  color: var(--slate);
}

.small {
  font-size: 13px;
}

.strong {
  font-weight: 700;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Marque */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
}

.brand:hover {
  color: var(--white);
}

.brand--dark {
  color: var(--ink);
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-at {
  color: var(--cyan);
}

.brand--dark .brand-at {
  color: var(--blue);
}

/* Structure : barre latérale sombre + contenu */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  padding: 28px 18px 22px;
  background: var(--ink);
  color: var(--mist);
}

.sidebar .brand {
  padding: 0 10px;
}

.sidebar-label {
  margin: 4px 0 22px;
  padding: 0 10px 0 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--mist);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-link:hover {
  background: var(--ink-2);
  color: var(--white);
}

.nav-link[aria-current='page'] {
  background: var(--ink-2);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 12px 0;
  border-top: 1px solid var(--ink-line);
}

.user {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--mist);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--white);
}

.main {
  width: 100%;
  max-width: 1240px;
  padding: 44px clamp(16px, 4vw, 56px) 64px;
}

.main:focus {
  outline: none;
}

/* En-têtes */

.page-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}

.eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.page-title {
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.page-title--sm {
  font-size: clamp(22px, 2vw, 26px);
}

/* Chiffres clés */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  padding: 18px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.kpi::after {
  content: '';
  position: absolute;
  top: -22px;
  right: -22px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--kpi-tone);
}

a.kpi:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi--blue {
  --kpi-tone: var(--blue);
}

.kpi--lilac {
  --kpi-tone: var(--lilac);
}

.kpi--lime {
  --kpi-tone: var(--lime);
}

.kpi--cyan {
  --kpi-tone: var(--cyan);
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
}

.kpi-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.kpi-hint {
  font-size: 13px;
  color: var(--slate);
}

/* Panneau de liste */

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: -4px;
  padding: 4px;
  scrollbar-width: thin;
}

.tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  color: var(--slate);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.tab:hover {
  background: var(--sand);
  color: var(--ink);
}

.tab[aria-current='true'] {
  background: var(--ink);
  color: var(--white);
}

.tab-count {
  min-width: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--sand);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tab[aria-current='true'] .tab-count {
  background: var(--ink-line);
  color: var(--white);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search {
  position: relative;
  display: flex;
  flex: 1 1 280px;
  align-items: center;
  color: var(--slate);
}

.search svg {
  position: absolute;
  left: 14px;
  pointer-events: none;
}

.kbd {
  position: absolute;
  right: 10px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 600 12px/20px 'Manrope', sans-serif;
  color: var(--slate);
  pointer-events: none;
}

.select-wrap {
  flex: 0 1 230px;
}

/* Champs */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input:hover {
  border-color: var(--slate);
}

.input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.input--search {
  padding-left: 42px;
  padding-right: 40px;
  background: var(--paper);
  border-color: var(--line);
}

.input--search::-webkit-search-cancel-button {
  display: none;
}

.input--select {
  appearance: none;
  padding-right: 38px;
  background: var(--white)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b5e70' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 14px center;
  cursor: pointer;
}

/* Boutons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.button:active {
  transform: translateY(1px);
}

.button--block {
  width: 100%;
}

.button--primary {
  background: var(--blue);
  color: var(--white);
}

.button--primary:hover {
  background: var(--blue-deep);
  color: var(--white);
}

.button--dark {
  background: var(--ink);
  color: var(--white);
}

.button--dark:hover {
  background: var(--ink-2);
  color: var(--white);
}

.button--ghost {
  border-color: var(--line-strong);
  background: var(--white);
  color: var(--ink);
}

.button--ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.button--danger {
  background: var(--red);
  color: var(--white);
}

.button--danger:hover {
  background: #a5172f;
  color: var(--white);
}

.button--danger-ghost {
  border-color: #f2b8c2;
  background: var(--white);
  color: var(--red);
}

.button--danger-ghost:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

/* Tableau */

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

.table th {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--slate);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table td > .small {
  display: block;
}

.row {
  position: relative;
  transition: background-color 0.12s var(--ease);
}

.row:hover {
  background: #fafaf7;
}

.row:last-child td {
  border-bottom: 0;
}

/* Toute la ligne est cliquable, le lien reste l'unique cible au clavier. */
.row-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.row-link:focus-visible {
  outline: none;
}

.row:has(.row-link:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.row--new .strong::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 8px 1px 0;
  border-radius: 50%;
  background: var(--blue);
}

.row--anonymized td {
  color: var(--mist);
}

.ref {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.ref--lg {
  font-size: 14px;
  color: var(--slate);
}

a.ref:hover {
  color: var(--blue);
}

/* Statuts */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.badge--new {
  background: var(--blue);
  color: var(--white);
}

.badge--qualified {
  background: var(--cyan);
  color: var(--ink);
}

.badge--proposal {
  background: var(--lilac);
  color: var(--ink);
}

.badge--won {
  background: var(--lime);
  color: var(--ink);
}

.badge--lost {
  background: var(--sand);
  color: var(--slate);
}

.badge--archived {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--slate);
}

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}

.dot--new {
  background: var(--blue);
}

.dot--qualified {
  background: var(--cyan);
}

.dot--proposal {
  background: var(--lilac);
}

.dot--won {
  background: var(--lime);
  box-shadow: inset 0 0 0 1px rgb(10 11 30 / 0.15);
}

.dot--lost {
  background: var(--mist);
}

.dot--archived {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--mist);
}

/* Vide, pagination, messages */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 64px 24px;
  text-align: center;
}

.empty-shape {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--lilac);
  transform: rotate(-8deg);
  box-shadow: 18px 10px 0 -6px var(--cyan);
}

.empty-title {
  font-size: 17px;
  font-weight: 800;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.flash {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.flash--success {
  background: #f1fbd2;
  color: #2f3d00;
  box-shadow: inset 4px 0 0 var(--lime);
}

.flash--error {
  background: var(--red-soft);
  color: #8a1026;
  box-shadow: inset 4px 0 0 var(--red);
}

/* Fiche */

.back {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--slate);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.back:hover {
  color: var(--ink);
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.detail-head .badge {
  padding: 7px 14px;
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.card--quiet {
  background: transparent;
  box-shadow: none;
}

.card--danger {
  border-color: #f2b8c2;
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 14px;
  font-weight: 600;
}

.chip-label {
  color: var(--slate);
  font-size: 12px;
  font-weight: 700;
}

.message {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

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

.page-head--actions > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta--stacked {
  grid-template-columns: minmax(0, 1fr);
}

.meta dt {
  margin-bottom: 2px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 700;
}

.meta dd {
  font-weight: 600;
  overflow-wrap: anywhere;
}

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

.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.status-option:hover {
  border-color: var(--line-strong);
}

.status-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.status-option:has(input:checked) {
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.status-option:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.confirm {
  max-width: 620px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* Édition de contenu */

.nav-group {
  margin: 18px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7d8099;
}

.nav-group:first-child {
  margin-top: 0;
}

.site-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.site-link:hover {
  color: var(--white);
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 980px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

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

.rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 12px;
}

.field-hint {
  color: var(--slate);
  font-size: 12.5px;
}

.field-error {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.input[aria-invalid='true'] {
  border-color: var(--red);
  background: #fffafb;
}

.input--area {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.lang {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 18px;
  vertical-align: 1px;
}

.link-button--danger {
  color: var(--red);
}

.link-button--danger:hover {
  color: #8a1026;
}

.add-button {
  align-self: flex-start;
  border-style: dashed;
}

.savebar {
  position: sticky;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 12px 12px 12px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.92);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}

/* Contenu : projets et services */

.page-head--actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 24px;
  transition:
    box-shadow 200ms var(--ease),
    transform 200ms var(--ease);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card:has(.project-link:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.project-card:target {
  border-color: var(--blue);
}

.project-card--draft .project-thumb img {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.project-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--sand);
}

.project-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.project-rank {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
}

.project-badges {
  display: flex;
  gap: 6px;
  min-height: 0;
}

.project-badges:empty {
  display: none;
}

.project-title,
.service-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.project-link {
  color: var(--ink);
  text-decoration: none;
}

.project-link:focus-visible {
  outline: none;
}

/* Toute la carte est cliquable ; les boutons d'ordre restent au-dessus. */
.project-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.project-tags {
  margin-top: auto;
  padding-top: 6px;
  color: var(--blue-deep);
  font-weight: 700;
}

.project-order {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  gap: 4px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.94);
  color: var(--ink);
  cursor: pointer;
  transition: background 150ms var(--ease);
}

.icon-button:hover:not(:disabled) {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.icon-button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}

.icon-button:disabled {
  color: var(--line-strong);
  cursor: default;
}

.input-prefix {
  display: flex;
  align-items: stretch;
}

.input-prefix-text {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--sand);
  color: var(--slate);
  font-size: 13px;
}

.input-prefix .input {
  flex: 1;
  min-width: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

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

.period .input {
  width: 7.5em;
}

.tint-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tint-field .input {
  width: 9em;
  font-family: ui-monospace, monospace;
}

.tint-field input[type='color'] {
  inline-size: 44px;
  block-size: 44px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
}

.fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.check-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.check-chip {
  position: relative;
}

.check-chip input {
  position: absolute;
  opacity: 0;
}

.check-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 150ms var(--ease),
    border-color 150ms var(--ease);
}

.check-chip span::before {
  content: '';
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
}

.check-chip input:checked + span {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.check-chip input:checked + span::before {
  border-color: var(--blue);
  background: var(--blue)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / 10px no-repeat;
}

.check-chip input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.fieldset[aria-invalid='true'] .check-chip span {
  border-color: var(--red);
}

.cover-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.cover-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.cover-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  object-position: top;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--sand);
}

.cover-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--slate);
  font-size: 14px;
}

.input--file {
  padding: 8px;
  cursor: pointer;
}

.input--file::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--white);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

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

.switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.switch:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.switch input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.check-row:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.check-row input {
  accent-color: var(--blue);
}

.check-row img {
  flex: none;
  border-radius: 4px;
  object-fit: cover;
  object-position: top;
}

.check-row .badge {
  margin-left: auto;
}

.service-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 980px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 200ms var(--ease);
}

.service-item:hover {
  box-shadow: var(--shadow-md);
}

.service-item:has(.project-link:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.service-item .muted {
  margin: 4px 0 0;
}

.service-index {
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.service-meta {
  text-align: right;
}

/* Pages : formulaire construit depuis la description de la page */

.editor-heading {
  margin: 12px 0 -4px;
  color: var(--slate);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-group + .page-group {
  margin-top: 32px;
}

.page-group .editor-heading {
  margin-bottom: 12px;
}

.service-item--page {
  grid-template-columns: minmax(0, 1fr) auto;
}

.subgroup {
  margin: 0;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.subgroup-title {
  padding: 0 6px;
  margin-left: -6px;
  font-size: 14px;
  font-weight: 800;
}

.subgroup .subgroup {
  background: var(--white);
}

.field-single {
  max-width: calc(50% - 10px);
}

.optional {
  margin-left: 6px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 500;
}

.repeater {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.repeater-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.repeater-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.repeater-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 800;
}

.repeater-row--new {
  display: block;
  padding: 0;
  border: 0;
  background: none;
}

.repeater-row--new summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.repeater-row--new summary::-webkit-details-marker {
  display: none;
}

.repeater-row--new[open] {
  padding: 14px 16px;
  border: 1.5px dashed var(--blue);
  border-radius: var(--radius-md);
  background: var(--white);
}

.repeater-row--new[open] summary {
  margin-bottom: 14px;
}

.error-summary {
  max-width: 980px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid var(--red);
  border-radius: var(--radius-md);
  background: var(--red-soft);
  color: var(--red);
}

.error-summary ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.error-summary a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-card:hover {
    transform: none;
    transition: none;
  }
}

/* Connexion */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  overflow: hidden;
  background: var(--ink);
}

.login-shape {
  position: fixed;
  z-index: 0;
  pointer-events: none;
}

.login-shape--circle {
  top: -14vmin;
  right: -10vmin;
  width: 52vmin;
  height: 52vmin;
  border-radius: 50%;
  background: var(--cyan);
}

.login-shape--square {
  bottom: -10vmin;
  left: -6vmin;
  width: 34vmin;
  height: 34vmin;
  border-radius: 6vmin;
  background: var(--lilac);
  transform: rotate(-12deg);
}

.login-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 420px);
  padding: 36px 32px 32px;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: 0 30px 60px -24px rgb(0 0 0 / 0.5);
}

.login-card .brand {
  margin-bottom: 18px;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-card .flash {
  margin: 8px 0 0;
}

.login-card form {
  margin-top: 16px;
}

/* Responsive */

@media (max-width: 1080px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .cover-editor,
  .switches {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-single {
    max-width: none;
  }

  .service-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .service-meta {
    display: none;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    height: auto;
    padding: 14px 16px;
  }

  .sidebar .brand {
    padding: 0;
  }

  .sidebar-label {
    display: none;
  }

  .nav {
    flex-direction: row;
    width: 100%;
    margin: 0 -4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-link {
    flex: none;
  }

  .nav-link svg {
    display: none;
  }

  .nav-group {
    display: none;
  }

  .sidebar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    padding: 10px 0 0;
  }

  .main {
    padding-top: 28px;
  }

  /* Le tableau devient une liste de cartes. */
  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }

  .row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
  }

  .row:last-child {
    border-bottom: 0;
  }

  .table td {
    padding: 0;
    border: 0;
  }

  .table td[data-label='Budget'] {
    display: none;
  }

  .table td[data-label='Statut'],
  .table td[data-label='Reçue'] {
    justify-self: end;
    color: var(--slate);
    font-size: 13px;
  }

  .table td[data-label='Contact'],
  .table td[data-label='Projet'] {
    grid-column: 1;
  }

  .table td[data-label='Statut'] {
    grid-row: 1;
    grid-column: 2;
  }

  .table td[data-label='Reçue'] {
    grid-row: 2;
    grid-column: 2;
  }

  .table td[data-label='Projet'] {
    color: var(--slate);
    font-size: 14px;
  }
}

@media (max-width: 520px) {
  .kpis {
    gap: 10px;
  }

  .kpi {
    padding: 14px 16px;
  }

  .kpi-value {
    font-size: 28px;
  }

  .kpi::after {
    top: -18px;
    right: -18px;
    width: 44px;
    height: 44px;
  }

  .kpi-label {
    padding-right: 22px;
    font-size: 11px;
  }

  .kbd,
  .filters .button {
    display: none;
  }

  .select-wrap {
    flex: 1 1 100%;
  }

  .row-fields + .row-fields {
    padding-top: 12px;
    border-top: 1px dashed var(--line-strong);
  }

  .meta,
  .status-picker,
  .grid-2,
  .row-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .card {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* Double authentification : QR code et clé de secours. */
.totp-qr {
  align-self: center;
  width: 200px;
  margin: 8px 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: #fff;
}

.totp-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.totp-key summary {
  cursor: pointer;
  font-weight: 600;
}

.totp-secret {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  letter-spacing: 0.08em;
  word-break: break-all;
  user-select: all;
}

.login-card .link-button {
  margin-top: 4px;
}
