:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --text: #111318;
  --muted: #3d4553;
  --border: #c5ccd6;
  --primary: #0b6e4f;
  --primary-text: #ffffff;
  --hold: #0891b2;
  --watch: #6d28d9;
  --send: #0b6e4f;
  --keep: var(--hold);
  --skip: #4a5568;
  --danger: #b42318;
  --focus: #0b6e4f;
  --shadow: 0 2px 8px rgba(17, 19, 24, 0.12);
  --radius: 14px;
  --tap: 56px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    linear-gradient(180deg, #f7f9fb 0%, #e8edf2 100%);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px 12px 96px;
}

.app-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.header-lists {
  display: flex;
  gap: 8px;
}

.btn-header-list {
  flex: 1;
  min-height: 48px;
  padding: 8px 10px;
  font-size: 0.95rem;
}

.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(244, 246, 248, 0.97);
  border-top: 2px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.app-footer .btn {
  box-shadow: none;
  font-weight: 700;
  color: var(--muted);
}

/* Reserved far-left footer slot for Back on every screen (now and future). */
.footer-back-slot {
  min-width: 5.75rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.footer-back-btn.is-idle {
  visibility: hidden;
  pointer-events: none;
}

.footer-menu {
  position: relative;
  margin-left: auto;
}

.footer-menu-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 160px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 40;
}

.footer-menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.footer-menu-item:last-child {
  border-bottom: 0;
}

.footer-menu-item:active,
.footer-menu-item:focus {
  background: #f0f2f5;
}

.orders-mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-mode {
  background: #fff;
  color: var(--muted);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  min-height: 48px;
  font-weight: 800;
}

.btn-mode.is-active {
  background: #ecfdf5;
  color: var(--primary);
  border-color: var(--primary);
}

.orders-range-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  align-items: end;
}

.orders-range-bar .btn {
  grid-column: 1 / -1;
}

.orders-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 800;
  color: var(--muted);
  font-size: 0.9rem;
}

.orders-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.orders-total-chip {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.orders-total-chip .label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 4px;
}

.orders-total-chip .value {
  display: block;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text);
}

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.order-card-date {
  font-weight: 900;
  font-size: 1.1rem;
}

.order-card-store {
  font-weight: 800;
  color: var(--muted);
}

.order-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.order-stat .label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

.order-stat .value {
  display: block;
  font-size: 1.05rem;
  font-weight: 900;
}

.order-paid-yes {
  color: var(--primary);
}

.order-paid-no {
  color: var(--danger);
}

.adv-ident-block {
  margin-bottom: 8px;
}

.adv-osk-host {
  margin-top: 8px;
}

.adv-label,
.adv-field > span {
  display: block;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 1.02rem;
}

.adv-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

.adv-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.95rem;
  text-transform: lowercase;
}

.adv-divider::before,
.adv-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--border);
}

.adv-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.adv-field {
  display: block;
}

.adv-select {
  width: 100%;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.adv-size-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.adv-size-col {
  min-width: 0;
}

.adv-size-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 800;
}

.adv-size-value {
  color: var(--primary);
  font-weight: 900;
  font-size: 1.05rem;
  white-space: nowrap;
}

.adv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.adv-size-chips {
  gap: 6px;
}

.adv-size-chips .adv-chip {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 10px;
  font-size: 0.98rem;
}

.adv-chip {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  min-height: 48px;
  min-width: 56px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--text);
  box-shadow: var(--shadow);
}

.adv-chip.is-active {
  background: #ecfdf5;
  border-color: var(--primary);
  color: var(--primary);
}

.adv-half-btn {
  margin-top: 8px;
  width: 100%;
  min-height: 44px;
  border: 2px dashed var(--border);
  background: #f7f9fb;
  border-radius: 12px;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--muted);
  box-shadow: none;
}

.adv-half-btn.is-active {
  border-style: solid;
  border-color: var(--primary);
  background: #ecfdf5;
  color: var(--primary);
}

.adv-age-chips .adv-chip {
  flex: 1;
  min-width: 0;
}

@media (max-width: 380px) {
  .adv-size-cols {
    grid-template-columns: 1fr;
  }
}

.adv-spokes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 800;
}

.adv-spokes-value {
  color: var(--primary);
  font-weight: 900;
  font-size: 1.1rem;
}

.adv-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.adv-slider:focus {
  outline: none;
}

.adv-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: #d7dde6;
  border: 1px solid var(--border);
}

.adv-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.adv-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #d7dde6;
  border: 1px solid var(--border);
}

.adv-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.adv-more {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}

.adv-more summary {
  font-weight: 900;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
}

.adv-more summary::-webkit-details-marker {
  display: none;
}

.adv-more[open] summary {
  margin-bottom: 10px;
  color: var(--text);
}

.adv-status {
  margin: 0 0 10px;
  font-weight: 800;
  color: var(--muted);
}

body.has-app-footer #app {
  padding-bottom: 88px;
}

body.has-app-footer .toast {
  bottom: 76px;
}

body.has-app-footer .install-banner {
  bottom: 76px;
}

body.has-app-footer.has-install-banner #app {
  padding-bottom: 160px;
}

