/* Palette de l'app (Frontend/src/theme/colors.ts). */
:root {
  --page: #08080a; --bg: #111113; --surface: #1b1b1e; --surface2: #242428; --line: #333338;
  --paper: #f3efe7; --muted: #a19d96; --faint: #77736d; --red: #ff2d2d; --red-tint: rgba(255, 45, 45, 0.12);
  --pseudo: #ffc53d; --ok: #86dc9c; --ok-tint: rgba(134, 220, 156, 0.12); --gift: #8ab4ff; --gift-tint: rgba(138, 180, 255, 0.14);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--paper); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { display: flex; min-height: 100vh; }
.side { width: 220px; flex: none; background: var(--bg); border-right: 1px solid var(--line); padding: 20px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; font-size: 18px; padding: 0 10px 18px; }
.brand span { color: var(--red); }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a:hover { background: var(--surface); color: var(--paper); }
.nav a.on { background: var(--surface2); color: var(--paper); }
.side .grow { flex: 1; }
.main { flex: 1; min-width: 0; padding: 28px 32px 60px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 28px 0 10px; color: var(--muted); font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.sub { color: var(--muted); margin: 0 0 20px; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.pseudo { color: var(--pseudo); font-family: var(--mono); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card .k { color: var(--muted); font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.card .v { font-size: 30px; font-weight: 800; margin-top: 6px; }
.card .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.alert { border-color: var(--red); }
.card.alert .v { color: var(--red); }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--muted); }
input.search { min-width: 260px; }
textarea { width: 100%; min-height: 60px; resize: vertical; }
.btn { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.main { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.btn.danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
.chip { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--paper); color: #141414; border-color: var(--paper); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface2); }
td.wrap { max-width: 520px; }
td.num { text-align: right; font-family: var(--mono); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-family: var(--mono); font-size: 12px; margin-right: 4px; white-space: nowrap; }
.badge.paid { background: var(--ok-tint); color: var(--ok); }
.badge.gift { background: var(--gift-tint); color: var(--gift); }
.badge.promo { background: rgba(255, 197, 61, 0.14); color: var(--pseudo); }
.badge.free { background: var(--surface2); color: var(--muted); }
.badge.red { background: var(--red-tint); color: var(--red); }
.badge.plain { background: var(--surface2); color: var(--paper); }

.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { color: var(--muted); font-size: 13px; }
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--paper); }
.report { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 10px; }
.quote { background: var(--bg); border-left: 3px solid var(--red); padding: 10px 12px; border-radius: 4px; margin: 10px 0; white-space: pre-wrap; word-break: break-word; }
.error { color: var(--red); margin-top: 10px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--paper); color: #141414; padding: 10px 16px; border-radius: 8px; font-weight: 600; }

.login { max-width: 340px; margin: 14vh auto 0; padding: 0 16px; }
.login .btn { width: 100%; margin-top: 6px; }
.login input { width: 100%; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; }
  .brand { padding-bottom: 10px; }
  .side .grow { display: none; }
  .main { padding: 18px 16px 50px; }
  .kv { grid-template-columns: 1fr; }
}
