/*
 * Buysendo — feuille de style des surfaces web `pay` et `ops`.
 *
 * Les mêmes valeurs de marque que `src/constants/theme.ts` (palette navy/orange,
 * R-D4 : navy = primaire, orange = accent, un seul accent par écran). Aucun
 * nouveau ton n'est inventé ici : une couleur qui manque est un manque de jeton,
 * pas une occasion d'en créer un.
 *
 * Deux thèmes, sans bifurcation dans le HTML : `prefers-color-scheme` décide,
 * comme `useColorScheme()` le fait dans l'app.
 */

:root {
  color-scheme: light dark;

  --navy-900: #0b2438;
  --navy-800: #0f2e49;
  --navy-700: #123a5c;
  --navy-100: #e3eaf1;
  --orange-600: #d14e12;
  --orange-500: #f4621e;
  --orange-100: #fde7da;
  --ink: #0d1b26;
  --ink-muted: #55677a;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --line: #e2e8f0;
  --success: #12805c;
  --warning: #b7791f;
  --danger: #c0392b;

  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eef4;
    --ink-muted: #9db0c2;
    --surface: #12283b;
    --canvas: #0b1c2b;
    --line: #1f3c56;
    --navy-100: #17314a;
    --orange-100: #3a2317;
    --success: #3fbf95;
    --warning: #e0ac4c;
    --danger: #e9705f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--navy-700);
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  a {
    color: #9dc4e8;
  }
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

.wrap--wide {
  max-width: 1180px;
}

/* ------------------------------------------------------------------ en-tête */

.top {
  background: var(--navy-900);
  color: #fff;
  padding: 18px 0 22px;
  margin-bottom: 28px;
}

.top .wrap {
  padding-bottom: 0;
}

.top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
}

.wordmark span {
  color: var(--orange-500);
}

.top-sub {
  color: #b9cbdb;
  font-size: 14px;
  margin: 4px 0 0;
}

.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.top nav a {
  color: #d7e4ef;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.top nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--orange-500);
}

/* -------------------------------------------------------------------- blocs */

h1 {
  font-size: 28px;
  line-height: 1.25;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

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

h3 {
  font-size: 15px;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

p {
  margin: 0 0 12px;
}

.lede {
  color: var(--ink-muted);
  font-size: 17px;
  max-width: 68ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: var(--gap);
}

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.tile .value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tile .label {
  color: var(--ink-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* -------------------------------------------------------------------- notes */

.note {
  border-left: 4px solid var(--navy-700);
  background: var(--navy-100);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  margin: 0 0 var(--gap);
}

.note--warn {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

.note--danger {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.note--good {
  border-left-color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}

.note p:last-child {
  margin-bottom: 0;
}

.note strong {
  display: block;
  margin-bottom: 4px;
}

/* ------------------------------------------------------------------ boutons */

button,
.button {
  font: inherit;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  background: var(--navy-700);
  color: #fff;
}

button:hover,
.button:hover {
  background: var(--navy-800);
}

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--navy-700);
  border-color: var(--navy-700);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--navy-100);
}

button.accent,
.button.accent {
  background: var(--orange-500);
  color: #fff;
}

button.accent:hover,
.button.accent:hover {
  background: var(--orange-600);
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

button.danger,
.button.danger {
  background: var(--danger);
}

/* ------------------------------------------------------------------ tableaux */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--ink-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------------ formulaires */

label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

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

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

.field {
  margin-bottom: 14px;
}

.hint {
  color: var(--ink-muted);
  font-size: 13px;
  margin-top: 4px;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
}

.check input {
  margin-top: 4px;
}

/* -------------------------------------------------------------------- divers */

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--navy-100);
  color: var(--navy-700);
  white-space: nowrap;
}

.pill--good {
  background: color-mix(in srgb, var(--success) 16%, var(--surface));
  color: var(--success);
}

.pill--warn {
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  color: var(--warning);
}

.pill--danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  color: var(--danger);
}

code,
.mono {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

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

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

.small {
  font-size: 13px;
}

.stack > * + * {
  margin-top: 10px;
}

.footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 16px;
  color: var(--ink-muted);
  font-size: 13px;
}

.lang {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.lang a {
  color: #b9cbdb;
  text-decoration: none;
  font-weight: 600;
}

.lang a[aria-current="true"] {
  color: #fff;
  text-decoration: underline;
}

.empty {
  color: var(--ink-muted);
  font-style: italic;
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

@media (max-width: 640px) {
  h1 {
    font-size: 24px;
  }
  .card {
    padding: 16px;
  }
}
