/* ===== BERTBROS MOTO LOG — MOTOCROSS BOLD THEME ===== */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800;900&family=Barlow:wght@400;500;600&display=swap');

:root {
  --orange: #FF6B00;
  --orange-hot: #FF8C00;
  --yellow: #FFD600;
  --red: #E63232;
  --bg: #0D0D0D;
  --bg2: #161616;
  --bg3: #222222;
  --bg4: #2C2C2C;
  --border: #333333;
  --text: #F0F0F0;
  --text-dim: #888888;
  --text-muted: #555555;
  --success: #2ECC71;
  --radius: 6px;
  --header-h: 60px;
  --bottom-h: 68px;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
}

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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Diagonal stripe texture on bg */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    -55deg,
    transparent,
    transparent 40px,
    rgba(255,107,0,0.015) 40px,
    rgba(255,107,0,0.015) 41px
  );
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }

/* ===== HEADER ===== */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  /* Grow the header by the status-bar inset so iOS's clock/camera/battery
     sit over the header's own background instead of over the page content.
     The header's visible row stays at --header-h — only the top padding
     expands to reserve space for the notch/status bar. */
  height: calc(var(--header-h) + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 2px solid var(--orange);
  z-index: 100;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    0
    env(safe-area-inset-left);
}

.header-inner {
  max-width: 700px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-width: 0; }
.brand-icon svg { width: 36px; height: 36px; }
.brand-icon { flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1; gap: 2px; min-width: 0; }
.brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  color: var(--orange);
  letter-spacing: 1.2px;
  white-space: nowrap;
}
.brand-sub {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  white-space: nowrap;
}
/* Tighten on narrow phones (iPhone SE etc.) so headline + tagline +
   sync badge don't push the hamburger off-screen. */
@media (max-width: 360px) {
  .brand { gap: 6px; }
  .brand-icon svg { width: 30px; height: 30px; }
  .brand-name { font-size: 15px; letter-spacing: 0.8px; }
  .brand-sub  { font-size: 8px; letter-spacing: 1px; }
  #sync-badge { display: none; }
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--orange); background: var(--bg3); }
.icon-btn svg { width: 22px; height: 22px; }

/* ===== SIDE MENU ===== */
#menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  backdrop-filter: blur(2px);
}
#menu-overlay.open { display: block; }

#side-menu {
  position: fixed;
  top: 0; right: -280px;
  width: 280px;
  height: 100dvh;
  background: var(--bg2);
  border-left: 2px solid var(--orange);
  z-index: 300;
  transition: right 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  /* Reserve space for the iOS status bar at the top and home indicator at the bottom */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-y: auto;
}
#side-menu.open { right: 0; }

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--orange);
}

#side-menu ul { list-style: none; padding: 12px 0; }
#side-menu ul li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: background 0.15s, color 0.15s;
}
#side-menu ul li a:hover { background: var(--bg3); color: var(--orange); }
.menu-icon { font-size: 18px; }
.menu-divider { height: 1px; background: var(--border); margin: 8px 16px; }

/* ===== MAIN CONTENT ===== */
#main-content {
  flex: 1;
  /* Match the expanded header (height + status-bar inset) */
  margin-top: calc(var(--header-h) + env(safe-area-inset-top));
  /* Match the expanded bottom nav (height + home-indicator inset) */
  margin-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  overflow-y: auto;
  padding: 0;
}

/* ===== VIEWS ===== */
.view { display: none; max-width: 700px; margin: 0 auto; padding: 20px 16px 24px; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--text);
}

.back-btn {
  background: none;
  border: none;
  color: var(--orange);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 6px 0;
  transition: opacity 0.15s;
}
.back-btn:hover { opacity: 0.7; }

/* ===== BIKES GRID ===== */
.bikes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 500px) {
  .bikes-grid { grid-template-columns: 1fr 1fr; }
}

.bike-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}
.bike-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
}
.bike-card:hover { border-color: var(--orange); transform: translateY(-2px); }
.bike-card:active { transform: translateY(0); }

.bike-card-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.bike-card-sub {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.bike-card-hours-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}
.bike-card-hours {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
}
.bike-card-hours-label {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.bike-card-last {
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}
.bike-card-last strong { color: var(--text); }

/* Notes/needs callout under LAST SERVICE on dashboard cards. */
.bike-card-notes {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(255, 200, 50, 0.08);
  border-left: 3px solid var(--yellow);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  word-wrap: break-word;
}
.bike-card-notes-lbl {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--yellow);
  letter-spacing: 1.5px;
  margin-right: 6px;
}

