/* ─── MARSX Sim — kiosk / charger touchscreen theme ───────────────── */
:root {
    --kbg: #07101e;
    --kbg-2: #0d1a2d;
    --kpanel: #122238;
    --kline: #1f3658;
    --ktext: #ffffff;
    --kmuted: #9fb1c8;
    --korange: #ff8c00;
    --kgreen: #20c997;
    --kred: #ff5252;
    --kyellow: #ffd166;
}

.kiosk-shell {
    min-height: 100vh;
    background: radial-gradient(ellipse at top, var(--kbg-2), var(--kbg) 70%);
    color: var(--ktext);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", Roboto, sans-serif;
}

.kiosk {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 32px 40px;
    transition: background 0.2s;
}

.kiosk-state-faulted   { background: linear-gradient(180deg, rgba(255, 82, 82, 0.18), transparent 40%); }
.kiosk-state-charging  { background: linear-gradient(180deg, rgba(32, 201, 151, 0.12), transparent 40%); }
.kiosk-state-offline   { background: linear-gradient(180deg, rgba(255, 82, 82, 0.18), transparent 40%); }

/* ─── Brand block ──────────────────────────────────────────────────── */
.kiosk-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--kline);
    padding-bottom: 18px;
}
.brand-left .brand-mark {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--korange);
    letter-spacing: 2px;
}
.brand-left .brand-tag {
    display: block;
    color: var(--kmuted);
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.brand-right { text-align: right; }
.kiosk-id { display: block; font-size: 1.25rem; font-weight: 600; }
.kiosk-vendor { display: block; color: var(--kmuted); font-size: 0.85rem; }

/* ─── EVSE picker ──────────────────────────────────────────────────── */
.kiosk-evse-picker {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-top: 16px;
    color: var(--kmuted);
}
.evse-picker-label { font-weight: 600; margin-right: 2px; }
.evse-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--kpanel);
    color: var(--ktext);
    border: 1px solid var(--kline);
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.evse-chip-name { font-weight: 600; }
.evse-chip-state { font-size: .82em; opacity: .9; }
/* Status dot — colour set per chip-* variant below */
.evse-chip-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #9ca3af; flex: 0 0 auto;
}
/* Selected head: orange ring (keeps its status colour on the dot). */
.evse-chip.on {
    border-color: var(--korange);
    box-shadow: 0 0 0 2px var(--korange) inset;
    font-weight: 700;
}

