/* Interface do passageiro (ui/shell/shell.js). Ativa com body.cb-on. */

:root {
    --cb-ink: #1F1A17;
    --cb-muted: #6B6058;
    --cb-line: #EEE9E4;
    --cb-soft: #F7F4F1;
    --cb-cacau: #8B4A0F;
    --cb-cacau-pale: #FBF3EA;
    --cb-alert: #C2410C;
    --cb-live: #1C6B3A;
    --cb-crowd: #9A3412;
    --cb-bg: #E5E3DF;
    --cb-surface: #FFFFFF;
    --cb-surface-2: #FFFFFF;
    --cb-edge: transparent;
    --cb-border: #E2DCD6;
    --cb-chip: #F2EEEA;
    --cb-hover: #F7F3EF;
    --cb-handle: #D6D0CA;
    --cb-off: #F3F0ED;
    --cb-dash: #B9AFA6;
    --cb-strong: #1F1A17;
    --cb-on-strong: #FFFFFF;
    --cb-on-cacau: #FFFFFF;
    --cb-banner-ico: #F2B57A;
    --cb-blue: #2563EB;
    --cb-blue-dot: #2563EB;
    --cb-kicker: #1D4ED8;
    --cb-ring: #FFFFFF;
    --cb-track: #D9E6F8;
    --cb-mine-ring: #F2E3D3;
    --cb-ok-bg: #E8F5EC;
    --cb-ok-fg: #14532D;
    --cb-info-bg: #EAF2FD;
    --cb-info-fg: #134E9C;
    --cb-glass: rgba(255, 255, 255, .58);
    --cb-glass-edge: rgba(255, 255, 255, .85);
    --cb-glow: .55;
    --cb-map-ink: #1F1A17;
    --cb-map-ink-on: #FFFFFF;
    --cb-float: 0 2px 10px rgba(0, 0, 0, .15);
    --cb-float-lg: 0 8px 28px rgba(0, 0, 0, .18);
    --cb-sheet-shadow: 0 -4px 20px rgba(0, 0, 0, .12);
    --cb-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    --cb-tabbar-h: 76px;
    --cb-safe-b: env(safe-area-inset-bottom, 0px);
    --cb-z: 1010;
}

