:root {
  color-scheme: light;
  --ink: #0b0b0b;
  --subtle: #6b6b6b;
  --line: #d8d8d8;
  --soft: #f4f4f1;
  --paper: #ffffff;
  --signal: #9b2f24;
  --olive: #50624a;
  --steel: #637281;
  --focus: #111111;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 104px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 58px;
  padding: 0 28px;
  border-bottom: 1px solid var(--ink);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand,
.nav a {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  font-size: 12px;
  text-transform: uppercase;
}

main {
  width: min(1520px, 100%);
  margin: 0 auto;
}

.overview {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 0.75fr);
  min-height: 430px;
  border-bottom: 1px solid var(--ink);
  scroll-margin-top: 104px;
}

.overview-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 430px;
  padding: 48px 28px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.88), rgba(255,255,255,0.52)),
    url("https://images.unsplash.com/photo-1485965120184-e220f721d03e?auto=format&fit=crop&w=1800&q=80") center / cover;
}

.kicker {
  margin: 0 0 10px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 0;
  font-size: clamp(36px, 7vw, 92px);
  font-weight: 500;
  line-height: 0.96;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 500;
  line-height: 1;
}

h3 {
  font-size: 18px;
  font-weight: 600;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-left: 1px solid var(--ink);
}

.stat-strip article {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 215px;
  padding: 24px;
  border-bottom: 1px solid var(--ink);
}

.stat-strip article:nth-child(odd) {
  border-right: 1px solid var(--ink);
}

.stat-strip span {
  display: block;
  font-size: clamp(32px, 5vw, 70px);
  line-height: 1;
}

.stat-strip p,
.muted {
  color: var(--subtle);
}

.section-grid {
  padding: 38px 28px 54px;
  border-bottom: 1px solid var(--ink);
  scroll-margin-top: 104px;
}

.section-heading {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: end;
  gap: 24px;
  margin-bottom: 26px;
}

.bike-layout,
.two-column,
.intake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
}

.bike-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-right: 0;
  border-bottom: 0;
}

.bike-card {
  min-width: 0;
  background: var(--paper);
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.bike-select {
  width: 100%;
  height: 100%;
  min-height: 300px;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
}

.bike-select img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--soft);
  filter: grayscale(0.15);
}

.bike-card.active .bike-select {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}

.bike-meta {
  display: grid;
  gap: 4px;
  padding: 14px;
}

.bike-meta strong {
  font-size: 16px;
  font-weight: 600;
}

.bike-meta small {
  color: var(--subtle);
}

.detail-panel,
.tool-panel,
.analysis-panel,
.table-shell {
  border: 1px solid var(--ink);
  background: var(--paper);
}

.detail-panel,
.analysis-panel {
  min-height: 300px;
}

.panel-header,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink);
}

.panel-header .kicker {
  margin-bottom: 0;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-size: 22px;
  line-height: 1;
}

.bike-detail-body {
  display: grid;
  gap: 18px;
  padding: 16px;
}

.bike-detail-body img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--soft);
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.detail-facts div {
  min-height: 78px;
  padding: 12px;
  background: var(--paper);
}

.detail-facts span {
  display: block;
  color: var(--subtle);
  font-size: 11px;
  text-transform: uppercase;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-button,
button[type="submit"],
#analyzeButton,
#commitDetected,
.detail-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.detail-actions button.secondary,
#commitDetected:disabled {
  background: var(--paper);
  color: var(--ink);
}

input[type="file"] {
  width: 100%;
}

.tool-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
  padding: 16px;
}

.tool-panel label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.tool-panel .wide,
.tool-panel button,
.tool-panel .segmented,
.tool-panel .file-drop,
.tool-panel .receipt-preview,
.tool-panel .muted {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

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

.log-list {
  display: grid;
  gap: 1px;
  align-content: start;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.log-entry,
.inventory-row,
.friend-card,
.detected-card {
  background: var(--paper);
}

.log-entry {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 18px;
  padding: 16px;
}

.log-entry time,
.inventory-row small {
  color: var(--subtle);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--ink);
  font-size: 11px;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-shell {
  min-width: 0;
}

.table-toolbar {
  flex-wrap: wrap;
}

.table-toolbar input {
  flex: 1 1 260px;
}

.table-toolbar select {
  flex: 0 1 190px;
}

.inventory-list {
  display: grid;
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 120px 100px 120px 120px;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.inventory-row:first-child {
  border-top: 0;
}

.inventory-row strong,
.detected-card strong {
  display: block;
  font-weight: 600;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--ink);
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--ink);
  color: var(--paper);
}

.file-drop {
  min-height: 92px;
  place-items: center;
  border: 1px dashed var(--ink);
  color: var(--ink);
}

.file-drop input {
  max-width: 240px;
  min-height: 0;
  border: 0;
  padding: 0;
}

.receipt-preview {
  display: none;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: var(--soft);
}

.receipt-preview.active {
  display: block;
}

.analysis-panel {
  display: flex;
  flex-direction: column;
}

.detected-empty {
  padding: 24px;
  color: var(--subtle);
}

.detected-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.detected-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
}

.friend-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.friend-card {
  min-height: 170px;
  padding: 16px;
}

.friend-card p {
  color: var(--subtle);
}

.friend-card .accent {
  display: block;
  width: 42px;
  height: 4px;
  margin-bottom: 28px;
  background: var(--olive);
}

.friend-card:nth-child(2) .accent {
  background: var(--signal);
}

.friend-card:nth-child(3) .accent {
  background: var(--steel);
}

.friend-card:nth-child(4) .accent {
  background: var(--ink);
}

.empty-state {
  padding: 20px;
  color: var(--subtle);
}

@media (max-width: 1180px) {
  .bike-wall,
  .friend-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bike-layout,
  .two-column,
  .intake-layout {
    grid-template-columns: 1fr;
  }

  .inventory-row {
    grid-template-columns: 1fr 110px 96px;
  }

  .inventory-row .hide-medium {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .nav {
    justify-content: flex-start;
    gap: 12px;
  }

  .overview {
    grid-template-columns: 1fr;
  }

  .overview-copy {
    min-height: 520px;
    padding: 32px 16px;
  }

  .stat-strip {
    border-left: 0;
  }

  .section-grid {
    padding: 30px 16px 44px;
  }

  .section-heading {
    display: block;
  }

  .bike-wall,
  .friend-board {
    grid-template-columns: 1fr;
  }

  .bike-select {
    min-height: 0;
  }

  .tool-panel {
    grid-template-columns: 1fr;
  }

  .detail-actions,
  .detail-facts {
    grid-template-columns: 1fr;
  }

  .log-entry,
  .inventory-row,
  .detected-card {
    grid-template-columns: 1fr;
  }

  .inventory-row .hide-medium {
    display: block;
  }
}
