/* Mes Frais — papier de caisse, encre bleue, tampon violet. */

:root {
  --paper: #edf1ee;
  --sheet: #ffffff;
  --ink: #18233f;
  --ink-2: #47516a;
  --ink-3: #6a7386;
  --rule: #cfd7d2;
  --rule-strong: #b4bfb8;
  --blue: #2346b5;
  --blue-press: #19348c;
  --blue-soft: #e5ebfa;
  --stamp: #6b3fa0;
  --check: #8f4405;
  --check-bg: #fff3df;
  --check-line: #e39a3b;
  --danger: #b3261e;
  --ok: #1d6f47;
  --focus: #f0a500;
  --r-s: 10px;
  --r: 14px;
  --r-l: 22px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Roboto Mono', 'Liberation Mono', monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --bar-h: 148px;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body.locked {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0;
}

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

button {
  cursor: pointer;
}

svg {
  flex: none;
}

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

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------------- Boutons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border: 2px solid transparent;
  border-radius: var(--r);
  font-weight: 650;
  font-size: 18px;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s, transform 0.1s;
  touch-action: manipulation;
}

.btn svg {
  width: 24px;
  height: 24px;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-press);
}

.btn-secondary {
  background: var(--sheet);
  color: var(--blue);
  border-color: #c6d2f1;
}

.btn-secondary:hover {
  border-color: var(--blue);
}

.btn-danger {
  background: var(--sheet);
  color: var(--danger);
  border-color: #e7b9b5;
}

.btn-big {
  width: 100%;
  min-height: 64px;
  font-size: 20px;
  border-radius: 16px;
}

.btn-big svg {
  width: 28px;
  height: 28px;
}

.btn-small {
  min-height: 44px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.btn-plain {
  background: var(--sheet);
  color: var(--ink);
  border-color: var(--rule);
}

.btn-plain:hover {
  border-color: var(--rule-strong);
}

.btn-small svg {
  width: 20px;
  height: 20px;
}

.btn-on-dark {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-text {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--blue);
  font-weight: 600;
  font-size: 17px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.btn-text.danger {
  color: var(--danger);
}

/* ---------------- Barre du haut ---------------- */

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-t)) 16px 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  font-size: 21px;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  color: var(--ink);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-s);
  background: none;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 16px;
}

.topbar-btn svg {
  width: 22px;
  height: 22px;
}

.topbar-btn:hover {
  background: rgba(24, 35, 63, 0.06);
}

/* ---------------- Espace partagé ---------------- */

.team-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 4px;
}

.team-name {
  min-width: 0;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-name::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--stamp);
  vertical-align: 0;
}

.sync-pill {
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.sync-pill.is-ok {
  background: #e3f1e8;
  color: var(--ok);
}

.sync-pill.is-sync {
  background: var(--blue-soft);
  color: var(--blue);
}

.sync-pill.is-off,
.sync-pill.is-err {
  background: var(--check-bg);
  color: var(--check);
  border-color: #f0c98c;
}

.st-team .st-buttons {
  margin-top: 6px;
}

.st-h4 {
  margin: 14px 0 6px;
  font-size: 16px;
}

.st-me {
  font-size: 16px;
}

.st-members {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.st-members li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  border-bottom: 1px dashed var(--rule);
}

.st-since {
  display: block;
  color: var(--ink-3);
  font-size: 13px;
}

.st-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 6px;
  background: #ece6f6;
  color: var(--stamp);
  font-size: 13px;
  font-weight: 650;
}

.qr {
  width: min(240px, 70vw);
  margin: 14px auto 6px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

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

.invite-label {
  margin-top: 10px;
  font-size: 15px;
}

.invite-code {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--ink);
}

.dlg-label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 650;
  color: var(--ink);
}

