/* ── Layout ── */
html, body { height: 100%; }

body {
  display: flex;
  justify-content: center;
  background: var(--color-neutral-300);
}

#app-shell {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  position: relative;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.page-content {
  padding: var(--space-4);
  padding-bottom: calc(72px + var(--space-4));
  overflow-y: auto;
  flex: 1;
}

.scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-4) calc(72px + var(--space-4));
}

/* ── Tab bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}

.tab-bar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 8px;
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--color-neutral-600);
  transition: color 0.15s;
}

.tab-bar a svg { stroke: currentColor; }

.tab-bar a.active,
.tab-bar a[aria-current="page"] {
  color: var(--color-accent);
}

/* ── Sticky header (title + filters) ── */
.sticky-header {
  padding: var(--space-4) var(--space-4) 0;
  background: var(--color-bg);
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.page-header h1 { margin: 0; font-size: 28px; }

/* ── Section title ── */
.section-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-neutral-600);
  margin: var(--space-6) 0 var(--space-3);
}

/* ── Card list ── */
.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Bus departure list ── */
.departure-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--color-divider);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.departure-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  font-size: 15px;
}

.departure-route {
  flex: 1;
  font-size: 13px;
  color: var(--color-neutral-600);
}

.departure-row.past { opacity: 0.45; }

.departure-time { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ── Filter strip (route/day chips) ── */
.filter-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: none;
  margin-bottom: var(--space-4);
}

.filter-strip::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-divider);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-surface);
  transition: background 0.1s, border-color 0.1s;
}

.chip.active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: transparent;
}

/* ── User avatar ── */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-bg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  user-select: none;
}

.user-avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
  margin: var(--space-4) auto var(--space-6);
}

.tab-bar-avatar-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 10px 0 8px;
}

.tab-bar-avatar-link .user-avatar {
  transition: box-shadow 0.15s;
}

.tab-bar-avatar-link.active .user-avatar,
.tab-bar-avatar-link[aria-current="page"] .user-avatar {
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-accent);
}

/* ── Profile notice ── */
.field-notice {
  font-size: 13px;
  color: var(--color-accent-2-700);
  background: var(--color-accent-2-100);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

/* ── Auth gate card ── */
.gate-card {
  border: 2px dashed var(--color-divider);
  background: var(--color-neutral-100);
}

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: calc(72px + var(--space-4));
  right: var(--space-4);
  z-index: 90;
}

/* ── Form page ── */
.form-section { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }

/* ── Home next bus ── */
.card.next-bus-card { background: var(--color-accent-700); color: #fff; }
.card.next-bus-card .card-kicker { color: rgba(255,255,255,0.65); }
.card.next-bus-card .card-title { font-size: 36px; color: #fff; }
.card.next-bus-card .card-meta { color: rgba(255,255,255,0.6); }
.card.next-bus-card .tag { background: rgba(0,0,0,0.25); color: #fff; border: none; }

/* ── Footer ── */
.app-footer {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  font-size: 13px;
  color: var(--color-neutral-600);
}

.app-footer .link-button {
  display: block;
  background: none;
  border: none;
  padding: 0;
  margin: 0 auto var(--space-4);
  font-size: inherit;
  color: var(--color-neutral-600);
  cursor: pointer;
  text-decoration: underline;
}