@font-face {
  font-family: Inter;
  src: url("/fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/Inter-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/Inter-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/Inter-Bold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --sun: #F9A432;
  --chrome: #c8c8c8;
  --card: #121212;
  --card-hi: #1a1a1a;
  --line: #2a2a2a;
  --line-bright: #3a3a3a;
  --text: #fff;
  --muted: #9a9a9a;
  --good: #22c55e;
  --good-hi: #16a34a;
  --bad: #FF3131;
  --wait: #F9A432;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
}

button, input, textarea {
  font: inherit;
  color: inherit;
  background: #000;
  border: 2px solid var(--line);
  border-radius: 0;
  touch-action: manipulation;
}

button {
  cursor: pointer;
  font-weight: 800;
}

img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.top {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 16px 16px 0;
}

.logo {
  width: 100%;
  max-width: 290px;
  margin: 0 auto 12px;
  background: #000;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.session-bar button {
  min-height: 36px;
  padding: 6px 10px;
  background: transparent;
  color: var(--text);
  border: 2px solid var(--line);
  font-size: 0.82rem;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
}

.tab {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--sun);
}

@media (max-width: 520px) {
  .tab {
    padding: 10px 8px;
    font-size: 0.8rem;
  }
}

.tab-secondary {
  font-weight: 600;
  opacity: 0.85;
}

.wrap {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 12px 16px 48px;
}

.banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  font-weight: 700;
}

.banner.good { border-color: var(--good); color: var(--good); }
.banner.bad { border-color: var(--bad); color: var(--bad); }

.section-head {
  margin: 4px 0 14px;
}

.section-head h1 {
  margin: 0 0 4px;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}


#view-fleet .section-head {
  text-align: center;
}

.fleet-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px;
  border-radius: 0;
}

@media (min-width: 640px) {
  .fleet-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

.fleet-stat {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 12px 14px;
  text-align: center;
}

.fleet-stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.fleet-stat-value {
  display: block;
  margin-top: 4px;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

/* Repair bin rows */
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  background: var(--card);
  border: 2px solid var(--line);
}

.row.tune-open {
  border-color: var(--line-bright);
}

.row.waiting_parts {
  border-left: 4px solid var(--wait);
}

.row.in_progress {
  border-left: 4px solid var(--chrome);
}

.row-main {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0;
  width: 100%;
  min-height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-weight: 400;
}

.row-bike {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  background: var(--card-hi);
  border-right: 2px solid var(--line);
  min-width: 0;
  text-align: center;
}

.row-bike-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--sun);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  text-align: center;
}

.row-issue {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 14px;
  min-width: 0;
}

.row-issue-text {
  font-weight: 600;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.row-issue-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Always-visible actions, equal-width row */
.row-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 2px solid var(--line);
  padding: 12px 14px 14px;
  background: #0a0a0a;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.action-row > * {
  min-width: 0;
}

.btn-fixed,
.btn-parts {
  width: 100%;
  min-height: 52px;
  padding: 10px 8px;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

.btn-fixed {
  background: var(--good);
  color: #000;
  border-color: var(--good);
}

.btn-fixed:active,
.btn-fixed:hover {
  background: var(--good-hi);
  border-color: var(--good-hi);
}

.btn-fixed.active {
  border-color: var(--sun);
  box-shadow: inset 0 0 0 2px var(--sun);
}

.btn-parts {
  background: #000;
  border-color: var(--wait);
  color: var(--wait);
}

.btn-parts.active {
  border-color: var(--sun);
  color: var(--text);
  background: #1a1208;
}

.parts-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border: 2px solid var(--wait);
}

.parts-panel[hidden] { display: none; }

.parts-panel-label {
  margin: 0;
  font-weight: 800;
  color: var(--wait);
  font-size: 0.9rem;
}

.parts-panel textarea {
  min-height: 88px;
  resize: vertical;
  background: #0a0a0a;
}

.btn-parts-submit {
  width: 100%;
  min-height: 52px;
  background: var(--wait);
  color: #000;
  border-color: var(--wait);
  font-size: 1.05rem;
}

