/* Meu Sergipe — visual em camadas: conteúdo embaixo, barras translúcidas por cima. */
:root {
  --accent: #0a8a5c;
  --accent-press: #08734d;
  --sun: #f5b700;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, .62);
  --label-3: rgba(60, 60, 67, .32);
  --sep: rgba(60, 60, 67, .16);
  --fill: rgba(120, 120, 128, .14);
  --empty: #dedad0;
  --empty-hover: #cfcabd;
  --bar-bg: rgba(242, 242, 247, .72);
  --scrim: rgba(0, 0, 0, .32);
  --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, .14);
  --r-lg: 14px;
  --r-xl: 22px;
  --nav-h: 0px;
  --tab-h: calc(56px + env(safe-area-inset-bottom));
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2fc28a;
    --accent-press: #27a676;
    --bg: #000000;
    --surface: #1c1c1e;
    --label: #f5f5f7;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .55);
    --fill: rgba(120, 120, 128, .28);
    --empty: #3a3a3c;
    --empty-hover: #48484a;
    --bar-bg: rgba(18, 18, 20, .72);
    --scrim: rgba(0, 0, 0, .5);
    --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 100%/1.45 system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--label);
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--label-2); }
.small { font-size: .85rem; }

/* ---------- Barra superior translúcida ---------- */
.nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bar-bg);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.nav-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; max-width: 760px; margin: 0 auto; }
h1 { font-size: 2.05rem; line-height: 1.08; letter-spacing: -0.022em; font-weight: 700; margin: 0; }
.sub { margin: 2px 0 0; color: var(--label-2); font-size: .95rem; letter-spacing: -0.005em; }
.sub strong { color: var(--label); font-variant-numeric: tabular-nums; }
.nav-actions { display: flex; gap: 8px; padding-bottom: 4px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: var(--fill); color: var(--accent); display: grid; place-items: center;
  transition: transform .12s ease-out, background-color .12s;
}
.icon-btn.accent { background: var(--accent); color: #fff; }
.icon-btn svg, .tabbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.92); }
.dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 2px var(--bg); }
.progress { height: 4px; background: var(--fill); border-radius: 99px; overflow: hidden; max-width: 760px; margin: 10px auto 0; }
#bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--sun)); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* ---------- Conteúdo ---------- */
main { flex: 1; position: relative; min-height: 0; }
.tab { position: absolute; inset: 0; display: none; }
.tab.active { display: block; animation: fadein .2s ease-out; }
@keyframes fadein { from { opacity: 0; } }
.scroll {
  height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--nav-h) + 12px) 16px calc(var(--tab-h) + 24px);
  max-width: 760px; margin: 0 auto;
}

/* Mapa ocupa a tela; barras flutuam por cima */
.mapwrap { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
#map { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
#map path { stroke: var(--bg); stroke-width: 1.1; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill .2s; }
#map path.vazio { fill: var(--empty); }
#map path.sem-foto { fill: var(--accent); }
#map path.press { opacity: .7; }
#map path.sel { stroke: var(--sun); stroke-width: 3; }
#map path.na-rota { fill: var(--sun); }
#map path.novo { animation: pop .5s cubic-bezier(.3, 1.4, .5, 1); transform-box: fill-box; transform-origin: center; }
@keyframes pop { 0% { transform: scale(.85); opacity: .4; } }
#map .rotulos text { fill: var(--label); paint-order: stroke; stroke: var(--bg); stroke-linejoin: round; text-anchor: middle; dominant-baseline: central; pointer-events: none; font-weight: 600; opacity: 0; transition: opacity .2s; }
#map.zoom .rotulos text { opacity: .9; }
#map text.num { fill: #1c1c1e; font-weight: 800; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
#map circle.num-bg { fill: #fff; stroke: var(--sun); }
.map-float { position: absolute; left: 0; right: 0; top: calc(var(--nav-h) + 10px); display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.pill {
  pointer-events: auto; border: 0; border-radius: 99px; padding: 9px 16px; font-size: .9rem; font-weight: 600;
  background: var(--bar-bg); color: var(--label); box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: transform .12s ease-out;
}
.pill:active { transform: scale(.95); }
.hint { position: absolute; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 12px); margin: 0; text-align: center; color: var(--label-2); font-size: .8rem; pointer-events: none; transition: opacity .3s; }

/* ---------- Listas agrupadas ---------- */
.section-title { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.015em; margin: 18px 4px 8px; }
.section-title:first-child { margin-top: 4px; }
.group { list-style: none; margin: 0 0 12px; padding: 0; background: var(--surface); border-radius: var(--r-lg); overflow: hidden; }
.group.pad { padding: 14px 16px; }
input[type=search], .entrar input {
  width: 100%; padding: 10px 14px; border: 0; border-radius: 12px; background: var(--fill); font-size: 1rem; outline: none;
}
input[type=search]:focus, .entrar input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.segmented { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; margin: 12px 0; }
.segmented button { flex: 1; border: 0; background: none; padding: 7px 0; border-radius: 8px; font-size: .88rem; font-weight: 500; transition: background-color .2s, box-shadow .2s; }
.segmented button.active { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); font-weight: 600; }

