/* Billetterie WiFi — feuille de style unique, sans dépendance externe. */

@font-face { font-family: "Atkinson"; font-weight: 400; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson"; font-weight: 600; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson"; font-weight: 800; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-next-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Mono"; font-weight: 700; font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --papier: #EDF1EB;      /* fond de page */
  --feuille: #FFFFFF;     /* surfaces */
  --encre: #10241B;       /* texte */
  --sourdine: #536A5E;    /* texte secondaire */
  --trait: #D3DCD4;       /* filets */
  --foret: #0B5D3F;       /* action principale */
  --foret-fonce: #074431;
  --mousse: #DDEBE2;      /* fond teinté */
  --soleil: #F5B700;      /* le ticket */
  --soleil-pale: #FFF3C7;
  --lagune: #1D5C9E;      /* Telegram, liens */
  --braise: #A8321F;      /* erreur, action irréversible */
  --braise-pale: #FBE6E1;
  --r: 10px;
  --sans: "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Atkinson Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 400 1rem/1.5 var(--sans);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h1 { font-size: 1.6rem; line-height: 1.15; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; line-height: 1.25; font-weight: 800; margin: 0 0 .75rem; }
p { margin: 0 0 1rem; }
a { color: var(--lagune); text-underline-offset: 2px; }
small { font-size: .85rem; }
.muted { color: var(--sourdine); }
.warn { color: var(--braise); font-weight: 600; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--soleil); outline-offset: 2px; border-radius: 4px; }

/* ---------- structure */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1rem; background: var(--foret); color: #fff;
}
.brand { display: flex; align-items: baseline; gap: .5rem; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark { width: 26px; height: 18px; fill: var(--soleil); align-self: center; flex: none; }
.brand-name { font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: .9rem; opacity: .8; white-space: nowrap; }
.who { color: #fff; font-size: .9rem; text-decoration: none; white-space: nowrap; opacity: .9; overflow: hidden; text-overflow: ellipsis; max-width: 38%; flex: none; }
@media (max-width: 480px) { .brand-sub { display: none; } }
.who:hover { text-decoration: underline; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--feuille); border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .55rem .25rem .5rem; min-height: var(--nav-h);
  color: var(--sourdine); text-decoration: none; font-size: .78rem; font-weight: 600;
}
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current] { color: var(--foret); box-shadow: inset 0 3px 0 var(--foret); }

.main { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1.25rem; }
.pagehead p { margin: .35rem 0 0; flex-basis: 100%; }
section { margin-top: 2rem; }
.lead { max-width: 62ch; }
.note { color: var(--sourdine); font-size: .9rem; margin-top: .6rem; max-width: 70ch; }
.narrow { max-width: 30rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.two { display: grid; gap: 0 2rem; }
.two > * { min-width: 0; }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 196px; }
  .topbar { position: fixed; top: 0; left: 0; width: 196px; height: 100%; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: 1.25rem 1rem; z-index: 21; }
  .brand { flex-direction: column; align-items: flex-start; gap: .15rem; }
  .brand-mark { align-self: flex-start; width: 34px; height: 24px; margin-bottom: .6rem; }
  .brand-name { white-space: normal; font-size: 1.15rem; line-height: 1.2; }
  .who { position: absolute; bottom: 1.25rem; left: 1rem; right: 1rem; white-space: normal; max-width: none; }
  .nav { top: 132px; left: 0; right: auto; bottom: auto; width: 196px; flex-direction: column; background: none; border: 0; z-index: 22; padding: 0 .5rem; gap: 2px; }
  .nav a { flex: none; flex-direction: row; gap: .7rem; min-height: 0; padding: .6rem .6rem; color: #fff; opacity: .82; font-size: .95rem; border-radius: 8px; }
  .nav a:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
  .nav a[aria-current] { color: var(--encre); background: var(--soleil); opacity: 1; box-shadow: none; }
  .nav svg { width: 20px; height: 20px; }
  .main { padding: 2rem 2rem 3rem; margin: 0; }
  .two { grid-template-columns: 1fr 1fr; }
}