/* ── Per-head live status variants ─────────────────────────────────── */
.evse-chip.chip-free     .evse-chip-dot { background: #22c55e; }                 /* ว่าง */
.evse-chip.chip-free     .evse-chip-state { color: #22c55e; }
.evse-chip.chip-plugged  .evse-chip-dot { background: #f59e0b; }                 /* เสียบสายแล้ว */
.evse-chip.chip-plugged  .evse-chip-state { color: #f59e0b; }
.evse-chip.chip-charging .evse-chip-dot { background: #0ea5e9; animation: chipPulse 1.1s infinite; } /* กำลังชาร์จ */
.evse-chip.chip-charging .evse-chip-state { color: #0ea5e9; }
.evse-chip.chip-paused   .evse-chip-dot { background: #eab308; }                 /* พักชั่วคราว */
.evse-chip.chip-paused   .evse-chip-state { color: #a16207; }
.evse-chip.chip-reserved .evse-chip-dot { background: #eab308; }                 /* จองแล้ว */
.evse-chip.chip-reserved .evse-chip-state { color: #a16207; }
.evse-chip.chip-fault    .evse-chip-dot { background: #ef4444; }                 /* ขัดข้อง */
.evse-chip.chip-fault    .evse-chip-state { color: #ef4444; }
.evse-chip.chip-unavail  .evse-chip-dot { background: #6b7280; }                 /* ปิดใช้งาน */
.evse-chip.chip-unavail  .evse-chip-state { color: #6b7280; }

@keyframes chipPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(14,165,233,.5); }
    50%      { box-shadow: 0 0 0 5px rgba(14,165,233,0); }
}

/* ─── Main display ─────────────────────────────────────────────────── */
.kiosk-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}
.screen {
    width: 100%;
    text-align: center;
    animation: fade 0.2s ease-out;
}
@keyframes fade { from { opacity: 0.4; } to { opacity: 1; } }

.huge-icon { font-size: 6rem; line-height: 1; margin-bottom: 16px; }
.huge {
    font-size: 4rem;
    font-weight: 800;
    margin: 8px 0;
    letter-spacing: 1px;
}
.sub { font-size: 1.4rem; color: var(--kmuted); }
.meta { font-size: 1rem; color: var(--kmuted); margin-top: 12px; }

/* ─── Available / waiting / authorizing ────────────────────────────── */
.screen.available .huge { color: var(--kyellow); }
.screen.waiting  .huge { color: var(--korange); }

.spinner {
    width: 64px; height: 64px;
    margin: 0 auto 20px;
    border: 6px solid var(--kline);
    border-top-color: var(--korange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Charging — big stats ─────────────────────────────────────────── */
.big-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    max-width: 980px;
    margin: 0 auto 24px;
}
.stat-card {
    background: var(--kpanel);
    border: 1px solid var(--kline);
    border-radius: 16px;
    padding: 28px 18px;
}
.stat-card.highlight {
    background: linear-gradient(180deg, rgba(32, 201, 151, 0.15), var(--kpanel));
    border-color: var(--kgreen);
}
.stat-value {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--kyellow);
}
.stat-card.highlight .stat-value { color: var(--kgreen); }
.stat-label {
    color: var(--kmuted);
    margin-top: 12px;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.bolt {
    color: var(--korange);
    margin-right: 6px;
    animation: pulse 1.2s infinite;
    display: inline-block;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.92); }
}
.charging-meta {
    color: var(--kmuted);
    display: flex;
    gap: 12px;
    justify-content: center;
    font-size: 1rem;
    margin-top: 8px;
}
.progress-bar {
    width: 80%;
    max-width: 720px;
    margin: 18px auto;
    height: 10px;
    background: var(--kpanel);
    border-radius: 999px;
    border: 1px solid var(--kline);
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--korange), var(--kyellow));
    transition: width 0.5s ease;
}

.kiosk-stop {
    background: var(--kred);
    color: white;
    border: none;
    padding: 18px 48px;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    margin-top: 18px;
    box-shadow: 0 6px 20px rgba(255, 82, 82, 0.35);
}
.kiosk-stop:hover { background: #ff7676; }

/* ─── Faulted / offline ───────────────────────────────────────────── */
.screen.faulted .huge,
.offline-banner { color: var(--kred); }
.offline-banner {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
    border: 2px solid var(--kred);
    padding: 14px 22px;
    border-radius: 10px;
    display: inline-block;
    background: rgba(255, 82, 82, 0.08);
}

/* ─── Receipt / ended ─────────────────────────────────────────────── */
.screen.ended .huge { color: var(--kgreen); }
.receipt {
    background: var(--kpanel);
    border: 1px solid var(--kline);
    border-radius: 12px;
    padding: 16px 22px;
    display: inline-block;
    color: var(--kyellow);
    font-size: 1.4rem;
    font-weight: 600;
}

/* ─── Sim debug bar ───────────────────────────────────────────────── */
.kiosk-sim-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border-top: 1px dashed var(--kline);
    padding-top: 16px;
    margin-top: 24px;
    color: var(--kmuted);
    font-size: 0.85rem;
}
.sim-tag {
    background: var(--kred);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-right: 4px;
}
.sim-btn {
    background: var(--kpanel);
    color: var(--ktext);
    border: 1px solid var(--kline);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
}
.sim-btn:hover { background: #1a2c47; }
/* Primary sim action (plug/unplug cable) — bigger, friendlier so it
   reads as the one-and-only thing the SIM user is meant to interact
   with. Sized for fingers on a touchscreen kiosk test rig. */
.sim-btn.primary {
    background: #1E40AF;
    border-color: #1E40AF;
    color: #fff;
    padding: 12px 32px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 10px;
}
.sim-btn.primary:hover { background: #1D4ED8; }
.sim-btn.primary:active { transform: scale(0.97); }
/* Car ignition controls — simulate the EV side. "สตาร์ทรถ" = EV requests
   charge (green); "ดับรถ" = EV cuts off mid-charge (red) → a correct system
   must END the session immediately. Sized like .primary for the touch rig. */
.sim-btn.car,
.sim-btn.danger {
    padding: 12px 28px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 10px;
    color: #fff;
}
.sim-btn.car      { background: #15803D; border-color: #15803D; }
.sim-btn.car:hover { background: #16A34A; }
.sim-btn.danger      { background: #B91C1C; border-color: #B91C1C; }
.sim-btn.danger:hover { background: #DC2626; }
.sim-btn.car:active,
.sim-btn.danger:active { transform: scale(0.97); }
.sim-input {
    background: var(--kpanel);
    color: var(--ktext);
    border: 1px solid var(--kline);
    padding: 6px 10px;
    border-radius: 6px;
    font: inherit;
    min-width: 160px;
}

.kiosk-offline {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--kmuted);
}
.kiosk-link {
    margin-top: 16px;
    color: var(--korange);
}

/* ─── Operator command banners ─────────────────────────────────────── */
.kiosk-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 8px 16px;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 500;
}
.kiosk-banner .banner-tag { font-size: 1.4rem; }
.kiosk-banner .banner-text { flex: 1; }
.kiosk-banner-display {
    background: #fff7d6;
    color: #6b4f00;
    border: 1px solid #f0c200;
}
.kiosk-banner-reserved {
    background: #fff2c5;
    color: #6e4900;
    border: 1px solid #e0a000;
}
.charging-cap {
    margin-top: 6px;
    color: #b56a00;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ─── Pay-to-charge + receipt QR cards (sim kiosk) ─────────────────── */
.available-grid,
.ended-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 32px;
    align-items: center;
    width: 100%;
    max-width: 1100px;
}
.available-left,
.ended-left {
    text-align: center;
}
.qr-card {
    background: #fff;
    border-radius: 18px;
    padding: 22px 22px 18px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.10);
    border: 1px solid #e5e7eb;
    text-align: center;
}
.qr-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
}
.qr-frame {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 8px;
}
.qr-frame svg {
    width: 240px;
    height: 240px;
}
.qr-sub {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #64748b;
}
.qr-url {
    margin-top: 6px;
    font-size: 0.7rem;
    color: #94a3b8;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.rate-chip {
    display: inline-block;
    margin-top: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #ecfeff;
    color: #0e7490;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid #a5f3fc;
}

@media (max-width: 900px) {
    .available-grid,
    .ended-grid {
        grid-template-columns: 1fr;
    }
    .qr-frame svg { width: 200px; height: 200px; }
}

/* ─── Real-charger style Charging screen ───────────────────────────── */
.screen.charging.fastcharger {
    padding: 18px 28px;
    gap: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 1100px;
}

/* Vehicle strip */
.vehicle-strip {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: linear-gradient(90deg, var(--car-color, #0EA5E9) 0%, transparent 0%, transparent 4px, #0F172A 4px, #0F172A 100%);
    color: #F8FAFC;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(15,23,42,0.15);
}
.vehicle-strip .vehicle-icon { font-size: 1.6rem; }
.vehicle-strip .vehicle-info { display: flex; flex-direction: column; gap: 2px; }
.vehicle-strip .vehicle-name { font-weight: 700; font-size: 1rem; }
.vehicle-strip .vehicle-plate {
    font-size: 0.78rem; opacity: 0.75;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.vehicle-strip .vehicle-eta {
    background: rgba(255,255,255,0.12);
    padding: 6px 12px; border-radius: 999px;
    font-size: 0.85rem; font-weight: 500;
}

/* Hero SoC battery */
.soc-hero {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 22px;
    align-items: center;
    padding: 18px 24px;
    background: #0F172A;
    border-radius: 14px;
    color: #F8FAFC;
}
.battery-shell {
    position: relative;
    width: 60px;
    height: 130px;
    border: 4px solid #94A3B8;
    border-radius: 8px;
    background: #1E293B;
    overflow: hidden;
    margin-left: 12px;
}
.battery-shell .battery-cap {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 6px;
    background: #94A3B8;
    border-radius: 2px;
}
.battery-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transition: height 0.5s ease, background 0.3s;
}
.soc-readout { display: flex; flex-direction: column; gap: 6px; }
.soc-readout .soc-num {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: #F8FAFC;
    letter-spacing: -0.02em;
}
.soc-readout .soc-num .pct {
    font-size: 2rem;
    font-weight: 600;
    color: #94A3B8;
    margin-left: 4px;
}
.soc-readout .soc-meta {
    color: #94A3B8;
    font-size: 0.95rem;
    display: flex;
    gap: 8px;
}

/* Three-stat row */
.charger-stats {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 12px;
}
.stat-tile {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 2px 6px rgba(15,23,42,0.04);
}
.stat-tile-head {
    font-size: 0.8rem;
    color: #64748B;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.stat-tile-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-tile-value .unit {
    font-size: 1rem;
    font-weight: 500;
    color: #64748B;
    margin-left: 4px;
}
.stat-tile-sub {
    margin-top: 6px;
    color: #64748B;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cap-chip {
    background: #FEF3C7;
    color: #92400E;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* Power tile gauge */
.power-tile { background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 100%); }
.power-bar {
    height: 8px;
    background: #F3F4F6;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
}
.power-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981 0%, #F59E0B 80%, #EF4444 100%);
    border-radius: 999px;
    transition: width 0.5s ease;
}
.bolt-anim {
    display: inline-block;
    color: #F59E0B;
    animation: boltPulse 1.2s ease-in-out infinite;
}
@keyframes boltPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(0.92); }
}

.cost-tile { background: linear-gradient(135deg, #ECFDF5 0%, #FFFFFF 100%); }
.cost-tile .stat-tile-value { color: #047857; }

/* Footer with time + stop */
.charger-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    margin-top: 4px;
}
.time-strip {
    background: #F1F5F9;
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    font-weight: 500;
}
.time-strip .time-icon { font-size: 1.2rem; }
.time-strip .time-label { color: #94A3B8; font-size: 0.85rem; }
.time-strip .time-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0F172A;
    margin-left: auto;
}
.screen.charging.fastcharger .kiosk-stop {
    margin: 0;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 700;
}

@media (max-width: 800px) {
    .charger-stats { grid-template-columns: 1fr; }
    .vehicle-strip { grid-template-columns: 1fr; text-align: center; }
    .charger-footer { grid-template-columns: 1fr; }
}

/* ─── Real-charger style "idle/welcome" + "arriving" screens ──────── */
.kiosk-idle {
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1100px;
    gap: 16px;
}

/* Top status bar */
.kiosk-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #0F172A;
    color: #F8FAFC;
    border-radius: 10px;
}
.kiosk-station-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.kiosk-status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 12px; border-radius: 999px;
    font-size: 0.78rem; font-weight: 700;
    background: rgba(255,255,255,0.08);
}
.kiosk-status-pill .dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.kiosk-status-pill .dot.big { width: 14px; height: 14px; }
.ready-pill   { color: #86EFAC; }
.ready-pill   .dot { background: #22C55E; box-shadow: 0 0 8px #22C55E; }
.waiting-pill { color: #FBBF24; }
.waiting-pill .dot { background: #F59E0B; }
.arriving-pill { color: var(--car-color, #67E8F9); }
.arriving-pill .dot { background: var(--car-color, #06B6D4); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(1.3); }
}
.dot.pulse { animation: pulse 1.4s ease-in-out infinite; }

/* Two-column idle hero + pay column */
.idle-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 18px;
    flex: 1;
}
/* Multi-EVSE: collapse to one column so QR grid below the hero gets full
   width — otherwise 4–8 QRs squeeze into a ~340px panel and shrink past
   the phone-camera scan threshold. Hero compresses to a thin horizontal
   strip on top; QR grid fills the rest. */
.idle-grid.multi-evse {
    grid-template-columns: 1fr;
    gap: 14px;
}
.idle-grid.multi-evse .idle-hero { padding: 16px 22px; }
.idle-grid.multi-evse .idle-bolt { font-size: 2rem; }
.idle-grid.multi-evse .idle-brand { font-size: 1.6rem; margin: 0; }
.idle-grid.multi-evse .idle-tag { margin-bottom: 8px; }
.idle-grid.multi-evse .idle-status-line { margin-bottom: 8px; }
.idle-grid.multi-evse .idle-spec-grid { display: none; }
.idle-grid.multi-evse .idle-pay { padding: 18px 26px; }
.idle-hero {
    background: linear-gradient(160deg, #0F172A 0%, #1E293B 100%);
    color: #F8FAFC;
    border-radius: 18px;
    padding: 28px 26px;
    display: flex; flex-direction: column;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(15,23,42,0.20);
}
.idle-bolt {
    font-size: 3.4rem;
    color: #FBBF24;
    line-height: 1;
    filter: drop-shadow(0 0 16px rgba(251,191,36,0.55));
    animation: boltPulse 2.2s ease-in-out infinite;
}
.idle-brand {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    margin: 4px 0 0;
}
.idle-accent { color: #FBBF24; }
.idle-tag {
    color: #94A3B8;
    font-weight: 500;
    letter-spacing: 0.16em;
    margin-bottom: 22px;
}
.idle-status-line {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 10px 18px;
    background: rgba(34,197,94,0.12);
    color: #86EFAC;
    border-radius: 999px;
    font-weight: 600;
    align-self: flex-start;
    margin-bottom: 22px;
}
.idle-spec-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 14px 8px;
}
.idle-spec { text-align: center; }
.idle-spec-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: #F8FAFC;
    line-height: 1;
}
.idle-spec-label {
    color: #94A3B8;
    font-size: 0.75rem;
    margin-top: 4px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Pay column (right) */
.idle-pay {
    background: #FFFFFF;
    border-radius: 18px;
    padding: 22px;
    display: flex; flex-direction: column;
    align-items: center;
    box-shadow: 0 6px 20px rgba(15,23,42,0.10);
}
.idle-pay-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 14px;
}
.idle-pay-step {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    color: #475569;
    font-size: 0.92rem;
    margin: 4px 0;
}
.step-num {
    width: 22px; height: 22px;
    background: #FBBF24; color: #422006;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 800;
    flex-shrink: 0;
}
/* Per-EVSE QR cards.
   Layout swapped from CSS grid auto-fit to flex-wrap because
   auto-fit + minmax(...,max-content) collapses cards onto the same
   column when the container is exactly slightly-too-narrow — the
   "QR ซ้อนกัน" bug. Flex with explicit basis + flex-wrap gives a
   predictable layout: 2-up on wide screens, 1-up below ~750px,
   never overlapping. */
.idle-pay-qr-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    /* Big visual gap so a phone camera focused on one QR can't frame
       a second one by accident. */
    gap: 48px 56px;
    margin: 18px 0;
    width: 100%;
}
.idle-pay-qr-grid.single { gap: 0; }

.idle-pay-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #FFFFFF;
    padding: 16px 16px 14px;
    border-radius: 16px;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    text-decoration: none;
    color: #0F172A;
    /* Fixed footprint — each card is exactly this wide so flex-wrap
       knows when to break to a new line. Without an explicit basis
       the children would stretch and overlap their siblings. */
    flex: 0 0 320px;
    max-width: 100%;
    box-sizing: border-box;
}
.idle-pay-qr:hover { transform: scale(1.02); box-shadow: 0 6px 16px rgba(15,23,42,0.10); }
.idle-pay-qr:active { transform: scale(0.99); }

/* SVG sizing matched to the card width minus padding (~288px). For
   the single-EVSE layout we let it go bigger because there's only
   one card and the panel has room. Both sizes are above the
   ZXing-recommended 3cm physical minimum on a typical kiosk
   display. */
.idle-pay-qr svg { width: 288px; height: 288px; display: block; }
.idle-pay-qr-grid.single .idle-pay-qr { flex-basis: 380px; }
.idle-pay-qr-grid.single .idle-pay-qr svg { width: 340px; height: 340px; }
.idle-pay-qr-label { font-size: 1.1rem; font-weight: 700; color: #1E40AF; text-align: center; }
.idle-pay-qr-sub   { font-size: 0.85rem; color: #64748B; }

/* Narrow screen fallback — under 768px the kiosk view stacks cards
   vertically so each QR keeps its scannable size. This handles
   developer previews on laptops + 9-inch tablet kiosks. */
@media (max-width: 768px) {
    .idle-pay-qr-grid { gap: 32px; }
    .idle-pay-qr { flex-basis: 280px; }
    .idle-pay-qr svg { width: 256px; height: 256px; }
}
.idle-pay-alt {
    margin-top: 8px;
    color: #64748B;
    font-size: 0.82rem;
}

/* Footer info strip */
.kiosk-footer-strip {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    color: #64748B;
    font-size: 0.78rem;
    padding: 6px 0;
    flex-wrap: wrap;
}

/* ─── Arriving (car detected) state ──────────────────────────────── */
.arriving {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    color: #F8FAFC;
    border-radius: 18px;
    overflow: hidden;
}
.arriving .kiosk-topbar { background: rgba(0,0,0,0.25); }
.arriving-hero {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 24px;
    text-align: center;
}
.arriving-icon {
    font-size: 5rem;
    line-height: 1;
    animation: arrivingFloat 2.4s ease-in-out infinite;
    filter: drop-shadow(0 0 24px var(--car-color, #06B6D4));
}
@keyframes arrivingFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
.arriving-headline {
    font-size: 2.4rem;
    font-weight: 800;
    margin: 14px 0 4px;
}
.arriving-model {
    font-size: 1.05rem;
    color: #CBD5E1;
    margin-bottom: 18px;
}
.arriving-status {
    background: rgba(255,255,255,0.10);
    color: var(--car-color, #67E8F9);
    border: 1px solid var(--car-color, #06B6D4);
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 18px;
}
.arriving-spinner-row {
    display: flex; align-items: center; gap: 12px;
    color: #CBD5E1;
}
.arriving-spinner-row .spinner.small {
    width: 22px; height: 22px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--car-color, #06B6D4);
}
.arriving .kiosk-footer-strip {
    background: rgba(0,0,0,0.2);
    color: #94A3B8;
    padding: 10px 0;
}

/* Waiting-auth screen — keep simple but match brand */
.waiting-hero {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 32px 16px;
    text-align: center;
    gap: 10px;
}
.waiting-vehicle {
    margin-top: 12px;
    padding: 8px 18px;
    background: #0F172A;
    color: #F8FAFC;
    border-radius: 999px;
    font-size: 0.92rem;
}
.waiting-qr {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 10px 12px 8px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}
.waiting-qr:hover { transform: scale(1.02); box-shadow: 0 6px 16px rgba(15,23,42,0.10); }
.waiting-qr:active { transform: scale(0.99); }
.waiting-qr svg { width: 140px; height: 140px; display: block; }
.waiting-qr-cap {
    color: #1E40AF;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

@media (max-width: 800px) {
    .idle-grid { grid-template-columns: 1fr; }
}
