/* ChargeOS web app: Mono brand, iPhone-first. */
:root {
  --black: #000; --ink: #0e0e11; --ink-2: #17171c; --ink-3: #202027;
  --line: rgba(255,255,255,.1); --line-2: rgba(255,255,255,.2);
  --white: #fff; --g2: #eaeaea; --g3: #dedede; --muted: #9a9aa3;
  --steel: #647b89; --steel-2: #476c84; --steel-hi: #8fb0c4; --err: #ff8a8a;
  /* honest pin tones, toned to sit on the dark map */
  --p-unchecked: #8d86c9; --p-working: #7ea6c2; --p-busy: #d9a05b; --p-down: #d4585c; --p-own: #6cc49a;
  --r: 4px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --tab-h: 58px;
  --head: "Michroma", "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Share Tech Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--black); color: var(--g2); overscroll-behavior: none; }
body { font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
input { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
#app { position: fixed; inset: 0; overflow: hidden; }

.view { position: absolute; inset: 0 0 calc(var(--tab-h) + var(--safe-b)) 0; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--safe-t) + 18px) calc(18px + var(--safe-r)) 32px calc(18px + var(--safe-l)); }
.view.scroll > * { max-width: 560px; margin-left: auto; margin-right: auto; }

/* ---------- Map ---------- */
#map { position: absolute; inset: 0; background: #0b0b0e; }
.maplibregl-ctrl-attrib { font: 400 10px var(--body) !important; background: rgba(0,0,0,.55) !important; color: #888 !important; }
.maplibregl-ctrl-attrib a { color: #aaa !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 0; }
.map-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 10px) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l)); display: flex; justify-content: space-between; align-items: center; pointer-events: none; z-index: 3; }
.map-top > * { pointer-events: auto; }
.brand-chip { height: 44px; display: flex; align-items: center; padding: 0 14px; background: rgba(0,0,0,.78); border: 1px solid var(--line); border-radius: var(--r); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.brand-chip img { height: 16px; width: auto; }
.map-actions { display: flex; gap: 8px; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: rgba(0,0,0,.78); border: 1px solid var(--line); border-radius: var(--r); color: var(--white); cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); padding: 0; }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn.active { border-color: var(--steel-hi); }
.badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--white); color: var(--black); font: 400 11px/18px var(--mono); text-align: center; }
.banner-stack { position: absolute; z-index: 2; left: 0; right: 0; top: calc(var(--safe-t) + 64px); display: grid; justify-items: center; gap: 8px; padding: 0 12px; pointer-events: none; }
.banner-stack > * { pointer-events: auto; }
.status-pill { font: 400 12px/1 var(--mono); letter-spacing: .06em; padding: 9px 12px; border-radius: 99px; background: rgba(0,0,0,.78); border: 1px solid var(--line); color: var(--g3); transition: opacity .4s; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 8px; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--steel-hi); }
.status-pill.err { color: var(--err); border-color: rgba(255,138,138,.35); }
.status-pill button { background: none; border: 0; color: var(--white); text-decoration: underline; padding: 0; font: inherit; cursor: pointer; }
.status-pill.fade { opacity: 0; pointer-events: none; }
.banner { width: 100%; max-width: 440px; display: flex; gap: 12px; align-items: center; padding: 12px 12px 12px 14px; background: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; font-size: 14px; color: var(--g3); box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.banner p { margin: 0; flex: 1; line-height: 1.4; }
.banner b { color: var(--white); font-weight: 600; }
.banner .share { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }
.banner .x { background: none; border: 0; color: var(--muted); font-size: 20px; width: 32px; height: 32px; cursor: pointer; padding: 0; flex: none; }
.banner .btn { min-height: 38px; padding: 0 12px; font-size: 11px; }
.fab { position: absolute; z-index: 2; right: calc(14px + var(--safe-r)); bottom: 40px; height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 16px 0 13px; background: var(--white); color: var(--black); border: 0; border-radius: var(--r); font: 600 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.55); }
.fab svg { width: 20px; height: 20px; }
.fab.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.me { width: 18px; height: 18px; border-radius: 50%; background: var(--steel-hi); border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(143,176,196,.5); animation: me 2.2s ease-out infinite; }
@keyframes me { 0% { box-shadow: 0 0 0 0 rgba(143,176,196,.55); } 80%, 100% { box-shadow: 0 0 0 16px rgba(143,176,196,0); } }

