/* FACTO+ · Demande de réquisition — thème ELYSIS */

:root {
  /* Palette ELYSIS */
  --navy: #0a009f;
  --navy-700: #08007d;
  --navy-900: #05004f;
  --cyan: #78c4db;
  --cyan-100: #e4f3f8;
  --cyan-50: #f2f9fc;
  --gray: #898d90;

  --ink: #1b1f2a;
  --ink-2: #40464d;
  --ink-3: #6b737b;
  --line: #d7dee3;
  --line-soft: #e8edf0;
  --bg: #f4f6f8;
  --surface: #ffffff;

  --ok: #1d7a46;
  --ok-bg: #e6f4ec;
  --warn: #9a5b00;
  --warn-bg: #fdf1dc;
  --err: #b3261e;
  --err-bg: #fcebea;
  --info-bg: #e8e7fb;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(10, 0, 159, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-pop: 0 8px 28px rgba(16, 24, 40, 0.16);
  --focus: 0 0 0 3px rgba(120, 196, 219, 0.55);

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}

[hidden] { display: none !important; }

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

h1 { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -0.01em; color: var(--navy); }
h2 { margin: 0; font-size: 18px; font-weight: 650; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: #fff; color: var(--navy); padding: 8px 12px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ En-tête */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar::after {
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan) 38%, rgba(120, 196, 219, 0.15) 100%);
}
.topbar__inner,
.tabs__inner,
.page,
.footer {
  width: 100%; max-width: 1180px; margin: 0 auto; padding-left: 24px; padding-right: 24px;
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand__logo { height: 24px; width: auto; display: block; }
.brand__wordmark { font-size: 21px; font-weight: 700; letter-spacing: 0.24em; }
.brand__divider { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.35); }
.brand__app { font-size: 15px; font-weight: 600; letter-spacing: 0.08em; color: var(--cyan); }
.brand__app sup { font-size: 0.8em; }

.userbox { display: flex; align-items: center; gap: 12px; min-width: 0; }
.userbox__text { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; min-width: 0; }
.userbox__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.userbox__mail { font-size: 12px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--cyan); color: var(--navy-900);
}

.tabs { background: var(--navy-700); }
.tabs__inner { display: flex; gap: 4px; }
.tab {
  appearance: none; border: 0; background: none; color: rgba(255, 255, 255, 0.78);
  font: inherit; font-weight: 600; padding: 12px 16px 10px; cursor: pointer;
  border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; border-bottom-color: var(--cyan); }
.tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.tab__count {
  background: var(--cyan); color: var(--navy-900); font-size: 12px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px;
}

/* ------------------------------------------------------------------ Page */
.page { flex: 1; padding-top: 28px; padding-bottom: 48px; }
.page__head { margin-bottom: 20px; }
.page__head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lead { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }

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

