/* Space Tensor / NavSense visual language, taken from the Android NavSense app
   (MVP/android/android_app/SensorsApp/app/src/main/res/values/colors.xml, themes.xml, drawable/*):
   deep-space black, navy surfaces, electric blue, sky cyan, glow; 14 px rounded controls; cyan
   letter-spaced labels; gradient cards with a thin blue border; soft blue glow from the top. */
:root {
  --st-space: #01050F; --st-surface: #061631; --st-raised: #0A2146; --st-border: #164A86; --st-divider: #12345F;
  --st-blue: #2675B4; --st-electric: #2F8CFF; --st-cyan: #48ACE5; --st-glow: #8BD3F2;
  --st-text: #E6F4FF; --st-muted: #8FB3D6; --st-red: #E5484D; --st-warm: #F5A524; --st-ok: #6EE7B7; --st-error: #FF6B6B;
  /* semantic tokens used by the app and its charts */
  --bg: var(--st-space); --panel: var(--st-surface); --ink: var(--st-text); --muted: var(--st-muted);
  --line: var(--st-divider); --accent: var(--st-electric); --accent-ink: #FFFFFF;
  --ok: var(--st-ok); --warn: var(--st-warm); --bad: var(--st-error); --chip: var(--st-raised);
  --truth: var(--st-text); --meas: var(--st-warm); --est: var(--st-cyan); --cand: var(--st-ok);
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--st-space); }
body {
  margin: 0; min-height: 100vh; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
  background: radial-gradient(ellipse 900px 480px at 50% -80px, rgba(47, 111, 184, 0.28), rgba(1, 5, 15, 0) 70%) no-repeat, var(--st-space);
}
code, .mono { font-family: var(--mono); font-size: 12px; color: var(--st-glow); }
pre.mono { white-space: pre-wrap; background: var(--st-space); border: 1px solid var(--st-divider); border-radius: 10px; padding: 10px; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
a { color: var(--st-cyan); }

/* ---------------- brand header */
.topbar { display: flex; align-items: center; gap: 18px; padding: 10px 20px; position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
  background: rgba(1, 5, 15, 0.86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--st-divider); }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; text-decoration: none; color: inherit; }
.brand .logo-img { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; border: 1px solid var(--st-border);
  box-shadow: 0 0 18px rgba(47, 140, 255, 0.35); transition: box-shadow .2s; }