/* ---------- messages */
.flash { padding: .7rem .9rem; border-radius: var(--r); margin-bottom: 1rem; font-weight: 600; border-left: 5px solid; }
.flash-ok { background: var(--mousse); border-color: var(--foret); }
.flash-error { background: var(--braise-pale); border-color: var(--braise); }
.flash-todo { background: var(--soleil-pale); border-color: var(--soleil); font-weight: 400; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--encre); color: #fff; padding: .6rem 1rem; border-radius: 999px; font-weight: 600; z-index: 40;
  max-width: calc(100vw - 2rem); text-align: center;
}
.tip { position: fixed; z-index: 30; background: var(--encre); color: #fff; padding: .35rem .6rem; border-radius: 6px; font-size: .85rem; pointer-events: none; white-space: nowrap; }
.empty { background: var(--feuille); border: 1px dashed var(--trait); border-radius: var(--r); padding: 2rem 1.25rem; text-align: center; }
.empty p { margin-bottom: .75rem; }

/* ---------- formulaires */
label { display: block; font-weight: 600; font-size: .95rem; }
label small { display: block; font-weight: 400; margin-top: .25rem; }
label .muted { font-weight: 400; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; min-height: 44px;
  background: var(--feuille); border: 1.5px solid #9DB0A4; border-radius: 8px;
}
textarea { font-family: var(--mono); font-size: .9rem; line-height: 1.45; resize: vertical; }
input[type=file] { display: block; margin-top: .3rem; max-width: 100%; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--foret); }
input.input-warn { border-color: var(--braise); background: var(--braise-pale); }
.pw { display: flex; gap: .4rem; align-items: stretch; }
.pw input { flex: 1; min-width: 0; }
.pw-toggle { margin-top: .3rem; min-width: 5.6rem; padding: 0 .7rem; border: 1.5px solid #9DB0A4; border-radius: 8px; background: var(--feuille); font-weight: 600; font-size: .9rem; cursor: pointer; }
.pw-toggle:hover { border-color: var(--encre); }
.pick { display: flex; gap: .7rem; align-items: flex-start; font-weight: 400; cursor: pointer; }
.pick input { flex: none; width: 22px; height: 22px; margin-top: .15rem; accent-color: var(--foret); }
.choice { border: 1px solid var(--trait); border-radius: var(--r); background: var(--feuille); padding: .8rem 1rem; margin-inline: 0; }
.choice legend { font-weight: 600; padding: 0 .3rem; }
.choice .pick + .pick { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--trait); }
.or { text-align: center; color: var(--sourdine); font-weight: 600; margin-bottom: 0; }
.stack > * + * { margin-top: 1rem; }
.formgrid { display: grid; gap: .9rem 1rem; align-items: end; margin-bottom: 1rem; }
@media (min-width: 640px) { .formgrid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } .formgrid > button { justify-self: start; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 8px; cursor: pointer;
  background: var(--feuille); color: var(--encre); border: 1.5px solid #9DB0A4;
  font-weight: 600; text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--encre); }