.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px 24px; margin: 0; min-width: 0;
}
.layout__side { position: sticky; top: 128px; }
.card__title {
  display: flex; align-items: center; gap: 10px; padding: 0; margin: 0 0 16px;
  font-size: 17px; font-weight: 650; color: var(--ink);
}
fieldset.card > legend.card__title { float: left; width: 100%; }
fieldset.card > legend.card__title + * { clear: both; }
.step {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-size: 13px; font-weight: 700;
}
.subhead { margin: 20px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------------ Champs */
.field { margin-top: 16px; min-width: 0; }
.field:first-child { margin-top: 0; }
.grid-2 > .field { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.req { color: var(--err); font-weight: 700; }
.optional { font-weight: 400; color: var(--ink-3); font-size: 13px; margin-left: 4px; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.hint.center { text-align: center; }
.hint--warn { color: var(--warn); }
.error { margin: 6px 0 0; font-size: 13px; color: var(--err); font-weight: 600; }
.error:empty { display: none; }

input[type="text"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #b9c3cb; border-radius: var(--radius-sm); padding: 9px 12px; min-height: 40px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 7.5 5 5 5-5' fill='none' stroke='%2340464d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input:hover, select:hover, textarea:hover { border-color: var(--gray); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
::placeholder { color: #98a1a9; }
.is-invalid input, .is-invalid select, .is-invalid textarea, .is-invalid .dropzone { border-color: var(--err); }

.amount { display: grid; grid-template-columns: minmax(0, 1fr) 104px; }
.amount input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.amount select { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; background-color: #f7f9fa; font-weight: 600; }
.amount select:focus { border-left: 1px solid var(--navy); margin-left: -1px; width: calc(100% + 1px); }

/* Choix segmenté */
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.segmented__option {
  position: relative; display: block; margin: 0; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 44px;
  transition: border-color 0.12s, background 0.12s;
}
.segmented__option input { position: absolute; opacity: 0; }
.segmented__option::before {
  content: ""; position: absolute; left: 16px; top: 17px; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--gray); background: #fff;
}
.segmented__option strong { display: block; font-size: 15px; }
.segmented__option small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.segmented__option:hover { border-color: var(--gray); }
.segmented__option:has(input:checked) { border-color: var(--navy); background: var(--cyan-50); }
.segmented__option:has(input:checked)::before { border: 5px solid var(--navy); }
.segmented__option:has(input:focus-visible) { box-shadow: var(--focus); }

/* Liste déroulante avec recherche */
.combo { position: relative; }
.combo__input { padding-right: 62px !important; }
.combo__clear, .combo__caret {
  position: absolute; top: 0; height: 40px; width: 30px; display: grid; place-items: center;
  border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 0;
}
.combo__caret { right: 2px; pointer-events: none; }
.combo__clear { right: 28px; font-size: 13px; }
.combo__clear:hover { color: var(--ink); }
.combo__list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 296px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.combo__option { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.combo__option.is-active { background: var(--cyan-100); }
.combo__option[aria-selected="true"] { font-weight: 600; color: var(--navy); }
.combo__main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__sub { flex: none; font-size: 12.5px; color: var(--ink-3); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__empty { padding: 10px; color: var(--ink-3); font-size: 14px; }
.combo__more { padding: 6px 10px 4px; color: var(--ink-3); font-size: 12.5px; border-top: 1px solid var(--line-soft); margin-top: 4px; }

/* Zone de dépôt */
.dropzone {
  border: 1.5px dashed #a9b4bd; border-radius: var(--radius); background: #fafbfc;
  padding: 26px 16px; text-align: center; cursor: pointer; color: var(--ink-2);
  transition: border-color 0.12s, background 0.12s;
}
.dropzone svg { width: 30px; height: 30px; color: var(--navy); }
.dropzone__text { margin: 6px 0 0; }
.dropzone:hover, .dropzone.is-over { border-color: var(--navy); background: var(--cyan-50); }
.dropzone:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--navy); }

.filechip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--cyan-50);
}
.filechip svg { flex: none; width: 22px; height: 22px; color: var(--navy); }
.filechip__name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filechip__size { flex: none; color: var(--ink-3); font-size: 13px; margin-left: auto; }
.iconbtn { flex: none; border: 0; background: none; cursor: pointer; color: var(--ink-3); width: 28px; height: 28px; border-radius: 6px; font-size: 13px; }
.iconbtn:hover { background: rgba(10, 0, 159, 0.08); color: var(--ink); }

/* ------------------------------------------------------------------ Boutons */
.btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid transparent; padding: 9px 16px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-700); }
.btn--primary:disabled { background: #a9adcf; cursor: not-allowed; }
.btn--secondary { background: #fff; color: var(--navy); border-color: #b9c3cb; }
.btn--secondary:hover { border-color: var(--navy); background: var(--cyan-50); }
.btn--ghost-light { background: none; color: #fff; border-color: rgba(255, 255, 255, 0.35); min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn--ghost-light:hover { background: rgba(255, 255, 255, 0.12); }
.btn--block { width: 100%; margin-top: 18px; min-height: 46px; font-size: 15.5px; }
.btn.is-busy .btn__label::before {
  content: ""; display: inline-block; width: 15px; height: 15px; margin-right: 9px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ------------------------------------------------------------------ Sommaire */
.summary { margin: 0; display: grid; gap: 10px; }
.summary > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.summary dt { color: var(--ink-3); font-size: 13px; }
.summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.summary__amount { font-size: 19px; color: var(--navy); font-variant-numeric: tabular-nums; }

.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.chain__step { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; }
.chain__step:last-child { padding-bottom: 0; }
.chain__step::before {
  content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--line);
}
.chain__step:last-child::before { display: none; }
.chain__num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cyan-100); color: var(--navy); font-size: 12.5px; font-weight: 700; border: 1.5px solid var(--cyan);
}
.chain__name { font-weight: 600; line-height: 1.25; padding-top: 3px; overflow-wrap: anywhere; }
.chain__mail { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.chain__empty { color: var(--ink-3); font-size: 14px; }
.chain__empty--warn { color: var(--warn); background: var(--warn-bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.chain--inline { max-width: 420px; margin: 18px auto 0; text-align: left; }

.banner { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin-top: 16px; }
.banner--error { background: var(--err-bg); color: var(--err); border: 1px solid #f1c4c1; }

/* ------------------------------------------------------------------ Confirmation */
.confirm { max-width: 640px; margin: 24px auto 0; text-align: center; padding: 40px 32px; }
.confirm__icon {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center;
  background: var(--ok-bg); color: var(--ok);
}
.confirm__icon svg { width: 32px; height: 32px; }
.confirm p { color: var(--ink-2); margin: 8px auto 0; max-width: 52ch; }
.confirm__actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Mes demandes */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  appearance: none; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 6px 13px;
}
.chip:hover { border-color: var(--gray); }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip:focus-visible { outline: none; box-shadow: var(--focus); }
.chip__n { opacity: 0.7; margin-left: 4px; font-weight: 500; }

.requests { display: grid; gap: 12px; }
.request {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; border-left: 4px solid var(--gray);
}
.request[data-status="approval"] { border-left-color: var(--navy); }
.request[data-status="approved"] { border-left-color: var(--cyan); }
.request[data-status="progress"] { border-left-color: #e0a100; }
.request[data-status="done"] { border-left-color: var(--ok); }
.request[data-status="rejected"], .request[data-status="error"] { border-left-color: var(--err); }

.request__head {
  width: 100%; appearance: none; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto 20px; gap: 16px; align-items: center; padding: 14px 18px;
}
.request__head:hover { background: #fafbfc; }
.request__head:focus-visible { outline: none; box-shadow: inset var(--focus); }
.request__title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request__meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request__amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.request__chev { color: var(--ink-3); transition: transform 0.15s; }
.request.is-open .request__chev { transform: rotate(180deg); }

.status {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 4px 10px;
  background: #eef0f2; color: var(--ink-2);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status[data-status="approval"] { background: var(--info-bg); color: var(--navy); }
.status[data-status="approved"] { background: var(--cyan-100); color: #0f5c73; }
.status[data-status="progress"] { background: var(--warn-bg); color: var(--warn); }
.status[data-status="done"] { background: var(--ok-bg); color: var(--ok); }
.request[data-status="cancelled"] { border-left-color: #898d90; }
.status[data-status="cancelled"] { background: #eceded; color: #55595c; }
.status[data-status="rejected"], .status[data-status="error"] { background: var(--err-bg); color: var(--err); }

.request__body { border-top: 1px solid var(--line-soft); padding: 16px 18px 18px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; }
.kv { margin: 0; display: grid; gap: 10px; }
.kv > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; }
.kv dt { color: var(--ink-3); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

.empty { text-align: center; color: var(--ink-3); padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ------------------------------------------------------------------ Mes POs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; display: grid; gap: 2px; min-width: 0; }
.kpi__label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.kpi__value { font-size: 22px; font-weight: 650; color: var(--navy); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi__sub { font-size: 12.5px; color: var(--ink-3); }

.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; margin-bottom: 12px; }
.toolbar select { min-width: 240px; }

.request__head--po { grid-template-columns: minmax(0, 1fr) auto 230px 150px 20px; }
.request__sep { color: var(--ink-3); font-weight: 400; }
.request__tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.request__billing { display: grid; gap: 3px; min-width: 0; }
.request__billed { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; align-items: center; }
.meter__bar { height: 8px; border-radius: 999px; background: #e6eaed; overflow: hidden; }
.meter__fill { display: block; height: 100%; border-radius: 999px; background: var(--navy); }
.meter[data-level="high"] .meter__fill { background: #e0a100; }
.meter[data-level="over"] .meter__fill { background: var(--err); }
.meter[data-level="full"] .meter__fill { background: var(--ok); }
.meter__text { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.meter[data-level="over"] .meter__text { color: var(--err); }

.request__body--po { display: block; }
.request__body--po .subhead:first-of-type { margin-top: 18px; }
.kv--inline { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kv--inline > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.kv--inline dd { font-weight: 600; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); background: #f7f9fa; padding: 8px 12px; white-space: nowrap; }
.table td { padding: 9px 12px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .neg { color: var(--err); font-weight: 600; }
.table .wrap { min-width: 220px; overflow-wrap: anywhere; }
.table .nowrap { white-space: nowrap; }
.table .strong { font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------------ Administration */
.tab--admin { margin-left: auto; }
.admin { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin__list { padding: 8px; display: grid; gap: 2px; position: sticky; top: 128px; max-height: calc(100vh - 160px); overflow-y: auto; }
.deptitem {
  appearance: none; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-sm); border-left: 3px solid transparent;
}
.deptitem:hover { background: #f4f6f8; }
.deptitem:focus-visible { outline: none; box-shadow: var(--focus); }
.deptitem.is-active { background: var(--cyan-50); border-left-color: var(--navy); }
.deptitem__name { font-weight: 600; overflow-wrap: anywhere; }
.deptitem.is-active .deptitem__name { color: var(--navy); }
.deptitem__meta { grid-column: 1; font-size: 12.5px; color: var(--ink-3); }
.deptitem .tag { grid-row: 1 / span 2; grid-column: 2; }
.tag { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: #eceded; color: #55595c; white-space: nowrap; }
.tag--new { background: var(--info-bg); color: var(--navy); }

.editor__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; }
.editor__rule { margin: 18px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--cyan-50); color: var(--ink-2); font-size: 13.5px; }

.steps { margin-top: 6px; }
.steps__cols, .steprow { display: grid; grid-template-columns: 30px minmax(0, 1fr) 170px 76px 30px; gap: 12px; align-items: start; }
.steps__cols { padding: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line-soft); }
.steprow { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.steprow.is-off .steprow__rank { background: #eceded; border-color: #d0d3d5; color: #7a7f83; }
.steprow__rank {
  width: 28px; height: 28px; margin-top: 6px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cyan-100); color: var(--navy); font-size: 12.5px; font-weight: 700; border: 1.5px solid var(--cyan);
}
.steprow__mail { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.steprow__amount { position: relative; }
.steprow__amount input { text-align: right; padding-right: 30px; font-variant-numeric: tabular-nums; font-weight: 600; }
.steprow__amount::after { content: "$"; position: absolute; right: 12px; top: 9px; color: var(--ink-3); font-weight: 600; }
.steprow__switch { padding-top: 9px; }
.steprow .iconbtn { margin-top: 6px; }
.steprow .iconbtn:disabled { opacity: 0.3; cursor: not-allowed; background: none; }
.steprow__error { grid-column: 2 / -1; margin: -4px 0 0; }
.steprow.is-invalid .combo__input, .steprow.is-invalid .steprow__amount input { border-color: var(--err); }
.steps__add { margin-top: 14px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { flex: none; width: 38px; height: 22px; border-radius: 999px; background: #b9c3cb; position: relative; transition: background 0.12s; }
.switch__track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.12s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch input:checked + .switch__track { background: var(--navy); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus); }

.sim { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.sim .chain { padding-top: 4px; }

.editor__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.editor__foot .spacer { flex: 1; }
.editor__status { order: -1; flex-basis: 100%; min-height: 18px; font-size: 13px; color: var(--ink-3); }
.editor__status.is-dirty { color: var(--warn); font-weight: 600; }
.btn--danger { background: #fff; color: var(--err); border-color: #e3b5b1; }
.btn--danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn--secondary:disabled { color: #98a1a9; border-color: var(--line); background: #fafbfc; cursor: not-allowed; }
.admin__editor { display: grid; gap: 20px; min-width: 0; }

.dialog { border: 0; border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 24px; width: min(460px, calc(100vw - 32px)); color: var(--ink); }
.dialog::backdrop { background: rgba(5, 0, 79, 0.45); }
.dialog p { margin: 10px 0 0; color: var(--ink-2); }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog .btn--primary.is-danger { background: var(--err); }
.dialog .btn--primary.is-danger:hover { background: #8f1e18; }

/* ------------------------------------------------------------------ États, avis, pied */
.state { text-align: center; padding: 96px 16px; color: var(--ink-2); }
.state .btn { margin-top: 12px; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--cyan-100); border-top-color: var(--navy); animation: spin 0.8s linear infinite;
}
.state.is-error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  background: var(--ink); color: #fff; border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-pop);
  font-size: 14px; animation: rise 0.18s ease-out;
}
.toast--error { background: var(--err); }
.toast--ok { background: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 20px; font-size: 12.5px; color: var(--ink-3); }

/* ------------------------------------------------------------------ Adaptatif */
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request__head--po { grid-template-columns: minmax(0, 1fr) 20px; gap: 8px 12px; }
  .request__head--po .request__tags { justify-content: flex-start; grid-column: 1; }
  .request__head--po .request__billing, .request__head--po .request__amount { grid-column: 1; text-align: left; }
  .request__head--po .request__chev { grid-row: 1; grid-column: 2; }
  .kv--inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin { grid-template-columns: minmax(0, 1fr); }
  .admin__list { position: static; max-height: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout__side { position: static; }
}
@media (max-width: 640px) {
  .toolbar { grid-template-columns: minmax(0, 1fr); }
  .toolbar select { min-width: 0; }
  .editor__head, .sim { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .steps__cols { display: none; }
  .steprow { grid-template-columns: 30px minmax(0, 1fr) 30px; }
  .steprow__amount { grid-column: 2; }
  .steprow__switch { grid-column: 2; padding-top: 0; }
  .steprow > .iconbtn { grid-row: 1; grid-column: 3; }
  .tab { padding-left: 10px; padding-right: 10px; }
  .topbar__inner, .tabs__inner, .page, .footer { padding-left: 16px; padding-right: 16px; }
  .userbox__text, .brand__divider, .brand__app { display: none; }
  .card { padding: 18px 16px 20px; }
  .grid-2, .segmented { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 22px; }
  .request__head { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; }
  .request__head .status { justify-self: start; grid-row: 2; }
  .request__amount { grid-row: 3; text-align: left; }
  .request__chev { grid-row: 1; grid-column: 2; }
  .request__body { grid-template-columns: minmax(0, 1fr); }
  .kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