.input-code {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dlg-hint {
  margin-top: 6px;
  font-size: 15px;
}

.dlg-hint:empty,
.dlg-error:empty {
  display: none;
}

.dlg-hint.is-ok {
  color: var(--ok);
  font-weight: 650;
}

.dlg-hint.is-bad,
.dlg-error {
  color: var(--danger);
  font-weight: 600;
}

.dlg-error {
  margin-top: 12px;
}

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

.row-wait {
  background: var(--check-bg);
  color: var(--check);
}

/* ---------------- Accueil ---------------- */

.home {
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 16px calc(var(--bar-h) + var(--safe-b) + 24px);
}

.is-desk .home {
  padding-bottom: 48px;
}

.banner {
  display: grid;
  gap: 12px;
  margin: 6px 0 18px;
  padding: 14px 16px;
  border: 2px solid #c6d2f1;
  border-radius: var(--r);
  background: var(--blue-soft);
  font-size: 16px;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Le ticket de caisse de l'année : l'élément signature */
.ticket {
  position: relative;
  margin: 8px 0 34px;
  padding: 14px 18px 22px;
  background: var(--sheet);
  border-radius: 6px 6px 0 0;
  filter: drop-shadow(0 1px 0 rgba(24, 35, 63, 0.07)) drop-shadow(0 10px 14px rgba(24, 35, 63, 0.1));
}

.ticket::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
  background: linear-gradient(-45deg, transparent 8px, var(--sheet) 0) 0 0 / 16px 12px repeat-x,
    linear-gradient(45deg, transparent 8px, var(--sheet) 0) 0 0 / 16px 12px repeat-x;
}

.year-switch {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 2px dashed var(--rule);
}

.year-label {
  text-align: center;
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.year-arrow {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--blue);
  display: grid;
  place-items: center;
}

.year-arrow svg {
  width: 26px;
  height: 26px;
}

.year-arrow:hover:not(:disabled) {
  background: var(--blue-soft);
}

.year-arrow:disabled {
  color: var(--rule-strong);
  cursor: default;
}

.ticket-lines {
  margin: 14px 0 16px;
}

.t-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
}

.t-line dt {
  color: var(--ink-2);
  font-size: 17px;
}

.t-line .leader {
  flex: 1;
  min-width: 16px;
  border-bottom: 2px dotted var(--rule-strong);
  transform: translateY(-5px);
}

.t-line dd {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 600;
  white-space: nowrap;
}

.t-line.t-total dt {
  color: var(--ink);
  font-weight: 700;
}

.t-line.t-total dd {
  font-size: 26px;
  font-weight: 750;
}

.t-cur {
  font-size: 0.7em;
  font-weight: 600;
  color: var(--ink-2);
  margin-left: 4px;
}

.ticket-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-ticket {
  min-height: 56px;
  padding: 0 12px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 17px;
}

.btn-ticket:hover:not(:disabled) {
  border-color: #b9c8ef;
}

/* Bureau (souris) : bouton d'import en haut, pas de barre en bas */
.desk-actions {
  margin: 0 0 26px;
  text-align: center;
}

.desk-hint {
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 16px;
}

.is-touch .desk-actions {
  display: none;
}

/* ---------------- Liste ---------------- */

.month {
  margin-bottom: 22px;
}

.month-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 0 4px 8px;
  border-bottom: 2px solid var(--ink);
}

.month-head h2 {
  font-size: 20px;
  font-weight: 750;
}

.month-sum {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-2);
  text-align: right;
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  text-align: left;
}

.row:hover {
  background: rgba(255, 255, 255, 0.6);
}

.row-thumb {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--rule);
  object-fit: cover;
  display: block;
}

.row-main {
  min-width: 0;
}

.row-title {
  display: block;
  font-weight: 650;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 15px;
}

.row-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.row-badge {
  padding: 0 6px;
  border-radius: 6px;
  background: #e9edf3;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.row-amount {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 18px;
  text-align: right;
  white-space: nowrap;
}

.row-amount small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.empty {
  padding: 28px 12px 12px;
  text-align: center;
  color: var(--ink-2);
}

.empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

/* ---------------- Barre d'action (téléphone) ---------------- */

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(237, 241, 238, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
}

.actionbar > * {
  max-width: 688px;
  width: 100%;
  margin: 0 auto;
}

.is-desk .actionbar {
  display: none;
}

/* ---------------- Feuilles plein écran (vérification, réglages) ---------------- */

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  animation: sheet-in 0.22s ease-out;
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