/* + LOG button now sits inside the hours-row flex container — no
   absolute positioning, so a long bike name can't overlap it. */
.bike-card-log-btn {
  flex-shrink: 0;
  align-self: center;
  background: var(--orange);
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.bike-card-log-btn:hover { background: var(--yellow); }
.bike-card-log-btn:active { transform: scale(0.96); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.empty-state p { color: var(--text-dim); margin-bottom: 24px; }

/* ===== BIKE DETAIL ===== */
.bike-detail-header {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.bike-detail-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
}
.bike-detail-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 2px;
  /* Reserve room for the absolutely-positioned + LOG corner button */
  padding-right: 90px;
  word-break: break-word;
}
.bike-detail-sub {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.bike-stats-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.bike-stat { }
.bike-stat-val {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: var(--orange);
  line-height: 1;
}
.bike-stat-lbl {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

/* "+ LOG" badge in the upper-right of the bike detail header.
   Larger than the dashboard card version since the detail page has
   more breathing room — this is the primary action of the page. */
.bike-detail-log-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--orange);
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1.5px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  z-index: 1;
}
.bike-detail-log-btn:hover { background: var(--yellow); }
.bike-detail-log-btn:active { transform: scale(0.96); }

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-bottom: 12px;
  text-transform: uppercase;
}

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

.log-entry {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-entry-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.log-entry-date {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.log-entry-hours {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--orange);
}
.log-entry-hours span {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.log-entry-services { display: flex; flex-wrap: wrap; gap: 6px; }
.service-tag {
  background: rgba(255,107,0,0.15);
  border: 1px solid rgba(255,107,0,0.4);
  color: var(--orange);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 3px;
}
.log-entry-notes {
  font-size: 14px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
}
/* EDIT + delete button row at the bottom of each log entry */
.log-entry-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.log-edit-btn {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.log-edit-btn:hover { color: var(--orange); border-color: var(--orange); }
.log-delete-btn {
  margin-left: auto; /* push to right end of the actions row */
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}
.log-delete-btn:hover { color: var(--red); }

/* ===== FORMS ===== */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--orange);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

/* Service chips */
.service-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip:hover { border-color: var(--orange); color: var(--orange); }
.chip.selected {
  background: var(--orange);
  border-color: var(--orange);
  color: #000;
}

.custom-service-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.custom-service-row .form-input { flex: 1; }

.selected-services {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--orange);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 14px 24px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-transform: uppercase;
}
.btn-primary:hover { background: var(--yellow); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.btn-full { width: 100%; }
.btn-primary.btn-sm {
  font-size: 13px;
  padding: 8px 14px;
  letter-spacing: 1px;
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--orange); color: var(--orange); }

.btn-danger {
  background: rgba(230,50,50,0.15);
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgba(230,50,50,0.3); }
.btn-danger.btn-sm { font-size: 12px; padding: 6px 12px; }

/* ===== BIKES MANAGE LIST ===== */
.bikes-manage-list { display: flex; flex-direction: column; gap: 10px; }

.bike-manage-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px 12px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bike-manage-info {
  flex: 1;
  min-width: 0;
}
.bike-manage-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  word-break: break-word;
}
.bike-manage-sub {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.bike-manage-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Up/Down reorder buttons — vertical stack on the left edge of each
   manage-bikes row. First row's up and last row's down are disabled. */
.bike-manage-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  margin-right: 4px;
}
.bike-arrow-btn {
  width: 36px;
  height: 28px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.bike-arrow-btn:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--orange);
  color: var(--orange);
}
.bike-arrow-btn:active:not(:disabled) {
  background: var(--orange);
  color: #000;
}
.bike-arrow-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Drag-state styles below are vestigial from the previous drag-reorder
   attempt; not currently applied since reordering is now arrow-based.
   Kept to avoid breaking anything that referenced the class names. */
.bike-manage-item.dragging {
  background: var(--bg3);
  border-color: var(--orange);
}

/* ===== BOTTOM NAV ===== */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  /* Total height = visible nav row + the iOS home-indicator safe area.
     With box-sizing: border-box, padding-bottom would otherwise eat into
     the visible height, squashing the icons against the orange top border. */
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  background: var(--bg2);
  border-top: 2px solid var(--orange);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  /* More top padding so the icon clears the orange top border with breathing room */
  padding: 14px 0 8px;
  transition: color 0.15s;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active, .nav-btn:hover { color: var(--orange); }