.fixed-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border: 2px solid var(--good);
}

.fixed-panel[hidden] { display: none; }

.fixed-panel-label {
  margin: 0;
  font-weight: 800;
  color: var(--good);
  font-size: 0.9rem;
}

.fixed-panel-sub {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.85rem;
}

.fixed-panel textarea {
  min-height: 72px;
  resize: vertical;
  background: #0a0a0a;
}

.fixed-parts-list {
  max-height: min(52vh, 420px);
  min-height: 280px;
  gap: 10px;
  padding: 2px 2px 4px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.fixed-parts-list .tuneup-item {
  min-height: 52px;
  padding: 14px;
  gap: 12px;
}

.fixed-parts-list .tuneup-item input {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.btn-fixed-submit {
  width: 100%;
  min-height: 52px;
  background: var(--good);
  color: #000;
  border-color: var(--good);
  font-size: 1.05rem;
}

.btn-parts-ordered {
  width: 100%;
  min-height: 48px;
  background: #000;
  border-color: var(--chrome);
  color: var(--chrome);
}

.btn-parts-ordered:hover,
.btn-parts-ordered:focus-visible {
  border-color: var(--sun);
  color: var(--text);
}

.tune-dropdown {
  position: relative;
  min-width: 0;
}

.btn-tune-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #000;
  border-color: var(--chrome);
  color: var(--chrome);
}

.btn-tune-toggle.open {
  border-color: var(--sun);
  color: var(--text);
}

.btn-tune-label {
  font-weight: 800;
  text-align: left;
  line-height: 1.15;
  flex: 1;
  min-width: 0;
}

.btn-tune-chevron {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--sun);
  transition: transform 0.15s ease;
}

.btn-tune-toggle.open .btn-tune-chevron {
  transform: rotate(180deg);
}

.tune-menu {
  margin-top: 8px;
  padding: 12px;
  background: var(--card);
  border: 2px solid var(--sun);
}

.tune-menu[hidden] { display: none; }

.tune-menu-title {
  margin: 0 0 10px;
  font-weight: 800;
  color: var(--sun);
  font-size: 0.9rem;
}

.tuneup-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.tuneup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #0a0a0a;
  border: 2px solid var(--line);
  cursor: pointer;
  font-weight: 600;
}

.tuneup-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--sun);
}

.btn-tuneups {
  width: 100%;
  min-height: 48px;
  background: #000;
  border-color: var(--chrome);
  color: var(--chrome);
}

.empty {
  margin: 28px 0;
  color: var(--muted);
  text-align: center;
}

/* Fleet */
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 0 auto 16px;
}

.filter {
  width: 100%;
  min-height: 44px;
  padding: 10px 6px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.filter.active {
  border-color: var(--sun);
  color: var(--text);
  background: #1a1408;
}

.fleet {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fleet-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
  padding: 0;
  background: var(--card);
  border: 2px solid var(--line);
}

.fleet-row.has-parts-action {
  grid-template-columns: 1fr auto;
}

.fleet-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  font-weight: 400;
  cursor: pointer;
}

.fleet-row .btn-parts-ordered {
  width: auto;
  align-self: center;
  min-height: 40px;
  margin-right: 12px;
  padding: 8px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.fleet-name {
  font-weight: 800;
}

.fleet-detail {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 2px solid var(--line);
  white-space: nowrap;
}

.badge.ready {
  color: var(--good);
  border-color: var(--good);
}

.badge.in_shop {
  color: var(--chrome);
  border-color: var(--chrome);
}

.badge.waiting_parts {
  color: var(--wait);
  border-color: var(--wait);
}

.badge.fixed_recently {
  color: var(--muted);
  border-color: var(--line-bright);
}

/* Order parts */
.order-vendors {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 18px;
}

@media (min-width: 640px) {
  .order-vendors {
    grid-template-columns: 1fr 1fr;
  }
}

.order-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 14px;
}

.order-card-name,
.order-heading,
.order-group-name {
  margin: 0;
}