.sheet-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--safe-t)) 10px 6px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.sheet-close {
  justify-self: start;
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.sheet-count {
  justify-self: end;
  padding-right: 6px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sheet-foot {
  display: grid;
  gap: 4px;
  padding: 10px 16px calc(10px + var(--safe-b));
  border-top: 1px solid var(--rule);
  background: var(--paper);
}

.sheet-foot > * {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.foot-links {
  display: flex;
  justify-content: center;
  gap: 18px;
}

/* ---------------- Vérification d'un ticket ---------------- */

.review-body {
  padding: 14px 16px 24px;
}

.rv-photo {
  margin: 0 auto 14px;
  max-width: 560px;
}

.rv-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 160px;
  border-radius: var(--r);
  background: #dfe5e1;
  overflow: hidden;
}

.rv-img-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.rv-img-btn img {
  display: block;
  width: 100%;
  max-height: 34vh;
  max-height: 34dvh;
  object-fit: contain;
}

.rv-loading {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
}

.rv-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.rv-form {
  max-width: 560px;
  margin: 0 auto;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--blue-soft);
  font-size: 16px;
}

.status:empty {
  display: none;
}

.status.is-warn {
  background: var(--check-bg);
  color: var(--check);
}

.status.is-done {
  background: #e5f3ea;
  color: var(--ok);
}

.status .bar {
  flex: 1;
  min-width: 60px;
}

.notice {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--check-bg);
  border: 2px solid var(--check-line);
  color: var(--check);
  font-size: 16px;
}

.field {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field > label,
.field > legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-weight: 650;
  font-size: 17px;
}

.opt {
  font-weight: 400;
  color: var(--ink-3);
  font-size: 15px;
}

.input {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 2px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--sheet);
  font-size: 19px;
  -webkit-appearance: none;
  appearance: none;
}

select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%2318233f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

input[type='date'].input {
  min-width: 0;
}

.input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(35, 70, 181, 0.2);
}

.input-short {
  max-width: 220px;
}

.amount-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 10px;
}

.input-amount {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  min-height: 64px;
}

.select-currency {
  min-height: 64px;
  font-weight: 650;
}

.hint {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-3);
}

.hint:empty {
  display: none;
}

.field.is-check .input:not(select) {
  border-color: var(--check-line);
  background: var(--check-bg);
}

.field.is-check .hint {
  color: var(--check);
  font-weight: 600;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 14px;
  border: 2px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--sheet);
  font-size: 16px;
  font-weight: 600;
}

.chip[aria-checked='true'] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.more {
  margin: 4px 0 14px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.more > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  font-weight: 650;
  color: var(--blue);
  cursor: pointer;
  list-style: none;
}

.more > summary::-webkit-details-marker {
  display: none;
}

.more > summary::before {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.more[open] > summary::before {
  transform: rotate(45deg);
}

.more[open] {
  padding-bottom: 4px;
}

.filename {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-2);
}

.filename .mono {
  color: var(--ink);
  font-weight: 650;
  font-size: 16px;
  word-break: break-all;
}

/* Tampon "Enregistré" */
.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  padding: 6px;
  border: 4px solid var(--stamp);
  border-radius: 12px;
  color: var(--stamp);
  transform: translate(-50%, -50%) rotate(-9deg) scale(1.6);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.stamp span {
  display: block;
  padding: 6px 16px;
  border: 2px solid var(--stamp);
  border-radius: 7px;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.82);
}

.stamp.on {
  animation: stamp-in 0.36s cubic-bezier(0.2, 0.9, 0.3, 1.15) forwards;
}

@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-14deg) scale(1.7);
  }
  70% {
    opacity: 0.95;
    transform: translate(-50%, -50%) rotate(-9deg) scale(0.96);
  }
  100% {
    opacity: 0.92;
    transform: translate(-50%, -50%) rotate(-9deg) scale(1);
  }
}

/* ---------------- Visionneuse ---------------- */

.viewer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: #0d1220;
}

.viewer-bar {
  display: flex;
  justify-content: space-between;
  padding: calc(8px + var(--safe-t)) 12px 8px;
}

.viewer-scroll {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 8px 8px calc(8px + var(--safe-b));
}

.viewer-scroll img {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
}

.viewer.zoomed .viewer-scroll {
  display: block;
}

.viewer.zoomed .viewer-scroll img {
  max-width: none;
  max-height: none;
  width: 250%;
}

/* ---------------- Réglages ---------------- */

.settings-body {
  padding: 8px 16px 40px;
}

.st-section {
  max-width: 600px;
  margin: 0 auto;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
}

.st-section h3 {
  font-size: 19px;
  margin-bottom: 8px;
}

.st-section p {
  color: var(--ink-2);
  font-size: 16px;
  margin-bottom: 12px;
}

.st-label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
  font-size: 16px;
}

.st-cats {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.st-cats li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  border-bottom: 1px dashed var(--rule);
}

.st-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.st-buttons {
  display: grid;
  gap: 10px;
}

.st-small {
  color: var(--ink-3);
  font-size: 15px;
  margin-top: 10px;
}