/* Modo escuro AMOLED (ui/shell/theme.js): preto puro nas superfícies grandes, bordas no lugar das sombras */
:root[data-theme="dark"] {
    color-scheme: dark;
    --cb-ink: #F3EEE9;
    --cb-muted: #A39890;
    --cb-line: #24201D;
    --cb-soft: #161210;
    --cb-cacau: #E0954F;
    --cb-cacau-pale: #22150A;
    --cb-live: #4CC27A;
    --cb-crowd: #F08A4B;
    --cb-bg: #000000;
    --cb-surface: #000000;
    --cb-surface-2: #0E0C0B;
    --cb-edge: #24201D;
    --cb-border: #2E2824;
    --cb-chip: #1A1614;
    --cb-hover: #1A1614;
    --cb-handle: #3A332F;
    --cb-off: #0E0C0B;
    --cb-dash: #4A423D;
    --cb-strong: #F3EEE9;
    --cb-on-strong: #000000;
    --cb-on-cacau: #000000;
    --cb-banner-ico: #8B4A0F;
    --cb-blue: #6EA1F8;
    --cb-blue-dot: #3B82F6;
    --cb-kicker: #7DA7F7;
    --cb-track: #1B2A40;
    --cb-mine-ring: #3A2410;
    --cb-ok-bg: #0B1F12;
    --cb-ok-fg: #8FE0AE;
    --cb-info-bg: #0F1C30;
    --cb-info-fg: #9CC0FA;
    --cb-float: 0 0 0 1px #24201D;
    --cb-float-lg: 0 0 0 1px #24201D;
    --cb-sheet-shadow: 0 -1px 0 #24201D;
    --cb-shadow: 0 0 0 1px #24201D;
}
/* Mapa escuro (data-map, pode valer sem a interface escura): marcadores com contorno preto */
:root[data-map="dark"] {
    --cb-ring: #000000;
    --cb-glass: rgba(0, 0, 0, .55);
    --cb-glass-edge: rgba(255, 255, 255, .14);
    --cb-glow: .7;
    --cb-map-ink: #F3EEE9;
    --cb-map-ink-on: #000000;
}
/* Base escura: OSM invertido; o chão claro vira quase #000, ruas em grafite, água azul-noite */
.cb-tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(.72) contrast(1.35) saturate(.35); }
:root[data-map="dark"] .leaflet-container { background: #000; }
:root[data-map="dark"] .leaflet-control-attribution { background: rgba(0, 0, 0, .7) !important; color: #6E6660; }
:root[data-map="dark"] .leaflet-control-attribution a { color: #A39890; }
:root[data-map="dark"] .leaflet-tooltip { background: #0E0C0B; color: #F3EEE9; border-color: #2E2824; box-shadow: none; }
:root[data-map="dark"] .leaflet-tooltip-top::before { border-top-color: #2E2824; }
/* Troca ao vivo (às 18h e às 6h): transição curta nas cores */
.cb-theme-swap #cb-app *, .cb-theme-swap #cb-app { transition: background-color .3s, color .3s, border-color .3s !important; }
@media (prefers-reduced-motion: reduce) { .cb-theme-swap #cb-app * { transition: none !important; } }

/* A interface antiga continua no DOM (o admin e a camada oficial escrevem nela), só escondida. */
body.cb-on .menu-trigger,
body.cb-on .app-brand,
body.cb-on #lines-drawer,
body.cb-on .side-btns,
body.cb-on .bottom-ui,
body.cb-on #sidebar,
body.cb-on #sidebar-overlay { display: none !important; }
body.cb-on .leaflet-control-locate { display: none !important; }

#cb-app { display: none; }
body.cb-on #cb-app { display: block; font-family: 'DM Sans', system-ui, sans-serif; color: var(--cb-ink); }
#cb-app button { font-family: inherit; }
#cb-app [hidden] { display: none !important; }

/* Barra do topo */
.cb-top {
    position: fixed; top: 0; left: 0; right: 0; z-index: var(--cb-z);
    display: flex; gap: 8px; padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 0;
    pointer-events: none;
}
.cb-top > * { pointer-events: auto; }
.cb-search-wrap { flex: 1; min-width: 0; position: relative; }
.cb-searchbar {
    height: 50px; border-radius: 25px; border: 0; background: var(--cb-surface);
    display: flex; align-items: center; gap: 10px; padding: 0 8px 0 18px; color: var(--cb-muted);
    box-shadow: var(--cb-float); font-size: 16px; cursor: text;
}
.cb-searchbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; color: var(--cb-ink); }
.cb-searchbar input::placeholder { color: var(--cb-muted); }
.cb-searchbar input::-webkit-search-cancel-button { display: none; }
.cb-searchbar:focus-within { box-shadow: 0 0 0 2px var(--cb-accent, var(--cb-cacau)), var(--cb-float); }
#cb-q-clear { width: 36px; height: 36px; flex: none; border: 0; border-radius: 18px; background: var(--cb-chip); color: var(--cb-ink); font-size: 20px; line-height: 1; cursor: pointer; }
.cb-suggest {
    position: absolute; top: 58px; left: 0; right: 0; max-height: min(60vh, 440px); overflow-y: auto;
    background: var(--cb-surface); border-radius: 18px; box-shadow: var(--cb-float-lg); padding: 6px;
}
.cb-suggest-group { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cb-muted); }
.cb-suggest button { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; color: var(--cb-ink); font-size: 15px; }
.cb-suggest button:hover, .cb-suggest button[aria-selected="true"] { background: var(--cb-hover); }
.cb-suggest button span { display: flex; flex-direction: column; min-width: 0; }
.cb-suggest button small { color: var(--cb-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-suggest-pin { width: 32px; height: 32px; flex: none; border-radius: 16px; background: var(--cb-chip); display: flex; align-items: center; justify-content: center; color: var(--cb-muted); }
.cb-suggest-empty { padding: 16px 12px; color: var(--cb-muted); font-size: 14px; }
.cb-me-dot { width: 18px; height: 18px; border-radius: 9px; background: var(--cb-blue-dot); border: 3px solid var(--cb-ring); box-shadow: 0 0 0 2px rgba(37, 99, 235, .35), 0 1px 4px rgba(0, 0, 0, .3); box-sizing: border-box; }
.cb-round {
    width: 50px; height: 50px; flex: none; border-radius: 25px; border: 0; background: var(--cb-surface);
    color: var(--cb-blue); display: flex; align-items: center; justify-content: center;
    box-shadow: var(--cb-float); cursor: pointer;
}

#cb-locate-btn.is-locating svg { animation: cb-geo-blink 1.2s ease-in-out infinite; }
@keyframes cb-geo-blink { 50% { opacity: .3; } }

/* Card da localização: vidro flutuante no meio da tela */
#cb-geo {
    position: fixed; inset: 0; z-index: calc(var(--cb-z) + 3); pointer-events: none;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
#cb-geo[hidden] { display: none; }
.cb-geo-card {
    pointer-events: auto; width: min(300px, 100%); padding: 22px 20px 12px; border-radius: 24px; text-align: center;
    background: var(--cb-glass); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid var(--cb-glass-edge); box-shadow: 0 12px 40px rgba(0, 0, 0, .22); color: var(--cb-ink);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    animation: cb-geo-in .2s cubic-bezier(.2, .8, .2, 1);
}
.cb-geo-card b { font-size: 17px; line-height: 1.3; }
.cb-geo-card p { margin: 0 0 8px; font-size: 14px; line-height: 1.4; color: var(--cb-muted); }
.cb-geo-card .cb-btn { min-height: 48px; }
.cb-geo-ico {
    width: 48px; height: 48px; border-radius: 24px; margin-bottom: 4px; display: flex; align-items: center; justify-content: center;
    color: var(--cb-blue); background: var(--cb-info-bg);
}
.cb-geo-card[data-state="locating"] .cb-geo-ico svg { animation: cb-geo-blink 1.2s ease-in-out infinite; }
.cb-geo-card[data-state="denied"] .cb-geo-ico, .cb-geo-card[data-state="fail"] .cb-geo-ico { color: var(--cb-alert); background: var(--cb-cacau-pale); }
.cb-geo-link { background: none; border: 0; min-height: 44px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--cb-muted); cursor: pointer; }
@keyframes cb-geo-in { from { opacity: 0; transform: scale(.94); } }
@media (prefers-reduced-motion: reduce) { .cb-geo-card, .cb-geo-card svg, #cb-locate-btn svg { animation: none !important; } }

/* Avisos flutuantes (toast): dados extras que saíram dos cards; "está chegando" fica até fechar */
#cb-toasts {
    position: fixed; top: calc(72px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; z-index: calc(var(--cb-z) + 2);
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.cb-toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 14px; border-radius: 16px;
    background: var(--cb-strong); color: var(--cb-on-strong); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: 14px; line-height: 1.35;
    animation: cb-toast-in .22s cubic-bezier(.2, .8, .2, 1);
}
.cb-toast svg { color: var(--cb-banner-ico); flex: none; }
.cb-toast span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cb-toast small { font-size: 13px; opacity: .78; }
.cb-toast button { background: none; border: 0; color: inherit; font-size: 22px; width: 40px; height: 40px; flex: none; cursor: pointer; }
.cb-toast.is-sticky { padding-top: 12px; padding-bottom: 12px; }
@keyframes cb-toast-in { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .cb-toast, #cb-ask { animation: none; } }

/* Pedido de lotação/ar: flutua uma vez por embarque, com o card fechado */
#cb-ask {
    position: fixed; left: 12px; right: 12px; bottom: calc(var(--cb-tabbar-h) + var(--cb-safe-b) + 12px); z-index: var(--cb-z);
    max-width: 420px; margin: 0 auto; padding: 10px 12px 12px; border-radius: 20px;
    background: var(--cb-glass); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid var(--cb-glass-edge); box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    display: flex; flex-direction: column; gap: 8px; animation: cb-geo-in .2s cubic-bezier(.2, .8, .2, 1);
}
#cb-ask[hidden] { display: none; }
.cb-ask-head { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.cb-ask-head button { background: none; border: 0; color: var(--cb-muted); font-size: 22px; width: 36px; height: 36px; margin-right: -6px; cursor: pointer; }
#cb-ask .cb-seg { min-height: 40px; font-size: 13px; }

/* Selo "Ao vivo" (viagem) e busca recolhida: só no celular, no lugar da barra de busca */
.cb-live-pill, #cb-q-open { display: none; }
.cb-live-pill {
    flex: 1; min-width: 0; height: 50px; border-radius: 25px; border: 0; padding: 0 16px 0 14px;
    align-items: center; gap: 8px; background: var(--cb-alert); color: #FFFFFF; box-shadow: var(--cb-float);
    font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.cb-live-pill .cb-badge { height: 24px; min-width: 34px; font-size: 13px; }
.cb-live-pill .cb-grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-live-dot { width: 8px; height: 8px; flex: none; border-radius: 4px; background: #FFFFFF; animation: cb-geo-blink 1.4s ease-in-out infinite; }
@media (max-width: 899px) {
    #cb-app[data-focus]:not([data-search]) .cb-search-wrap { display: none; }
    #cb-app[data-focus]:not([data-search]) #cb-q-open { display: flex; margin-left: auto; color: var(--cb-ink); }
    #cb-app[data-focus="ride"]:not([data-search]) .cb-live-pill { display: flex; }
}

/* Painel deslizante */
#cb-sheet {
    position: fixed; left: 0; right: 0; bottom: calc(var(--cb-tabbar-h) + var(--cb-safe-b)); z-index: var(--cb-z);
    background: var(--cb-surface); border-radius: 24px 24px 0 0; box-shadow: var(--cb-sheet-shadow);
    display: flex; flex-direction: column; transition: height .25s cubic-bezier(.4, 0, .2, 1);
    max-width: 640px; margin: 0 auto;
}
#cb-sheet[data-size="half"] { height: min(46vh, 460px); }
/* Do tamanho do conteúdo (acompanhar, ônibus, viagem): o card é curto e o resto da tela é mapa */
#cb-sheet[data-size="fit"] { height: auto; max-height: min(46vh, 420px); }
#cb-sheet[data-size="fit"] #cb-sheet-body { flex: 0 1 auto; }
/* Fechado: desce para trás da barra inferior, sobra só o mapa e a barra */
#cb-sheet[data-size="closed"] {
    height: min(46vh, 460px); transform: translateY(calc(100% + var(--cb-tabbar-h) + var(--cb-safe-b)));
    visibility: hidden; transition: transform .25s cubic-bezier(.4, 0, .2, 1), visibility 0s .25s;
}
#cb-sheet { transition: height .25s cubic-bezier(.4, 0, .2, 1), transform .25s cubic-bezier(.4, 0, .2, 1); touch-action: pan-y; }
#cb-handle { touch-action: none; }
/* Em telas baixas o painel não cobre a busca do topo */
#cb-sheet[data-size="closed"], #cb-sheet[data-size="half"] {
    max-height: calc(100% - var(--cb-tabbar-h) - var(--cb-safe-b) - 76px - env(safe-area-inset-top, 0px));
}
#cb-sheet[data-size="full"] { height: calc(100% - var(--cb-tabbar-h) - var(--cb-safe-b) - 24px - env(safe-area-inset-top, 0px)); }
#cb-handle {
    flex: none; height: 22px; border: 0; background: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
#cb-handle::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--cb-handle); }
#cb-sheet-body {
    flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 14px;
    display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain;
}
#cb-sheet-body h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.25; }
#cb-sheet-body p { margin: 0; }

/* Barra inferior */
.cb-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--cb-z) + 1);
    height: calc(var(--cb-tabbar-h) + var(--cb-safe-b)); padding-bottom: var(--cb-safe-b);
    background: var(--cb-surface); border-top: 1px solid var(--cb-line);
    display: flex; align-items: center; justify-content: space-around;
}
.cb-tab {
    background: none; border: 0; min-width: 56px; min-height: 48px; display: flex; flex-direction: column;
    align-items: center; gap: 3px; color: var(--cb-muted); font-size: 11px; font-weight: 600; cursor: pointer;
}
.cb-tab.active { color: var(--cb-cacau); }
.cb-center {
    height: 48px; padding: 0 16px; border-radius: 24px; display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; cursor: pointer; transition: background .2s, box-shadow .2s;
}
.cb-center-off { border: 1px dashed var(--cb-dash); background: var(--cb-off); color: var(--cb-muted); cursor: default; }
.cb-center-on { border: 0; background: var(--cb-alert); color: #FFFFFF; box-shadow: 0 0 0 6px rgba(194, 65, 12, .18); animation: cb-pulse 1.6s infinite; }
.cb-center-live { border: 2px solid var(--cb-alert); background: var(--cb-surface); color: var(--cb-alert); }
@keyframes cb-pulse { 50% { box-shadow: 0 0 0 10px rgba(194, 65, 12, .08); } }
@media (prefers-reduced-motion: reduce) { .cb-center-on { animation: none; } #cb-sheet { transition: none; } }

/* Peças do painel */
.cb-sheet-head { display: flex; align-items: center; gap: 10px; }
.cb-sheet-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cb-kicker { font-size: 12px; font-weight: 600; color: var(--cb-kicker); }
.cb-muted { color: var(--cb-muted); }
.cb-small { font-size: 13px; }
.cb-strong { font-weight: 700; }
.cb-grow { flex: 1; min-width: 0; }
.cb-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-section { font-size: 13px; font-weight: 700; color: var(--cb-muted); margin-top: 6px !important; }
.cb-empty { padding: 16px; border-radius: 12px; background: var(--cb-soft); color: var(--cb-muted); font-size: 14px; line-height: 1.5; }

.cb-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 30px; padding: 0 8px;
    border-radius: 8px; font-size: 14px; font-weight: 700; flex: none;
}
.cb-badge-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--cb-muted); font-weight: 700; }

.cb-list { display: flex; flex-direction: column; gap: 6px; }
.cb-row {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; min-height: 56px;
    border-radius: 12px; border: 1px solid var(--cb-line); background: var(--cb-surface-2); color: var(--cb-ink);
    text-align: left; cursor: pointer;
}
.cb-row:hover { background: var(--cb-cacau-pale); }
.cb-row:focus-visible, .cb-btn:focus-visible, .cb-pill:focus-visible, .cb-tab:focus-visible, .cb-center:focus-visible { outline: 3px solid var(--cb-blue); outline-offset: 2px; }
/* Perfil da parada (a nota fica numa pílula no cabeçalho do ponto) */
.cb-save { margin: 0 -10px 0 0; color: var(--cb-muted); }
.cb-save.on { color: var(--cb-cacau); }
.cb-save.on svg { fill: currentColor; }
.cb-stop-photo { margin: 12px 0 0; border-radius: 16px; overflow: hidden; background: var(--cb-chip); }
.cb-stop-photo button { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; }
.cb-stop-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
/* Foto aberta: flutua no meio da tela, sem borda, cantos arredondados; qualquer toque fecha */
#cb-photo {
    position: fixed; inset: 0; z-index: calc(var(--cb-z) + 4); padding: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    animation: cb-photo-fade .18s ease-out;
}
#cb-photo[hidden] { display: none; }
#cb-photo button { padding: 0; border: 0; background: none; cursor: zoom-out; display: flex; max-width: 100%; max-height: 100%; }
#cb-photo img {
    display: block; max-width: min(100%, 900px); max-height: calc(100vh - 32px); width: auto; height: auto;
    border-radius: 20px; object-fit: contain; box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
    animation: cb-geo-in .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes cb-photo-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #cb-photo, #cb-photo img { animation: none; } }
