/* LE QG : base commune (polices, couleurs, composants) */

@font-face { font-family: "Onest"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/onest-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/onest-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/onest-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/onest-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Onest"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/onest-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --brand: #13876B;
  --brand-ui: #0E7A5F;
  --brand-deep: #103D32;
  --mint: #5DD4A9;
  --amber: #F2B84B;

  --ink: #0C1F1B;
  --ink-2: #23352F;
  --muted: #4D5F59;
  --line: #E8EFEC;
  --border: #D7E3DE;
  --border-input: #C3D3CC;
  --track: #E1EAE6;
  --surface: #FFFFFF;
  --surface-2: #F8FBF9;
  --chip: #EAF0ED;
  --late: #C2410C;
  --late-bg: #FDE8DC;
  --late-ink: #9A3412;
  --amber-bg: #FDEFCF;
  --amber-ink: #6B4A06;
  --blue-bg: #DCE7F3;
  --blue-ink: #1E3A5F;
  --note-bg: #FFF5DA;
  --note-border: #F0DCA3;
  --night: #0C1F1B;
  --night-ink: #EEF6F3;
  --night-muted: #9DB3AB;
  --night-line: #2C4A42;
  --discord: #4752C4;
  --discord-sub: #E3E6FF;
  --shadow-lg: 0 30px 60px -30px rgba(12, 31, 27, 0.35);
  --shadow-md: 0 12px 32px -12px rgba(12, 31, 27, 0.28);
  --focus: 0 0 0 3px color-mix(in srgb, var(--a, #13876B) 45%, transparent);

  /* Accent par défaut (remplacé par le thème du compte) */
  --a: #13876B; --a-on: #FFFFFF; --a-text: #0E7A5F; --a-soft: #D9F0E7; --a-soft-ink: #073D30;
  --a-ev: #C8ECDF; --a-today: #EBF5F1; --a-mint: #5DD4A9; --bg: #F1F5F3; --bg-side: #F8FBF9;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #E6EFEB; --ink-2: #C6D8D2; --muted: #9DB3AB; --line: #1C2E29; --border: #22352F; --border-input: #2C4540;
  --track: #22352F; --surface: #13221E; --surface-2: #0F1C18; --chip: #1C2E29;
  --late: #F07A3E; --late-bg: #3A1F14; --late-ink: #F5A97F; --amber-bg: #3A2E12; --amber-ink: #F2D28B;
  --blue-bg: #1B2A3A; --blue-ink: #B7CDE6; --note-bg: #26220F; --note-border: #4A4020;
  --night: #081310; --night-line: #2C4A42;
  --shadow-lg: 0 30px 60px -30px rgba(0, 0, 0, 0.6); --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --ink: #E6EFEB; --ink-2: #C6D8D2; --muted: #9DB3AB; --line: #1C2E29; --border: #22352F; --border-input: #2C4540;
    --track: #22352F; --surface: #13221E; --surface-2: #0F1C18; --chip: #1C2E29;
    --late: #F07A3E; --late-bg: #3A1F14; --late-ink: #F5A97F; --amber-bg: #3A2E12; --amber-ink: #F2D28B;
    --blue-bg: #1B2A3A; --blue-ink: #B7CDE6; --note-bg: #26220F; --note-border: #4A4020;
    --night: #081310; --night-line: #2C4A42;
    --shadow-lg: 0 30px 60px -30px rgba(0, 0, 0, 0.6); --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; font-size: 15px; -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; }
a { color: var(--a-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 1000; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--surface); text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }
.ic { flex: 0 0 auto; display: block; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-input); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--a); color: var(--a-on); border-color: transparent; font-weight: 600; }
.btn--primary:hover { background: color-mix(in srgb, var(--a) 88%, #000); border-color: transparent; }
.btn--brand { background: var(--brand-ui); color: #FFFFFF; border-color: transparent; font-weight: 600; }
.btn--brand:hover { background: #0B6A52; border-color: transparent; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--chip); border-color: transparent; }
.btn--danger { color: var(--late); border-color: color-mix(in srgb, var(--late) 45%, transparent); background: var(--surface); }
.btn--danger:hover { background: var(--late-bg); border-color: var(--late); }
.btn--danger-solid { background: var(--late); color: #FFFFFF; border-color: transparent; font-weight: 600; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn--lg { min-height: 52px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--discord { background: var(--discord); color: #FFFFFF; border-color: transparent; }
.btn--discord:hover { background: #3C45A5; border-color: transparent; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border-input); background: var(--surface); color: var(--ink); position: relative; flex: 0 0 auto; text-decoration: none; }
.icon-btn:hover { border-color: var(--muted); }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.icon-btn--ghost:hover { background: var(--chip); }
.icon-btn--sm { width: 36px; height: 36px; border-radius: 8px; }
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--late); }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-input); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 15px; }
.input--lg { min-height: 48px; }
.textarea { padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 88px; }
.select { appearance: none; padding-right: 36px; background-image: 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='%234D5F59' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .85; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--a); box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--late); }
.field-error { font-size: 13px; color: var(--late); }
.help { font-size: 13px; color: var(--muted); line-height: 1.5; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .field { flex: 1 1 140px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--a); width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }

/* Interrupteur */
.switch { appearance: none; -webkit-appearance: none; width: 44px !important; height: 26px !important; border-radius: 999px; background: var(--border-input); position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch:checked { background: var(--a); }
.switch:checked::after { transform: translateX(18px); }

/* Onglets segmentés et pastilles */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--track); max-width: 100%; overflow-x: auto; }
.seg__item { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.seg__item[aria-selected="true"], .seg__item[aria-current="page"], .seg__item.is-on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(12,31,27,.08); }
.seg__count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-input); background: var(--surface); color: var(--ink-2); font-size: 14px; text-decoration: none; white-space: nowrap; }
.pill[aria-pressed="true"], .pill[aria-selected="true"], .pill[aria-current="page"], .pill.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pill--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: var(--chip); color: var(--ink-2); line-height: 1.4; }
.badge--late { background: var(--late-bg); color: var(--late-ink); }
.badge--soft { background: var(--a-soft); color: var(--a-soft-ink); }
.badge--amber { background: var(--amber-bg); color: var(--amber-ink); }
.badge--blue { background: var(--blue-bg); color: var(--blue-ink); }
.badge--plain { background: transparent; color: var(--muted); padding-left: 0; padding-right: 0; }
.badge--mono { font-family: var(--mono); }
.tag { font-size: 12px; color: var(--muted); }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; min-width: 0; }
.card--dark { background: var(--night); color: var(--night-ink); border-color: transparent; }
.card--note { background: var(--note-bg); border-color: var(--note-border); }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.card__title { font-size: 18px; font-weight: 600; }
.card__link { font-size: 13px; }
.card--dark .card__link { color: var(--a-mint); }
.section-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* Barres de progression */
.bar { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--a); }
.steps-bar { display: grid; gap: 4px; }
.steps-bar > span { height: 8px; border-radius: 2px; background: var(--track); }
.steps-bar > span.on { background: var(--a); }

/* Messages */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 15px; line-height: 1.5; }
.alert--success { background: var(--a-soft); color: var(--a-soft-ink); }
.alert--error { background: var(--late-bg); color: var(--late-ink); }
.alert--info { background: var(--blue-bg); color: var(--blue-ink); }
.alert--warn { background: var(--amber-bg); color: var(--amber-ink); }
.alert a { color: inherit; font-weight: 600; }

/* Toasts */
.toasts { position: fixed; z-index: 400; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-md); font-size: 15px; animation: toast-in .2s ease-out; }
.toast--error { background: var(--late); color: #FFFFFF; }
.toast button { margin-left: auto; background: transparent; border: 0; color: inherit; font-weight: 600; min-height: 32px; text-decoration: underline; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Boîtes de dialogue */
.dlg { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); }
.dlg::backdrop { background: rgba(6, 24, 21, 0.55); backdrop-filter: blur(2px); }
.dlg__head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; }
.dlg__title { font-size: 18px; font-weight: 700; flex: 1 1 auto; }
.dlg__body { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg__foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 20px 20px; }
.dlg--wide { width: min(760px, calc(100vw - 32px)); }

/* États vides */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; }
.empty__title { font-size: 17px; font-weight: 700; }
.empty__text { font-size: 14px; color: var(--muted); max-width: 360px; line-height: 1.5; }
.empty .btn { margin-top: 8px; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--a-soft); color: var(--a-soft-ink); font-weight: 700; font-size: 15px; overflow: hidden; flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Tuiles d'app */
.app-tile { flex: 0 0 auto; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; line-height: 1; }
.app-tile--img { background: #FFFFFF; border: 1px solid var(--border); }
.app-tile img { display: block; object-fit: contain; }
.app-tile svg { display: block; flex: none; }

/* Drapeaux de langue */
.lang { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--track); }
.lang__item { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 13px; }
.lang__item[aria-current="true"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.lang__flag { width: 22px; height: 15px; border-radius: 3px; overflow: hidden; display: block; box-shadow: 0 0 0 1px rgba(12,31,27,.15); flex: 0 0 auto; }
.lang__flag img { width: 100%; height: 100%; object-fit: cover; display: block; }

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

/* Pile verticale (pages publiques et app) */
.stack { display: flex; flex-direction: column; gap: 16px; }
