/* =============================================================================
 * PATHFINDER by Ionity — application styles (built on ionity-tokens.css v1.1.0)
 * Ionity Global (Pty) Ltd | Policy 986 AED | (c) 2018-2026 Antwerp Designs — TM2
 * ============================================================================= */
:root {
  --bg: var(--ionity-surface-bg);
  --s1: var(--ionity-surface-surface-1);
  --s2: #1b2030;
  --line: var(--ionity-surface-border);
  --ink: var(--ionity-text-default);
  --muted: var(--ionity-text-muted);
  --purple: var(--ionity-brand-purple);
  --teal: var(--ionity-brand-teal);
  --cyan: var(--ionity-brand-cyan);
  --amber: #ffb020;
  --red: #ff5470;
  --grad: var(--ionity-gradient-brand);
  --r: var(--ionity-radius-md);
  --r-lg: var(--ionity-radius-lg);
  --font: var(--ionity-typography-family-sans);
  --mono: var(--ionity-typography-family-mono);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 100% -10%, rgba(87,70,227,.18), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(0,212,184,.10), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--cyan); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--red); }
.eyebrow { margin: 0 0 2px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.brand-bar { position: fixed; inset: 0 0 auto 0; height: 3px; background: var(--grad); z-index: 1000; }

/* ---------- boot / sign-in ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.boot img { animation: spin 3.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.signin { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 24px; }
.signin-card { width: 100%; max-width: 440px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 36px 28px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.signin-logo { filter: drop-shadow(0 0 24px rgba(0,210,255,.35)); }
.wordmark { font-size: 2.3rem; font-weight: 800; letter-spacing: .18em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 4px 0 10px; }
.lead { color: var(--muted); margin: 0 0 24px; }
.lead em { color: var(--ink); font-style: normal; font-weight: 600; }
.signin-points { text-align: left; margin: 24px 0 0; padding: 16px 18px; list-style: none; background: var(--bg); border-radius: var(--r); border: 1px solid var(--line); display: grid; gap: 8px; font-size: .9rem; color: var(--muted); }
.signin-points b { color: var(--teal); }

/* ---------- buttons / inputs ---------- */
.btn { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: var(--ionity-radius-pill); font: 600 .92rem var(--font); color: #fff; background: linear-gradient(90deg, var(--purple), #3d7bf0); box-shadow: 0 6px 20px rgba(87,70,227,.35); text-decoration: none; transition: transform .12s, filter .12s, opacity .12s; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; color: var(--ink); }
.btn-ghost:hover { border-color: var(--cyan); }
.btn-danger { background: transparent; border: 1px solid rgba(255,84,112,.5); box-shadow: none; color: var(--red); }
.btn-sm { padding: 7px 13px; font-size: .84rem; }
.btn-google { width: 100%; background: #fff; color: #1f1f1f; box-shadow: 0 6px 24px rgba(0,0,0,.35); padding: 13px 18px; }
.btn.stop { background: linear-gradient(90deg, #c2334d, var(--red)); box-shadow: 0 6px 20px rgba(255,84,112,.3); }
.input { background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 12px; font: inherit; min-width: 0; }
.input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.input-sm { padding: 6px 10px; font-size: .85rem; max-width: 200px; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 10px 0; }
.field { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); margin: 10px 0; }
.field input[type=range] { accent-color: var(--teal); width: 100%; }
.hint { font-size: .8rem; color: var(--muted); margin: 6px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.actions.end { justify-content: flex-end; }

/* switch */
.switch { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: .9rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 40px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--cyan); }

/* ---------- app shell ---------- */
.app { max-width: 1240px; margin: 0 auto; padding: 14px 16px 24px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo b { display: block; letter-spacing: .16em; font-size: 1rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo small { display: block; color: var(--muted); font-size: .7rem; letter-spacing: .1em; }
.me { display: flex; align-items: center; gap: 10px; }
.me-photo { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); object-fit: cover; background: var(--s2); }
.chip { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: rgba(87,70,227,.22); color: #b8b0ff; border: 1px solid rgba(87,70,227,.5); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); border-image: var(--grad) 1; border-bottom-width: 2px; border-bottom-style: solid; }
.view { display: grid; gap: 16px; }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }
.card.narrow { max-width: 640px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; }
.grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-wide { grid-template-columns: minmax(0, 1fr); } }
.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; padding: 12px 16px; border-radius: var(--r); background: rgba(255,176,32,.1); border: 1px solid rgba(255,176,32,.4); font-size: .9rem; }
.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.toolbar-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* status */
.status-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--muted); flex: none; box-shadow: 0 0 0 0 currentColor; color: var(--muted); }
.pulse.live { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 14px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.kv div { min-width: 0; }
.kv .wide { grid-column: 1 / -1; }
.kv dt { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.kv dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 2px; }
.tile span { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tile b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: .78rem; }
.tile.t-on b { color: var(--teal); } .tile.t-off b { color: var(--amber); } .tile.t-bad b { color: var(--red); }

/* maps / charts */
.map { height: 380px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: #0e1320; z-index: 0; }
.map-sm { height: 260px; }
.map-lg { height: 460px; }
.chart-box { position: relative; height: 360px; }
.leaflet-container { font-family: var(--font); }
.pf-dot span { display: block; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.pf-avatar span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 3px solid; overflow: hidden; background: #1b2030; color: #fff; font: 700 13px var(--font); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* tables / lists */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(0,210,255,.04); }
.mono { font-family: var(--mono); font-size: .8rem; }
.person { display: flex; gap: 10px; align-items: center; min-width: 180px; }
.person img, .person .av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--s2); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.person small { display: block; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.results { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.results li button { width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: var(--r); padding: 8px 12px; cursor: pointer; font: inherit; font-size: .85rem; }
.results li button:hover { border-color: var(--cyan); }
.list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.days { border: 0; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.days legend { color: var(--muted); margin-bottom: 6px; }
.days label { cursor: pointer; }
.days input { position: absolute; opacity: 0; }
.days span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--muted); }
.days input:checked + span { background: rgba(0,212,184,.15); border-color: var(--teal); color: var(--teal); }
.days input:focus-visible + span { outline: 2px solid var(--cyan); }

/* dialog */
.dialog { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--s1); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.dialog::backdrop { background: rgba(5,6,10,.75); backdrop-filter: blur(4px); }
.dialog-body { padding: 24px; display: grid; gap: 12px; }
.consent-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.consent-list b { color: var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--teal); width: 18px; height: 18px; flex: none; }

/* android app */
.banner-app { background: rgba(0,210,255,.08); border-color: rgba(0,210,255,.4); }
#native-panel { margin-top: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.bg-line { display: flex; gap: 10px; align-items: center; font-size: .88rem; min-width: 0; }
.mini-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.steps li small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.steps li .st { font-size: .78rem; font-weight: 700; }
.steps li.ok { border-color: rgba(0,212,184,.45); }
.steps li.ok .st { color: var(--teal); }
.steps li.ok button { display: none; }
@media (max-width: 420px) { .steps li { grid-template-columns: 1fr auto; } .steps li .st { display: none; } }

/* toast / footer */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--s2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; font-size: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 2000; max-width: calc(100vw - 32px); }
.foot { text-align: center; color: var(--muted); font-size: .76rem; padding: 28px 0 8px; }
.foot a { color: var(--muted); }

@media (max-width: 560px) {
  .app { padding: 10px 12px 20px; }
  .kv { grid-template-columns: 1fr; }
  .map { height: 300px; }
  .map-lg { height: 360px; }
  .chart-box { height: 280px; }
  .me .btn { padding: 6px 10px; }
  .logo small { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
