/* Le portail du gérant, avec les jetons des apps (core/designsystem : AfreeColors, AfreeSpacing), comme la console.
   Une barre en haut, des onglets dessous, une colonne de contenu ; clair par défaut, sombre avec les jetons sombres.
   Pas de framework, pas de script. */

@font-face {
    font-family: "Manrope";
    src: url("fonts/manrope.ttf") format("truetype");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --header-blue: #002455;
    --accent-blue: #0D47A1;
    --screen-background: #F8F9FA;
    --card: #FFFFFF;
    --divider: #DDDDDD;
    --label-grey: #757575;
    --text-dark: #333333;
    --failure-red: #EF5350;
    --on-blue: #FFFFFF;
    --on-blue-muted: #FFFFFFB3;
    --info-bg: #E3F2FD;
    --error-bg: #FDECEA;

    --bg: var(--screen-background);
    --fg: var(--text-dark);
    --fg-muted: var(--label-grey);
    --line: var(--divider);
    --panel: var(--card);
    --link: var(--accent-blue);
    --radius: 12px;
    --gap: 16px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0E1621;
        --fg: #E8EAED;
        --fg-muted: #A5ABB3;
        --line: #2A3442;
        --panel: #16202D;
        --link: #8AB4F8;
        --info-bg: #102A43;
        --error-bg: #3B1717;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
body.canvas { background: var(--header-blue); }
a { color: var(--link); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--gap); top: var(--gap); background: var(--panel); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.topbar { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; padding: 12px max(16px, env(safe-area-inset-left)); background: var(--header-blue); color: var(--on-blue); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--on-blue); text-decoration: none; font-weight: 700; }
.brand img { width: 32px; height: 32px; }
.brand-app { font-weight: 500; color: var(--on-blue-muted); }
.who { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.who-store { font-weight: 700; }
.who-code, .who-name { color: var(--on-blue-muted); font-weight: 500; font-size: 14px; }
.signout { margin: 0; }

.tabs { display: flex; gap: 4px; padding: 0 max(16px, env(safe-area-inset-left)); background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 12px 14px; color: var(--fg-muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--link); }

.page { max-width: 1080px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left)) 48px; }
.screen-title { margin: 0 0 4px; font-size: 26px; text-wrap: balance; }
.subtitle { margin: 0 0 24px; color: var(--fg-muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.section-label { margin: 0 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }

.signin { max-width: 420px; margin: 32px auto; background: var(--panel); border-radius: 16px; padding: 28px 24px; }
.signin-logo { width: 56px; height: 56px; }
.signin-title { margin: 12px 0 4px; font-size: 24px; text-wrap: balance; }
.signin-sub { margin: 0 0 20px; color: var(--fg-muted); }
.signin-form { display: flex; flex-direction: column; gap: 6px; }
.signin-form label { font-weight: 600; margin-top: 10px; }
.signin-form input { font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 48px; }
.signin-form input.code { letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.signin-alt { margin: 16px 0 0; text-align: center; }
.field-help { margin: 4px 0 0; font-size: 14px; color: var(--fg-muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 10px; border: 0; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--accent-blue); color: var(--on-blue); }
.btn-quiet { background: transparent; color: var(--on-blue); border: 1px solid var(--on-blue-muted); min-height: 40px; }
.btn-wide { width: 100%; margin-top: 18px; }

.banner { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; }
.banner-info { background: var(--info-bg); }
.banner-error { background: var(--error-bg); color: var(--fg); border-left: 4px solid var(--failure-red); }

@media (max-width: 480px) {
    .who { margin-left: 0; align-items: flex-start; width: 100%; }
    .signin { margin: 0; border-radius: 0; min-height: calc(100vh - 56px); }
}

/* Étape 3 : les chiffres du jour, les tableaux de paiements, les filtres. */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; }
.btn-secondary { background: var(--panel); color: var(--link); border: 1px solid var(--line); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.kpi-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--fg-muted); font-size: 14px; }
.card + .card { margin-top: var(--gap); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; margin-bottom: 8px; }
.muted, .empty { color: var(--fg-muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--fg-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; margin-right: 4px; background: var(--line); }
.pill-success { background: #E8F5E9; color: #1B5E20; }
.pill-pending { background: #FFF8E1; color: #7A5A00; }
.pill-failed, .pill-expired { background: #FDECEA; color: #8E1C17; }
.pill-refund { background: #E3F2FD; color: #0D47A1; }
details summary { cursor: pointer; color: var(--link); font-weight: 600; white-space: nowrap; }
/* Ouvert, le détail prend la place qu'il lui faut au lieu de se tasser dans la dernière colonne. */
details[open] { min-width: 300px; }
.detail { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 14px; }
.detail dt { color: var(--fg-muted); }
.detail dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chips a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); text-decoration: none; font-weight: 600; font-size: 14px; }
.chips a[aria-current="true"] { background: var(--accent-blue); border-color: var(--accent-blue); color: var(--on-blue); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0 0 12px; }
.filters label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.filters input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); min-height: 44px; }
.filters .grow { flex: 1 1 220px; }
.filters .grow input { width: 100%; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; padding-top: 12px; }
@media (prefers-color-scheme: dark) {
    .pill-success { background: #143D1E; color: #A5D6A7; }
    .pill-pending { background: #3D3210; color: #FFE082; }
    .pill-failed, .pill-expired { background: #3B1717; color: #EF9A9A; }
    .pill-refund { background: #102A43; color: #90CAF9; }
}

/* Étape 4 : les caisses, leur code et les confirmations. */
.stack { display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.stack label { font-weight: 600; }
.stack input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 44px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn-danger { background: var(--failure-red); color: #FFFFFF; }
.btn-quiet-danger { background: transparent; color: var(--failure-red); border: 1px solid var(--line); }
.confirm { border-left: 4px solid var(--accent-blue); }
.reveal { text-align: center; }
.code-big { font-size: 40px; font-weight: 800; letter-spacing: .12em; margin: 8px 0; font-variant-numeric: tabular-nums; }
.terminals { list-style: none; margin: 0; padding: 0; }
.terminal { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.terminal:last-child { border-bottom: 0; }
.terminal-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.terminal-name { font-weight: 700; }
.terminal-state { color: var(--fg-muted); font-size: 14px; }
.terminal.inactive .terminal-name { color: var(--fg-muted); }

/* Étape 5 : les caissiers. */
.stack select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); min-height: 44px; }

/* Les liens de paiement (ADR-B07, étape 2). L'état se dit en mots ; « Payé » est seulement plus appuyé. */
.link-amount { font-size: 28px; font-weight: 800; margin: 8px 0; font-variant-numeric: tabular-nums; }
.link-url { max-width: 480px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); margin: 8px auto 12px; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; font-variant-numeric: tabular-nums; }
.link-closed { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.link-label { font-weight: 600; margin: 12px 0 0; }
.reveal .row { justify-content: center; }
.state-paid { color: var(--fg); font-weight: 700; }
.link-created { font-size: 13px; }
.link-foot { margin: 12px 0 0; font-size: 14px; }
.stack .row input { flex: 1 1 160px; min-width: 0; }

/* La page Statistiques (afreedata/AfreePayPOS#607) : une phrase d'aide à côté d'un titre, une liste nue, et la jauge
   native des heures d'affluence, mise à l'échelle de l'heure la plus chargée, sans style en ligne. */
.hint { color: var(--fg-muted); font-size: 14px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
table.hours { width: 100%; }
table.hours td:first-child { width: 4.5rem; white-space: nowrap; }
table.hours meter { width: 100%; height: 0.8rem; }
