/* Couleurs du logo Buandrifi : marine, corail, bleu eau, bleu pâle (PRD, F30). */
:root {
    --navy: #1F3B6E;
    --coral: #FF615C;
    --water: #5BC3EA;
    --pale: #A9DDF3;

    --bg: #f3f7fa;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5b6475;
    --line: #dbe3ea;
    --accent: var(--navy);        /* liens, titres */
    --btn: var(--navy);           /* boutons ordinaires */
    --btn-text: #ffffff;
    --soft: #e3f3fb;              /* fonds légers (carte du solde) */
    --soft-text: var(--navy);
    --ok-bg: #e6f4ea;
    --ok-text: #1e5e32;
    --warn-bg: #fff4e0;
    --warn-text: #7a4a00;
    --error: #b42318;             /* distinct du corail des boutons */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1726;
        --surface: #17223a;
        --text: #e8ebf0;
        --muted: #9aa3b2;
        --line: #2a3752;
        --accent: var(--pale);
        --btn: var(--water);
        --btn-text: var(--navy);
        --soft: #1d3157;
        --soft-text: #ffffff;
        --ok-bg: #16301f;
        --ok-text: #9fd9b0;
        --warn-bg: #33270f;
        --warn-text: #f0c879;
        --error: #ff8a80;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

h1 { font-size: 1.6rem; margin: 0 0 16px; color: var(--accent); }
h2 { font-size: 1.15rem; margin: 32px 0 12px; color: var(--accent); }
a { color: var(--accent); }

.stack { display: grid; gap: 8px; max-width: 420px; }
label { font-weight: 600; margin-top: 8px; }

input, select, textarea {
    width: 100%;
    padding: 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.btn {
    margin-top: 12px;
    padding: 14px 20px;
    font: inherit;
    font-weight: 600;
    color: var(--btn-text);
    background: var(--btn);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}
.btn-big { width: 100%; padding: 18px; font-size: 1.25rem; }
/* Action principale en corail : texte blanc, gras et gros (contraste suffisant seulement en grand). */
.btn-action { background: var(--coral); color: #ffffff; font-weight: 700; font-size: 1.25rem; }

.link {
    padding: 0;
    font: inherit;
    color: var(--accent);
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

.bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}
.label { margin: 0; color: var(--muted); font-size: 0.9rem; }
.balance { margin: 4px 0 8px; font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.notice { padding: 12px 14px; border-radius: 10px; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); }
.field-error { margin: 0; color: var(--error); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.inactive { opacity: 0.5; }
.choices { display: flex; gap: 20px; }
.choices label { font-weight: 400; margin-top: 0; display: flex; align-items: center; gap: 6px; }
.choices input { width: auto; }

.amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.amounts form { margin: 0; }
.btn-amount { width: 100%; margin-top: 0; padding: 16px 8px; }

.history { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history .plus { color: var(--ok-text); font-weight: 600; }

a.btn { display: inline-block; text-decoration: none; }

.machine .state { margin: 0 0 4px; font-size: 1.6rem; font-weight: 700; }
.machine p { margin: 4px 0; }
.machine-mine .state { color: var(--accent); }
.machine-free .state { color: var(--accent); }
.machine-busy .state, .machine-offline .state { color: var(--warn-text); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-small { margin: 8px 4px 0 0; padding: 8px 12px; font-size: 0.9rem; }
.btn-ghost { color: var(--accent); background: transparent; border: 1px solid var(--accent); }

/* En-tête commun : toujours blanc, pour que le hublot marine du logo reste lisible. */
.site { background: #ffffff; border-bottom: 4px solid var(--water); }
.site-in { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.site .logo { display: block; line-height: 0; }
.site .logo img { height: 46px; width: auto; max-width: 60vw; }
.site form { margin: 0; }
.site .link { color: #1F3B6E; }

.card-balance { background: var(--soft); border-color: transparent; color: var(--soft-text); }
.card-balance .label, .card-balance .muted { color: var(--soft-text); opacity: 0.8; }

.machines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.machines a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; font-weight: 600; }
.machines a::after { content: "›"; color: var(--muted); font-size: 1.4rem; line-height: 1; }
.machine-name { flex: 1; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: #1F3B6E; white-space: nowrap; }
.pill-free { background: var(--water); }
.pill-mine { background: var(--pale); }
.pill-busy { background: var(--warn-bg); color: var(--warn-text); }
.pill-offline { background: var(--line); color: var(--muted); }

/* Demande d'accès : champ piège invisible pour les gens (F34). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
textarea { font: inherit; resize: vertical; }
.request { margin-bottom: 12px; }
.request p { margin: 4px 0; }
.request .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.request .actions form { margin: 0; }
.message { white-space: pre-line; }