.order-card-name {
  font-size: 1.15rem;
}

.order-card-blurb {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  flex: 1;
}

.order-open,
.order-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 14px;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
  border-radius: 0;
}

.order-open {
  background: var(--sun);
  color: #000;
  border: 2px solid var(--sun);
}

.order-heading {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.order-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-group-name {
  color: var(--sun);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.order-link {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--line);
}

.order-note {
  margin-top: 18px;
  border: 2px solid var(--line);
  background: var(--card);
  border-radius: 0;
}

.order-note summary {
  min-height: 44px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
}

.order-note p {
  margin: 0;
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Forms / log */
.field {
  display: block;
  margin: 14px 0 8px;
  font-weight: 800;
  color: var(--sun);
  font-size: 0.9rem;
}

input, textarea {
  width: 100%;
  padding: 14px;
  background: var(--card);
}

.submit {
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  background: var(--sun);
  color: #000;
  border-color: var(--sun);
  font-size: 1.05rem;
}

.log-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.log-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.log-body {
  font-weight: 600;
}

/* Login leftovers */
.login-simple {
  width: min(100%, 400px);
  margin: 48px auto;
  padding: 0 16px;
}

.login-logo { margin-bottom: 20px; }

.login-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-form label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 800;
  color: var(--sun);
}

.login-form input {
  width: 100%;
  padding: 14px;
  background: var(--card);
}

.login-form label.login-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  font-weight: 700;
  color: var(--text);
}

.login-form label.login-remember input {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--sun);
}

.login-form button {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  background: var(--sun);
  color: #000;
  border-color: var(--sun);
}

@media (max-width: 520px) {
  .row-main { grid-template-columns: 34% 66%; }
  .row-bike-name { font-size: 0.95rem; }
  .btn-fixed,
  .btn-parts {
    font-size: 0.82rem;
    padding: 10px 6px;
  }

  .filter {
    font-size: 0.78rem;
    padding: 10px 4px;
    white-space: normal;
  }

  .fleet-row.has-parts-action {
    grid-template-columns: 1fr;
  }

  .fleet-row .btn-parts-ordered {
    width: calc(100% - 24px);
    margin: 0 12px 12px;
  }

  .fleet-main {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fleet-main .badge {
    justify-self: start;
  }
}


/* Fleet bike history sheet */
.fleet-row {
  width: 100%;
}

.fleet-row:hover,
.fleet-row:focus-within {
  border-color: var(--sun);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 40;
}

.bike-sheet[hidden],
.sheet-backdrop[hidden] {
  display: none !important;
}

.bike-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 720px);
  max-height: min(70vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 50;
  background: #0a0a0a;
  border: 2px solid var(--line-bright);
  border-bottom: 0;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.65);
  display: none;
}

.bike-sheet:not([hidden]) {
  display: block;
}

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

.sheet-title {
  margin: 0;
  font-size: 1.35rem;
  color: var(--sun);
}

.sheet-close {
  min-height: 40px;
  padding: 8px 14px;
  background: #000;
  border-color: var(--chrome);
  color: var(--chrome);
  font-size: 0.85rem;
}

.sheet-state {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.sheet-status,
.sheet-when {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.sheet-issue {
  margin: 0 0 8px;
  font-weight: 700;
}

.sheet-parts {
  margin: 0 0 12px;
  color: var(--wait);
  font-weight: 700;
}

.sheet-section {
  margin: 18px 0 10px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sun);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  padding: 12px 0 12px 12px;
  border-left: 3px solid var(--line-bright);
  border-bottom: 1px solid var(--line);
}

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

.timeline-item.type-created { border-left-color: var(--sun); }
.timeline-item.type-completed { border-left-color: var(--good); }
.timeline-item.type-parts { border-left-color: var(--wait); }
.timeline-item.type-parts_ordered { border-left-color: var(--sun); }
.timeline-item.type-status_change { border-left-color: var(--chrome); }
.timeline-item.type-tuneups { border-left-color: var(--chrome); }

.timeline-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.timeline-body {
  font-weight: 600;
}