/* ---------- Sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; visibility: hidden; }
.sheet-wrap.open { visibility: visible; }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .25s; }
.sheet-wrap.open .scrim { opacity: 1; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--ink); border-top: 1px solid var(--line-2); border-radius: 14px 14px 0 0; padding: 8px calc(20px + var(--safe-r)) calc(20px + var(--safe-b)) calc(20px + var(--safe-l)); transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.sheet-wrap.open .sheet { transform: none; }
@media (min-width: 640px) { .sheet { left: 50%; right: auto; width: 440px; margin-left: -220px; } }
.grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.22); margin: 4px auto 16px; cursor: pointer; }
.sh-status { display: flex; align-items: center; gap: 8px; font: 400 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--g3); }
.sh-status i { width: 10px; height: 10px; border-radius: 50%; }
.sh-brand { margin-top: 14px; font: 400 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sheet h2 { font: 400 18px/1.3 var(--head); color: var(--white); margin: 8px 0 6px; letter-spacing: -.01em; }
.sh-addr { color: var(--muted); font-size: 14px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.chip { font: 400 13px/1 var(--mono); padding: 9px 10px; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--g2); }
.sh-lines { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin-bottom: 16px; display: grid; gap: 6px; font-size: 14px; }
.sh-lines .k { color: var(--muted); }
.sh-lines div { display: flex; justify-content: space-between; gap: 12px; }
.sh-lines div span:last-child { color: var(--white); text-align: right; }
.rel-strong { color: var(--steel-hi) !important; }
.btn { -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--white); font: 600 12px/1 var(--body); letter-spacing: .13em; text-transform: uppercase; text-decoration: none; cursor: pointer; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--white); color: var(--black); }
.btn-ghost { background: transparent; color: var(--white); border-color: var(--line-2); }
.btn[disabled] { opacity: .5; cursor: progress; }
.wide { width: 100%; }
.sh-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sh-actions .wide { grid-column: 1 / -1; }
.sh-foot { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.list { list-style: none; margin: 0; padding: 0; }
.list button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 15px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--white); font-size: 16px; text-align: left; cursor: pointer; }
.list button small { margin-left: auto; color: var(--muted); font: 400 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.list i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sheet h3 { font: 400 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 42px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: transparent; color: var(--g2); font: 400 14px var(--mono); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--black); border-color: var(--white); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--white); cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 14px; background: var(--ink-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked { background: var(--steel-2); border-color: var(--steel-hi); }
.switch input:checked::after { transform: translateX(20px); background: #fff; }
.select { width: 100%; height: 48px; padding: 0 12px; font: 400 16px var(--body); color: var(--white); background: var(--black); border: 1px solid var(--line-2); border-radius: var(--r); }
.legend-row { display: grid; grid-template-columns: 14px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.legend-row i { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; }
.legend-row b { display: block; color: var(--white); font-weight: 600; font-size: 15px; }
.legend-row span { color: var(--muted); font-size: 14px; }
.p-unchecked { background: var(--p-unchecked); } .p-working { background: var(--p-working); } .p-busy { background: var(--p-busy); } .p-down { background: var(--p-down); } .p-own { background: var(--p-own); }

/* ---------- Pages ---------- */
.page-head { margin-bottom: 18px; }
.eyebrow { font: 400 11px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.page-head h1 { font: 400 26px/1.2 var(--head); color: var(--white); margin: 10px 0 0; }
.h2 { font: 400 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; font-weight: 400; }
.block { margin-top: 28px; }
.wallet-card { position: relative; overflow: hidden; padding: 20px; border-radius: 10px; border: 1px solid var(--line-2); background: radial-gradient(120% 120% at 100% 0%, rgba(100,123,137,.35) 0%, rgba(14,14,17,0) 55%), var(--ink); }
.wc-top { display: flex; justify-content: space-between; align-items: center; }
.wc-label { font: 400 11px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--g3); }
.wc-balance { font-size: 44px; line-height: 1; color: var(--white); margin: 22px 0 10px; letter-spacing: .01em; }
.wc-sub { color: var(--muted); font-size: 14px; }
.wc-sync { margin-top: 14px; font: 400 11px/1.4 var(--mono); color: var(--muted); letter-spacing: .04em; }
.wc-sync.err { color: var(--err); }
.wc-sync button { background: none; border: 0; padding: 0; color: var(--white); text-decoration: underline; font: inherit; cursor: pointer; }
.amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.amt { min-height: 50px; border-radius: var(--r); border: 1px solid var(--line-2); background: transparent; color: var(--white); font: 400 18px var(--mono); cursor: pointer; }
.amt[aria-checked="true"] { background: var(--white); color: var(--black); border-color: var(--white); }
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font: 400 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.fld input, .rupee input { width: 100%; height: 50px; padding: 0 14px; font: 400 16px var(--body); color: var(--white); background: var(--black); border: 1px solid var(--line-2); border-radius: var(--r); outline: none; }
.fld input:focus { border-color: var(--steel-hi); }
.rupee { display: flex; }
.rupee b { display: flex; align-items: center; padding: 0 12px; font: 400 16px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--ink-2); }
.rupee input { border-radius: 0 var(--r) var(--r) 0; font-family: var(--mono); letter-spacing: .04em; }
.ferr { color: var(--err); font-size: 14px; margin: -4px 0 12px; min-height: 0; }
.ferr:empty { display: none; }
.fine { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: center; }
.note { margin-top: 16px; padding: 12px 14px; border-left: 2px solid var(--steel); background: var(--ink); color: var(--g3); font-size: 14px; border-radius: 0 var(--r) var(--r) 0; }
.history { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.history li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.history .t { color: var(--white); font-size: 15px; }
.history .d { color: var(--muted); font: 400 12px/1.3 var(--mono); }
.history .a { font: 400 17px/1 var(--mono); color: var(--white); text-align: right; }
.history .s { justify-self: end; font: 400 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; padding: 5px 7px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); }
.history .s.paid { color: var(--steel-hi); border-color: rgba(143,176,196,.45); }
.history .s.expired { color: var(--muted); text-decoration: line-through; }
.history .empty { display: block; color: var(--muted); font-size: 14px; text-align: center; padding: 26px 0; }
.pay-state { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--ink); margin-bottom: 16px; }
.pay-state b { display: block; color: var(--white); font-weight: 600; }
.pay-state span { color: var(--muted); font-size: 14px; }
.pay-state .ic { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); }
.pay-state .ic.spin { border: 2px solid var(--line-2); border-top-color: var(--white); animation: spin .9s linear infinite; }
.pay-state.ok { border-color: rgba(143,176,196,.55); }
.pay-state.ok .ic { background: var(--steel-2); border-color: var(--steel-hi); }
.pay-state.bad { border-color: rgba(255,138,138,.4); }
.pay-state button { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.rows { list-style: none; padding: 0; margin: 28px auto 0; border-top: 1px solid var(--line); }
.rows li { border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; min-height: 54px; gap: 12px; }
.rows li > span { color: var(--muted); font-size: 15px; }
.rows a { flex: 1; display: flex; justify-content: space-between; align-items: center; min-height: 54px; text-decoration: none; color: var(--white); font-size: 15px; }
.rows a span { color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--white); font-size: 14px; cursor: pointer; padding: 8px 0; }
.saved { font: 400 11px/1 var(--mono); color: var(--steel-hi); letter-spacing: .08em; height: 12px; }
.privacy p { color: var(--muted); font-size: 14px; margin: 0 0 10px; line-height: 1.6; }
.privacy .fine { text-align: left; }
.version { text-align: center; color: #5d5d66; font-size: 12px; margin-top: 30px; }

/* ---------- Tab bar ---------- */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l); display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(0,0,0,.92); border-top: 1px solid var(--line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; color: #6e6e78; cursor: pointer; font: 400 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; position: relative; }
.tab svg { width: 23px; height: 23px; }
.tab[aria-selected="true"] { color: var(--white); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; top: -1px; left: 34%; right: 34%; height: 2px; background: var(--white); }

.offline { position: absolute; z-index: 15; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 78px); background: var(--ink); color: var(--g3); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: var(--r); font-size: 13px; width: max-content; max-width: calc(100% - 32px); text-align: center; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translate(-50%, 12px); width: max-content; max-width: calc(100% - 32px); background: var(--white); color: var(--black); padding: 12px 16px; border-radius: var(--r); font-size: 14px; line-height: 1.4; opacity: 0; transition: .25s; pointer-events: none; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.sheet-open .toast { bottom: calc(var(--safe-b) + 16px); }

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