.brand {
  margin: 48px 0 8px;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input {
  width: 100%;
  min-height: var(--tap);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
}

.input-lg {
  min-height: 60px;
  font-size: 1.35rem;
}

.input:focus {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.btn {
  min-height: var(--tap);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(1px);
}

.btn-lg {
  min-height: 64px;
  font-size: 1.35rem;
}

.btn-small {
  min-height: 44px;
  font-size: 0.95rem;
  box-shadow: none;
}

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

.btn-keep {
  background: var(--hold);
  color: #fff;
  border-color: var(--hold);
}

.btn-watch {
  background: var(--watch);
  color: #fff;
  border-color: var(--watch);
}

.btn-list {
  background: #fff;
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  flex: 1;
}

.btn-header-watch {
  color: var(--watch);
  border-color: var(--watch);
}

.btn-header-hold {
  color: var(--hold);
  border-color: var(--hold);
}

.btn-header-send {
  color: var(--send);
  border-color: var(--send);
}

.list-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.needed-pill {
  background: transparent;
  color: var(--hold);
  border: 2px solid var(--hold);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 900;
}

.btn-list.has-needed {
  border-color: var(--hold);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.list-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.list-header h2.title-hold {
  color: var(--hold);
}

.list-header h2.title-watch {
  color: var(--watch);
}

.list-header h2.title-send {
  color: var(--send);
}

.list-store-group {
  margin: 12px 0 6px;
  padding: 6px 2px 4px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

.list-store-group:first-child {
  margin-top: 2px;
}

.list-sub {
  margin: 0 0 12px;
  font-weight: 800;
  color: var(--hold);
}

.list-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-needed-filter {
  background: #fff;
  color: var(--hold);
  border: 2px solid var(--hold);
  box-shadow: var(--shadow);
  min-height: 52px;
  font-weight: 800;
}

.btn-needed-filter.is-active {
  background: #f0fdfa;
  color: var(--hold);
  border: 2px solid var(--hold);
  box-shadow: var(--shadow);
}

.list-row-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.list-row-actions .btn {
  min-height: 44px;
  flex: 1;
  box-shadow: none;
}

.btn-skip {
  background: #d7dde6;
  color: var(--skip);
}

.btn-send {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border-color: var(--border);
}

.btn-clear {
  background: #ffe8a3;
  color: #5c4300;
  min-width: 56px;
  padding-left: 0;
  padding-right: 0;
  font-size: 1.75rem;
  line-height: 1;
  font-weight: 700;
}

.btn-toast {
  background: #111318;
  color: #fff;
  min-height: 44px;
  box-shadow: none;
}

.hint {
  color: var(--danger);
  font-weight: 700;
}

.login-request {
  margin-top: 18px;
  text-align: center;
}

.login-request a {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.05rem;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
  align-items: stretch;
}

#searchInput:focus {
  outline-color: var(--primary);
  border-color: var(--primary);
}

#searchInput::placeholder {
  font-size: 75%;
}

#searchInput[readonly] {
  caret-color: var(--primary);
}

.recent {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.recent button {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 92px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.result-row img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: #f0f2f5;
  flex-shrink: 0;
}

.result-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.result-sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.list-help {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.list-help h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 900;
}

.list-help p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
}

.list-help p:last-child {
  margin-bottom: 0;
}

.list-help-hold {
  border-color: var(--hold);
}

.list-help-hold h3 {
  color: var(--hold);
}

.list-help-watch {
  border-color: var(--watch);
}

.list-help-watch h3 {
  color: var(--watch);
}

.list-help-send {
  border-color: var(--send);
}

.list-help-send h3 {
  color: var(--send);
}

.list-data-age {
  font-weight: 700;
  color: #5b6472;
}

.wheel-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.thumb-wrap {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.thumb {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  background: #f0f2f5;
  display: block;
}

.wa {
  font-size: 1.5rem;
  font-weight: 900;
}

.price {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  margin: 4px 0;
}

.size, .make-model {
  font-weight: 700;
  color: var(--muted);
}

.message {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff3cd;
  border: 2px solid #e6c200;
  border-radius: 10px;
  font-weight: 800;
}

.kept-note {
  margin-top: 8px;
  font-weight: 700;
  color: var(--hold);
}

#wheelWatchedNote {
  color: var(--watch);
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.store-grid .btn {
  min-height: 72px;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.not-needed {
  grid-column: 1 / -1;
  text-align: center;
  padding: 18px;
  background: #e5e9ef;
  border-radius: var(--radius);
  font-weight: 800;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 16px;
  max-width: 536px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #1b2330;
  color: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 40;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2.5rem;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
}

.osk {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 12px;
}

.osk-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 6px;
}

.osk-key {
  min-width: 34px;
  min-height: 48px;
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #f7f8fa;
  font-weight: 800;
  font-size: 1.05rem;
}

.osk-key.wide {
  flex: 2.2;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  .wheel-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

.install-coach {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 19, 24, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.install-card {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  color: var(--text);
  border-radius: 18px 18px 12px 12px;
  padding: 20px 18px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.install-card h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1.2;
}

.install-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 650;
  font-size: 1.05rem;
}

.install-step-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--primary);
}

.install-steps {
  margin: 0 0 14px;
  padding-left: 1.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  counter-reset: none;
}

.install-steps li {
  margin-bottom: 12px;
}

.install-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #fff3cd;
  border: 2px solid #e6c200;
  border-radius: 10px;
  font-weight: 800;
}

.install-block .btn {
  width: 100%;
  margin-bottom: 10px;
}

#installIosOtherBrowser .btn-primary {
  margin-top: 2px;
}

.install-card > .btn-skip {
  width: 100%;
  margin-top: 4px;
}

.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 45;
  max-width: 536px;
  margin: 0 auto;
  min-height: 56px;
  border: 0;
  border-radius: 14px;
  background: #0b6e4f;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}