.btn-primary { background: var(--foret); border-color: var(--foret); color: #fff; }
.btn-primary:hover { background: var(--foret-fonce); border-color: var(--foret-fonce); }
.btn-danger { color: var(--braise); border-color: var(--braise); }
.btn-danger:hover { background: var(--braise-pale); border-color: var(--braise); }
.btn-wa { background: var(--foret); border-color: var(--foret); color: #fff; }
.btn-tg { background: var(--lagune); border-color: var(--lagune); color: #fff; }
.btn-wa:hover, .btn-tg:hover { filter: brightness(.9); border-color: transparent; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.chip { min-height: 36px; padding: .25rem .8rem; border-radius: 999px; border: 1.5px solid #9DB0A4; background: var(--feuille); font-weight: 600; font-size: .9rem; cursor: pointer; }
.chip:hover { border-color: var(--encre); }
.tag { display: inline-block; padding: 0 .5rem; border-radius: 999px; background: var(--mousse); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tag-warn { background: var(--soleil-pale); }
.code { font-family: var(--mono); font-weight: 700; letter-spacing: .04em; }
.pre { font-family: var(--mono); font-weight: 700; font-size: .9rem; background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); padding: .9rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 1rem; }

/* ---------- connexion */
.page-login { padding: 0; }
.page-login .main { max-width: 24rem; padding-top: 12vh; }
.login h1 { margin: .9rem 0 .25rem; }
.login-mark { width: 56px; height: 40px; fill: var(--soleil); stroke: var(--encre); stroke-width: .6; }

/* ---------- vendre : le guichet */
.tiles { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; font-weight: 400; cursor: pointer; }
.tile input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tile-face {
  display: flex; flex-direction: column; gap: .15rem; height: 100%;
  background: var(--feuille); border: 2px solid var(--trait); border-radius: var(--r);
  padding: .8rem .9rem .75rem;
}
.tile-dur { font-size: 1rem; font-weight: 600; color: var(--sourdine); line-height: 1.1; }
.tile-dur b { font-size: 2.6rem; font-weight: 800; color: var(--encre); letter-spacing: -0.03em; }
.tile-price { font-weight: 800; font-size: 1.1rem; margin-top: .2rem; }
.tile-stock { font-size: .85rem; color: var(--sourdine); }
.tile-stock.is-low { color: var(--braise); font-weight: 600; }
.tile:hover .tile-face { border-color: var(--sourdine); }
.tile input:checked + .tile-face { border-color: var(--foret); background: var(--soleil); }
.tile input:checked + .tile-face .tile-dur, .tile input:checked + .tile-face .tile-stock { color: var(--encre); }
.tile input:focus-visible + .tile-face { outline: 3px solid var(--foret); outline-offset: 2px; }
.tile-off { cursor: not-allowed; }
.tile-off .tile-face { background: transparent; border-style: dashed; }
.tile-off .tile-dur b, .tile-off .tile-price { color: var(--sourdine); }

.sell-bar { margin-top: 1.25rem; display: grid; gap: 1rem; align-items: end; }
@media (min-width: 640px) { .sell-bar { grid-template-columns: auto 1fr auto; } }
.stepper { display: flex; margin-top: .3rem; }
.stepper input { width: 4.2rem !important; margin: 0 !important; text-align: center; border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.step { width: 48px; min-height: 44px; border: 1.5px solid #9DB0A4; background: var(--feuille); font-size: 1.4rem; font-weight: 600; cursor: pointer; }
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child { border-radius: 0 8px 8px 0; }
.btn-emit { min-height: 56px; font-size: 1.1rem; font-weight: 800; padding: .7rem 1.4rem; }

/* ---------- le ticket émis */
.voucher {
  --notch: 11px;
  max-width: 26rem; margin: 0 0 .9rem; background: var(--feuille); border-radius: 14px; overflow: hidden;
  filter: drop-shadow(0 2px 0 var(--trait)) drop-shadow(0 8px 14px rgba(16, 36, 27, .10));
  /* encoches de part et d'autre de la ligne de découpe */
  -webkit-mask: radial-gradient(circle var(--notch) at 0 calc(100% - 46px), #0000 98%, #000) 0 0 / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% calc(100% - 46px), #0000 98%, #000) 100% 0 / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 calc(100% - 46px), #0000 98%, #000) 0 0 / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% calc(100% - 46px), #0000 98%, #000) 100% 0 / 51% 100% no-repeat;
}
.voucher-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; background: var(--soleil); padding: .7rem 1.1rem; }
.voucher-site { font-weight: 600; }
.voucher-plan { font-weight: 800; font-size: 1.25rem; white-space: nowrap; }
.voucher-body { padding: .6rem 1.1rem .9rem; }
.cred { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: .75rem; padding: .55rem 0; }
.cred + .cred { border-top: 1px solid var(--trait); }
.cred-label { grid-column: 1 / -1; font-size: .85rem; color: var(--sourdine); font-weight: 600; }
.cred-value { font-family: var(--mono); font-weight: 700; font-size: 2.1rem; line-height: 1.15; letter-spacing: .1em; overflow-wrap: anywhere; user-select: all; }
.voucher-foot { display: flex; justify-content: space-between; gap: 1rem; height: 46px; align-items: center; padding: 0 1.4rem; border-top: 2px dashed var(--trait); font-size: .85rem; color: var(--sourdine); }
.voucher-foot span:last-child { font-weight: 800; color: var(--encre); font-size: 1rem; }
.voucher-void .cred-value { text-decoration: line-through; color: var(--sourdine); }
.voucher-void .voucher-head { background: var(--trait); }
.voucher-stamp { color: var(--braise); font-weight: 800; margin: .3rem 0 0; }
.share { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; max-width: 26rem; margin-bottom: .6rem; }
.share-all { margin-bottom: 1.5rem; }
.share-all .btn:first-child { grid-column: 1 / -1; }
.fix { max-width: 26rem; margin-bottom: 2rem; }
.fix summary, details.inline summary, .card details summary, .datatable summary { cursor: pointer; color: var(--lagune); font-weight: 600; padding: .4rem 0; min-height: 36px; }
.fix-form { margin-top: .6rem; display: grid; gap: .7rem; padding: .9rem; background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); }
.after { margin-top: 1.5rem; }

/* ---------- tableaux */
.tablewrap { overflow-x: auto; background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .6rem .8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--trait); }
.table thead th { font-size: .85rem; color: var(--sourdine); font-weight: 600; white-space: nowrap; background: #F7F9F6; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody th { font-weight: 600; white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .grow { width: 34%; min-width: 120px; }
.table .grow small { display: block; }
.row-off { opacity: .6; }
.table-form input:not([type=checkbox]) { margin: 0; min-width: 7rem; }
details.inline summary { white-space: nowrap; }
details.inline .formgrid { margin-top: .5rem; min-width: 16rem; }

.meter { display: block; width: 100%; height: 6px; margin-bottom: .2rem; }
.meter-track { fill: var(--mousse); }
.meter-fill { fill: var(--foret); }
.meter-low .meter-track { fill: var(--braise-pale); }
.meter-low .meter-fill { fill: var(--braise); }
.hbar { display: block; width: 100%; height: 8px; }
.hbar rect { fill: var(--foret); }

/* ---------- filtres */
.filters { display: flex; flex-wrap: wrap; gap: .7rem .9rem; align-items: end; margin-bottom: 1.25rem; }
.filters label { font-size: .85rem; }
.filters input, .filters select { min-width: 9.5rem; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1.5px solid #9DB0A4; border-radius: 8px; overflow: hidden; background: var(--feuille); }
.seg button, .seg a { border: 0; background: none; padding: .55rem .8rem; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; cursor: pointer; color: var(--encre); text-decoration: none; font-size: .9rem; }
.seg button + button, .seg a + a { border-left: 1px solid var(--trait); }
.seg [aria-pressed=true], .seg [aria-current] { background: var(--foret); color: #fff; }
.seg-links { margin-bottom: 1rem; }
.summary { font-size: 1.05rem; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }

/* ---------- analyse */
.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (min-width: 760px) { .figures { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.figure { background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); padding: .8rem 1rem; display: flex; flex-direction: column; }
.figure-label { font-size: .85rem; color: var(--sourdine); font-weight: 600; }
.figure-value { font-size: 1.35rem; font-weight: 800; line-height: 1.2; margin-top: .15rem; }
.figure-note { font-size: .85rem; color: var(--sourdine); }
.figure-hero { grid-column: 1 / -1; background: var(--foret); border-color: var(--foret); color: #fff; }
@media (min-width: 760px) { .figure-hero { grid-column: auto; } }
.figure-hero .figure-label { color: #CFE5D9; }
.figure-hero .figure-value { font-size: 2.4rem; letter-spacing: -0.02em; }

.chartwrap { overflow-x: auto; background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); }
.chart { display: block; width: 100%; min-width: 620px; height: auto; }
.chart .grid { stroke: #E4EAE5; stroke-width: 1; }
.chart .axis { font: 400 11px var(--sans); fill: var(--sourdine); font-variant-numeric: tabular-nums; }
.chart .peak { font: 600 11px var(--sans); fill: var(--encre); }
.chart .bar { fill: var(--foret); }
.chart .hit { fill: transparent; }
.chart .col { outline: none; }
.chart .col:hover .hit, .chart .col:focus-visible .hit { fill: var(--mousse); }
.chart .col:hover .bar, .chart .col:focus-visible .bar { fill: var(--foret-fonce); }
.datatable { margin-top: .5rem; }

/* ---------- menu, cartes */
.menu { list-style: none; padding: 0; margin: 0 0 1.5rem; background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); overflow: hidden; }
.menu li + li { border-top: 1px solid var(--trait); }
.menu a { display: block; padding: .8rem 1rem; text-decoration: none; color: var(--encre); }
.menu a:hover { background: var(--mousse); }
.menu b { display: block; }
.menu span { color: var(--sourdine); font-size: .9rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.card { background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--r); padding: .8rem 1rem; }
.card-off { background: transparent; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; }
.help { max-width: 44rem; }

@media (prefers-reduced-motion: no-preference) {
  .voucher { animation: sortie .28s ease-out; }
  @keyframes sortie { from { transform: translateY(-14px); opacity: 0; } }
}
@media print {
  .topbar, .nav, .share, .fix, .after, .flash { display: none !important; }
  body { padding: 0; background: #fff; }
}