.cb-stop-score { display: flex; align-items: center; gap: 14px; margin: 14px 0 6px; }
.cb-stop-score b {
    width: 56px; height: 56px; flex: none; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; background: var(--cb-ok-bg); color: var(--cb-ok-fg);
}
.cb-stop-score[data-level="mid"] b { background: var(--cb-cacau-pale); color: var(--cb-cacau); }
.cb-stop-score[data-level="low"] b { background: var(--cb-cacau-pale); color: var(--cb-alert); }
.cb-stop-score span { display: flex; flex-direction: column; }
.cb-stop-score strong { font-size: 17px; }
.cb-stop-score small { font-size: 13px; color: var(--cb-muted); }
.cb-feat { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cb-feat li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--cb-soft); font-size: 13px; line-height: 1.3; }
.cb-feat li > span:first-child { font-weight: 800; color: var(--cb-live); }
.cb-feat li.is-no { color: var(--cb-muted); }
.cb-feat li.is-no > span:first-child { color: var(--cb-dash); }
.cb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 340px) { .cb-feat { grid-template-columns: 1fr; } }

.cb-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cb-row-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-row-eta { display: flex; flex-direction: column; align-items: flex-end; font-size: 17px; font-weight: 700; color: var(--cb-cacau); white-space: nowrap; }
.cb-row-eta small { font-size: 11px; font-weight: 500; color: var(--cb-muted); }
.cb-row-eta-muted { color: var(--cb-muted); }
.cb-src { font-size: 12px; font-weight: 600; color: var(--cb-muted); }
.cb-src-live { color: var(--cb-live); }
.cb-src-crowd { color: var(--cb-crowd); }
.cb-stop-ico { width: 36px; height: 36px; border-radius: 18px; background: var(--cb-soft); color: var(--cb-cacau); display: flex; align-items: center; justify-content: center; flex: none; }