.st-version {
  max-width: 600px;
  margin: 18px auto 0;
}

.st-danger h3 {
  color: var(--danger);
}

.howto {
  margin: 0;
  padding-left: 22px;
  font-size: 17px;
}

.howto li {
  margin: 8px 0;
}

/* ---------------- Boîtes de dialogue ---------------- */

.dialog-wrap {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 75;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(13, 18, 32, 0.5);
}

.dialog {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: var(--r-l);
  background: var(--sheet);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.45);
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
}

.dialog-title {
  font-size: 21px;
  margin-bottom: 10px;
}

.dialog-body {
  color: var(--ink-2);
  font-size: 17px;
}

.dialog-body p + p,
.dialog-body p + ol,
.dialog-body ol + p {
  margin-top: 10px;
}

.dialog-buttons {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.steps {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
}

.steps li {
  position: relative;
  padding: 8px 0 8px 46px;
  color: var(--ink);
  counter-increment: s;
}

.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 750;
}

/* ---------------- Traitement en cours ---------------- */

.busy {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(237, 241, 238, 0.82);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.busy-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
  max-width: 340px;
  padding: 24px 20px;
  border-radius: var(--r-l);
  background: var(--sheet);
  box-shadow: 0 12px 40px -16px rgba(0, 0, 0, 0.3);
  text-align: center;
  font-size: 17px;
}

.bar {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: #dfe5ee;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--blue);
  transition: width 0.25s;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3.5px solid #c9d4f0;
  border-top-color: var(--blue);
  animation: spin 0.9s linear infinite;
}

.status .spinner {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- Messages ---------------- */

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bar-h) + var(--safe-b) + 8px);
  z-index: 80;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.is-desk .toasts {
  bottom: calc(24px + var(--safe-b));
}

body.locked .toasts {
  bottom: calc(150px + var(--safe-b));
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}

.toast.is-ok::before {
  content: '';
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b79be0;
  box-shadow: 0 0 0 3px rgba(183, 155, 224, 0.3);
}

.toast.is-error {
  background: var(--danger);
}

.toast button {
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--r-s);
  background: none;
  color: #fff;
  font-weight: 700;
}

@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}

.drop-overlay {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 90;
  display: grid;
  place-items: center;
  border: 4px dashed var(--blue);
  border-radius: var(--r-l);
  background: rgba(229, 235, 250, 0.92);
  color: var(--blue);
  font-size: 28px;
  font-weight: 750;
  pointer-events: none;
}

/* ---------------- Grands écrans ---------------- */

@media (min-width: 900px) {
  .sheet {
    top: 24px;
    right: 24px;
    bottom: 24px;
    left: 24px;
    max-width: 1120px;
    margin: 0 auto;
    border-radius: var(--r-l);
    box-shadow: 0 30px 80px -30px rgba(13, 18, 32, 0.55), 0 0 0 100vmax rgba(13, 18, 32, 0.35);
    overflow: hidden;
  }

  #review .review-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    padding: 22px 26px;
  }

  #review .rv-photo {
    position: sticky;
    top: 0;
    max-width: none;
    margin: 0;
  }

  #review .rv-img-btn img {
    max-height: calc(100vh - 260px);
  }

  #review .rv-form {
    max-width: none;
    margin: 0;
  }

  .ticket {
    padding: 18px 26px 26px;
  }
}

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

  .spinner {
    animation: none;
    border-top-color: var(--blue);
    border-right-color: var(--blue);
  }
}

/* Code de l'espace, à garder en lieu sûr (Réglages) */
.st-key {
  background: var(--blue-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}
.st-key p {
  margin: 0 0 6px;
}
#st-team .st-key .invite-code {
  margin: 6px 0;
  font-size: 22px;
  text-align: left;
}

/* Comptes : bloc à remplir et actions du responsable */
.st-key-warn {
  background: var(--check-bg);
  border: 1px solid var(--check-line);
}
.st-key .btn {
  margin-top: 6px;
}
.st-members li {
  flex-wrap: wrap;
  padding: 6px 0;
}
.st-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  justify-content: flex-end;
}
.st-actions .btn-text {
  font-size: 14px;
}

/* Lecture par IA (Réglages) */
.st-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: 15px;
  line-height: 1.4;
}
.st-check input {
  width: 22px;
  height: 22px;
  margin-top: 1px;
  flex: none;
  accent-color: var(--blue);
}
