/* Installable app: install link, how-to sheet, offline banner, phone bottom bar */
.app-install { cursor: pointer; }
.app-tabs { display: none; }

/* How-to sheet */
.ce-pwa-sheet { position: fixed; inset: 0; z-index: 9999; background: rgba(15, 20, 27, .55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.ce-pwa-card { width: 100%; max-width: 420px; background: #fff; color: #1d2733; border-radius: 22px; padding: 24px 24px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); font: 15px/1.5 Inter, -apple-system, "Segoe UI", Roboto, sans-serif; margin-bottom: env(safe-area-inset-bottom); }
.ce-pwa-card h3 { font-size: 19px; margin: 0 0 12px; color: #1d2733; }
.ce-pwa-card ol { margin: 0 0 12px; padding-left: 22px; } .ce-pwa-card li { margin: 8px 0; }
.ce-pwa-card li svg { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: #0a7aff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ce-pwa-card p { color: #5d6878; margin: 0 0 16px; font-size: 14px; }
.ce-pwa-close { width: 100%; border: 0; border-radius: 999px; padding: 13px; font: 700 16px inherit; background: var(--brand, #2d3cf0); color: #fff; cursor: pointer; }
@media (min-width: 700px) { .ce-pwa-sheet { align-items: center; } }

/* Toast + offline banner */
.ce-pwa-toast, .ce-net { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 9998; background: #1d2733; color: #fff; padding: 11px 18px; border-radius: 999px; font: 600 14px Inter, -apple-system, sans-serif; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100% - 32px); text-align: center; }
.ce-net { background: #b42318; } .ce-net.ok { background: #1f7a45; }
@media (min-width: 901px) { .ce-pwa-toast, .ce-net { bottom: 24px; } }

/* Driver app header button */
.hdr-install { margin-left: auto; border: 1.5px solid currentColor; background: transparent; color: inherit; border-radius: 999px; padding: 7px 14px; font: 600 13px inherit; cursor: pointer; opacity: .9; }
@media (min-width: 900px) { header .hdr-install { margin-right: 8px; } }

/* Phone: 4 tabs + More; the full menu opens as a sheet */
@media (max-width: 900px) {
  html body.has-tabs .app-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: #121a24; padding: 0 0 env(safe-area-inset-bottom); box-shadow: 0 -4px 20px rgba(0, 0, 0, .12); }
  html body.has-tabs .app-tabs a, html body.has-tabs .app-tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; color: #8ea0b0; text-decoration: none; font: 600 11px Inter, -apple-system, sans-serif; background: none; border: 0; cursor: pointer; }
  html body.has-tabs .app-tabs .on { color: #fff; }
  html body.has-tabs .app-tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  html body.th-bright.has-tabs .app-tabs { background: #fff; border-top: 1px solid #e6eff5; box-shadow: 0 -4px 20px rgba(52, 60, 106, .06); }
  html body.th-bright.has-tabs .app-tabs a, html body.th-bright.has-tabs .app-tabs button { color: #9aa6b8; }
  html body.th-bright.has-tabs .app-tabs .on { color: var(--brand); }
  html body.th-dark.has-tabs .app-tabs { background: #151c25; border-top: 1px solid #232d3a; }

  html body.has-tabs .app-nav { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 4px; position: fixed !important; left: 8px !important; right: 8px !important; top: auto !important; width: auto !important; height: auto !important;
    bottom: calc(66px + env(safe-area-inset-bottom)) !important; max-height: 68vh; overflow-y: auto !important; overflow-x: hidden !important; padding: 12px !important; border-radius: 20px; z-index: 59;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3); transform: translateY(16px); opacity: 0; visibility: hidden; transition: opacity .18s, transform .18s, visibility .18s; }
  html body.has-tabs.nav-open .app-nav { transform: none; opacity: 1; visibility: visible; }
  html body.has-tabs .app-nav a { flex: none !important; flex-direction: column; justify-content: center; gap: 5px !important; padding: 12px 4px !important; font-size: 12px !important; text-align: center; border: 0 !important; border-radius: 14px !important; box-shadow: none !important; }
  html body.th-bright.has-tabs .app-nav { border: 1px solid #e6eff5 !important; }
  html body.th-bright.has-tabs .app-nav a.on { background: var(--brand-lt) !important; }
  html body.has-tabs.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 20, 27, .35); z-index: 58; }
  html body.has-tabs .app-main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}
/* Inside the installed app the header sits under the phone's status bar */
html.is-app .app-top { padding-top: calc(10px + env(safe-area-inset-top)); }

/* Phone header: logo + icons only, so nothing overflows */
@media (max-width: 600px) {
  html body .app-top { gap: 8px; padding-left: 12px !important; padding-right: 12px; height: auto; min-height: 58px; }
  html body .app-top .app-brand { min-width: 0; overflow: hidden; }
  html body .app-top .app-brand b { font-size: 16px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body .app-top .app-brand small { display: none; }
  html body .app-top img { height: 34px !important; }
  html body .app-top .more { gap: 6px; }
  html body .app-top .app-ic { width: 36px; height: 36px; }
  html body .app-top .app-av span { width: 34px; height: 34px; }
  html body .app-top a.app-ic[aria-label="Branding"] { display: none; }
}
@media (max-width: 380px) { html body .app-top .app-brand { display: none; } }
@media (max-width: 900px) {
  html body .hm-grid, html body .hm-kpis { grid-template-columns: minmax(0, 1fr) !important; }
  html body .hm-grid > *, html body .hm-kpis > * { min-width: 0; }
  html body .app-main { overflow-x: clip; }
}