.cb-pill {
    height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--cb-border); background: var(--cb-surface-2);
    font-size: 13px; font-weight: 600; color: var(--cb-ink); cursor: pointer; flex: none;
}
.cb-pill-accent { background: var(--cb-cacau); border-color: var(--cb-cacau); color: var(--cb-on-cacau); }
.cb-pill-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.cb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cb-icon-btn { width: 44px; height: 44px; flex: none; border-radius: 22px; border: 0; background: none; display: flex; align-items: center; justify-content: center; color: var(--cb-ink); cursor: pointer; margin-left: -10px; }

.cb-btn {
    width: 100%; min-height: 52px; border-radius: 14px; border: 0; font-size: 16px; font-weight: 700;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; flex: none;
}
.cb-btn small { font-size: 12px; font-weight: 500; }
.cb-btn-dark { background: var(--cb-strong); color: var(--cb-on-strong); }
.cb-btn-light { background: var(--cb-surface-2); color: var(--cb-ink); border: 1px solid var(--cb-border); }
.cb-btn-off { background: var(--cb-off); color: var(--cb-muted); border: 1px dashed var(--cb-dash); cursor: default; }
.cb-btn-board { background: var(--cb-alert); color: #FFFFFF; flex-direction: row; gap: 10px; min-height: 58px; font-size: 17px; box-shadow: 0 0 0 6px rgba(194, 65, 12, .18); }
.cb-link { align-self: center; background: none; border: 0; color: var(--cb-muted); font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cb-link:hover { color: var(--cb-ink); }

.cb-eta-block { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.cb-eta-block > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cb-eta-block > .cb-eta-side { align-items: flex-end; flex: none; }
.cb-eta-big { font-size: 34px; font-weight: 700; line-height: 1; }
.cb-big { margin: 0; font-size: 18px; }

.cb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cb-chip { border: 1px solid var(--cb-border); border-radius: 14px; padding: 4px 10px; font-size: 12px; }

.cb-toggle { display: flex; align-items: center; gap: 12px; background: var(--cb-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.cb-toggle svg { color: var(--cb-cacau); flex: none; }
.cb-toggle span { flex: 1; }
.cb-toggle input { width: 22px; height: 22px; accent-color: var(--cb-cacau); }

.cb-live-head { display: flex; align-items: center; gap: 10px; background: var(--cb-alert); color: #FFFFFF; border-radius: 14px; padding: 8px 10px 8px 14px; font-weight: 700; font-size: 14px; }
.cb-callout { display: flex; flex-direction: column; gap: 6px; background: var(--cb-ok-bg); border-radius: 14px; padding: 14px; color: var(--cb-ok-fg); font-size: 14px; line-height: 1.45; }
.cb-callout strong { font-size: 16px; }
.cb-callout .cb-btn { margin-top: 6px; }
.cb-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; min-width: 0; }
.cb-kv span { color: var(--cb-muted); }
.cb-group { display: flex; flex-direction: column; gap: 8px; }
.cb-segs { display: flex; gap: 8px; }
.cb-seg { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--cb-border); background: var(--cb-surface-2); color: var(--cb-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.cb-seg.on { background: var(--cb-strong); color: var(--cb-on-strong); border-color: var(--cb-strong); }



.cb-timeline { list-style: none; margin: 0; padding: 0; }
.cb-timeline li { position: relative; padding-left: 28px; }
.cb-timeline li::before { content: ''; position: absolute; left: 9px; top: 0; bottom: 0; width: 4px; background: #1D6FD6; opacity: .8; }
.cb-timeline li:first-child::before { top: 22px; }
.cb-timeline li:last-child::before { bottom: calc(100% - 22px); }
.cb-timeline button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; background: none; border: 0; padding: 0; text-align: left; color: var(--cb-ink); cursor: pointer; }
.cb-tl-dot { position: absolute; left: 4px; width: 14px; height: 14px; border-radius: 7px; background: var(--cb-surface); border: 3px solid #1D6FD6; box-sizing: border-box; }
.cb-tl-name { flex: 1; min-width: 0; font-size: 14px; }
.cb-tl-eta { font-size: 13px; font-weight: 600; color: var(--cb-muted); white-space: nowrap; }
.cb-timeline .cb-mine .cb-tl-name { color: var(--cb-cacau); font-weight: 700; }
.cb-timeline .cb-mine .cb-tl-dot { left: 2px; width: 18px; height: 18px; border-radius: 9px; background: var(--cb-cacau); border-color: var(--cb-mine-ring); }
.cb-bus-chip { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 8px; background: var(--cb-info-bg); color: var(--cb-info-fg); font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; }

.cb-search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--cb-soft); color: var(--cb-muted); }
.cb-search input { flex: 1; min-width: 0; border: 0; background: none; font-size: 16px; color: var(--cb-ink); outline: none; font-family: inherit; }

.cb-account { display: flex; align-items: center; gap: 12px; }
.cb-account img { border-radius: 22px; }
.cb-account .cb-grow { display: flex; flex-direction: column; }

/* Marcadores do mapa */
.cb-crowd-icon { background: none; border: 0; }
.cb-crowd-pin {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 40px; height: 26px; padding: 0 8px;
    border: 2px dashed var(--cb-ring); border-radius: 10px; font-size: 12px; font-weight: 700; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); white-space: nowrap;
}
.cb-me-pin { background: var(--cb-alert); color: #FFFFFF; border-style: solid; height: 28px; box-shadow: 0 0 0 8px rgba(194, 65, 12, .2); }
.cb-me-pin svg { width: 14px; height: 14px; }

/* Globos dos ônibus (ui/shell/busLayer.js) */
.cb-bus-icon { background: none; border: 0; }
.cb-bus {
    position: relative; width: 36px; height: 36px; margin: 4px; border-radius: 50%;
    background: var(--bg); color: var(--fg); border: 3px solid var(--cb-ring); box-sizing: border-box;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(31, 26, 23, .35); font: 800 13px/1 'DM Sans', system-ui, sans-serif; letter-spacing: -.02em;
    transition: transform .15s;
}
.cb-bus.is-crowd { border-style: dashed; }
/* Halo de situação (pontualidade): anel + brilho na cor, em volta do globo */
.cb-bus.st-ok { --halo: 28, 107, 58; }
.cb-bus.st-late { --halo: 217, 164, 0; }
.cb-bus.st-verylate { --halo: 194, 65, 12; }
.cb-bus.st-early { --halo: 29, 78, 216; }
.cb-bus.st-ok, .cb-bus.st-late, .cb-bus.st-verylate, .cb-bus.st-early {
    box-shadow: 0 0 0 3px rgb(var(--halo)), 0 0 12px 5px rgba(var(--halo), var(--cb-glow)), 0 2px 6px rgba(31, 26, 23, .35);
}
.cb-bus.is-sel { transform: scale(1.22); box-shadow: 0 0 0 4px rgba(139, 74, 15, .35), 0 3px 10px rgba(31, 26, 23, .4); }
.cb-bus.is-sel.st-ok, .cb-bus.is-sel.st-late, .cb-bus.is-sel.st-verylate, .cb-bus.is-sel.st-early {
    box-shadow: 0 0 0 3px rgb(var(--halo)), 0 0 16px 8px rgba(var(--halo), .6), 0 3px 10px rgba(31, 26, 23, .4);
}
.cb-bus-num { position: relative; z-index: 1; }
/* Seta de direção: triângulo escuro com contorno branco, por fora do globo */
.cb-bus-dir { position: absolute; inset: -13px; pointer-events: none; }
.cb-bus-dir::before {
    content: ''; position: absolute; left: 50%; top: 0; transform: translateX(-50%);
    border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 11px solid var(--cb-map-ink);
    filter: drop-shadow(0 0 1px var(--cb-ring)) drop-shadow(0 0 1px var(--cb-ring)) drop-shadow(0 1px 1px rgba(0, 0, 0, .3));
}
/* Grupo de globos sobrepostos: vidro fosco com as linhas, sem contagem */
.cb-bus-group {
    width: 100%; height: 100%; box-sizing: border-box; padding: 5px; border-radius: 16px;
    background: var(--cb-glass); -webkit-backdrop-filter: blur(10px) saturate(1.8); backdrop-filter: blur(10px) saturate(1.8);
    border: 1.5px solid var(--cb-glass-edge); box-shadow: 0 4px 14px rgba(31, 26, 23, .25);
    display: grid; grid-template-columns: repeat(var(--cols, 2), auto); gap: 3px; align-content: center; justify-content: center;
    font: 800 11px/1 'DM Sans', system-ui, sans-serif;
}
.cb-bus-group i { font-style: normal; min-width: 24px; padding: 4px 5px; border-radius: 7px; text-align: center; box-shadow: 0 1px 2px rgba(31, 26, 23, .25); }
/* Quantidade (grupos com mais de 4 ônibus): escura e com ícone, diferente de um número de linha */
.cb-bus-group i.more { display: inline-flex; align-items: center; justify-content: center; gap: 2px; background: var(--cb-map-ink); color: var(--cb-map-ink-on); }

/* Telas largas: painel à esquerda */
@media (min-width: 900px) {
    #cb-sheet { left: 16px; right: auto; width: 420px; margin: 0; bottom: calc(var(--cb-tabbar-h) + 16px); border-radius: 20px; }
    #cb-sheet[data-size="half"], #cb-sheet[data-size="closed"] { height: min(56vh, 520px); }
    #cb-toasts { right: auto; width: 428px; left: 16px; }
    #cb-ask { left: 16px; right: auto; width: 420px; margin: 0; bottom: calc(var(--cb-tabbar-h) + 16px); }
    #cb-sheet[data-size="full"] { height: calc(100% - var(--cb-tabbar-h) - 100px); }
    .cb-top { right: auto; width: 452px; }
}

@media (prefers-reduced-motion: reduce) { #cb-sheet, #cb-sheet[data-size="closed"] { transition: none; } }

/* Avisos por cima do app (painel › Funcionalidades): manutenção, mapa desligado, versão antiga */
.cb-blocker { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(31, 26, 23, .55); backdrop-filter: blur(4px); }
.cb-blocker-card { width: 100%; max-width: 360px; background: var(--cb-surface); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 10px; text-align: center; font-family: 'DM Sans', system-ui, sans-serif; color: var(--cb-ink); border: 1px solid var(--cb-edge); }
.cb-blocker-card strong { font-size: 18px; }
.cb-blocker-card p { margin: 0; color: var(--cb-muted); line-height: 1.5; }
.cb-blocker + .cb-blocker { display: none; }

/* Você › Aparência: estilos de mapa em fichas compactas */
.cb-maps { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-opt {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px; border-radius: 20px;
    border: 1px solid var(--cb-border); background: var(--cb-surface-2); color: var(--cb-ink);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.cb-opt.on { border-color: var(--cb-cacau); box-shadow: inset 0 0 0 1px var(--cb-cacau); }
.cb-opt:focus-visible { outline: 3px solid var(--cb-blue); outline-offset: 2px; }
.cb-opt i { width: 28px; height: 28px; flex: none; border-radius: 14px; border: 1px solid var(--cb-border); }
.cb-sw-osm { background: linear-gradient(135deg, #F2EFE9 0 40%, #FCD6A4 40% 52%, #F2EFE9 52% 70%, #AAD3DF 70%); }
.cb-sw-liberty { background: linear-gradient(135deg, #F8F4F0 0 45%, #FFFFFF 45% 55%, #D8E8C8 55% 72%, #9FC6E8 72%); }
.cb-sw-bright { background: linear-gradient(135deg, #F8F4F0 0 42%, #FDB462 42% 54%, #E0EDC8 54% 72%, #A0C8F0 72%); }
.cb-sw-opnv { background: linear-gradient(135deg, #EDEDED 0 40%, #3070D0 40% 48%, #EDEDED 48% 60%, #D03030 60% 66%, #B5D0D0 66%); }
.cb-sw-hybrid { background: linear-gradient(135deg, #2F3A24 0 38%, #E8C9A0 38% 46%, #4A5235 46% 66%, #0E2A3A 66%); }
.cb-sw-amoled { background: linear-gradient(135deg, #000 0 42%, #3D3631 42% 52%, #000 52% 70%, #06101A 70%); }
.cb-sw-dark { background: linear-gradient(135deg, #0C0C0C 0 42%, #2A2A2A 42% 52%, #0C0C0C 52% 70%, #1B1B1D 70%); }
.cb-sw-fiord { background: linear-gradient(135deg, #45516E 0 42%, #6B7A99 42% 52%, #45516E 52% 70%, #38435C 70%); }

/* Abas da barra inferior (Linhas, Salvos, Você): sem a busca do topo repetida, linhas de uma linha só */
#cb-sheet[data-size="auto"] {
    height: auto; max-height: calc(100% - var(--cb-tabbar-h) - var(--cb-safe-b) - 24px - env(safe-area-inset-top, 0px));
}
#cb-sheet[data-size="auto"] #cb-sheet-body { flex: 0 1 auto; }
.cb-row-sm { min-height: 48px; padding: 8px 12px; gap: 10px; }
.cb-row-sm .cb-stop-ico { width: 30px; height: 30px; }
.cb-row-sm .cb-src { flex: none; }
.cb-bus-chip svg { width: 13px; height: 13px; }
.cb-empty svg { width: 16px; height: 16px; vertical-align: -3px; }
@media (max-width: 899px) {
    #cb-app:not([data-tab="map"]) .cb-top { display: none; }
    #cb-app:not([data-tab="map"]) #cb-toasts { top: calc(12px + env(safe-area-inset-top, 0px)); }
}
/* A busca de Linhas fica presa no topo ao rolar a lista */
.cb-search { position: sticky; top: 0; z-index: 1; flex: none; box-shadow: 0 -12px 0 6px var(--cb-surface); }

/* ============================================================
   Vidro sobre o mapa (painel › App do passageiro › Aparência; config/appearance.js)
   <html data-glass="cards toasts chrome"> diz onde vale; vazio = tudo sólido.
   Intensidade: --cb-glass-a-light / --cb-glass-a-dark (opacidade) e --cb-glass-b (desfoque).
   O vidro segue o tema da interface (data-theme), não o do mapa: o texto fica
   escuro no vidro claro e claro no vidro escuro, também em "só o mapa".
   Vale também nas telas cheias (Linhas, tela da linha): o mapa aparece desfocado atrás.
   ============================================================ */
:root {
    --cb-glass-ui: rgba(255, 255, 255, var(--cb-glass-a-light, .72));
    --cb-glass-ui-edge: rgba(255, 255, 255, .9);
    --cb-glass-row: rgba(255, 255, 255, .55);
    --cb-glass-row-edge: rgba(31, 26, 23, .08);
    --cb-glass-soft: rgba(31, 26, 23, .05);
    --cb-glass-blur: blur(var(--cb-glass-b, 22px)) saturate(1.8);
}
:root[data-theme="dark"] {
    --cb-glass-ui: rgba(0, 0, 0, var(--cb-glass-a-dark, .62));
    --cb-glass-ui-edge: rgba(255, 255, 255, .14);
    --cb-glass-row: rgba(255, 255, 255, .06);
    --cb-glass-row-edge: rgba(255, 255, 255, .1);
    --cb-glass-soft: rgba(255, 255, 255, .06);
}

/* Cards: o de baixo (exceto tela cheia), a pergunta de lotação e o da localização */
:root[data-glass~="cards"] :is(#cb-sheet, #cb-ask, .cb-geo-card),
:root[data-glass~="toasts"] .cb-toast:not(.is-sticky),
:root[data-glass~="chrome"] :is(.cb-searchbar, .cb-round, .cb-tabbar) {
    background: var(--cb-glass-ui);
    -webkit-backdrop-filter: var(--cb-glass-blur); backdrop-filter: var(--cb-glass-blur);
    border: 1px solid var(--cb-glass-ui-edge);
}
:root[data-glass~="cards"] #cb-sheet { border-bottom: 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .16); }
:root[data-glass~="chrome"] .cb-tabbar { border-width: 1px 0 0; }
/* Peças de dentro: translúcidas também, senão viram blocos opacos sobre o vidro */
:root[data-glass~="cards"] #cb-sheet :is(.cb-row, .cb-pill:not(.cb-pill-accent), .cb-seg:not(.on), .cb-btn-light),
:root[data-glass~="cards"] #cb-ask .cb-seg:not(.on) {
    background: var(--cb-glass-row); border-color: var(--cb-glass-row-edge);
}
:root[data-glass~="cards"] #cb-sheet .cb-row:hover { background: var(--cb-glass-soft); }
:root[data-glass~="cards"] #cb-sheet :is(.cb-empty, .cb-toggle, .cb-chip, .cb-stop-ico, .cb-search) { background: var(--cb-glass-soft); border-color: var(--cb-glass-row-edge); }
/* Aviso comum em vidro (texto do tema); "está chegando" continua escuro e sólido para chamar atenção */
:root[data-glass~="toasts"] .cb-toast:not(.is-sticky) { color: var(--cb-ink); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
/* Pergunta de lotação e card da localização: mesmo vidro do tema (antes seguiam o tema do mapa) */
#cb-ask, .cb-geo-card { background: var(--cb-surface); }

/* Sem suporte a desfoque, ou com "reduzir transparência" no sistema: volta ao sólido */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root[data-glass] :is(#cb-sheet, .cb-toast:not(.is-sticky), #cb-ask, .cb-geo-card, .cb-searchbar, .cb-round, .cb-tabbar) { background: var(--cb-surface) !important; }
}
@media (prefers-reduced-transparency: reduce) {
    :root[data-glass] :is(#cb-sheet, .cb-toast:not(.is-sticky), #cb-ask, .cb-geo-card, .cb-searchbar, .cb-round, .cb-tabbar) {
        background: var(--cb-surface) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    }
}
/* Busca presa no topo da lista de Linhas: sem a faixa sólida que cobria a rolagem */
:root[data-glass~="cards"] #cb-sheet .cb-search { background: var(--cb-glass-ui); box-shadow: none; -webkit-backdrop-filter: var(--cb-glass-blur); backdrop-filter: var(--cb-glass-blur); }