#lista li { display: flex; align-items: center; gap: 12px; padding: 9px 16px; position: relative; cursor: pointer; transition: background-color .1s; }
#lista li + li::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; border-top: .5px solid var(--sep); }
#lista li:active { background: var(--fill); }
#lista .thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--empty) center/cover; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; }
#lista .thumb.ok { background-color: var(--accent); }
#lista .nome { font-weight: 500; letter-spacing: -0.005em; }
#lista .reg { font-size: .8rem; color: var(--label-2); }
#lista .chev { margin-left: auto; color: var(--label-3); }
#lista .vazio-lista { color: var(--label-2); justify-content: center; padding: 24px; }

.rota { padding-left: 0; margin: 8px 0 12px; list-style: none; counter-reset: r; }
.rota li { counter-increment: r; display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.rota li::before { content: counter(r); width: 26px; height: 26px; border-radius: 50%; background: var(--sun); color: #1c1c1e; font-weight: 700; font-size: .85rem; display: grid; place-items: center; flex: none; }
.rota .km { color: var(--label-2); font-size: .82rem; margin-left: auto; font-variant-numeric: tabular-nums; }
.stepper { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: .5px solid var(--sep); }
.stepper-ctl { display: flex; align-items: center; background: var(--fill); border-radius: 9px; }
.stepper-ctl button { border: 0; background: none; width: 40px; height: 32px; font-size: 1.2rem; transition: background-color .1s; border-radius: 9px; }
.stepper-ctl button:active { background: var(--sep); }
.stepper-ctl strong { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.regioes li { padding: 12px 16px; position: relative; }
.regioes li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.regioes .top-line { display: flex; justify-content: space-between; font-weight: 500; }
.regioes .top-line span:last-child { color: var(--label-2); font-variant-numeric: tabular-nums; font-weight: 400; }
.regioes .mini { height: 4px; background: var(--fill); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.regioes .mini div { height: 100%; background: var(--accent); border-radius: 99px; }
.regioes .falta { font-size: .8rem; color: var(--label-2); margin-top: 6px; }

/* ---------- Botões ---------- */
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row .btn { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
  border: 0; background: var(--fill); color: var(--accent); padding: 12px 16px; border-radius: 13px;
  font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; text-decoration: none; text-align: center;
  transition: transform .1s ease-out, background-color .1s;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-press); }
.btn.danger { color: #ff3b30; background: none; }
.btn:active { transform: scale(.97); }

/* ---------- Barra de abas ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  background: var(--bar-bg); border-top: .5px solid var(--sep);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.tabbar button {
  flex: 1; max-width: 160px; border: 0; background: none; color: var(--label-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .68rem; font-weight: 600; letter-spacing: .01em; transition: color .15s, transform .1s;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--accent); }
.tabbar button:active { transform: scale(.92); }

/* ---------- Painéis (sheets) — movidos por mola em JS ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet[hidden] { display: none; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; }
.panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-sheet);
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(100%); will-change: transform; touch-action: pan-y;
}
.panel.tall { max-width: 760px; }
.grabber { width: 38px; height: 5px; border-radius: 99px; background: var(--label-3); margin: 0 auto 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 1.6rem; line-height: 1.12; letter-spacing: -0.02em; margin: 0; }
.eyebrow { margin: 0 0 2px; font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.close { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--fill); color: var(--label-2); font-size: .8rem; font-weight: 700; transition: transform .1s; }
.close:active { transform: scale(.9); }
.foto img { width: 100%; max-height: 46dvh; object-fit: cover; border-radius: 16px; display: block; }
.foto:empty { display: none; }
#sData { margin: 12px 0 0; }
.acoes { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.export-frame { border-radius: 16px; overflow: hidden; background: #f6f5f0; min-height: 200px; display: grid; place-items: center; }
.export-frame img { width: 100%; display: block; transition: opacity .2s; }
.export-frame img.carregando { opacity: .35; }
.toggles { margin-top: 14px; background: var(--fill); }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; position: relative; cursor: pointer; }
.toggle + .toggle::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.toggle input { position: absolute; opacity: 0; }
.toggle i { width: 51px; height: 31px; border-radius: 99px; background: var(--label-3); position: relative; transition: background-color .25s; flex: none; }
.toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .3s cubic-bezier(.3, 1.3, .5, 1); }
.toggle input:checked + i { background: #34c759; }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
.codigo { font: 600 1.6rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; text-align: center; padding: 16px; background: var(--fill); border-radius: 14px; margin: 10px 0 0; user-select: all; }
.entrar { margin-top: 22px; padding-top: 16px; border-top: .5px solid var(--sep); }
.entrar input { flex: 2; text-transform: uppercase; letter-spacing: .06em; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); z-index: 40;
  transform: translate(-50%, -140%); opacity: 0;
  background: var(--bar-bg); color: var(--label); padding: 10px 18px; border-radius: 99px; font-weight: 600; font-size: .92rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16); white-space: nowrap;
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: transform .45s cubic-bezier(.2, 1.2, .4, 1), opacity .25s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Acessibilidade ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .15s !important; }
  .toast { transform: translate(-50%, 0); }
}
@media (prefers-reduced-transparency: reduce) {
  .nav, .tabbar, .pill, .toast { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
}
@media (prefers-contrast: more) {
  .nav, .tabbar { background: var(--surface); }
  .pill, .btn, .group { outline: 1px solid var(--label-2); }
}
@media (min-width: 900px) {
  h1 { font-size: 2.4rem; }
}

/* ---------- Entrar / criar conta ---------- */
.auth { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; display: flex; justify-content: center;
  padding: calc(40px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); animation: fadein .25s ease-out; }
.auth[hidden] { display: none; }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; }
.auth-icon { border-radius: 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, .14); margin: 0 auto 16px; }
.auth h1 { text-align: center; }
.auth-tag { text-align: center; margin: 6px 0 18px; }
.form { margin: 0; }
.campo { display: flex; align-items: center; gap: 12px; padding: 0 16px; position: relative; }
.campo + .campo::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.campo[hidden] { display: none; }
.campo span { width: 64px; flex: none; font-weight: 500; }
.campo input { flex: 1; min-width: 0; border: 0; background: none; padding: 14px 0; font-size: 1rem; outline: none; }
.erro { color: #ff3b30; font-size: .88rem; min-height: 1.3em; margin: 10px 4px; }
.auth-nota { text-align: center; margin-top: 10px; }
.btn.sem-cor { color: var(--label-2); background: none; }
@media (prefers-color-scheme: dark) {
  .segmented button.active { background: #636366; }
}

/* ---------- Botão flutuante de instalar ---------- */
.fab-instalar {
  position: fixed; z-index: 15; right: 16px; bottom: calc(var(--tab-h) + 14px);
  display: flex; align-items: center; gap: 2px; padding: 5px 5px 5px 6px; border-radius: 99px;
  background: var(--bar-bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .18), 0 0 0 .5px var(--sep);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  animation: fab-in .5s cubic-bezier(.2, 1.3, .4, 1) both;
  transform-origin: bottom right;
}
.fab-instalar[hidden] { display: none; }
@keyframes fab-in { from { transform: translateY(16px) scale(.85); opacity: 0; } }
.fab-main { display: flex; align-items: center; gap: 8px; border: 0; background: var(--accent); color: #fff; font-weight: 600; font-size: .92rem;
  padding: 5px 14px 5px 5px; border-radius: 99px; transition: transform .1s ease-out, background-color .1s; }
.fab-main img { border-radius: 8px; display: block; }
.fab-main:active { transform: scale(.95); background: var(--accent-press); }
.fab-x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--label-2); font-size: .75rem; font-weight: 700; transition: transform .1s; }
.fab-x:active { transform: scale(.9); }
body.pode-instalar .hint { right: 190px; text-align: left; }
.passos { margin: 0; padding-left: 1.3rem; display: grid; gap: 14px; line-height: 1.45; }
.ios-ic { width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: #0a84ff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Pontos turísticos ---------- */
.lugares-topo { margin: 4px 4px 12px; }
.lugares-topo p { margin: 0 0 8px; }
.mini-barra { height: 4px; background: var(--fill); border-radius: 99px; overflow: hidden; }
.mini-barra div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--sun)); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; border-radius: 99px; padding: 7px 14px; background: var(--fill); font-size: .88rem; font-weight: 500; transition: background-color .15s, color .15s, transform .1s; }
.chip:active { transform: scale(.95); }
.chip.active { background: var(--accent); color: #fff; }
#listaLugares li, .pontos-cidade li { display: flex; align-items: center; gap: 12px; padding: 9px 16px; position: relative; cursor: pointer; transition: background-color .1s; }
#listaLugares li + li::before, .pontos-cidade li + li::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; border-top: .5px solid var(--sep); }
#listaLugares li:active, .pontos-cidade li:active { background: var(--fill); }
.thumb-ponto { width: 44px; height: 44px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 1.3rem; background: var(--fill) center/cover; }
.thumb-ponto.ok { box-shadow: inset 0 0 0 2px var(--accent); }
.ponto-txt { min-width: 0; }
.ponto-txt .nome { font-weight: 500; letter-spacing: -0.005em; }
.ponto-txt .reg { font-size: .8rem; color: var(--label-2); }
.selo { margin-left: auto; flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
.selo.ok { background: var(--accent); color: #fff; }
.selo.nao { color: var(--label-3); font-size: 1.1rem; font-weight: 400; }
.desc { margin: 12px 0 0; line-height: 1.5; }
.desc:empty { display: none; }
.pontos-cidade:empty { display: none; }
.pontos-cidade h3 { font-size: 1.05rem; letter-spacing: -0.01em; margin: 22px 0 8px; }
.pontos-cidade ul { list-style: none; margin: 0; padding: 0; background: var(--fill); border-radius: var(--r-lg); overflow: hidden; }
.pontos-cidade .thumb-ponto { background-color: var(--surface); }
/* pinos no mapa: só aparecem com zoom */
#map .pinos { opacity: 0; pointer-events: none; transition: opacity .2s; }
#map.zoom .pinos { opacity: 1; pointer-events: auto; }
#map .pino circle { fill: #fff; stroke: var(--accent); }
#map .pino.ok circle { fill: var(--accent); stroke: #fff; }
#map .pino text { text-anchor: middle; dominant-baseline: central; pointer-events: none; }
#map .pino.press circle { opacity: .7; }
#listaLugares .vazio-lista { color: var(--label-2); justify-content: center; padding: 24px; cursor: default; }