.nav-center-btn {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  background: var(--orange);
  border-radius: 50%;
  color: #000 !important;
  margin-bottom: 12px;
  /* Override the inherited column layout + top/bottom padding so
     the single + glyph centers cleanly. */
  flex-direction: row;
  padding: 0;
  gap: 0;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255,107,0,0.5);
  transition: background 0.15s, transform 0.1s !important;
}
.nav-center-btn:hover { background: var(--yellow) !important; }
.nav-center-btn:active { transform: scale(0.92) !important; }
.plus-icon {
  /* Bold glyph, sized to feel substantial inside the 60px circle.
     line-height: 1 + flex centering keeps it true-centered. */
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
  /* Pull up by a hair — most +/× glyphs are designed slightly above
     the optical center to balance with descenders that don't exist here. */
  margin-top: -2px;
}

/* ===== TOAST ===== */
#toast {
  position: fixed;
  bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 1px solid var(--orange);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 20px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
  /* Allow long messages (e.g. sync error details) to wrap rather than
     overflow off-screen. Cap at viewport width with margin for safety. */
  max-width: calc(100vw - 32px);
  text-align: center;
  word-wrap: break-word;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== EDIT HOURS INLINE ===== */
/* Single full-width row: input takes available space, button matches
   input height. Result is a tidy aligned bar instead of a cluster of
   different-sized controls. */
.hours-edit-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-top: 18px;
}
.hours-edit-row .form-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 16px; /* >=16px so iOS doesn't zoom on focus */
}
.hours-edit-row .btn-secondary {
  flex: 0 0 auto;
  padding: 0 18px;
  font-size: 14px;
  white-space: nowrap;
}

/* ===== BIKE NOTES EDITOR (detail page) ===== */
.bike-notes-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.notes-textarea {
  width: 100%;
  resize: vertical;
  min-height: 70px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
}
.bike-notes-editor .btn-secondary { align-self: flex-start; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== RESPONSIVE ===== */
@media (min-width: 700px) {
  .view { padding: 28px 24px; }
  .view-title { font-size: 40px; }
}

/* ===== TORQUE SPECS ===== */
.torque-disclaimer {
  font-size: 13px;
  color: var(--yellow);
  background: rgba(255,214,0,0.08);
  border: 1px solid rgba(255,214,0,0.25);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.torque-bike-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.torque-bike-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(255,107,0,0.15), transparent);
  border-bottom: 2px solid var(--orange);
}

.torque-bike-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--orange);
}

.torque-bike-year {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.torque-section-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text-muted);
  padding: 10px 18px 6px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.torque-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.torque-table thead tr {
  background: rgba(255,107,0,0.06);
}

.torque-table th {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.torque-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  line-height: 1.3;
  vertical-align: top;
}

.torque-table tbody tr:last-child td { border-bottom: none; }

.torque-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.torque-table td:nth-child(1) { font-weight: 500; }
.torque-table td:nth-child(2) { font-family: monospace; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.torque-table td:nth-child(3) { font-family: var(--font-display); font-size: 15px; font-weight: 800; color: var(--orange); white-space: nowrap; }
.torque-table td:nth-child(4) { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text-dim); white-space: nowrap; }
.torque-table td:nth-child(5) { font-size: 12px; color: var(--text-muted); }

/* highlight critical rows */
.torque-table td:contains("⚡") { color: var(--yellow) !important; }

.torque-manual-link {
  display: block;
  padding: 12px 18px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--orange);
  text-decoration: none;
  border-top: 1px solid var(--border);
  background: rgba(255,107,0,0.05);
  transition: background 0.15s;
}
.torque-manual-link:hover { background: rgba(255,107,0,0.12); }

/* Responsive table scroll on small screens */
@media (max-width: 500px) {
  .torque-table { display: block; overflow-x: auto; white-space: nowrap; }
  .torque-table td:nth-child(5) { white-space: normal; min-width: 120px; }
}


