/* Auction Key look, light theme: one amber, slate ink, blocks with a hard 2px edge and a hard
   shadow to the bottom right, corners 4px or less. Shadows stay bottom-right in Arabic too. */
:root {
  --surface: #ffffff; --ground: #f8fafc; --ink: #0f172b; --muted: #45556c; --subtle: #62748e; --line: #e2e8f0;
  --amber: #ffb900; --amber-hover: #ffd230; --accent: #bb4d00; --soft: #fef3c6;
  --ok: #007a55; --ok-soft: #d0fae5; --warn: #ca3500; --warn-soft: #ffedd4; --bad: #ec003f; --bad-ink: #c70036; --bad-soft: #ffe4e6;
  --edge: 2px solid var(--ink);
  --shadow-s: 2px 2px 0 0 var(--ink); --shadow-m: 3px 3px 0 0 var(--ink); --shadow-l: 4px 4px 0 0 var(--ink);
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif; color: var(--ink);
  background-color: var(--ground);
  background-image:
    repeating-linear-gradient(63.435deg, rgba(15, 23, 43, .04) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(116.565deg, rgba(15, 23, 43, .04) 0 1px, transparent 1px 28px);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
h1, h2, p { margin: 0; }
h2 { font-size: 19px; letter-spacing: -.02em; line-height: 1.2; }
::selection { background: #fee685; }

#app, .screen { min-height: 100%; }
.screen { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; min-height: 100dvh; position: relative; }
main { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); animation: in .28s var(--ease); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.grow { flex: 1; }

.bar { position: sticky; top: 0; z-index: 500; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 48px;
  padding-top: env(safe-area-inset-top); background: var(--surface); border-bottom: var(--edge); }
.bar h1 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-back { height: 44px; display: grid; place-items: center; color: var(--ink); }
/* Back points toward where the previous screen came from: left in English, right in Arabic.
   It is an icon, not a "‹" character, because browsers already mirror that character in Arabic. */
[dir="rtl"] .bar-back svg { transform: scaleX(-1); }

.card { background: var(--surface); border: var(--edge); border-radius: 2px; box-shadow: var(--shadow-m); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.card.soft { background: var(--soft); }
.card.warn { background: var(--warn-soft); }
.label { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12.5px; text-align: center; }
.bad-text { color: var(--bad-ink); }
.num { font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; }
.big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; display: inline-block; }
.big small { font-size: 13px; font-weight: 500; color: var(--muted); margin-inline-start: 6px; letter-spacing: 0; }
.center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.pad { padding: 10px; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row.total { border-top: var(--edge); margin-top: 4px; padding-top: 8px; font-weight: 700; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 14px; font-weight: 700; font-size: 15px; text-align: center;
  background: var(--surface); border: var(--edge); border-radius: 2px; box-shadow: var(--shadow-m); transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .12s; }
.btn.primary { background: var(--amber); }
.btn.primary:hover { background: var(--amber-hover); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.hero { flex-direction: column; gap: 6px; padding: 22px 14px; font-size: 17px; box-shadow: var(--shadow-l); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; box-shadow: var(--shadow-s); flex: none; }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn:disabled { background: var(--line); color: var(--subtle); box-shadow: none; cursor: default; transform: none; }
.btn:focus-visible, .link:focus-visible, .chip:focus-visible, .field:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.link { color: var(--accent); font-weight: 600; font-size: 13.5px; text-align: center; padding: 6px; align-self: center; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; flex: none;
  background: #f1f5f9; border: var(--edge); border-radius: 1px; box-shadow: var(--shadow-s); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.busy { background: var(--warn-soft); color: var(--warn); }
.pill.live { background: var(--soft); color: var(--accent); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dot.pulse, .live-dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* The mono face has no Arabic letters, and its fallback spaces them badly. In Arabic, figures
   use the text face with fixed-width digits instead. */
[dir="rtl"] .num, [dir="rtl"] .stat b, [dir="rtl"] .seg button { font-family: inherit; font-variant-numeric: tabular-nums; }
[dir="rtl"] .num { font-size: 14px; font-weight: 600; }

/* Home */
.active { flex-direction: row; align-items: center; gap: 10px; width: 100%; }
.active b { flex: 1; }
.live-dot { width: 10px; height: 10px; background: var(--accent); border: var(--edge); }
.item { display: block; width: 100%; padding: 8px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.empty { padding: 6px 0 2px; font-size: 13.5px; }

/* Sheets */
.scrim { position: fixed; inset: 0; z-index: 900; background: rgba(15, 23, 43, .5); animation: fade .2s; }
.sheet { position: fixed; z-index: 901; left: 50%; bottom: 0; width: 100%; max-width: 480px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 12px;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); border: var(--edge); border-bottom: 0; animation: up .28s var(--ease); }
.grab { width: 40px; height: 4px; background: var(--ink); align-self: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translate(-50%, 100%); } }

/* Top up */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip { padding: 12px 0; text-align: center; font: 500 15px var(--mono); background: var(--surface); border: var(--edge); border-radius: 2px; box-shadow: var(--shadow-s); transition: transform .12s var(--ease), box-shadow .12s, background .12s; }
.chip.on { background: var(--amber); box-shadow: none; transform: translate(2px, 2px); }
.field { width: 100%; padding: 12px; background: var(--surface); border: var(--edge); border-radius: 3px; font-family: var(--mono); font-size: 15px; }
.field::placeholder { font-family: system-ui, sans-serif; color: var(--subtle); }

/* Charger */
.seg { display: flex; background: var(--surface); border: var(--edge); border-radius: 2px; }
.seg button { flex: 1; padding: 9px 0; text-align: center; font: 500 13px var(--mono); color: var(--muted); border-inline-start: var(--edge); transition: background .12s; }
.seg button:first-child { border-inline-start: 0; }
.seg button.on { background: var(--amber); color: var(--ink); font-weight: 700; }

/* Session */
.state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 28px 8px; }
.mark { width: 60px; height: 60px; display: grid; place-items: center; font-size: 30px; font-weight: 700; background: var(--amber); border: var(--edge); border-radius: 2px; box-shadow: var(--shadow-m); margin-bottom: 6px; }
.mark.wait { background: var(--soft); color: var(--accent); }
.mark.bad { background: var(--bad-soft); color: var(--bad-ink); }
.spinner { width: 20px; height: 20px; display: inline-block; border: 3px solid var(--ink); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { gap: 12px; }
.steps div { display: flex; align-items: center; gap: 12px; }
.steps i { width: 26px; height: 26px; flex: none; display: grid; place-items: center; font: 600 12px var(--mono); font-style: normal; color: var(--subtle); border: 2px solid var(--line); border-radius: 1px; }
.steps .done i { background: var(--amber); border-color: var(--ink); color: var(--ink); }
.steps .now i { background: var(--soft); border-color: var(--ink); }
.steps .now b { color: var(--accent); }
.steps .spinner { width: 12px; height: 12px; border-width: 2px; border-color: var(--accent); border-top-color: transparent; }
.ring { position: relative; width: 190px; height: 190px; align-self: center; margin: 6px 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { transition: stroke-dasharray .8s var(--ease); }
.ring-in { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-in b { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; direction: ltr; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; background: var(--surface); border: var(--edge); border-radius: 2px; box-shadow: var(--shadow-s); }
.stat b { font: 600 16px var(--mono); }
.receipt-head { padding: 10px 0 6px; }

/* Stations */
.map { height: 240px; border: var(--edge); box-shadow: var(--shadow-m); background: var(--line); z-index: 0; }
.pin { width: 34px; height: 34px; display: grid; place-items: center; font: 700 14px var(--mono); color: var(--ink); background: var(--amber); border: var(--edge); box-shadow: var(--shadow-m); }
.pin.off { background: #cad5e2; }
.station { padding: 0; gap: 0; }
.station-head { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 12px 14px; }
.charger { display: flex; flex-direction: column; gap: 8px; margin: 0 14px; padding: 10px 0; border-top: 1px solid var(--ink); }
.directions { margin: 4px 14px 14px; align-self: flex-start; }
.leaflet-container { font: inherit; }

.toast { position: fixed; z-index: 1000; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: calc(100% - 32px); max-width: 448px; padding: 12px 14px;
  font-size: 13.5px; font-weight: 600; color: #fff; background: var(--ink); border: 2px solid var(--amber); animation: fade .2s; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* The shareable demo */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 16px; font-size: 12.5px; font-weight: 600; color: #fff; background: var(--ink); }
.demo-bar button { flex: none; padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--amber); border: 2px solid var(--amber); border-radius: 1px; }
.demo-bar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.demo-pick { justify-content: flex-start; text-align: start; font-size: 14px; padding: 11px 14px; }
.map.still { position: relative; overflow: hidden; }
.map.still img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map.still .pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); }
.map.still .credit { position: absolute; right: 0; bottom: 0; padding: 1px 6px; font-size: 10.5px; background: rgba(255, 255, 255, .8); direction: ltr; }
