/* RoadRecord — app shell layout: header, screen stack, bottom nav. */

/* The `hidden` attribute must actually hide things.
   The UA stylesheet's [hidden] { display: none } is a plain attribute selector, so
   ANY class rule that sets display — .btn, .app — outranks it and the element stays
   on screen with el.hidden === true. That is how a dead "Continue" button ended up
   sitting on the sign-in slide: paint() hid it, .btn's display:inline-flex un-hid it,
   and its click handler is a no-op on that slide. Anything toggled via .hidden in JS
   depends on this rule. */
[hidden] { display: none !important; }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- Header ---- */

.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.hdr-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hdr-sub {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ---- Screens ---- */

.screens {
  flex: 1;
  min-height: 0;
}

.screen {
  display: none;
  padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.screen.active { display: block; }

.screen h2 {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 22px 0 10px;
}

.screen h2:first-child { margin-top: 0; }

/* ---- Bottom nav ---- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  min-width: 0;
  height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: 0;
  padding: 0 2px;
  color: var(--text-faint);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.14s ease;
}

.nav-btn.active { color: var(--accent); }

.nav-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Badge on a tab (e.g. vehicles needing an odometer reading). */
.nav-count {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ---- Modal / sheet ---- */

.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.62);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-back.open { display: flex; }

.sheet {
  width: 100%;
  max-width: 680px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line-strong);
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 20px);
  box-shadow: var(--shadow);
}

.sheet-title {
  font-size: 17px;
  font-weight: 650;
  margin: 0 0 4px;
}

.sheet-note {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 16px;
}

/* ---- Full-screen gate (onboarding / sign-in) ---- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.gate.open { display: flex; }

.gate-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) 22px
           calc(env(safe-area-inset-bottom) + 28px);
}
