/* iPhone standalone shell: match the native safe areas and tab-bar clearance. */
:root {
  --side: max(16px, env(safe-area-inset-left));
  --tab-height: 52px;
}

html {
  /* Stop iOS from inflating short text blocks; this does not disable pinch zoom. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body, #app { min-height: 100%; min-height: 100dvh; width: 100%; max-width: 100%; }
html, body { overflow-x: hidden; }
body { min-height: 100dvh; }
.app-shell, .login-page { min-height: 100dvh; width: 100%; max-width: 100%; min-width: 0; }
.app-shell { padding-top: env(safe-area-inset-top); }
.login-page { padding: max(24px, env(safe-area-inset-top)) var(--side) max(24px, env(safe-area-inset-bottom)); }

.top {
  height: 52px;
  top: env(safe-area-inset-top);
  padding-left: var(--side);
  padding-right: var(--side);
}

.screen {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-top: 14px;
  gap: 12px;
  padding-left: var(--side);
  padding-right: var(--side);
  padding-bottom: calc(var(--tab-height) + 24px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(var(--tab-height) + 24px + env(safe-area-inset-bottom));
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: stretch;
  width: 100%;
  max-width: 100%;
  min-height: calc(var(--tab-height) + env(safe-area-inset-bottom));
  padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
}

.tabs button {
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  align-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tabs button span { min-width: 0; white-space: nowrap; }
.metrics, .metric, .card, .trip-card, .trip-main, .trip-heading, .trip-meta, .history-row, .location, .readiness { min-width: 0; max-width: 100%; }
.trip-main p, .history-row p, .route p, .spotlight p, .location span, .readiness p { overflow-wrap: anywhere; word-break: break-word; }

.tabs svg { width: 22px; height: 22px; display: block; fill: currentColor; }
.tabs button.selected, .tabs button.selected svg { color: #0a84ff; }
.toast { left: var(--side); right: var(--side); top: calc(env(safe-area-inset-top) + 68px); }

/* Home uses the same SVG icon system as the tab bar; avoid platform-dependent glyphs. */
.metric-icon { display: flex; align-items: center; height: 22px; color: #0877a5; }
.metric-icon svg { width: 20px; height: 20px; fill: currentColor; }
.home-label { display: inline-flex; align-items: center; gap: 6px; }
.home-label svg { width: 17px; height: 17px; fill: currentColor; color: #164d70; flex: 0 0 auto; }
.status-label svg { color: var(--green); }
.attention svg { width: 17px; height: 17px; fill: var(--orange); flex: 0 0 auto; }
.attention span { flex: 1; }

@media (max-width: 390px) {
  .screen { padding-left: var(--side); padding-right: var(--side); }
}
