/* บอทเข้าห้อง — pages du site « une partie à la fois » (web_room/, WEB_UI=room).
   Sombre, calme, un seul accent : la braise (ember) = « dans la partie » et l'action principale. Aucune ombre décorative,
   bordures de 1 px, rayons hiérarchisés (contrôles 6 px, conteneurs 12 px, pastilles rondes). */

@font-face { font-family: "LINE Seed Sans TH"; src: url("/static/LINESeedSansTH_Rg.woff2?v=1796049919") format("woff2"); font-weight: 100 500; font-display: swap; }
@font-face { font-family: "LINE Seed Sans TH"; src: url("/static/LINESeedSansTH_Bd.woff2?v=1796049919") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "LINE Seed Sans TH"; src: url("/static/LINESeedSansTH_XBd.woff2?v=1796049919") format("woff2"); font-weight: 800 900; font-display: swap; }

:root {
    color-scheme: dark;
    --bg: #0c0d10;
    --surface: #121419;
    --raised: #181b21;
    --hover: #1e2128;
    --line: #262a32;
    --line-2: #333844;
    --text: #e9ebf0;
    --text-2: #a7adb9;
    --text-3: #7a8190;
    --ember: #ff7a2f;
    --ember-hi: #ff9152;
    --ember-ink: #1c0e05;
    --ember-soft: rgba(255, 122, 47, .13);
    --sky: #5aa8ff;
    --sky-soft: rgba(90, 168, 255, .13);
    --mint: #3ecf8e;
    --mint-soft: rgba(62, 207, 142, .13);
    --amber: #f2b740;
    --amber-soft: rgba(242, 183, 64, .13);
    --rose: #f2555d;
    --rose-soft: rgba(242, 85, 93, .13);
    --r-sm: 6px;
    --r-md: 12px;
    --font: "LINE Seed Sans TH", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --top: 56px;
    --wrap: 1080px;
    --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 400 15px/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; line-height: 1.35; font-weight: 700; }
h3 { font-size: 15px; line-height: 1.4; font-weight: 700; }
a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text-2); }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--ember-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- chargement ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot .mark { width: 40px; height: 40px; }

/* ---------- marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; }
.mark { width: 28px; height: 28px; flex: none; }
.mark rect { fill: var(--raised); stroke: var(--line-2); }
.mark .door { fill: var(--ember); }

/* ---------- boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 14px; border-radius: var(--r-sm);
    border: 1px solid var(--line-2); background: var(--raised); color: var(--text);
    font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--hover); border-color: #3c4250; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ember); border-color: var(--ember); color: var(--ember-ink); }
.btn.primary:hover { background: var(--ember-hi); border-color: var(--ember-hi); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--raised); color: var(--text); }
.btn.danger { color: var(--rose); }
.btn.danger:hover { background: var(--rose-soft); border-color: rgba(242, 85, 93, .4); }
.btn.solid-danger { background: var(--rose); border-color: var(--rose); color: #1d0607; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 15px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.busy { pointer-events: none; }
.btn.busy .ic { animation: spin .8s linear infinite; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- formulaires ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.input:disabled { opacity: .45; cursor: not-allowed; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .textarea, .select {
    width: 100%; min-height: 40px; padding: 9px 12px;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
    color: var(--text); transition: border-color .15s ease, background .15s ease;
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.5; font-size: 14px; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .textarea:hover, .select:hover { border-color: #3c4250; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--ember); background: var(--raised); }
.input[aria-invalid="true"] { border-color: var(--rose); }
.hint { font-size: 13px; color: var(--text-3); }
.form-error { min-height: 20px; font-size: 13px; color: var(--rose); }
.form-error:empty { display: none; }
.pw { position: relative; }
.pw .input { padding-right: 44px; }
.pw .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--ember); }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }

/* ---------- contrôle segmenté ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg a {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
    border: 0; border-radius: 6px; background: transparent; color: var(--text-2);
    font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"], .seg a[aria-current="page"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
nav.seg { display: flex; width: max-content; max-width: 100%; }
.seg .count { color: var(--text-3); font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] .count { color: var(--text-2); }

/* ---------- état d'un compte ---------- */
.state { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.state .dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.state .sub { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.state.room { color: var(--ember); }
.state.room .dot { background: var(--ember); }
.state.room .dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--ember); opacity: 0; animation: breathe 2.4s ease-out infinite; }
.state.search { color: var(--sky); }
.state.search .dot { background: var(--sky); }
.state.wait { color: var(--amber); }
.state.wait .dot { background: var(--amber); }
.state.online { color: var(--text); }
.state.online .dot { background: var(--mint); }
.state.off { color: var(--text-2); }
.state.err { color: var(--rose); }
.state.err .dot { background: var(--rose); }
.state.done { color: var(--mint); }
.state.done .dot { background: var(--mint); }
@keyframes breathe { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }

/* ---------- barre de progression (EXP) ---------- */
.bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--text-2); border-radius: inherit; transition: width .4s ease; }

/* ---------- structure ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top); background: rgba(12, 13, 16, .86); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { height: 100%; display: flex; align-items: center; gap: 20px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { height: 32px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 600; }
.nav a:hover { color: var(--text); background: var(--raised); }
.nav a[aria-current="page"] { color: var(--text); background: var(--raised); }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .name { font-size: 14px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-letter { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line-2); font-size: 13px; font-weight: 700; color: var(--text-2); flex: none; }
main.wrap { padding-top: 36px; padding-bottom: 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; font-size: 14px; color: var(--text-2); }
.page-head .facts b { color: var(--text); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.banner .ic { margin-top: 2px; color: var(--text-3); }
.banner.warn { border-color: rgba(242, 183, 64, .35); background: var(--amber-soft); color: #f6d48d; }
.banner.warn .ic { color: var(--amber); }
.banner.danger { border-color: rgba(242, 85, 93, .35); background: var(--rose-soft); color: #f7a6aa; }
.banner.danger .ic { color: var(--rose); }

/* ---------- liste des comptes ---------- */
.list { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.list-head, .acc {
    display: grid; align-items: center; gap: 16px;
    grid-template-columns: minmax(0, 1.6fr) minmax(170px, 1fr) minmax(150px, 1fr) 88px 124px;
    padding: 0 16px;
}
.list-head { height: 38px; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); }
.list-head .r { text-align: right; }
.acc { min-height: 64px; border-top: 1px solid var(--line); transition: background .15s ease; }
.list-head + .acc { border-top: 0; }
.acc:hover { background: #15171d; }
.acc .who-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acc .pic { width: 36px; height: 36px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); object-fit: cover; flex: none; }
.acc .pic.letter { display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--text-3); }
.acc .names { min-width: 0; }
.acc .nick { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc .uid { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.acc .lv { display: grid; gap: 6px; }
.acc .lv-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.acc .lv-top b { font-weight: 700; }
.acc .lv-top span { color: var(--text-3); font-variant-numeric: tabular-nums; }
.acc .today { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
.acc .today small { display: block; font-size: 12px; color: var(--text-3); }
.acc .actions { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.acc .actions .btn.sm:not(.icon) { min-width: 76px; }
/* « เจอห้องแล้ว เข้าเกมได้เลย » : fenêtre et bandeau du moment où le client doit se connecter */
.go-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md);
    background: rgba(255, 122, 47, .1); border: 1px solid rgba(255, 122, 47, .45); color: var(--text); }
.go-box .ic { flex: none; margin-top: 2px; color: var(--ember); }
.go-box b { font-size: 16px; }
.go-box p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.banner.go { border-color: rgba(255, 122, 47, .45); background: rgba(255, 122, 47, .1); color: var(--text); }
.banner.go .ic { color: var(--ember); }
.acc .note { grid-column: 1 / -1; margin: -6px 0 12px 48px; font-size: 13px; color: var(--rose); }
.acc .note.info { color: var(--text-3); }
.empty { padding: 56px 24px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.empty h2 { font-size: 17px; }
.empty p { color: var(--text-2); max-width: 420px; }
.skeleton { height: 64px; border-top: 1px solid var(--line); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .03), transparent) 0 0 / 200% 100% var(--surface); animation: shimmer 1.4s ease infinite; }
.skeleton:first-child { border-top: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- tableau (administration) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { height: 38px; padding: 0 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table tbody tr:hover td { background: #15171d; }
.table .r { text-align: right; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--raised); color: var(--text-2); border: 1px solid var(--line-2); white-space: nowrap; }
.tag.ok { background: var(--mint-soft); color: var(--mint); border-color: transparent; }
.tag.warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.bad { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.tag.hot { background: var(--ember-soft); color: var(--ember); border-color: transparent; }

/* ---------- vue d'ensemble (administration) ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 24px; }
.stat { padding: 18px 20px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat .k { font-size: 13px; color: var(--text-2); }
.stat .v { font-size: 26px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat .v.hot { color: var(--ember); }
.section { margin-top: 28px; }
.section > h2 { margin-bottom: 12px; }
.panel { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.panel-pad { padding: 20px; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.events li:first-child { border-top: 0; }
.events time { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 13px; }
.events .lv-error { color: var(--rose); }
.events .lv-warning { color: var(--amber); }
.events .lv-success { color: var(--mint); }
.settings { display: grid; gap: 0; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; padding: 20px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.setting .what p { font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ---------- connexion ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); }
.auth-stage { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; border-right: 1px solid var(--line); background: radial-gradient(120% 80% at 0% 100%, rgba(255, 122, 47, .07), transparent 60%), var(--bg); overflow: hidden; }
.auth-stage h1 { font-size: 34px; line-height: 1.25; font-weight: 800; letter-spacing: -.015em; max-width: 520px; }
.auth-stage .lead { margin-top: 14px; color: var(--text-2); max-width: 460px; font-size: 16px; }
.ticket { width: 100%; max-width: 420px; margin: 40px 0; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); }
.ticket-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--line); }
.ticket-row:first-child { border-top: 0; }
.ticket-row .pic { width: 40px; height: 40px; border-radius: 9px; background: var(--raised); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 800; color: var(--text-3); flex: none; }
.ticket-row .names { flex: 1; min-width: 0; }
.ticket-row .nick { font-weight: 700; font-size: 14px; }
.ticket-row .uid { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.auth-stage .foot { font-size: 13px; color: var(--text-3); }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.auth-card { width: 100%; max-width: 360px; display: grid; gap: 24px; }
.auth-card .brand-row { display: none; }
.auth-card h2 { font-size: 22px; }
.auth-card .sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }

/* ---------- fenêtres ---------- */
dialog.dlg {
    width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
    border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}
dialog.dlg.wide { width: min(640px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(4, 5, 7, .72); }
dialog.dlg[open] { animation: rise .18s ease-out; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.dlg-body { padding: 16px 20px 20px; display: grid; gap: 16px; overflow-y: auto; max-height: calc(100vh - 180px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.result { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); border: 1px solid var(--line); font-size: 14px; }
.result ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.copybox { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--raised); border: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.copybox code { flex: 1; font-family: inherit; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; white-space: pre-line; line-height: 1.7; }
.panel-pad h3 { margin-bottom: 4px; }

/* ---------- messages ---------- */
.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); font-size: 14px; animation: rise .18s ease-out; }
.toast .ic { margin-top: 2px; color: var(--mint); }
.toast.err .ic { color: var(--rose); }
.offline { position: fixed; z-index: 50; left: 50%; top: calc(var(--top) + 10px); transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: var(--amber-soft); border: 1px solid rgba(242, 183, 64, .35); color: #f6d48d; font-size: 13px; font-weight: 600; }

/* ---------- petits écrans ---------- */
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-stage { display: none; }
    .auth-card .brand-row { display: flex; }
    .list-head { display: none; }
    .acc { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who actions" "state state" "lv lv"; gap: 10px 12px; padding: 14px 16px; }
    .acc .who-cell { grid-area: who; }
    .acc .actions { grid-area: actions; }
    .acc .state-cell { grid-area: state; }
    .acc .lv { grid-area: lv; }
    .acc .today { display: none; }
    .acc .note { grid-column: 1 / -1; margin: 0; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat:nth-child(3) { border-left: 0; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
    .setting { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 640px) {
    :root { --gutter: 16px; }
    main.wrap { padding-top: 22px; padding-bottom: 48px; }
    h1 { font-size: 21px; }
    .who .name, .nav-label { display: none; }
    .topbar .wrap { gap: 12px; }
    .nav { margin-left: 0; }
    .nav a { padding: 0 10px; }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar .seg { width: 100%; }
    .toolbar .row-gap { width: 100%; }
    .toolbar .row-gap .btn.primary { flex: 1; }
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: 12px 16px; border-top: 1px solid var(--line); }
    .table tbody tr:first-child { border-top: 0; }
    .table td { border: 0; padding: 3px 0; }
    .table td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 104px; color: var(--text-3); font-size: 13px; }
    .table .r { text-align: left; }
    .toasts { right: 12px; left: 12px; bottom: 12px; width: auto; }
    .events li { grid-template-columns: 52px 1fr; padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .state.room .dot::after { display: none; }
}

/* ---------- connexion / inscription ---------- */
.auth-tabs { display: flex; width: 100%; }
.auth-tabs button { flex: 1; justify-content: center; height: 34px; font-size: 14px; }
/* bouton « voir » natif d'Edge : en double avec le nôtre (et seul sur « ยืนยันรหัสผ่าน ») */
input::-ms-reveal, input::-ms-clear { display: none; }

/* ---------- แพ็กเกจ (membre) : forfait, achat, paiement ---------- */
.banner > .btn { margin-left: auto; flex: none; align-self: center; }
.plan-card { padding: 20px; display: grid; gap: 16px; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.plan-head h2 { font-size: 20px; margin-top: 2px; }
.plan-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.plan-facts div { padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); border: 1px solid var(--line); min-width: 0; }
.plan-facts dt { font-size: 12px; color: var(--text-3); }
.plan-facts dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.buy { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.buy-sum { padding: 20px; display: grid; gap: 14px; position: sticky; top: calc(var(--top) + 16px); }
.pkgs { display: grid; gap: 10px; }
.pkg { position: relative; display: block; cursor: pointer; }
.pkg input { position: absolute; opacity: 0; pointer-events: none; }
.pkg-body { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--raised); transition: border-color .15s, background-color .15s; }
.pkg:hover .pkg-body { border-color: #3c4250; }
.pkg input:checked + .pkg-body { border-color: var(--ember); background-color: #21170f; }
.pkg input:focus-visible + .pkg-body { outline: 2px solid var(--ember); outline-offset: 2px; }
.pkg.off { cursor: not-allowed; opacity: .55; }
.pkg-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pkg-top b { font-size: 15px; }
.pkg-price { font-size: 14px; color: var(--text-2); }
.pkg-price b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.pkg-desc { font-size: 13px; color: var(--text-2); white-space: pre-line; }
.stepper { display: flex; gap: 6px; }
.stepper .input { text-align: center; min-width: 0; }
.stepper .btn { flex: none; }
.stepper-val { display: flex; align-items: center; justify-content: center; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: default; }
.stepper-val:hover { border-color: var(--line-2); }
.renew-what { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--raised); border: 1px solid var(--line-2); }
.renew-what .ic { margin-top: 3px; color: var(--ember); }
.sum { display: grid; gap: 8px; font-size: 14px; transition: opacity .15s; }
.sum.stale { opacity: .5; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; }
.sum-row span { color: var(--text-3); flex: none; }
.sum-row b { text-align: right; font-weight: 600; }
.sum-row.total { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); align-items: baseline; }
.sum-row.total span { color: var(--text-2); font-weight: 600; }
.sum-row.total b { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.methods { display: grid; gap: 8px; }
.method { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px 14px; text-align: left; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--raised); cursor: pointer; }
.method:hover { border-color: #3c4250; }
.method[aria-checked="true"] { border-color: var(--ember); background-color: #21170f; }
.method .ic { margin-top: 2px; color: var(--text-2); }
.method[aria-checked="true"] .ic { color: var(--ember); }
.method b { display: block; font-size: 14px; }
.method small { display: block; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.pay-manual { display: grid; gap: 12px; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--raised); }
.copy-row > div { min-width: 0; }
.copy-row small { display: block; font-size: 12px; color: var(--text-3); }
.copy-row b { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.copy-row.big b { font-size: 22px; font-weight: 800; }
.bank-box { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.bank-box .copy-row { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.bank-box .copy-row:first-child { border-top: 0; }
.slip { display: grid; justify-items: center; gap: 4px; padding: 18px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); text-align: center; cursor: pointer; background: var(--surface); }
.slip:hover { border-color: var(--text-3); }
.slip:focus-within { outline: 2px solid var(--ember); outline-offset: 2px; }
.slip .ic { width: 22px; height: 22px; color: var(--text-2); }
.slip img { max-height: 220px; max-width: 100%; border-radius: 6px; }
.slip-change { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.slip-full { display: block; max-width: 100%; max-height: 62vh; margin: 0 auto; border-radius: 8px; }
.agent-card { display: flex; gap: 14px; align-items: center; padding: 16px 20px; }
.agent-card > .ic { color: var(--text-2); }
.agent-card > div { flex: 1; min-width: 0; }
.agent-card .btn { flex: none; }
/* commande à payer */
.pay-card { padding: 20px; display: grid; gap: 14px; border-color: rgba(242, 183, 64, .35); }
.pay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pay-head p { margin-top: 2px; }
.pay-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.pay-grid > :only-child { grid-column: 1 / -1; }
.pay-info { display: grid; gap: 10px; }
.qr { margin: 0; display: grid; gap: 8px; justify-items: center; width: 216px; }
.qr img { width: 200px; height: 200px; padding: 8px; background: #fff; border-radius: 10px; }
.qr figcaption { font-size: 12px; color: var(--text-3); text-align: center; }
.pay-wait { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--amber); }
.pay-wait .spin { width: 14px; height: 14px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
/* หลังบ้าน : commandes */
.slip-thumb { display: block; padding: 0; width: 44px; height: 56px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raised); cursor: zoom-in; overflow: hidden; }
.slip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.warn-text { color: var(--amber); }
.seg .count[data-pending-count] { color: var(--amber); }
.seg .count:empty { display: none; }
@media (max-width: 900px) {
    .buy { grid-template-columns: 1fr; }
    .buy-sum { position: static; }
}
@media (max-width: 640px) {
    .plan-facts { grid-template-columns: 1fr 1fr; }
    .pay-grid { grid-template-columns: 1fr; justify-items: center; }
    .pay-info { width: 100%; }
    .agent-card { flex-wrap: wrap; }
    .agent-card .btn { width: 100%; }
}

/* ---------- โปรไฟล์ (membre) : compte + forfait côte à côte, historique dessous ---------- */
.who-link { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; border-radius: var(--r-sm); padding: 2px 6px 2px 2px; }
.who-link:hover { background: var(--raised); }
.who-link:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.prof-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.prof-me { display: grid; gap: 16px; align-content: start; }
.hist-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hist-head h2 { margin: 0; }
.num .pos { color: var(--mint); }
.num .neg { color: var(--rose); }
@media (max-width: 900px) {
    .prof-grid { grid-template-columns: 1fr; }
}