.brand:hover .logo-img { box-shadow: 0 0 22px rgba(245, 165, 36, 0.45); }
.who { display: inline-flex; align-items: center; gap: 7px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700;
  color: #FFFFFF; background: linear-gradient(135deg, var(--st-electric), var(--st-blue)); border: 1px solid var(--st-cyan); }
.avatar:empty { display: none; }
.brand .wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.brand .wordmark strong { font-size: 15px; letter-spacing: 0.18em; color: var(--st-text); }
.brand .wordmark span { font-size: 12px; color: var(--st-cyan); }
.tag { font-size: 10.5px; padding: 2px 8px; border: 1px solid var(--st-border); border-radius: 999px; color: var(--st-muted);
  margin-left: 4px; letter-spacing: 0.04em; }
.tabs { display: flex; gap: 6px; }
.tabs button { background: none; border: 1px solid transparent; padding: 8px 14px; color: var(--muted); cursor: pointer;
  border-radius: var(--radius); font: inherit; letter-spacing: 0.02em; }
.tabs button:hover { color: var(--st-glow); border-color: var(--st-divider); }
.tabs button.active { color: var(--st-text); font-weight: 600; background: linear-gradient(315deg, var(--st-raised), var(--st-surface));
  border-color: var(--st-cyan); box-shadow: 0 0 14px rgba(72, 172, 229, 0.25); }
.session { margin-left: auto; display: flex; gap: 10px; align-items: center; }

main { padding: 18px; max-width: 1600px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.layout { display: grid; grid-template-columns: 290px 1fr; gap: 16px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ---------------- cards (acceleration_card / sensor_panel drawables) */
.panel { background: linear-gradient(315deg, var(--st-raised), var(--st-surface)); border: 1px solid var(--st-border);
  border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; min-width: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.panel h2 { font-size: 13px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--st-cyan); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.panel h3 { font-size: 12px; margin: 14px 0 8px; color: var(--st-cyan); letter-spacing: 0.06em; text-transform: uppercase; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------------- controls (Widget.SpaceTensor.Button / .Outline) */
button { font: inherit; cursor: pointer; border-radius: var(--radius); border: 1.5px solid var(--st-cyan); background: var(--st-surface);
  color: var(--st-glow); padding: 7px 14px; letter-spacing: 0.02em; transition: box-shadow .15s, border-color .15s, background .15s; }
button:hover { box-shadow: 0 0 12px rgba(72, 172, 229, 0.35); }
button.primary { background: var(--st-electric); color: #FFFFFF; border-color: var(--st-electric); font-weight: 600; }
button.primary:hover { box-shadow: 0 0 16px rgba(47, 140, 255, 0.55); }
button.ghost { background: none; border-color: var(--st-border); color: var(--st-muted); }
button.small { padding: 3px 10px; font-size: 12px; border-radius: 10px; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--st-space); border: 1px solid var(--st-border);
  border-radius: 10px; padding: 6px 9px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--st-cyan); box-shadow: 0 0 0 2px rgba(72, 172, 229, 0.25); }
textarea { font-family: var(--mono); font-size: 12px; width: 100%; min-height: 120px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
input[type=checkbox] { accent-color: var(--st-cyan); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 10px; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px;
  border: 1px solid transparent; }
.list li:hover { background: var(--st-raised); border-color: var(--st-divider); }
.list li.sel { background: var(--st-raised); border-color: var(--st-cyan); font-weight: 600; }
.sections { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--st-divider); padding-bottom: 10px; }
.sections button { border: 1px solid transparent; background: none; color: var(--muted); padding: 5px 11px; border-radius: 999px; }
.sections button.active { color: var(--st-text); background: var(--st-raised); border-color: var(--st-cyan); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 11.5px; color: var(--st-cyan); font-weight: 700; letter-spacing: 0.04em; }
.field > span .unit { color: var(--st-muted); font-weight: 400; margin-left: 4px; }
.field input[type=checkbox] { width: 18px; height: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.messages { margin-top: 10px; }
.msg { padding: 7px 11px; border-radius: 10px; margin: 5px 0; font-size: 13px; border: 1px solid transparent; }
.msg.err { background: rgba(229, 72, 77, 0.12); border-color: rgba(229, 72, 77, 0.45); }
.msg.warn { background: rgba(245, 165, 36, 0.10); border-color: rgba(245, 165, 36, 0.40); }
.msg.ok { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.35); }

/* ---------------- status pills / badges (pill_status, badge_real) */
.pill { font-size: 11px; padding: 2px 10px; border-radius: 999px; font-weight: 700; background: var(--st-raised);
  border: 1px solid var(--st-border); letter-spacing: 0.03em; }
.pill.COMPLETED { color: var(--st-ok); border-color: rgba(110, 231, 183, 0.5); background: rgba(52, 211, 153, 0.12); }
.pill.FAILED { color: var(--st-error); border-color: rgba(229, 72, 77, 0.55); background: rgba(229, 72, 77, 0.12); }
.pill.CANCELLED { color: var(--muted); }
.pill.RUNNING, .pill.QUEUED, .pill.VALIDATING, .pill.CREATED { color: var(--st-warm); border-color: rgba(245, 165, 36, 0.5); }
.badge { font-size: 10px; letter-spacing: .06em; padding: 1px 7px; border-radius: 5px; border: 1px solid currentColor; font-weight: 700; }
.badge.truth { color: var(--truth); } .badge.meas { color: var(--meas); } .badge.est { color: var(--est); }
.progress { height: 6px; background: var(--st-space); border: 1px solid var(--st-divider); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--st-blue), var(--st-electric), var(--st-cyan));
  box-shadow: 0 0 10px rgba(47, 140, 255, 0.6); transition: width .4s; }

/* ---------------- tables */
table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.data th, table.data td { border-bottom: 1px solid var(--st-divider); padding: 6px 9px; text-align: left; vertical-align: top; }
table.data th { color: var(--st-cyan); font-weight: 700; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; }
table.data tbody tr:hover td { background: rgba(10, 33, 70, 0.6); }
table.data tr.sel td { background: var(--st-raised); }
.num { font-variant-numeric: tabular-nums; }

/* ---------------- KPI tiles (magnitude_card drawable + glowing readout) */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.kpi { border: 1.5px solid var(--st-cyan); border-radius: var(--radius); padding: 10px 12px;
  background: linear-gradient(315deg, #0B2A5A, var(--st-surface)); }
.kpi .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--st-glow);
  text-shadow: 0 0 14px rgba(47, 140, 255, 0.55); }
.kpi .l { font-size: 11px; color: var(--st-muted); letter-spacing: 0.03em; margin-top: 2px; }

.plot { width: 100%; height: 300px; }
.plot.tall { height: 420px; }
.scroll { max-height: 340px; overflow: auto; }
dialog { border: 1px solid var(--st-border); border-radius: 16px; background: linear-gradient(315deg, var(--st-raised), var(--st-surface));
  color: var(--ink); max-width: 440px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(1, 5, 15, 0.75); }
dialog h2 { color: var(--st-cyan); letter-spacing: 0.06em; text-transform: uppercase; font-size: 14px; }
dialog input { width: 100%; margin: 8px 0; }
#toast { position: fixed; bottom: 18px; right: 18px; background: var(--st-raised); color: var(--st-text); padding: 9px 15px;
  border: 1px solid var(--st-cyan); border-radius: var(--radius); opacity: 0; transition: opacity .3s; pointer-events: none;
  max-width: 420px; box-shadow: 0 0 18px rgba(72, 172, 229, 0.3); }
#toast.show { opacity: .97; }

/* ---------------- page layout: footer stays at the bottom */
body.app-page, body.auth-page { display: flex; flex-direction: column; }
body.app-page > main { flex: 1; width: 100%; }

/* ---------------- account pages (sign in / create account / reset), after the NavSense Android account screen */
html.checking body { visibility: hidden; }   /* while a stored session is being confirmed */
.auth-main { flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 440px; padding: 28px 26px 22px; border-radius: 18px; border: 1px solid var(--st-border);
  background: linear-gradient(315deg, var(--st-raised), var(--st-surface)); box-shadow: 0 0 40px rgba(47, 140, 255, 0.16); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.auth-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; border: 1px solid var(--st-border);
  box-shadow: 0 0 22px rgba(47, 140, 255, 0.4); }
.auth-brand .wordmark { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand .wordmark strong { font-size: 17px; letter-spacing: 0.2em; }
.auth-brand .wordmark span { font-size: 13px; color: var(--st-cyan); }
.auth-title { font-size: 22px; margin: 0 0 10px; font-weight: 700; }
.auth-state { padding: 12px 14px; border-radius: var(--radius); background: var(--st-space); border: 1px solid var(--st-divider);
  color: var(--st-muted); font-size: 13px; margin-bottom: 18px; }
.auth-state.ok { color: var(--st-ok); border-color: rgba(110, 231, 183, 0.45); }
.auth-state.err { color: var(--st-error); border-color: rgba(255, 107, 107, 0.5); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form[hidden] { display: none; }
.auth-label { color: var(--st-cyan); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; }
.auth-hint { color: var(--st-muted); font-size: 12.5px; margin: -4px 0 0; }
.auth-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--st-muted); }
.auth-field input { width: 100%; background: transparent; border: 0; border-bottom: 2px solid var(--st-cyan); border-radius: 0;
  padding: 8px 2px; font-size: 15px; color: var(--st-text); }
.auth-field input:focus { box-shadow: none; border-bottom-color: var(--st-glow); }
.auth-field input#code { letter-spacing: 0.4em; font-family: var(--mono); font-size: 18px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 0; bottom: 6px; padding: 2px 8px; font-size: 11.5px; border-radius: 8px;
  border: 1px solid var(--st-border); background: none; color: var(--st-muted); }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.auth-row .check { display: inline-flex; align-items: center; gap: 7px; color: var(--st-text); cursor: pointer; }