/* ===== SYNC BADGE ===== */
.sync-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 10px;
  white-space: nowrap;
  transition: all 0.3s;
}
.sync-badge.synced  { background: rgba(46,204,113,0.15); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
.sync-badge.offline { background: rgba(136,136,136,0.15); color: var(--text-muted); border: 1px solid var(--border); }
.sync-badge.error   { background: rgba(230,50,50,0.15); color: var(--red); border: 1px solid rgba(230,50,50,0.3); }

/* ===== PIN MODAL ===== */
#pin-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  /* Scroll if content taller than viewport (e.g. keyboard open on iPhone SE).
     Top-aligned with padding rather than centered so the bottom button
     remains reachable by scrolling. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding:
    calc(40px + env(safe-area-inset-top))
    20px
    calc(40px + env(safe-area-inset-bottom))
    20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
}
.pin-box {
  position: relative;
  z-index: 9001;
  background: var(--bg2);
  border: 3px solid var(--orange);
  border-radius: 14px;
  padding: 32px 28px 28px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  /* Nudge toward vertical center when there's space — but flex-start
     parent means we fall back to top-aligned + scroll when there isn't. */
  margin-top: auto;
  margin-bottom: auto;
}
.pin-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--orange);
  margin-bottom: 6px;
}
.pin-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.5;
}
/* Four big digit boxes — DISPLAY ONLY. The real keyboard target is
   the single hidden <input> inside .pin-digits. */
.pin-digits {
  position: relative;
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
  cursor: text;
}
/* Hidden input — invisibly occupies the same area as the boxes so a
   stray tap in the label still focuses it. It's the thing iOS opens
   the numeric keyboard for. Kept visually undetectable but not
   display:none (iOS won't focus display:none inputs). */
.pin-hidden-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px; /* iOS won't zoom the page on focus for >= 16px */
  -webkit-appearance: none;
  appearance: none;
  z-index: 2;
}
.pin-hidden-input:focus { outline: none; }
.pin-digit {
  position: relative;
  width: 62px;
  height: 76px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: border-color 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.pin-digit.filled { border-color: rgba(255,107,0,0.5); color: var(--orange); }
/* When the hidden input has focus, the box that would receive the
   next digit gets a pulsing orange border as a visual caret. */
.pin-digit.caret {
  border-color: var(--orange);
  animation: pinCaretPulse 1s ease-in-out infinite;
}
@keyframes pinCaretPulse {
  0%, 100% { border-color: var(--orange); }
  50%      { border-color: rgba(255,107,0,0.35); }
}

.pin-btn {
  width: 100%;
  background: var(--orange);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 16px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.15s, transform 0.1s;
}
.pin-btn:hover { background: var(--yellow); }
.pin-btn:active { transform: scale(0.98); }
.pin-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.pin-cancel {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 8px;
  width: 100%;
  transition: color 0.15s;
}
.pin-cancel:hover { color: var(--text); }

.pin-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* My PIN display in menu */
.menu-pin {
  padding: 12px 20px;
  background: rgba(255,107,0,0.06);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.menu-pin-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.menu-pin-number {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--orange);
  display: block;
}

/* ===== FUEL MIX VIEW ===== */
/* Quick calculator — two side-by-side input fields (ratio, gallons)
   with a big result line beneath. Built to match the existing form-card
   look. */
.mix-calc-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.mix-calc-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mix-calc-lbl {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}
.mix-calc-field .form-input {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  padding: 10px 8px;
}
/* The "32:1" composite — number input + literal ":1" suffix */
.mix-ratio-input {
  position: relative;
  display: flex;
  align-items: center;
}
.mix-ratio-input .form-input {
  padding-right: 32px;
  text-align: right;
}
.mix-ratio-input span {
  position: absolute;
  right: 12px;
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dim);
}

.mix-result {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.mix-result strong {
  font-size: 26px;
  color: var(--orange);
  letter-spacing: 1.5px;
  margin-right: 4px;
}

/* Saved-mix preset cards */
.mix-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.mix-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--orange);
}
.mix-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mix-card-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text);
  word-break: break-word;
}
.mix-card-ratio {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--yellow);
  flex-shrink: 0;
}
.mix-card-result {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.mix-card-oz {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: var(--orange);
  letter-spacing: 1px;
}
.mix-card-of {
  font-size: 13px;
  color: var(--text-dim);
}
.mix-card-gal {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.mix-card-notes {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin: 4px 0 10px;
  word-break: break-word;
}
.mix-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mix-card-actions .btn-secondary,
.mix-card-actions .btn-danger {
  font-size: 12px;
  padding: 6px 12px;
}
