/* SwapLoop Rider SPA — low-fidelity mobile wireframe stylesheet */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --muted: #555555;
  --line: #222222;
  --line-soft: #999999;
  --fill: #e8e8e8;
  --fill-strong: #d0d0d0;
  --focus: #000000;
  --shell-max: 26rem;
  --font: "Segoe UI", Arial, Helvetica, sans-serif;
  --nav-h: 3.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.4;
}

a {
  color: var(--ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1 {
  margin: 0 0 0.3rem;
  font-size: 1.375rem;
  font-weight: 700;
}

h2 {
  margin: 0 0 0.4rem;
  font-size: 1.0625rem;
  font-weight: 700;
}

h3 {
  margin: 0 0 0.3rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

p {
  margin: 0 0 0.6rem;
}

.lede {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Phone shell ---------- */
.phone {
  max-width: var(--shell-max);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-topbar {
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-topbar .brand {
  font-weight: 700;
  font-size: 1.0625rem;
  text-decoration: none;
}

.app-topbar .brand span {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.75rem;
  display: block;
}

.topbar-back {
  border: 1px solid var(--line);
  background: var(--surface);
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  text-decoration: none;
  flex: none;
  font-weight: 700;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title strong {
  display: block;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.app-main {
  flex: 1;
  padding: 1rem 1rem 1.5rem;
}

.app-main--with-nav {
  padding-bottom: calc(var(--nav-h) + 1.25rem);
}

/* ---------- Bottom tab bar ---------- */
.bottom-nav {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 10;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.6875rem;
  border-top: 3px solid transparent;
}

.bottom-nav a .icon-box {
  margin: 0;
  width: 1.1rem;
  height: 1.1rem;
}

.bottom-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  border-top-color: var(--ink);
}

.bottom-nav a[aria-current="page"] .icon-box {
  background: var(--ink);
}

/* ---------- Auth screens ---------- */
.auth-main {
  padding: 1.5rem 1.25rem 2.5rem;
}

.brand-block {
  text-align: center;
  margin-bottom: 1.5rem;
}

.brand-block .brand {
  display: block;
  font-size: 1.625rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-block p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.step-indicator {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.step-indicator .step {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.step-indicator .step-dot {
  width: 1.4rem;
  height: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
}

.step-indicator .step--done .step-dot {
  background: var(--ink);
  color: var(--surface);
}

.step-indicator .step--current .step-dot {
  background: var(--fill);
}

.step-indicator .step-sep {
  width: 1.5rem;
  border-top: 1px dashed var(--line-soft);
}

/* ---------- Panels / cards ---------- */
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.9rem;
  margin-bottom: 0.9rem;
}

.panel--dashed {
  border-style: dashed;
  border-color: var(--line-soft);
  background: #fafafa;
}

.wf-note {
  margin: 0 0 0.9rem;
  padding: 0.5rem 0.65rem;
  border: 1px dashed var(--line-soft);
  background: #fafafa;
  font-size: 0.75rem;
  color: var(--muted);
}

.wf-note strong {
  color: var(--ink);
  font-weight: 600;
}

.section-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* ---------- Forms ---------- */
.form-stack {
  display: grid;
  gap: 0.8rem;
}

.fieldset {
  border: 1px solid var(--line-soft);
  padding: 0.8rem;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.fieldset legend {
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0 0.3rem;
}

.field {
  display: grid;
  gap: 0.25rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 600;
}

.field .hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.field .error {
  font-size: 0.75rem;
  font-weight: 600;
  border-left: 3px solid var(--ink);
  padding-left: 0.4rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  font-size: 0.9375rem;
  border-radius: 0;
  min-height: 2.6rem;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-width: 2px;
  background: var(--fill);
}

.radio-row-group {
  display: grid;
  gap: 0.4rem;
}

.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border: 1px solid var(--line-soft);
  padding: 0.5rem 0.6rem;
  font-size: 0.875rem;
}

.radio-row input {
  margin-top: 0.2rem;
}

.radio-row.is-selected {
  border-color: var(--line);
  background: var(--fill);
  font-weight: 600;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.2rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line-soft);
}

.required-mark {
  font-weight: 400;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border-radius: 0;
}

.btn--primary {
  background: var(--ink);
  color: var(--surface);
}

.btn--danger {
  border-width: 2px;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--small {
  min-height: 2.1rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-row .btn {
  flex: 1;
}

.link-muted {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.9rem;
  font-size: 0.875rem;
  background: var(--surface);
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.alert--error {
  border-width: 2px;
}

.alert--success {
  background: var(--fill);
}

.alert--warning {
  border-style: dashed;
}

.alert h2 {
  font-size: 0.9375rem;
  margin-bottom: 0.2rem;
}

.alert .icon-box {
  margin-top: 0.15rem;
  flex: none;
}

/* ---------- Status badges (never colour-only) ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface);
  white-space: nowrap;
}

.status-badge--muted {
  background: var(--fill);
}

.status-badge--dashed {
  border-style: dashed;
  color: var(--muted);
}

.status-badge--strong {
  background: var(--ink);
  color: var(--surface);
}

/* ---------- Toolbar / filters ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.chip {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 0.35rem 0.7rem;
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: inline-block;
}

.chip[aria-pressed="true"] {
  border-color: var(--line);
  background: var(--fill);
  font-weight: 700;
}

.filter-summary {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

/* ---------- Station cards ---------- */
.station-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.station-card {
  display: block;
  border: 1px solid var(--line);
  padding: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}

.station-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.station-card__head h3 {
  margin: 0;
}

.station-card__meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

.station-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--line-soft);
  font-size: 0.8125rem;
}

.avail-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--line-soft);
  padding: 0.1rem 0.4rem;
}

.avail-chip--ready {
  border-color: var(--line);
  background: var(--fill);
}

.avail-chip--none {
  border-style: dashed;
  color: var(--muted);
}

/* ---------- Empty state ---------- */
.empty-state {
  border: 1px dashed var(--line);
  padding: 2rem 1rem;
  text-align: center;
  background: var(--surface);
}

.empty-state h2 {
  margin-bottom: 0.3rem;
}

.empty-state p {
  margin: 0 auto 0.9rem;
  max-width: 22rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Detail / summary lists ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem 1rem;
  margin: 0;
}

.detail-grid dt {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
}

.detail-grid dd {
  margin: 0.1rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.summary-list {
  margin: 0;
  padding: 0;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.875rem;
}

.summary-list div:last-child {
  border-bottom: 0;
}

.summary-list dt {
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.summary-list dd {
  margin: 0;
  text-align: right;
}

/* ---------- Countdown / live telemetry ---------- */
.countdown-box {
  border: 2px solid var(--line);
  padding: 1rem;
  text-align: center;
  margin-bottom: 0.9rem;
  background: var(--fill);
}

.countdown-box .countdown-value {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.countdown-box .countdown-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.countdown-box--expiring {
  border-style: dashed;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.telemetry-tile {
  border: 1px solid var(--line);
  padding: 0.6rem 0.4rem;
  text-align: center;
}

.telemetry-tile .tele-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.telemetry-tile .tele-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.progress-track {
  border: 1px solid var(--line);
  height: 0.9rem;
  margin-bottom: 0.9rem;
  background: var(--surface);
}

.progress-track__fill {
  height: 100%;
  background: var(--fill-strong);
  border-right: 1px solid var(--line);
  width: var(--pct, 50%);
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.live-tag .pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--ink);
}

/* ---------- Receipt ---------- */
.receipt-box {
  border: 2px solid var(--line);
  padding: 1rem;
  background: var(--fill);
  margin-bottom: 0.9rem;
}

.receipt-box .receipt-label {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.receipt-box .receipt-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.receipt-box .receipt-code {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Recent list ---------- */
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line-soft);
  padding: 0.6rem 0.7rem;
  text-decoration: none;
  color: var(--ink);
}

.recent-item__main {
  min-width: 0;
}

.recent-item__main strong {
  display: block;
  font-size: 0.875rem;
}

.recent-item__main span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.recent-item__price {
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- QR scan screen ---------- */
.scan-frame {
  border: 1px solid var(--line);
  background: var(--fill);
  min-height: 16rem;
  display: grid;
  place-items: center;
  margin-bottom: 0.9rem;
  padding: 1rem;
  text-align: center;
}

.scan-frame__target {
  width: 9rem;
  height: 9rem;
  border: 2px dashed var(--line-soft);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8125rem;
  margin: 0 auto 0.75rem;
}

/* ---------- Media placeholder ---------- */
.media-placeholder {
  border: 1px solid var(--line);
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), var(--line-soft) calc(50% - 0.5px), var(--line-soft) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to top left, transparent calc(50% - 0.5px), var(--line-soft) calc(50% - 0.5px), var(--line-soft) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    var(--fill);
  display: grid;
  place-items: center;
  min-height: 6rem;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
  padding: 0.5rem;
}

.icon-box {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 1px solid var(--line);
  vertical-align: -0.05rem;
  margin-right: 0.3rem;
  flex: none;
}

/* ---------- Wireframe index (state directory) ---------- */
.wf-index {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.wf-index .group {
  margin-bottom: 1.25rem;
}

.wf-index .group h2 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

.wf-index ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.wf-index a {
  display: block;
  border: 1px solid var(--line-soft);
  padding: 0.5rem 0.7rem;
  text-decoration: none;
  font-size: 0.9375rem;
}

.wf-index a:hover {
  border-color: var(--line);
  background: var(--fill);
}

.wf-index a span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}