.auth-row a { text-decoration: none; }
.auth-row a:hover, .auth-switch a:hover { text-decoration: underline; }
button.block { width: 100%; height: 54px; font-size: 15px; margin-top: 4px; }
.auth-buttons { display: flex; gap: 10px; }
.auth-buttons button { flex: 1; height: 48px; }
button.verify { background: var(--st-blue); border-color: var(--st-blue); color: #FFFFFF; font-weight: 600; }
.auth-switch { text-align: center; margin: 18px 0 0; color: var(--st-muted); font-size: 13px; }
.auth-switch a { font-weight: 600; text-decoration: none; }
.pw-rules { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pw-rules li { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--st-border); color: var(--st-muted); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.ok { color: var(--st-ok); border-color: rgba(110, 231, 183, 0.45); }
.pw-rules li.ok::before { content: "● "; }

/* ---------------- site footer */
.site-footer { border-top: 1px solid var(--st-divider); background: rgba(1, 5, 15, 0.86); font-size: 12px; color: var(--st-text); }
.footer-inner { max-width: 1600px; margin: 0 auto; padding: 14px 20px; display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 16px; align-items: center; }
.footer-left { line-height: 1.6; }
.footer-center { text-align: center; padding: 6px 16px; border: 1px solid var(--st-border); border-radius: 999px;
  letter-spacing: 0.04em; white-space: nowrap; background: linear-gradient(315deg, var(--st-raised), var(--st-surface)); }
.footer-center strong { color: var(--st-cyan); }
.footer-right { text-align: right; line-height: 1.6; }
.site-footer a { text-decoration: none; }
@media (max-width: 760px) {
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-right { text-align: center; }
  .footer-center { justify-self: center; }
}
.empty { padding: 34px; text-align: center; color: var(--muted); }
.legend-note { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.subrow { border: 1px solid var(--st-border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: rgba(1, 5, 15, 0.35); }
.subrow header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--st-border); border-radius: 999px; }
::-webkit-scrollbar-track { background: var(--st-space); }
